Email Address Verification ??

Thread Solved

Join Date: Dec 2008
Posts: 38
Reputation: wwwmadeasy is an unknown quantity at this point 
Solved Threads: 0
wwwmadeasy wwwmadeasy is offline Offline
Light Poster

Email Address Verification ??

 
0
  #1
Dec 28th, 2008
hi there i want help doing the following..

user come to the web site there will be a form for registration when he submit the information it will store in the database but only admin can verify his account ...

can any one plz help me in that...

thanks in advance...
Last edited by wwwmadeasy; Dec 28th, 2008 at 1:14 pm.
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 596
Reputation: buddylee17 has a spectacular aura about buddylee17 has a spectacular aura about 
Solved Threads: 125
buddylee17's Avatar
buddylee17 buddylee17 is offline Offline
Posting Pro

Re: Email Address Verification ??

 
0
  #2
Dec 28th, 2008
Set a field called verified in the database with a default value of 0 or False. Then after admin verifies, have him/her set the value to 1 or True.
Lost time is never found again.
- Benjamin Franklin
Reply With Quote Quick reply to this message  
Join Date: Dec 2008
Posts: 38
Reputation: wwwmadeasy is an unknown quantity at this point 
Solved Threads: 0
wwwmadeasy wwwmadeasy is offline Offline
Light Poster

Re: Email Address Verification ??

 
0
  #3
Dec 28th, 2008
can u plz provide me som sort of codes plz... thanks in advance
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 596
Reputation: buddylee17 has a spectacular aura about buddylee17 has a spectacular aura about 
Solved Threads: 125
buddylee17's Avatar
buddylee17 buddylee17 is offline Offline
Posting Pro

Re: Email Address Verification ??

 
0
  #4
Dec 28th, 2008
No, you'll have to show some kind of effort first. The site is called daniweb. Not free code for the lazy.
Last edited by buddylee17; Dec 28th, 2008 at 9:40 pm.
Lost time is never found again.
- Benjamin Franklin
Reply With Quote Quick reply to this message  
Join Date: Dec 2008
Posts: 38
Reputation: wwwmadeasy is an unknown quantity at this point 
Solved Threads: 0
wwwmadeasy wwwmadeasy is offline Offline
Light Poster

Re: Email Address Verification ??

 
0
  #5
Dec 29th, 2008
Originally Posted by buddylee17 View Post
No, you'll have to show some kind of effort first. The site is called daniweb. Not free code for the lazy.
if u cant reply me in good manner can say just no...
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 6
Reputation: sanishan is an unknown quantity at this point 
Solved Threads: 2
sanishan sanishan is offline Offline
Newbie Poster

Re: Email Address Verification ??

 
0
  #6
Jan 7th, 2009
Create a database and Run this query

  1. Table "temp_members_db"
  2. CREATE TABLE `temp_members_db` (
  3. `confirm_code` varchar(65) NOT NULL default '',
  4. `name` varchar(65) NOT NULL default '',
  5. `email` varchar(65) NOT NULL default '',
  6. `password` varchar(15) NOT NULL default '',
  7. `country` varchar(65) NOT NULL default ''
  8. ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
  9.  
  10.  
  11. Table "registered_members"
  12. CREATE TABLE `registered_members` (
  13. `id` int(4) NOT NULL auto_increment,
  14. `name` varchar(65) NOT NULL default '',
  15. `email` varchar(65) NOT NULL default '',
  16. `password` varchar(65) NOT NULL default '',
  17. `country` varchar(65) NOT NULL default '',
  18. PRIMARY KEY (`id`)
  19. ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

Create a file signup.php - Create sign up form

Sample Code
  1. ############### Code
  2.  
  3. <table width="350" border="0" align="center" cellpadding="0" cellspacing="0">
  4. <tr>
  5. <td><form name="form1" method="post" action="signup_ac.php">
  6. <table width="100%" border="0" cellspacing="4" cellpadding="0">
  7. <tr>
  8. <td colspan="3"><strong>Sign up</strong></td>
  9. </tr>
  10. <tr>
  11. <td width="76">Name</td>
  12. <td width="3">:</td>
  13. <td width="305"><input name="name" type="text" id="name" size="30"></td>
  14. </tr>
  15. <tr>
  16. <td>E-mail</td>
  17. <td>:</td>
  18. <td><input name="email" type="text" id="email" size="30"></td>
  19. </tr>
  20. <tr>
  21. <td>password</td>
  22. <td>:</td>
  23. <td><input name="password" type="password" id="password" size="30"></td>
  24. </tr>
  25. <tr>
  26. <td>Country</td>
  27. <td>:</td>
  28. <td><input name="country" type="text" id="country" size="30"></td>
  29. </tr>
  30. <tr>
  31. <td>&nbsp;</td>
  32. <td>&nbsp;</td>
  33. <td><input type="submit" name="Submit" value="Submit"> &nbsp;
  34. <input type="reset" name="Reset" value="Reset"></td>
  35. </tr>
  36. </table>
  37. </form><br> Powered By: www.thebolly.com</td>
  38. </tr>
  39. </table>

signup_ac.php - Insert data into database
In this step
1. Random confirmation code
2. Insert data and confirmation code into database
3. Send email to user with confirmation link


############### Code
  1. <?
  2. include('config.php');
  3.  
  4. // table name
  5. $tbl_name=temp_members_db;
  6.  
  7. // Random confirmation code
  8. $confirm_code=md5(uniqid(rand()));
  9.  
  10. // values sent from form
  11. $name=$_POST['name'];
  12. $email=$_POST['email'];
  13. $country=$_POST['country'];
  14.  
  15. // Insert data into database
  16. $sql="INSERT INTO $tbl_name(confirm_code, name, email, password, country)VALUES('$confirm_code', '$name', '$email', '$password', '$country')";
  17. $result=mysql_query($sql);
  18.  
  19. // if suceesfully inserted data into database, send confirmation link to email
  20. if($result){
  21.  
  22. // ---------------- SEND MAIL FORM ----------------
  23.  
  24. // send e-mail to ...
  25. $to=$email;
  26.  
  27. // Your subject
  28. $subject="Your confirmation link here";
  29.  
  30. // From
  31. $header="from: your name <your email>";
  32.  
  33. // Your message
  34. $message="Your Comfirmation link \r\n";
  35. $message.="Click on this link to activate your account \r\n";
  36. $message.="Powered By: www.thebolly.com \r\n";
  37. $message.="http://www.yourweb.com/confirmation.php?passkey=$confirm_code";
  38.  
  39. // send email
  40. $sentmail = mail($to,$subject,$message,$header);
  41.  
  42. }
  43.  
  44. // if not found
  45. else {
  46. echo "Not found your email in our database";
  47. }
  48.  
  49. // if your email succesfully sent
  50. if($sentmail){
  51. echo "Your Confirmation link Has Been Sent To Your Email Address.";
  52. }
  53. else {
  54. echo "Cannot send Confirmation link to your e-mail address";
  55. }
  56.  
  57. ?>

confirmation.php
When jack open his email he'll see this message and link to file "confirmation.php" including passkey in url.

In this step
1. Check passkey
2. If found passkey in database, move all data in that row from table "temp_members_db" to table "registered_members"
3. Delete passkey from table "temp_members_db"


############### Code
  1. <?
  2. include('config.php');
  3.  
  4. // Passkey that got from link
  5. $passkey=$_GET['passkey'];
  6.  
  7. $tbl_name1="temp_members_db";
  8.  
  9. // Retrieve data from table where row that match this passkey
  10. $sql1="SELECT * FROM $tbl_name1 WHERE confirm_code ='$passkey'";
  11. $result1=mysql_query($sql1);
  12.  
  13. // If successfully queried
  14. if($result1){
  15.  
  16. // Count how many row has this passkey
  17. $count=mysql_num_rows($result1);
  18.  
  19. // if found this passkey in our database, retrieve data from table "temp_members_db"
  20. if($count==1){
  21.  
  22. $rows=mysql_fetch_array($result1);
  23. $name=$rows['name'];
  24. $email=$rows['email'];
  25. $password=$rows['password'];
  26. $country=$rows['country'];
  27.  
  28. $tbl_name2="registered_members";
  29.  
  30. // Insert data that retrieves from "temp_members_db" into table "registered_members"
  31. $sql2="INSERT INTO $tbl_name2(name, email, password, country)VALUES('$name', '$email', '$password', '$country')";
  32. $result2=mysql_query($sql2);
  33. }
  34.  
  35. // if not found passkey, display message "Wrong Confirmation code"
  36. else {
  37. echo "Wrong Confirmation code";
  38. }
  39.  
  40. // if successfully moved data from table"temp_members_db" to table "registered_members" displays message "Your account has been activated" and don't forget to delete confirmation code from table "temp_members_db"
  41. if($result2){
  42.  
  43. echo "Your account has been activated";
  44.  
  45. // Delete information of this user from table "temp_members_db" that has this passkey
  46. $sql3="DELETE FROM $tbl_name1 WHERE confirm_code = '$passkey'";
  47. $result3=mysql_query($sql3);
  48.  
  49. }
  50.  
  51. }
  52. ?>

config.php - config your database
  1. <?
  2.  
  3. $host="localhost"; // Host name
  4. $username=""; // Mysql username
  5. $password=""; // Mysql password
  6. $db_name=""; // Database name
  7.  
  8.  
  9. //Connect to server and select database.
  10. mysql_connect("$host", "$username", "$password")or die("cannot connect to server");
  11. mysql_select_db("$db_name")or die("cannot select DB");
  12.  
  13. ?>
Reply With Quote Quick reply to this message  
Join Date: Dec 2008
Posts: 38
Reputation: wwwmadeasy is an unknown quantity at this point 
Solved Threads: 0
wwwmadeasy wwwmadeasy is offline Offline
Light Poster

Re: Email Address Verification ??

 
0
  #7
Jan 7th, 2009
sanishan thanks for your help. i relay appreciate it..
Reply With Quote Quick reply to this message  
Reply

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


Thread Tools Search this Thread



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

©2003 - 2009 DaniWeb® LLC