13th March 2016, 17:27
|
|
Senior Member
|
|
Join Date: Sep 2011
Posts: 278
|
|
Enable / Disable Registrations
SQL:
PHP Code:
CREATE TABLE `config` ( `name` varchar(255) NOT NULL default '', `value` varchar(255) NOT NULL default '', PRIMARY KEY (`name`) ) TYPE=MyISAM;
INSERT INTO `config` (`name` ,`value`)VALUES ('signup', '0');
Then in signup.php find:
PHP Code:
require_once("include/bittorrent.php"); dbconn();
And add this code below:
PHP Code:
$signup = mysql_result(mysql_query("SELECT value FROM config WHERE name = 'signup'"), 0); if ($signup == 0) stderr("Error", "Registrations close. Please come back later!");
Then create a file called closesdignup.php and add this code:
PHP Code:
<? ob_start("ob_gzhandler"); require_once("include/bittorrent.php"); dbconn(); loggedinorreturn(); $signup = (int)$_GET['signup']; if (get_user_class() < UC_SYSOP){ stderr("w00t", "You don't have access to this site"); stdfoot(); exit; } stdhead(""); if ($CURUSER[stylesheet]=='1' || $CURUSER[stylesheet]>='3') begin_frame("Open / Close registrations"); echo '<center>'; echo 'On this page you can open and close registrations:)<p>'; if ($signup != "") { if ($signup == 1) { mysql_query("UPDATE config SET value = '1' WHERE name = 'signup'"); write_log("Registrations open by $CURUSER[username]"); } if ($signup == 2) { mysql_query("UPDATE config SET value = '0' WHERE name = 'signup'"); write_log("Registration closed by $CURUSER[username]"); } } $signup = mysql_result(mysql_query("SELECT value FROM config WHERE name = 'signup'"), 0); if ($signup == 0) { echo 'Registration is already closed<br/><a href=?signup=1>Click here to open registration!</a>'; } else { echo 'Registration is already open<br/><a href=?signup=2>Click here to close Registrations!</a>'; } echo '</center>'; if ($CURUSER[stylesheet]=='1' || $CURUSER[stylesheet]>='3') end_frame(); stdfoot(); ?>
That's it!
Hope this will be helpful!
Good luck!
__________________
|