California Hangin' Around

Joined: Mar 24, 2005 Posts: 28
|
Posted:
Mon Apr 18, 2005 1:28 pm |
|
I need a MOD for one of my nuke sites (not the same one I posted the other registration MOD for in this forum, that is still pending).
I need the auto register as AOL keeps blocking emails intermittently thus people can not click the confirmation link to register. The problem is that some people are using bad email addresses -> can you imagine?.
I want to modify the code below so it sends a welcome email with the username and password when using the auto registration option. This way I can see if the message bounces back and why to decide if the person gave a bad email or if the email was just blocked.
I tried including part of the code that is used for the normal registration after the auto registration but gave up as I could not get it to work. I also posted for help in the modules forum but have not received a reply in a week. Here is the code if anyone can help. I was thinking this is a simple fix if you know what you are doing but am willing to pay a little if you can fix it up.
| Code: |
function confirmNewUser($username, $user_email, $user_password, $user_password2, $random_num, $gfx_check) {
global $stop, $EditedMessage, $sitename, $module_name, $minpass, $autoActivate;
include("header.php");
include("config.php");
filter_text($username);
$u]sername = $EditedMessage;
$user_viewemail = "0";
userCheck($username, $user_email);
if (!$stop) {
$datekey = date("F j");
$rcode = hexdec(md5($_SERVER[HTTP_USER_AGENT] . $sitekey . $_POST[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)) {
title(""._NEWUSERERROR."");
OpenTable();
echo "<center><b>"._SECCODEINCOR."</b><br><br>"
.""._GOBACK."</center>";
CloseTable();
include("footer.php");
die();
}
if ($user_password == "" AND $user_password2 == "") {
$user_password = makepass();
} elseif ($user_password != $user_password2) {
title(""._NEWUSERERROR."");
OpenTable();
echo "<center><b>"._PASSDIFFERENT."</b><br><br>"._GOBACK."</center>";
CloseTable();
include("footer.php");
die();
} elseif ($user_password == $user_password2 AND strlen($user_password) < $minpass) {
title(""._NEWUSERERROR."");
OpenTable();
echo "<center>"._YOUPASSMUSTBE." <b>$minpass</b> "._CHARLONG."<br><br>"._GOBACK."</center>";
CloseTable();
include("footer.php");
die();
}
title("$sitename: "._USERREGLOGIN."");
OpenTable();
echo "<center><b>"._USERFINALSTEP."</b><br><br>$username, "._USERCHECKDATA."<br><br>"
."<table align='center' border='0'>"
."<tr><td><b>"._UUSERNAME.":</b> $username<br></td></tr>"
."<tr><td><b>"._EMAIL.":</b> $user_email</td></tr></table><br><br>";
if (!$autoActivate) echo "<center><b>"._NOTE."</b> "._YOUWILLRECEIVE."";
echo "<form action=\"modules.php?name=$module_name\" method=\"post\">"
."<input type=\"hidden\" name=\"random_num\" value=\"$random_num\">"
."<input type=\"hidden\" name=\"gfx_check\" value=\"$gfx_check\">"
."<input type=\"hidden\" name=\"username\" value=\"$username\">"
."<input type=\"hidden\" name=\"user_email\" value=\"$user_email\">"
."<input type=\"hidden\" name=\"user_password\" value=\"$user_password\">"
."<input type=\"hidden\" name=\"op\" value=\"finish\"><br><br>"
."<input type=\"submit\" value=\""._FINISH."\"> "._GOBACK."</form></center>";
CloseTable();
} else {
OpenTable();
echo "<center><font class=\"title\"><b>Registration Error!</b></font><br><br>";
echo "<font class=\"content\">$stop<br>"._GOBACK."</font></center>";
CloseTable();
}
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, $autoActivate;
include("header.php");
include("config.php");
userCheck($username, $user_email);
$user_regdate = date("M d, Y");
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);
$username = check_html($username, nohtml);
$user_email = check_html($user_email, nohtml);
$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>";
} elseif ($autoActivate) { activate($username, $check_num, $autoActivate);
} else {
$message = ""._WELCOMETO." $sitename!\n\n"._YOUUSEDEMAIL." ($user_email) "._TOREGISTER." $sitename.\n\n "._TOFINISHUSER."\n\n $finishlink\n\n "._FOLLOWINGMEM."\n\n"._UNICKNAME." $username\n"._UPASSWORD." $user_password";
$subject = ""._ACTIVATIONSUB."";
$from = "$adminmail";
mail($user_email, $subject, $message, "From: $from\nX-Mailer: PHP/" . phpversion());
title("$sitename: "._USERREGLOGIN."");
OpenTable();
echo "<center><b>"._ACCOUNTCREATED."</b><br><br>";
echo ""._YOUAREREGISTERED.""
."<br><br>"
.""._FINISHUSERCONF."<br><br>"
.""._THANKSUSER." $sitename!</center>";
CloseTable();
}
} else {
echo "$stop";
}
include("footer.php");
}
function activate($username, $check_num, $autoActivate=FALSE) {
global $db, $user_prefix, $module_name, $language, $stop, $EditedMessage, $adminmail, $sitename, $Default_Theme, $db, $storyhome, $nukeurl, $autoActivate;
$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);
if ($check_num == $row[check_num]) {
$db->sql_query("INSERT INTO ".$user_prefix."_users (user_id, username, user_email, user_password, user_avatar, user_regdate, user_lang) VALUES (NULL, '$row[username]', '$row[user_email]', '$row[user_password]', 'gallery/blank.gif', '$row[user_regdate]', '$language')");
$db->sql_query("DELETE FROM ".$user_prefix."_users_temp WHERE username='$username' AND check_num='$check_num'");
if (!$autoActivate) include("header.php");
include("config.php");
title(""._ACTIVATIONYES."");
OpenTable();
echo "<center><b>$row[username]:</b> "._ACTMSG."</center>";
CloseTable();
include("footer.php");
die();
} else {
if (!$autoActivate) include("header.php");
title(""._ACTIVATIONERROR."");
OpenTable();
echo "<center>"._ACTERROR1."</center>";
CloseTable();
include("footer.php");
die();
}
} else {
if (!$autoActivate) include("header.php");
title(""._ACTIVATIONERROR."");
OpenTable();
echo "<center>"._ACTERROR2."</center>";
CloseTable();
include("footer.php");
die();
}
} | I tried adding the globals to the auto activation if statement and this code but it did not work so what am I doing wrong?:
| Code: |
$message = ""._WELCOMETO." $sitename!\n\n"._YOUUSEDEMAIL." ($user_email) "._TOREGISTER." $sitename.\n\n "._TOFINISHUSER."\n\n $finishlink\n\n "._FOLLOWINGMEM."\n\n"._UNICKNAME." $username\n"._UPASSWORD." $user_password";
$subject = ""._ACTIVATIONSUB."";
$from = "$adminmail";
mail($user_email, $subject, $message, "From: $from\nX-Mailer: PHP/" . phpversion()); |
|
|
|