Email Confirmation Prob

Thread Solved

Join Date: Sep 2009
Posts: 30
Reputation: smvec is an unknown quantity at this point 
Solved Threads: 0
smvec's Avatar
smvec smvec is offline Offline
Light Poster

Email Confirmation Prob

 
0
  #1
Sep 17th, 2009
im a newbie php developer...

i've tried sending an email n receiving the confirmation back for activating the users...

here is the email sending code :
  1. if($res)
  2. {
  3. echo "record added";
  4. $to = $mail;
  5. $sub = "Confirm Mail From LeLys";
  6. $header = "from: admin<support@domain.org>";
  7.  
  8. $message = "confirm link \r\n";
  9. $message.= "click to activete your account";
  10. $message.= "http://www.domain.org/confirmation.php?key=$ccode";
  11.  
  12. $sending = mail($to,$sub,$message,$header);
  13.  
  14. if($sending)
  15. echo ("email comfirm");
  16. else
  17. echo("email not sent");
  18.  
  19. }

here is the Confirmation Page :
  1. $passkey = $_GET['key'];
  2. $sql1 = "SELECT * FROM temp_db WHERE code='$passkey'";
  3. $result1 = mysql_query($sql1);
  4.  
  5. if($result1)
  6. {
  7. // Count how many row has this passkey
  8. $count = mysql_num_rows($result1);
  9.  
  10. // if found this passkey in our database, retrieve data from table "temp_members_db"
  11. if($count == 1)
  12. {
  13. $rows = mysql_fetch_array($result1);
  14. $a = $rows['fname'];
  15. $b = $rows['mname'];
  16. $c = $rows['lname'];
  17. $d = $rows['dob'];
  18. $e = $rows['gender'];
  19. $f = $rows['email'];
  20. $g = $rows['country'];
  21. $h = $rows['phno'];
  22. $i = $rows['mobile'];
  23. $j = $rows['userid'];
  24. $k = $rows['password'];
  25. $l = $rows['mti'];
  26. $m = = $rows['rtime'];
  27.  
  28. $sql2 = "INSERT INTO regd_db(fname,mname,lname,dob,gender,email,country,phno,mobile,userid,password,mti,rtime)
  29. VALUES('$a','$b','$c','$d','$e','$f','$g','$h','$i','$j','$k','$l','$m')";
  30. $result2 = mysql_query($sql2);
  31. }
  32. // if not found passkey, display message "Wrong Confirmation code"
  33. else
  34. echo "Wrong confirmation code";
  35. // if successfully moved data from table"temp" to table "registered" display"Your account has been activated"
  36. if($result2)
  37. {
  38. echo "You hav Been Activated.. please log in";
  39.  
  40. $sql3 = "DELETE FROM temp_db WHERE code='$passkey'";
  41. $result3 = mysql_query($sql3) or die("Cud not delete temp files");
  42. }
  43. }

On clicking the link in my email, i get a BLANK confirmation page...

wat is the prob.. ?

need help
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 77
Reputation: ivatanako is an unknown quantity at this point 
Solved Threads: 5
ivatanako ivatanako is offline Offline
Junior Poster in Training

Re: Email Confirmation Prob

 
0
  #2
Sep 17th, 2009
Originally Posted by smvec View Post
im a newbie php developer...

i've tried sending an email n receiving the confirmation back for activating the users...

here is the email sending code :
  1. if($res)
  2. {
  3. echo "record added";
  4. $to = $mail;
  5. $sub = "Confirm Mail From LeLys";
  6. $header = "from: admin<support@domain.org>";
  7.  
  8. $message = "confirm link \r\n";
  9. $message.= "click to activete your account";
  10. $message.= "http://www.domain.org/confirmation.php?key=$ccode";
  11.  
  12. $sending = mail($to,$sub,$message,$header);
  13.  
  14. if($sending)
  15. echo ("email comfirm");
  16. else
  17. echo("email not sent");
  18.  
  19. }

here is the Confirmation Page :
  1. $passkey = $_GET['key'];
  2. $sql1 = "SELECT * FROM temp_db WHERE code='$passkey'";
  3. $result1 = mysql_query($sql1);
  4.  
  5. if($result1)
  6. {
  7. // Count how many row has this passkey
  8. $count = mysql_num_rows($result1);
  9.  
  10. // if found this passkey in our database, retrieve data from table "temp_members_db"
  11. if($count == 1)
  12. {
  13. $rows = mysql_fetch_array($result1);
  14. $a = $rows['fname'];
  15. $b = $rows['mname'];
  16. $c = $rows['lname'];
  17. $d = $rows['dob'];
  18. $e = $rows['gender'];
  19. $f = $rows['email'];
  20. $g = $rows['country'];
  21. $h = $rows['phno'];
  22. $i = $rows['mobile'];
  23. $j = $rows['userid'];
  24. $k = $rows['password'];
  25. $l = $rows['mti'];
  26. $m = = $rows['rtime'];
  27.  
  28. $sql2 = "INSERT INTO regd_db(fname,mname,lname,dob,gender,email,country,phno,mobile,userid,password,mti,rtime)
  29. VALUES('$a','$b','$c','$d','$e','$f','$g','$h','$i','$j','$k','$l','$m')";
  30. $result2 = mysql_query($sql2);
  31. }
  32. // if not found passkey, display message "Wrong Confirmation code"
  33. else
  34. echo "Wrong confirmation code";
  35. // if successfully moved data from table"temp" to table "registered" display"Your account has been activated"
  36. if($result2)
  37. {
  38. echo "You hav Been Activated.. please log in";
  39.  
  40. $sql3 = "DELETE FROM temp_db WHERE code='$passkey'";
  41. $result3 = mysql_query($sql3) or die("Cud not delete temp files");
  42. }
  43. }

On clicking the link in my email, i get a BLANK confirmation page...

wat is the prob.. ?

need help
How about putting a else statement here

  1. if($result2)
  2. {
  3. echo "You hav Been Activated.. please log in";
  4.  
  5. $sql3 = "DELETE FROM temp_db WHERE code='$passkey'";
  6. $result3 = mysql_query($sql3) or die("Cud not delete temp files");
  7. }else
  8. {
  9. echo 'problems found';
  10. }

let see if which will it print.
Reply With Quote Quick reply to this message  
Join Date: Sep 2009
Posts: 30
Reputation: smvec is an unknown quantity at this point 
Solved Threads: 0
smvec's Avatar
smvec smvec is offline Offline
Light Poster

Re: Email Confirmation Prob

 
0
  #3
Sep 22nd, 2009
hi ivatanako

tried wat u said.. but still no hope..

still getting te same blank page...
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 55
Reputation: wilch is an unknown quantity at this point 
Solved Threads: 9
wilch wilch is offline Offline
Junior Poster in Training

Re: Email Confirmation Prob

 
0
  #4
Sep 22nd, 2009
Usually all output disappears from your browser if you have an error in your code, and error_reporting is set to E_ALL & E_NOTICE in your php.ini file.
In this case, i think your error, is that you are using trying to access array items using associative indices, when your array only has number indices because you used mysql_fetch_array.

Therefore if you use mysql_fetch_array($result1), then access your array items as $rows[0], $rows[1], ...
If you use mysql_fetch_assoc($result1), then access your array items as $rows['country'], $rows['mobile'], ...

Try that !
Reply With Quote Quick reply to this message  
Join Date: Sep 2009
Posts: 30
Reputation: smvec is an unknown quantity at this point 
Solved Threads: 0
smvec's Avatar
smvec smvec is offline Offline
Light Poster

Re: Email Confirmation Prob

 
0
  #5
Sep 23rd, 2009
hey wilch..

i've tried that assoc fetch, but still get the same blank page..

i saw my php.ini file..

error_reporting
; Default Value: E_ALL & ~E_NOTICE
; Development Value: E_ALL | E_STRICT
; Production Value: E_ALL & ~E_DEPRECATED

this is wat i found in it...

does this mean anything related to my prob.. ? coz i dont know..
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 55
Reputation: wilch is an unknown quantity at this point 
Solved Threads: 9
wilch wilch is offline Offline
Junior Poster in Training

Re: Email Confirmation Prob

 
0
  #6
Sep 23rd, 2009
well, then that's not the problem for you, but ofr me - i once experienced it on that part.

Anyway, i think i see where the problem is. Line 26, there's an extra = sign.
Remove it !
Reply With Quote Quick reply to this message  
Join Date: Sep 2009
Posts: 30
Reputation: smvec is an unknown quantity at this point 
Solved Threads: 0
smvec's Avatar
smvec smvec is offline Offline
Light Poster

Re: Email Confirmation Prob

 
0
  #7
Sep 23rd, 2009
Dude...

thanks man... its working now...

but... need some tuning help...

You hav Been Activated.. please log in
Cud not insert into regd user


this is the output im getting...

but the database has been updated into regd user....
Reply With Quote Quick reply to this message  
Join Date: Sep 2009
Posts: 30
Reputation: smvec is an unknown quantity at this point 
Solved Threads: 0
smvec's Avatar
smvec smvec is offline Offline
Light Poster

Re: Email Confirmation Prob

 
0
  #8
Sep 23rd, 2009
hey Wilch...

thanks... the "=" sign was the prob i think...

i found, why the above posted error was coming...

i stupidly echo'd it...

thanks again.. i myself did not read my code fully,
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 55
Reputation: wilch is an unknown quantity at this point 
Solved Threads: 9
wilch wilch is offline Offline
Junior Poster in Training

Re: Email Confirmation Prob

 
0
  #9
Sep 23rd, 2009
Cool buddy !
Plus the gratitude is even better, if you Add To Their Reputation, the thread they helped you solve.

Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the PHP Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC