View Single Post
  #1  
Old 13th March 2016, 17:27
Chez's Avatar
Chez Chez is offline
Senior Member
 
Join Date: Sep 2011
P2P
Posts: 278
Default Enable / Disable Registrations
Click the image to open in full size.

SQL:

PHP Code:
CREATE TABLE `config` (
 `
namevarchar(255NOT NULL default '',
 `
valuevarchar(255NOT 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!

__________________
http://www.bvlist.com/images/avatars/signaturepics/sigpic16443_2.gif
Reply With Quote
The Following User Says Thank You to Chez For This Useful Post:
Elena (6th October 2017)