Im using the following script below for my website, i was wondering if anybody could add a small script to it so that when it creates a website account it also creates a game account. I dont care about the LAST_IP. Currently i have my PHP nuke set up that so it bypasses the email activation so currently it puts it in the temp_users, than into the the actual users table.
here is my CONFIG.PHP
And Here is my account creation scriptPHP Code:
$dbhost = "localhost";
$dbuname = "root";
$dbpass = "------";
$dbname = "website";
$prefix = "nuke";
$user_prefix = "nuke";
$dbtype = "MySQL";
$sitekey = "qFPksqb5SKCBv7OGbWnKg2ClZ1Y0JFY6cQqSWNuT";
$gfx_chk = 0;
$subscription_url = "";
$admin_file = "admin";
$nuke_editor = 1;
$display_errors = false;
And here it is without the rainbow colorsPHP Code:
function finishNewUser($username, $user_email, $user_password, $random_num, $gfx_check) {
global $stop, $EditedMessage, $adminmail, $sitename, $Default_Theme, $user_prefix, $db, $storyhome, $module_name, $nukeurl, $language;
include_once("header.php");
include("config.php");
userCheck($username, $user_email);
$user_email = validate_mail($user_email);
$user_regdate = date("M d, Y");
$user_password = htmlspecialchars(stripslashes($user_password));
if (!isset($stop)) {
$datekey = date("F j");
$rcode = hexdec(md5($_SERVER['HTTP_USER_AGENT'] . $sitekey . $random_num . $datekey));
$code = substr($rcode, 2, 6);
if (extension_loaded("gd") AND $code != $gfx_check AND ($gfx_chk == 3 OR $gfx_chk == 4 OR $gfx_chk == 6 OR $gfx_chk == 7)) {
Header("Location: modules.php?name=$module_name");
die();
}
mt_srand ((double)microtime()*1000000);
$maxran = 1000000;
$check_num = mt_rand(0, $maxran);
$check_num = md5($check_num);
$time = time();
$finishlink = "$nukeurl/modules.php?name=$module_name&op=activate&username=$username&check_num=$check_num";
$new_password = md5($user_password);
$new_password = htmlspecialchars(stripslashes($new_password));
$username = filter($username, "nohtml", 1);
$user_email = filter($user_email, "nohtml", 1);
$result = $db->sql_query("INSERT INTO ".$user_prefix."_users_temp (user_id, username, user_email, user_password, user_regdate, check_num, time) VALUES (NULL, '$username', '$user_email', '$new_password', '$user_regdate', '$check_num', '$time')");
if(!$result) {
echo ""._ERROR."<br>";
} else {
////
$past = time()-86400;
$db->sql_query("DELETE FROM ".$user_prefix."_users_temp WHERE time < $past");
$sql = "SELECT * FROM ".$user_prefix."_users_temp WHERE username='$username' AND check_num='$check_num'";
$result = $db->sql_query($sql);
if ($db->sql_numrows($result) == 1) {
$row = $db->sql_fetchrow($result);
$user_password = htmlspecialchars(stripslashes($row['user_password']));
if ($check_num == $row[check_num]) {
$db->sql_query("INSERT INTO ".$user_prefix."_users (user_id, username, user_email, user_password, user_avatar, user_avatar_type, user_regdate, user_lang) VALUES (NULL, '$row[username]', '$row[user_email]', '$user_password', 'gallery/blank.gif', 3, '$row[user_regdate]', '$language')");
$result2 = $db->sql_query("SELECT user_id FROM ".$user_prefix."_users WHERE username='".$row['username']."'");
$row2 = $db->sql_fetchrow($result2);
$guserid = intval($row2['user_id']);
$db->sql_query("INSERT INTO ".$prefix."_bbgroups (group_name, group_description, group_single_user, group_moderator) VALUES ('', 'Personal User', '1', '0')");
$group_id = $db->sql_nextid();
$db->sql_query("INSERT INTO ".$prefix."_bbuser_group (user_id, group_id, user_pending) VALUES ('$guserid', '$group_id', '0')");
$db->sql_query("DELETE FROM ".$user_prefix."_users_temp WHERE username='$username' AND check_num='$check_num'");
// include_once("header.php");
title(""._ACTIVATIONYES."");
// OpenTable();
echo "<center><b>$row[username]:</b> "._ACTMSG."</center>";
// CloseTable();
// include("footer.php");
// die();
} else {
// include("header.php");
title(""._ACTIVATIONERROR."");
// OpenTable();
echo "<center>"._ACTERROR1."</center>";
// CloseTable();
// include("footer.php");
// die();
}
} else {
// include("header.php");
title(""._ACTIVATIONERROR."");
// OpenTable();
echo "<center>"._ACTERROR2."</center>";
// CloseTable();
// include("footer.php");
die();
}
////
}
} else {
echo "$stop";
}
include("footer.php");
function finishNewUser($username, $user_email, $user_password, $random_num, $gfx_check) {
global $stop, $EditedMessage, $adminmail, $sitename, $Default_Theme, $user_prefix, $db, $storyhome, $module_name, $nukeurl, $language;
include_once("header.php");
include("config.php");
userCheck($username, $user_email);
$user_email = validate_mail($user_email);
$user_regdate = date("M d, Y");
$user_password = htmlspecialchars(stripslashes($user_password));
if (!isset($stop)) {
$datekey = date("F j");
$rcode = hexdec(md5($_SERVER['HTTP_USER_AGENT'] . $sitekey . $random_num . $datekey));
$code = substr($rcode, 2, 6);
if (extension_loaded("gd") AND $code != $gfx_check AND ($gfx_chk == 3 OR $gfx_chk == 4 OR $gfx_chk == 6 OR $gfx_chk == 7)) {
Header("Location: modules.php?name=$module_name");
die();
}
mt_srand ((double)microtime()*1000000);
$maxran = 1000000;
$check_num = mt_rand(0, $maxran);
$check_num = md5($check_num);
$time = time();
$finishlink = "$nukeurl/modules.php?name=$module_name&op=activate&username=$username&check_num=$check_nu m";
$new_password = md5($user_password);
$new_password = htmlspecialchars(stripslashes($new_password));
$username = filter($username, "nohtml", 1);
$user_email = filter($user_email, "nohtml", 1);
$result = $db->sql_query("INSERT INTO ".$user_prefix."_users_temp (user_id, username, user_email, user_password, user_regdate, check_num, time) VALUES (NULL, '$username', '$user_email', '$new_password', '$user_regdate', '$check_num', '$time')");
if(!$result) {
echo ""._ERROR."<br>";
} else {
////
$past = time()-86400;
$db->sql_query("DELETE FROM ".$user_prefix."_users_temp WHERE time < $past");
$sql = "SELECT * FROM ".$user_prefix."_users_temp WHERE username='$username' AND check_num='$check_num'";
$result = $db->sql_query($sql);
if ($db->sql_numrows($result) == 1) {
$row = $db->sql_fetchrow($result);
$user_password = htmlspecialchars(stripslashes($row['user_password']));
if ($check_num == $row[check_num]) {
$db->sql_query("INSERT INTO ".$user_prefix."_users (user_id, username, user_email, user_password, user_avatar, user_avatar_type, user_regdate, user_lang) VALUES (NULL, '$row[username]', '$row[user_email]', '$user_password', 'gallery/blank.gif', 3, '$row[user_regdate]', '$language')");
$result2 = $db->sql_query("SELECT user_id FROM ".$user_prefix."_users WHERE username='".$row['username']."'");
$row2 = $db->sql_fetchrow($result2);
$guserid = intval($row2['user_id']);
$db->sql_query("INSERT INTO ".$prefix."_bbgroups (group_name, group_description, group_single_user, group_moderator) VALUES ('', 'Personal User', '1', '0')");
$group_id = $db->sql_nextid();
$db->sql_query("INSERT INTO ".$prefix."_bbuser_group (user_id, group_id, user_pending) VALUES ('$guserid', '$group_id', '0')");
$db->sql_query("DELETE FROM ".$user_prefix."_users_temp WHERE username='$username' AND check_num='$check_num'");
// include_once("header.php");
title(""._ACTIVATIONYES."");
// OpenTable();
echo "<center><b>$row[username]:</b> "._ACTMSG."</center>";
// CloseTable();
// include("footer.php");
// die();
} else {
// include("header.php");
title(""._ACTIVATIONERROR."");
// OpenTable();
echo "<center>"._ACTERROR1."</center>";
// CloseTable();
// include("footer.php");
// die();
}
} else {
// include("header.php");
title(""._ACTIVATIONERROR."");
// OpenTable();
echo "<center>"._ACTERROR2."</center>";
// CloseTable();
// include("footer.php");
die();
}
////
}
} else {
echo "$stop";
}
include("footer.php");