Advertisement
Guest User

Untitled

a guest
Jan 8th, 2019
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.77 KB | None | 0 0
  1. // Table Scheme for Verify Table
  2. CREATE TABLE `verify` (
  3. `id` int(11) NOT NULL AUTO_INCREMENT,
  4. `email` text NOT NULL,
  5. `password` text NOT NULL,
  6. `code` text NOT NULL,
  7. PRIMARY KEY (`id`)
  8. ) ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=latin1
  9.  
  10. // Table Scheme for verified_user table
  11. CREATE TABLE `verified_user` (
  12. `id` int(11) NOT NULL AUTO_INCREMENT,
  13. `email` text NOT NULL,
  14. `password` text NOT NULL,
  15. PRIMARY KEY (`id`)
  16. ) ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=latin1
  17.  
  18.  
  19. if(isset($_POST['register']))
  20. {
  21. $email_id=$_POST['email'];
  22. $pass=$_POST['password'];
  23. $code=substr(md5(mt_rand()),0,15);
  24. mysql_connect('localhost','root','');
  25. mysql_select_db('sample');
  26.  
  27. $insert=mysql_query("insert into verify values('','$email','$pass','$code')");
  28. $db_id=mysql_insert_id();
  29.  
  30. $message = "Your Activation Code is ".$code."";
  31. $to=$email;
  32. $subject="Activation Code For Talkerscode.com";
  33. $from = 'your email';
  34. $body='Your Activation Code is '.$code.' Please Click On This link <a href="verification.php">Verify.php?id='.$db_id.'&code='.$code.'</a>to activate your account.';
  35. $headers = "From:".$from;
  36. mail($to,$subject,$body,$headers);
  37.  
  38. echo "An Activation Code Is Sent To You Check You Emails";
  39. }
  40.  
  41. if(isset($_GET['id']) && isset($_GET['code']))
  42. {
  43. $id=$_GET['id'];
  44. $code=$_GET['id'];
  45. mysql_connect('localhost','root','');
  46. mysql_select_db('sample');
  47. $select=mysql_query("select email,password from verify where id='$id' and code='$code'");
  48. if(mysql_num_rows($select)==1)
  49. {
  50. while($row=mysql_fetch_array($select))
  51. {
  52. $email=$row['email'];
  53. $password=$row['password'];
  54. }
  55. $insert_user=mysql_query("insert into verified_user values('','$email','$password')");
  56. $delete=mysql_query("delete from verify where id='$id' and code='$code'");
  57. }
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement