настройка таблицы mysql 'auto_increment'... в phpmyadmin открой таблицу 'msqip_table'... далее 'операции'... в самом низу настройка...Если я PhpMyAdmin удаляю все записи в MSGIP_TABLE, то при добавлении новой записи, ей присваивается значение не 1, а большее того, которое было последним при удалении...

стрянно.... в принципе должна заполнятся единицей при входе... и нулем при создании сессии... попробуй это...Кроме этого, запись user_message всегда остаётся пустой. Я добавил её и в таблицу phpbb_users и в таблицу которая используется на моём форуме...
Update from 1.0.3 to 1.1.0.txt
Код: Выделить всё
##############################################################
## MOD Title: Message for IP [Update from 1.0.3 to 1.1.0]
## MOD Author: [R: R@m$e$ :U] < Ramses@FromRU.com > (Ramses) http://www.phpbbguru.net
## MOD Description: Displays a message for defined IP
## MOD Version: 1.1.0
##
## Installation Level: Easy
## Installation Time: ~3 Minutes
## Files To Edit:
## includes/page_header.php
## includes/sessions.php
## Included Files:
## db_update_103_to_110.php
##############################################################
## For Security Purposes, Please Check: http://www.phpbbguru.net/mods/ for the
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code
## to enter into your phpBB Forum.
##############################################################
## Author Notes:
## Find bug? Please write me...
##
## Run SQL-commands in phpMyAdmin or execute db_update_103_to_110.php
##
##############################################################
## MOD History:
##
## 2005-03-10 - Version 1.1.0
## - Kill function from 1.0.2 =) and more advanced check for one message ;)
## - Fix install for phpBB Mods DB... =)
##
## 2005-03-10 - Version 1.0.3
## - Fix possible error with already sent headers
##
## 2005-03-09 - Version 1.0.2
## - Only one message in from logging + 1 minute...
##
## 2005-03-08 - Version 1.0.1
## - Remake install
##
## 2005-03-08 - Version 1.0.0
## - First release... =)))
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################
#
#-----[ SQL ]------------------------------------------
#
ALTER TABLE `phpbb_users` ADD `user_message` VARCHAR( 25 ) NOT NULL ;
#
#-----[ OPEN ]------------------------------------------
#
includes/page_header.php
#
#-----[ FIND ]------------------------------------------
#
// [start] Message for IP 1.0.3
$msgiptime = time() - 60;
if ($msgiptime < $userdata['user_lastvisit'] && !($gen_simple_header))
{
$sql = "SELECT *
FROM " . MSGIP_TABLE . "
WHERE msg_ip = '" . encode_ip($client_ip) . "'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
if ( !empty($row['msg_ip']) )
{
$template->assign_block_vars('switch_enable_msgip_popup', array());
}
}
// [end] Message for IP 1.0.3
#
#-----[ REPLACE WITH ]------------------------------------------
#
// [start] Message for IP 1.1.0
if (($userdata['user_message'] == 0) && ($userdata['user_id'] != ANONYMOUS) && !($gen_simple_header))
{
$sql = "SELECT *
FROM " . MSGIP_TABLE . "
WHERE msg_ip = '" . encode_ip($client_ip) . "'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
// Disable message for this session
$sql = "UPDATE " . USERS_TABLE . "
SET user_message = 1
WHERE user_id = " . $userdata['user_id'];
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, "Could not update user information", '', __LINE__, __FILE__, $sql);
}
if ( !empty($row['msg_ip']) )
{
$template->assign_block_vars('switch_enable_msgip_popup', array());
}
}
// [end] Message for IP 1.1.0
#
#-----[ OPEN ]------------------------------------------
#
includes/sessions.php
#
#-----[ FIND ]------------------------------------------
#
$sql = "UPDATE " . USERS_TABLE . "
SET user_session_time = $current_time, user_session_page = $page_id, user_lastvisit = $last_visit
WHERE user_id = $user_id";
#
#-----[ BEFORE, ADD ]------------------------------------------
#
// [start] Message for IP 1.1.0
#
#-----[ AFTER, ADD ]------------------------------------------
#
// [end] Message for IP 1.1.0
#
#-----[ IN-LINE FIND ]------------------------------------------
#
, user_lastvisit = $last_visit
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
, user_message = 0
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM
Код: Выделить всё
<?
#########################################################
## SQL commands to phpBB2
## Author: Niels Chr. Rшd
## Nickname: Niels Chr. Denmark
## Email: ncr@db9.dk
##
## Ver 1.0.7
##
## phpBB2 database update script for mods
## this file is intended to use with phpBB2, when installing mods
## after so you may delete this file, but only admin can use so it really doesen't matter
## The script will look what prefix you are using, and use the existing DB defined by congig.php
## The execution of this script's included SQL is harmless, so you can run it as meny times you like
## note, though that the users last visit, will be set back to his/her last login,
## but that is a minor cosmetic isue, that will correct it self next time the use logs in
##
## the following example are from my mods, and you can add some self, for other mods if you like
## you will after execution get a list over those commands that are run with succes and those with warnings !
## delete the sample lines if you are using it only for other mods
##
#########################################################
define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
include($phpbb_root_path . 'includes/functions_selects.'.$phpEx);
###################################################################################################
##
## put the SQL commands below here, the SQL commands listed below are only exampels, substitude them with the one you need ##
##
###################################################################################################
$sql=array(
'ALTER TABLE ' . USERS_TABLE . ' ADD `user_message` VARCHAR( 25 ) NOT NULL'
);
$mods = array (
'Message for IP [Update from 1.0.3 to 1.1.0]'
);
############################################### Do not change anything below this line #######################################
//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
//
// End session management
//
if ($userdata['user_level']!=ADMIN)
message_die(GENERAL_ERROR, "You are not Authorised to do this");
$n=0;
$message="<b>This list is a result of the SQL queries needed for mod</b><br/><br/>";
while($sql[$n])
{
$message .= ($mods[$n-1] != $mods[$n]) ? '<p><b><font size=3>'.$mods[$n].'</font></b><br/>' : '';
if(!$result = $db->sql_query($sql[$n]))
$message .= '<b><font color=#FF0000>[Already added]</font></b> line: '.($n+1).' , '.$sql[$n].'<br />';
else $message .='<b><font color=#0000fF>[Added/Updated]</font></b> line: '.($n+1).' , '.$sql[$n].'<br />';
$n++;
}
message_die(GENERAL_MESSAGE, $message);
?>
Update from 1.0.2 to 1.1.0.txt
Код: Выделить всё
##############################################################
## MOD Title: Message for IP [Update from 1.0.2 to 1.1.0]
## MOD Author: [R: R@m$e$ :U] < Ramses@FromRU.com > (Ramses) http://www.phpbbguru.net
## MOD Description: Displays a message for defined IP
## MOD Version: 1.1.0
##
## Installation Level: Easy
## Installation Time: ~3 Minutes
## Files To Edit:
## includes/page_header.php
## includes/sessions.php
## Included Files:
## db_update_102_to_110.php
##############################################################
## For Security Purposes, Please Check: http://www.phpbbguru.net/mods/ for the
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code
## to enter into your phpBB Forum.
##############################################################
## Author Notes:
## Find bug? Please write me...
##
## Run SQL-commands in phpMyAdmin or execute db_update_102_to_110.php
##
##############################################################
## MOD History:
##
## 2005-03-10 - Version 1.1.0
## - Kill function from 1.0.2 =) and more advanced check for one message ;)
## - Fix install for phpBB Mods DB... =)
##
## 2005-03-10 - Version 1.0.3
## - Fix possible error with already sent headers
##
## 2005-03-09 - Version 1.0.2
## - Only one message in from logging + 1 minute...
##
## 2005-03-08 - Version 1.0.1
## - Remake install
##
## 2005-03-08 - Version 1.0.0
## - First release... =)))
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################
#
#-----[ SQL ]------------------------------------------
#
ALTER TABLE `phpbb_users` ADD `user_message` VARCHAR( 25 ) NOT NULL ;
#
#-----[ OPEN ]------------------------------------------
#
includes/page_header.php
#
#-----[ FIND ]------------------------------------------
#
// [start] Message for IP 1.0.2
$msgiptime = time() - 60;
if ($msgiptime < $userdata['user_lastvisit'])
{
$sql = "SELECT *
FROM " . MSGIP_TABLE . "
WHERE msg_ip = '" . encode_ip($client_ip) . "'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
if ( !empty($row['msg_ip']) )
{
$template->assign_block_vars('switch_enable_msgip_popup', array());
}
}
// [start] Message for IP 1.0.2
#
#-----[ REPLACE WITH ]------------------------------------------
#
// [start] Message for IP 1.1.0
if (($userdata['user_message'] == 0) && ($userdata['user_id'] != ANONYMOUS) && !($gen_simple_header))
{
$sql = "SELECT *
FROM " . MSGIP_TABLE . "
WHERE msg_ip = '" . encode_ip($client_ip) . "'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
// Disable message for this session
$sql = "UPDATE " . USERS_TABLE . "
SET user_message = 1
WHERE user_id = " . $userdata['user_id'];
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, "Could not update user information", '', __LINE__, __FILE__, $sql);
}
if ( !empty($row['msg_ip']) )
{
$template->assign_block_vars('switch_enable_msgip_popup', array());
}
}
// [end] Message for IP 1.1.0
#
#-----[ OPEN ]------------------------------------------
#
includes/sessions.php
#
#-----[ FIND ]------------------------------------------
#
$sql = "UPDATE " . USERS_TABLE . "
SET user_session_time = $current_time, user_session_page = $page_id, user_lastvisit = $last_visit
WHERE user_id = $user_id";
#
#-----[ BEFORE, ADD ]------------------------------------------
#
// [start] Message for IP 1.1.0
#
#-----[ AFTER, ADD ]------------------------------------------
#
// [end] Message for IP 1.1.0
#
#-----[ IN-LINE FIND ]------------------------------------------
#
, user_lastvisit = $last_visit
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
, user_message = 0
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM
Код: Выделить всё
<?
#########################################################
## SQL commands to phpBB2
## Author: Niels Chr. Rшd
## Nickname: Niels Chr. Denmark
## Email: ncr@db9.dk
##
## Ver 1.0.7
##
## phpBB2 database update script for mods
## this file is intended to use with phpBB2, when installing mods
## after so you may delete this file, but only admin can use so it really doesen't matter
## The script will look what prefix you are using, and use the existing DB defined by congig.php
## The execution of this script's included SQL is harmless, so you can run it as meny times you like
## note, though that the users last visit, will be set back to his/her last login,
## but that is a minor cosmetic isue, that will correct it self next time the use logs in
##
## the following example are from my mods, and you can add some self, for other mods if you like
## you will after execution get a list over those commands that are run with succes and those with warnings !
## delete the sample lines if you are using it only for other mods
##
#########################################################
define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
include($phpbb_root_path . 'includes/functions_selects.'.$phpEx);
###################################################################################################
##
## put the SQL commands below here, the SQL commands listed below are only exampels, substitude them with the one you need ##
##
###################################################################################################
$sql=array(
'ALTER TABLE ' . USERS_TABLE . ' ADD `user_message` VARCHAR( 25 ) NOT NULL'
);
$mods = array (
'Message for IP [Update from 1.0.2 to 1.1.0]'
);
############################################### Do not change anything below this line #######################################
//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
//
// End session management
//
if ($userdata['user_level']!=ADMIN)
message_die(GENERAL_ERROR, "You are not Authorised to do this");
$n=0;
$message="<b>This list is a result of the SQL queries needed for mod</b><br/><br/>";
while($sql[$n])
{
$message .= ($mods[$n-1] != $mods[$n]) ? '<p><b><font size=3>'.$mods[$n].'</font></b><br/>' : '';
if(!$result = $db->sql_query($sql[$n]))
$message .= '<b><font color=#FF0000>[Already added]</font></b> line: '.($n+1).' , '.$sql[$n].'<br />';
else $message .='<b><font color=#0000fF>[Added/Updated]</font></b> line: '.($n+1).' , '.$sql[$n].'<br />';
$n++;
}
message_die(GENERAL_MESSAGE, $message);
?>
Update from 1.0.0 to 1.1.0.txt
Код: Выделить всё
##############################################################
## MOD Title: Message for IP [Update from 1.0.0 to 1.1.0]
## MOD Author: [R: R@m$e$ :U] < Ramses@FromRU.com > (Ramses) http://www.phpbbguru.net
## MOD Description: Displays a message for defined IP
## MOD Version: 1.1.0
##
## Installation Level: Easy
## Installation Time: ~3 Minutes
## Files To Edit:
## includes/page_header.php
## includes/sessions.php
## Included Files:
## db_update_100_to_110.php
##############################################################
## For Security Purposes, Please Check: http://www.phpbbguru.net/mods/ for the
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code
## to enter into your phpBB Forum.
##############################################################
## Author Notes:
## Find bug? Please write me...
##
## Run SQL-commands in phpMyAdmin or execute db_update_100_to_110.php
##
##############################################################
## MOD History:
##
## 2005-03-10 - Version 1.1.0
## - Kill function from 1.0.2 =) and more advanced check for one message ;)
## - Fix install for phpBB Mods DB... =)
##
## 2005-03-10 - Version 1.0.3
## - Fix possible error with already sent headers
##
## 2005-03-09 - Version 1.0.2
## - Only one message in from logging + 1 minute...
##
## 2005-03-08 - Version 1.0.1
## - Remake install
##
## 2005-03-08 - Version 1.0.0
## - First release... =)))
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################
#
#-----[ SQL ]------------------------------------------
#
ALTER TABLE `phpbb_users` ADD `user_message` VARCHAR( 25 ) NOT NULL ;
#
#-----[ OPEN ]------------------------------------------
#
includes/page_header.php
#
#-----[ FIND ]------------------------------------------
#
// [start] Message for IP
$sql = "SELECT *
FROM " . MSGIP_TABLE . "
WHERE msg_ip = '" . encode_ip($client_ip) . "'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
if ( !empty($row['msg_ip']) )
{
$template->assign_block_vars('switch_enable_msgip_popup', array());
}
// [end] Message for IP
#
#-----[ REPLACE WITH ]------------------------------------------
#
// [start] Message for IP 1.1.0
if (($userdata['user_message'] == 0) && ($userdata['user_id'] != ANONYMOUS) && !($gen_simple_header))
{
$sql = "SELECT *
FROM " . MSGIP_TABLE . "
WHERE msg_ip = '" . encode_ip($client_ip) . "'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
// Disable message for this session
$sql = "UPDATE " . USERS_TABLE . "
SET user_message = 1
WHERE user_id = " . $userdata['user_id'];
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, "Could not update user information", '', __LINE__, __FILE__, $sql);
}
if ( !empty($row['msg_ip']) )
{
$template->assign_block_vars('switch_enable_msgip_popup', array());
}
}
// [end] Message for IP 1.1.0
#
#-----[ OPEN ]------------------------------------------
#
includes/sessions.php
#
#-----[ FIND ]------------------------------------------
#
$sql = "UPDATE " . USERS_TABLE . "
SET user_session_time = $current_time, user_session_page = $page_id, user_lastvisit = $last_visit
WHERE user_id = $user_id";
#
#-----[ BEFORE, ADD ]------------------------------------------
#
// [start] Message for IP 1.1.0
#
#-----[ AFTER, ADD ]------------------------------------------
#
// [end] Message for IP 1.1.0
#
#-----[ IN-LINE FIND ]------------------------------------------
#
, user_lastvisit = $last_visit
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
, user_message = 0
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM
Код: Выделить всё
<?
#########################################################
## SQL commands to phpBB2
## Author: Niels Chr. Rшd
## Nickname: Niels Chr. Denmark
## Email: ncr@db9.dk
##
## Ver 1.0.7
##
## phpBB2 database update script for mods
## this file is intended to use with phpBB2, when installing mods
## after so you may delete this file, but only admin can use so it really doesen't matter
## The script will look what prefix you are using, and use the existing DB defined by congig.php
## The execution of this script's included SQL is harmless, so you can run it as meny times you like
## note, though that the users last visit, will be set back to his/her last login,
## but that is a minor cosmetic isue, that will correct it self next time the use logs in
##
## the following example are from my mods, and you can add some self, for other mods if you like
## you will after execution get a list over those commands that are run with succes and those with warnings !
## delete the sample lines if you are using it only for other mods
##
#########################################################
define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
include($phpbb_root_path . 'includes/functions_selects.'.$phpEx);
###################################################################################################
##
## put the SQL commands below here, the SQL commands listed below are only exampels, substitude them with the one you need ##
##
###################################################################################################
$sql=array(
'ALTER TABLE ' . USERS_TABLE . ' ADD `user_message` VARCHAR( 25 ) NOT NULL'
);
$mods = array (
'Message for IP [Update from 1.0.0 to 1.1.0]'
);
############################################### Do not change anything below this line #######################################
//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
//
// End session management
//
if ($userdata['user_level']!=ADMIN)
message_die(GENERAL_ERROR, "You are not Authorised to do this");
$n=0;
$message="<b>This list is a result of the SQL queries needed for mod</b><br/><br/>";
while($sql[$n])
{
$message .= ($mods[$n-1] != $mods[$n]) ? '<p><b><font size=3>'.$mods[$n].'</font></b><br/>' : '';
if(!$result = $db->sql_query($sql[$n]))
$message .= '<b><font color=#FF0000>[Already added]</font></b> line: '.($n+1).' , '.$sql[$n].'<br />';
else $message .='<b><font color=#0000fF>[Added/Updated]</font></b> line: '.($n+1).' , '.$sql[$n].'<br />';
$n++;
}
message_die(GENERAL_MESSAGE, $message);
?>