Advertisement
Guest User

Untitled

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