943,774 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Marked Solved
  • Views: 647
  • PHP RSS
Sep 17th, 2009
0

Email Confirmation Prob

Expand 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 :
PHP Syntax (Toggle Plain Text)
  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 :
PHP Syntax (Toggle Plain Text)
  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
Similar Threads
Reputation Points: 10
Solved Threads: 0
Light Poster
smvec is offline Offline
30 posts
since Sep 2009
Sep 17th, 2009
0

Re: Email Confirmation Prob

Click to Expand / Collapse  Quote originally posted by smvec ...
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 :
PHP Syntax (Toggle Plain Text)
  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 :
PHP Syntax (Toggle Plain Text)
  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

PHP Syntax (Toggle Plain Text)
  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.
Reputation Points: 18
Solved Threads: 15
Junior Poster
ivatanako is offline Offline
150 posts
since Jul 2007
Sep 22nd, 2009
0

Re: Email Confirmation Prob

hi ivatanako

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

still getting te same blank page...
Reputation Points: 10
Solved Threads: 0
Light Poster
smvec is offline Offline
30 posts
since Sep 2009
Sep 22nd, 2009
0

Re: Email Confirmation Prob

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 !
Reputation Points: 21
Solved Threads: 15
Junior Poster in Training
wilch is offline Offline
76 posts
since Aug 2007
Sep 23rd, 2009
0

Re: Email Confirmation Prob

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..
Reputation Points: 10
Solved Threads: 0
Light Poster
smvec is offline Offline
30 posts
since Sep 2009
Sep 23rd, 2009
0

Re: Email Confirmation Prob

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 !
Reputation Points: 21
Solved Threads: 15
Junior Poster in Training
wilch is offline Offline
76 posts
since Aug 2007
Sep 23rd, 2009
0

Re: Email Confirmation Prob

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....
Reputation Points: 10
Solved Threads: 0
Light Poster
smvec is offline Offline
30 posts
since Sep 2009
Sep 23rd, 2009
0

Re: Email Confirmation Prob

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,
Reputation Points: 10
Solved Threads: 0
Light Poster
smvec is offline Offline
30 posts
since Sep 2009
Sep 23rd, 2009
0

Re: Email Confirmation Prob

Cool buddy !
Plus the gratitude is even better, if you Add To Their Reputation, the thread they helped you solve.

Reputation Points: 21
Solved Threads: 15
Junior Poster in Training
wilch is offline Offline
76 posts
since Aug 2007

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: New great php templete engine (RainTPL)
Next Thread in PHP Forum Timeline: advice from thesis





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC