seb hughes Posted May 20, 2007 Share Posted May 20, 2007 ."$url = 'http://www.runnerselite.com/website/activate.php?hash=".($usename)."$key"; iv changed it so it matches the user name with the key now! but it still does not work That defo wont work. Why are you using () and why are you using ' and " , why not stick to just '? Link to comment https://forums.phpfreaks.com/topic/52211-solved-user-activation-via-email/page/2/#findComment-257617 Share on other sites More sharing options...
MadTechie Posted May 20, 2007 Share Posted May 20, 2007 the "section" causeing the problem.. rather than the line you think is the problem! Link to comment https://forums.phpfreaks.com/topic/52211-solved-user-activation-via-email/page/2/#findComment-257619 Share on other sites More sharing options...
seb hughes Posted May 20, 2007 Share Posted May 20, 2007 the "section" causeing the problem.. rather than the line you think is the problem! I've lost the plot in thsi thread what section do you mean, randomcode? Link to comment https://forums.phpfreaks.com/topic/52211-solved-user-activation-via-email/page/2/#findComment-257621 Share on other sites More sharing options...
runnerjp Posted May 20, 2007 Author Share Posted May 20, 2007 ."$url = 'http://www.runnerselite.com/website/activate.php?hash=".($usename)."$key"; this line is the problem tho as the key is being placed into the table... i need it so that to activate chnageing 0 to 1 the user must click the link with the key having to match the user id for this to work and seb hughes show me what you mean by not useing () as i got told they must be in Link to comment https://forums.phpfreaks.com/topic/52211-solved-user-activation-via-email/page/2/#findComment-257623 Share on other sites More sharing options...
seb hughes Posted May 20, 2007 Share Posted May 20, 2007 I give up. Link to comment https://forums.phpfreaks.com/topic/52211-solved-user-activation-via-email/page/2/#findComment-257625 Share on other sites More sharing options...
MadTechie Posted May 20, 2007 Share Posted May 20, 2007 don't think that will work.. but i'm out.. the simpliest thing seams to be over some peoples head.. Link to comment https://forums.phpfreaks.com/topic/52211-solved-user-activation-via-email/page/2/#findComment-257627 Share on other sites More sharing options...
runnerjp Posted May 20, 2007 Author Share Posted May 20, 2007 no with that i get Parse error: syntax error, unexpected T_STRING Link to comment https://forums.phpfreaks.com/topic/52211-solved-user-activation-via-email/page/2/#findComment-257630 Share on other sites More sharing options...
MadTechie Posted May 20, 2007 Share Posted May 20, 2007 Sighs $theKey = key(); $url = "http://www.runnerselite.com/website/activate.php?hash=".md5($userid)."&key=$theKey"; Link to comment https://forums.phpfreaks.com/topic/52211-solved-user-activation-via-email/page/2/#findComment-257641 Share on other sites More sharing options...
runnerjp Posted May 20, 2007 Author Share Posted May 20, 2007 no i just got arse error: syntax error, unexpected T_VARIABLE in but been thinking i could do it like this $url = "http://www.runnerselite.com/website/activate.php?hash="&key=$Key"; $code = $_GET['key']; $query = "SELECT * FROM users WHERE key = $key"; $result = mysql_query($query) or die ("Error in query" . mysql_query()); $row = mysql_fetch_assoc($result); if (mysql_num_rows($result) == 1) { $id = $row['username']; $update = "UPDATE users SET status =1 WHERE username = '$username'"; mysql_query($update) or die ("Error in query" . mysql_query()); echo "Your account is now active"; header(location: where you need it to be forwarded to; exit; } else { header(location: login page); } Link to comment https://forums.phpfreaks.com/topic/52211-solved-user-activation-via-email/page/2/#findComment-257655 Share on other sites More sharing options...
seb hughes Posted May 20, 2007 Share Posted May 20, 2007 $theKey = key(); $url = "http://www.runnerselite.com/website/activate.php?hash=".md5($userid)."&key=".$theKey.""; That work? Link to comment https://forums.phpfreaks.com/topic/52211-solved-user-activation-via-email/page/2/#findComment-257657 Share on other sites More sharing options...
runnerjp Posted May 20, 2007 Author Share Posted May 20, 2007 syntax error, unexpected T_VARIABLE is what i got for $theKey = key(); Link to comment https://forums.phpfreaks.com/topic/52211-solved-user-activation-via-email/page/2/#findComment-257660 Share on other sites More sharing options...
chigley Posted May 20, 2007 Share Posted May 20, 2007 Paste the line above the $theKey = key(); please. Link to comment https://forums.phpfreaks.com/topic/52211-solved-user-activation-via-email/page/2/#findComment-257663 Share on other sites More sharing options...
runnerjp Posted May 20, 2007 Author Share Posted May 20, 2007 its $url = "http://www.runnerselite.com/website/activate.php?hash=".($usename)."&key=$theKey"; Link to comment https://forums.phpfreaks.com/topic/52211-solved-user-activation-via-email/page/2/#findComment-257665 Share on other sites More sharing options...
chigley Posted May 20, 2007 Share Posted May 20, 2007 Before the $theKey = key(); please. Link to comment https://forums.phpfreaks.com/topic/52211-solved-user-activation-via-email/page/2/#findComment-257667 Share on other sites More sharing options...
MadTechie Posted May 20, 2007 Share Posted May 20, 2007 runnerjp you REALLY need to get a book and stop using this place as your "do it for me" lab! Link to comment https://forums.phpfreaks.com/topic/52211-solved-user-activation-via-email/page/2/#findComment-257671 Share on other sites More sharing options...
runnerjp Posted May 20, 2007 Author Share Posted May 20, 2007 function sendWelcome($user, $email, $pass){ $from = "From: ".EMAIL_FROM_NAME." <".EMAIL_FROM_ADDR.">"; $subject = "Jpmaster77's Site - Welcome!"; $body = $user.",\n\n" ."Welcome! You've just registered at Jpmaster77's Site " ."with the following information:\n\n" ."Username: ".$user."\n" ."Password: ".$pass."\n\n" $Key = key(); $url = "http://www.runnerselite.com/website/activate.php?hash=".md5($userid)."&key=$Key"; return mail($email,$subject,$body,$from); } here is the whole email script! Link to comment https://forums.phpfreaks.com/topic/52211-solved-user-activation-via-email/page/2/#findComment-257677 Share on other sites More sharing options...
chigley Posted May 20, 2007 Share Posted May 20, 2007 <?php function sendWelcome($user, $email, $pass){ $from = "From: ".EMAIL_FROM_NAME." <".EMAIL_FROM_ADDR.">"; $subject = "Jpmaster77's Site - Welcome!"; $body = $user.",\n\n"; ."Welcome! You've just registered at Jpmaster77's Site "; ."with the following information:\n\n"; ."Username: ".$user."\n"; ."Password: ".$pass."\n\n"; $Key = key(); $url = "http://www.runnerselite.com/website/activate.php?hash=".md5($userid)."&key=$Key"; return mail($email,$subject,$body,$from); } ?> Link to comment https://forums.phpfreaks.com/topic/52211-solved-user-activation-via-email/page/2/#findComment-257680 Share on other sites More sharing options...
seb hughes Posted May 20, 2007 Share Posted May 20, 2007 runnerjp you REALLY need to get a book and stop using this place as your "do it for me" lab! I concur, also in your email script runnerjp you don't even have a funtion created for key, so key doesn't exist and it will give you an error. Link to comment https://forums.phpfreaks.com/topic/52211-solved-user-activation-via-email/page/2/#findComment-257689 Share on other sites More sharing options...
runnerjp Posted May 20, 2007 Author Share Posted May 20, 2007 ok im going to show the WHOLE of the script function randomkeys($length){ $pattern="1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; for($i=0; $i<$length; $i++) $key.=$pattern{rand(0,61)}; return $key; } function addNewUser($username, $password, $email){ $time=time(); if(strcasecmp($username, ADMIN_NAME) == 0) $ulevel=ADMIN_LEVEL; else $ulevel=USER_LEVEL; $key=$this->randomkeys(30); $status = 0; $q="INSERT INTO ".TBL_USERS." VALUES ('$username', '$password', '0', $ulevel, '$email', $time, $status,'$key')"; $result = mysql_query($q, $this->connection) or die(mysql_error()); return $result; } here the random key is made... so surly the function should be key then once that is added and email is sent <?php function sendWelcome($user, $email, $pass){ $from = "From: ".EMAIL_FROM_NAME." <".EMAIL_FROM_ADDR.">"; $subject = "Jpmaster77's Site - Welcome!"; $body = $user.",\n\n"; ."Welcome! You've just registered at Jpmaster77's Site "; ."with the following information:\n\n"; ."Username: ".$user."\n"; ."Password: ".$pass."\n\n"; $Key = key(); $url = "http://www.runnerselite.com/website/activate.php?hash="&key=$Key"; return mail($email,$subject,$body,$from); } ?> at the moment this code does not work as i think its because of all the ; then once the email has been sent it goes to activiate.php where $code = $_GET['key']; $query = "SELECT * FROM users WHERE key = $key"; $result = mysql_query($query) or die ("Error in query" . mysql_query()); $row = mysql_fetch_assoc($result); if (mysql_num_rows($result) == 1) { $id = $row['username']; $update = "UPDATE users SET status =1 WHERE username = '$username'"; mysql_query($update) or die ("Error in query" . mysql_query()); echo "Your account is now active"; header(location: where you need it to be forwarded to; exit; } else { header(location: login page); } is done!! Link to comment https://forums.phpfreaks.com/topic/52211-solved-user-activation-via-email/page/2/#findComment-257693 Share on other sites More sharing options...
MadTechie Posted May 20, 2007 Share Posted May 20, 2007 LOL <?php $url = "http://www.runnerselite.com/website/activate.php?hash=&key=$Key"; ?> Link to comment https://forums.phpfreaks.com/topic/52211-solved-user-activation-via-email/page/2/#findComment-257706 Share on other sites More sharing options...
seb hughes Posted May 20, 2007 Share Posted May 20, 2007 Man this thread is causing so much hassle it is unreal, I say runnerjp goes reads up and we party . Link to comment https://forums.phpfreaks.com/topic/52211-solved-user-activation-via-email/page/2/#findComment-257708 Share on other sites More sharing options...
runnerjp Posted May 20, 2007 Author Share Posted May 20, 2007 fine ill close thread down Link to comment https://forums.phpfreaks.com/topic/52211-solved-user-activation-via-email/page/2/#findComment-257710 Share on other sites More sharing options...
seb hughes Posted May 20, 2007 Share Posted May 20, 2007 I didn't say that but it seems like you havnt look at the manual or anything. no offensive. Just create a activate code and in the email have this code and the email, so they have to match to ok it. Link to comment https://forums.phpfreaks.com/topic/52211-solved-user-activation-via-email/page/2/#findComment-257715 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.