qbs Wysłany: Sob 27 Maj, 2006 |
|
|
Modyfikacja dodaj?ca mozliwosc nalozenia dziennego limitu rejestracji. limit zmieniamy modyfikujac wartosc zmiennej $regs_per_day
plik usercp_register.php
Kod--- [ find ] -----
if ( !defined('IN_PHPBB') )
{
die('Hacking attempt');
exit;
}
--- [ after add ] -----
// registeration daily limits
$regs_per_day = 20;
$last_reg_date = date("Y-m-d");
function update_reg_data()
{
global $board_config, $db;
$sql = "update " . CONFIG_TABLE . " set config_value = '" . ($board_config['this_day_reg_count'] + 1) . "' where config_name = 'this_day_reg_count'";
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not update forum configuration', '', __LINE__, __FILE__, $sql);
}
sql_cache('clear', 'board_config');
}
if ( $last_reg_date )
{
$clear_cache = 0;
if ( !isset($board_config['last_reg_date']) )
{
$sql = "insert into " . CONFIG_TABLE . " ( config_name, config_value )
values ('last_reg_date', '$last_reg_date')";
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not update forum configuration', '', __LINE__, __FILE__, $sql);
}
$clear_cache = 1;
$board_config['last_reg_date'] = $last_reg_date;
}
if ( !isset($board_config['this_day_reg_count']) )
{
$sql = "insert into " . CONFIG_TABLE . " ( config_name, config_value )
values ('this_day_reg_count', '0')";
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not update forum configuration', '', __LINE__, __FILE__, $sql);
}
$clear_cache = 1;
$board_config['this_day_reg_count'] = 0;
}
if ( $board_config['last_reg_date'] != $last_reg_date )
{
$sql_a = "update " . CONFIG_TABLE . " set config_value = '$last_reg_date' where config_name = 'last_reg_date'";
$sql_b = "update " . CONFIG_TABLE . " set config_value = '0' where config_name = 'this_day_reg_count'";
if ( !$db->sql_query($sql_a) || !$db->sql_query($sql_b) )
{
message_die(GENERAL_ERROR, 'Could not update forum configuration', '', __LINE__, __FILE__, $sql_a . '<hr />' . $sql_b);
}
$board_config['last_reg_date'] = $last_reg_date;
$board_config['this_day_reg_count'] = 0;
$clear_cache = 1;
}
if ( $clear_cache )
{
sql_cache('clear', 'board_config');
}
}
else
{
message_die(GENERAL_MESSAGE, 'last_reg_date variable is empty, for help check <a href="http://mody.lastinn.info" target="_blank">http://mody.lastinn.info</a>');
}
if ( $board_config['this_day_reg_count'] > $regs_per_day )
{
message_die(GENERAL_MESSAGE, 'Witaj go¶ciu, niestety dzienny limit rejestracji zosta? wyczerpany, prosimy spr?bowa? w dniu jutrzejszym.');
}
--- [ find ] -----
if ( !($result = $db->sql_query($sql, BEGIN_TRANSACTION)) )
{
message_die(GENERAL_ERROR, 'Could not insert data into users table', '', __LINE__, __FILE__, $sql);
}
--- [ after add ] -----
// registeration daily limits
else
{
update_reg_data();
}
ciekawe jak dziala to odkrywanie hide'ow :mrgreen:
przypominam ze do rozmow odnosnie modyfikacji sluzy dzial offtopic: http://mody.lastinn.info/forum,2.html |
|