Nukemods Forum  
» Log in
User Name:

Password:

Not a member yet?
Register Now!
» Online Users: 53
5 members and 48 guests
affiz4iliate6ec, cliaw9cckhereto, mariacolmanyne3, medaricalddw93g, parttarcts
Most users ever online was 611, 03-21-2008 at 10:10 PM.
» .::.
» .:.

Go Back   Nukemods Forum > PHP-Nuke 7.x > Nuke 7.x - Modules

Reply
 
LinkBack Thread Tools Display Modes
Sending Welcome Email With Auto Registration Module
Old
  (#1 (permalink))
Junior Member
 
Status: Offline
Posts: 8
Join Date: Apr 2005
Sending Welcome Email With Auto Registration Module - 04-19-2005, 01:15 PM

I use an auto registration module on one of my Nuke sites because 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.

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 to produce an email (see the code at the bottom) but gave up as I could not get it to work.

Here is the code if anyone can help. Send a PM or post if you need to see the rest of the code, I just included the part I thought it involved.

Thanks

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>"._SECCODEINCOR."

"
		.""._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>"._PASSDIFFERENT."

"._GOBACK."</center>";
	    CloseTable();
	    include("footer.php");
	    die();
	} elseif ($user_password == $user_password2 AND strlen($user_password) < $minpass) {
	    title(""._NEWUSERERROR."");
	    OpenTable();
	    echo "<center>"._YOUPASSMUSTBE." $minpass "._CHARLONG."

"._GOBACK."</center>";
	    CloseTable();
	    include("footer.php");
	    die();
	}
	title("$sitename: "._USERREGLOGIN."");
	OpenTable();
	echo "<center>"._USERFINALSTEP."

$username, "._USERCHECKDATA."

"
	    ."<table align='center' border='0'>"
	    ."<tr><td>"._UUSERNAME.": $username
</td></tr>"
	    ."<tr><td>"._EMAIL.": $user_email</td></tr></table>

";
	if (!$autoActivate) echo "<center>"._NOTE." "._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\">

"
	    ."<input type=\"submit\" value=\""._FINISH."\"> "._GOBACK."</form></center>";
	CloseTable();
    } else {
	OpenTable();
	echo "<center><font class=\"title\">Registration Error!</font>

";
	echo "<font class=\"content\">$stop
"._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."
";
	} 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>"._ACCOUNTCREATED."

";
	    echo ""._YOUAREREGISTERED.""
	        ."

"
		.""._FINISHUSERCONF."

"
		.""._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>$row[username]: "._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());
   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Pleas Help Pleas
Old
  (#2 (permalink))
Junior Member
 
Status: Offline
Posts: 3
Join Date: Feb 2005
Pleas Help Pleas - 04-19-2005, 01:37 PM

Pleas All Help me some 1 give me Good Program for build / Repier php Site Plasss Help
   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Disallow registration by certain email domains Astroman Nuke 7.x - General 4 02-09-2007 04:00 PM
EMAIL REGISTRATION macca Nuke 7.x - General 5 04-15-2005 09:20 PM
Email Not Sending romer Open topics 1 10-13-2004 10:09 AM
registration email varialskate Nuke 6.5 to 6.9 - General 1 08-15-2004 05:52 AM
error: "failed sending email" ??? darkdan Purged Topics 3 02-12-2003 08:47 PM




vBulletin Skin developed by: vBStyles.com


LinkBacks Enabled by vBSEO 3.3.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31