Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Modules
Author Message
California
Hangin' Around



Joined: Mar 24, 2005
Posts: 28

PostPosted: Mon Apr 11, 2005 1:36 am Reply with quote

I am using a MOD that Raven did to register users automatically without email confirmation. I would like to have the MOD email users a welcome email containing their username and password (without the confirmation link) so I tried adding the email function to the script before the auto registration finish where it writes to the users table instead of the temp users table but I must be missing something because it is not working. Here is the code if anyone can help please:

Part of orig MOD code:
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."\"> &nbsp;&nbsp;"._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());
 
View user's profile Send private message
California







PostPosted: Mon Apr 11, 2005 1:45 am Reply with quote

I want to do this so I can deactivate users who register and their "auto activation welcome" email I am trying to create above comes back user unknown.

Why not use the email confirmation link you might wonder? I still need the auto activation because AOL keeps blocking our email temporaily causing havoc for those trying to register with the confirmation link required. This way I can see who may be using a bad email without preventing those from registering if their host has blocked my server email temporaily by looking at the type of bounce message sent back.

Please help me set this up.
 
jasonrhl
New Member
New Member



Joined: Jun 29, 2004
Posts: 5

PostPosted: Wed Sep 28, 2005 2:16 am Reply with quote

Did you get this code to work. I am also interested in sending an email to welcome members and give them theur usernames and passwords aswell as some information on how to use the site.

hope someone can help soon
 
View user's profile Send private message
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Modules

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©