ShiwaniGoel

register php

Jul 11th, 2016
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.38 KB | None | 0 0
  1. if (!empty($_POST['register-submit']))
  2. {
  3. //insert in table;sms on phn-otp;mail on id,pass confirm pass same
  4. echo "Thank you!<br>";
  5. $fname=$_POST["fname"];
  6. $lname=$_POST["lname"];
  7. $email=$_POST["email"];
  8. $user=$_POST["user"];
  9. $pass=$_POST["pass"];
  10. $cpass=$_POST["cpass"];
  11. $phn=$_POST["phn"];
  12. if($pass!=$cpass)
  13. {
  14. echo("Password nottt same.");
  15. }
  16.  
  17. }
  18. //sms OTP
  19.  
  20. //echo $name."<br>".$branch."<br>".$sex."<br>".$course."<br>".$contact."<br>".$emailid."<br>";
  21. $servername="localhost";
  22. $username="root";
  23.  
  24. //create connection
  25. $conn=new mysqli($servername,$username,"","projectdb");
  26. //check connection
  27. if($conn->connect_error)
  28. {
  29. die("failed".$conn->connect_error);
  30. }
  31. //create database
  32. $sql="INSERT INTO users VALUES('".$fname."','".$lname."','".$email."','".$user."','".$pass."','".$phn."')"; //)",'".$_POST["column"]."')";
  33. if($conn->query($sql)===TRUE)
  34. {
  35. echo "You are successfully registered.<br><br>!";
  36. }
  37. else
  38. {
  39. echo "Some failure occured.";
  40. }
  41. $conn->close();
  42. //*****SMS AS A SERVICE********* http://control.msg91.com/user/index.php#api
  43. //Your authentication key
  44. $authKey = "118972AixJH0o8L57828cea";
  45.  
  46. //Multiple mobiles numbers separated by comma
  47. $mobileNumber = $phn;
  48.  
  49. //Sender ID,While using route4 sender id should be 6 characters long.
  50. $senderId = "102234";
  51.  
  52. //Your message to send, Add URL encoding here.
  53. $message = urlencode("Hello".$fname.",<br>Thank You For Registering at VideoSharing site by AWS");
  54.  
  55. //Define route
  56. $route = "default";
  57. //Prepare you post parameters
  58. $postData = array(
  59. 'authkey' => $authKey,
  60. 'mobiles' => $mobileNumber,
  61. 'message' => $message,
  62. 'sender' => $senderId,
  63. 'route' => $route
  64. );
  65.  
  66. //API URL
  67. $url="https://control.msg91.com/api/sendhttp.php";
  68.  
  69. // init the resource
  70. $ch = curl_init();
  71. curl_setopt_array($ch, array(
  72. CURLOPT_URL => $url,
  73. CURLOPT_RETURNTRANSFER => true,
  74. CURLOPT_POST => true,
  75. CURLOPT_POSTFIELDS => $postData
  76. //,CURLOPT_FOLLOWLOCATION => true
  77. ));
  78.  
  79.  
  80. //Ignore SSL certificate verification
  81. curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
  82. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
  83.  
  84.  
  85. //get response
  86. $output = curl_exec($ch);
  87.  
  88. //Print error if any
  89. if(curl_errno($ch))
  90. {
  91. echo 'error:' . curl_error($ch);
  92. }
  93.  
  94. curl_close($ch);
  95.  
  96. echo $output;
  97.  
  98. }
Add Comment
Please, Sign In to add comment