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 '? Quote Link to comment 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! Quote Link to comment 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? Quote Link to comment 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 Quote Link to comment Share on other sites More sharing options...
seb hughes Posted May 20, 2007 Share Posted May 20, 2007 I give up. Quote Link to comment 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.. Quote Link to comment 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 Quote Link to comment 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"; Quote Link to comment 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); } Quote Link to comment 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? Quote Link to comment 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(); Quote Link to comment 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. Quote Link to comment 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"; Quote Link to comment Share on other sites More sharing options...
chigley Posted May 20, 2007 Share Posted May 20, 2007 Before the $theKey = key(); please. Quote Link to comment 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! Quote Link to comment 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! Quote Link to comment 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); } ?> Quote Link to comment 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. Quote Link to comment 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!! Quote Link to comment 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"; ?> Quote Link to comment 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 . Quote Link to comment Share on other sites More sharing options...
runnerjp Posted May 20, 2007 Author Share Posted May 20, 2007 fine ill close thread down Quote Link to comment 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.