Advertisement
Guest User

Untitled

a guest
Jul 20th, 2016
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.94 KB | None | 0 0
  1. <?php
  2.  
  3.  
  4. if (isset($_POST['register'])){
  5.  
  6. // connection handler link
  7. $conreg = new mysqli('localhost', 'x', '123456', 'db.x.x');
  8.  
  9. // in case theres no link to connection
  10. if (mysqli_connect_error()){
  11. echo mysqli_connect_error();
  12. exit();
  13. } // end error if
  14.  
  15. else // when connection is okay
  16. {
  17. echo "we good on connection so far";
  18. echo "<br>";
  19.  
  20. } // end else connection okay
  21.  
  22.  
  23.  
  24.  
  25. $userreg = $_POST['username'];
  26.  
  27.  
  28. $passreg =$_POST['password'];
  29. $phash = sha1(sha1($passreg."salt")."salt");
  30.  
  31.  
  32. $emailreg = $_POST['email'];
  33.  
  34.  
  35. $sqlreg = "INSERT INTO tbl1 (`username` , `password`, `email` , `comment_value`, `Member_Since`) VALUES (?,?,?,'1' , now() ) ";
  36.  
  37. // prepare link, and function statement
  38. $stmtreg = $conreg->prepare($sqlreg);
  39.  
  40.  
  41.  
  42. // bind variable parameters
  43. mysqli_stmt_bind_param($stmtreg, "sss", $userreg , $phash , $emailreg ); // bind variables s' is a string for username , s' is a string for password
  44.  
  45. if ( !mysqli_execute($stmtreg) )
  46. {
  47.  
  48. echo "Died on bind variable parameters";
  49. die( 'stmt error: '.mysqli_stmt_error($stmtreg) );
  50.  
  51. } // end error if
  52.  
  53.  
  54. mysqli_stmt_execute($stmtreg); //excute the preapared register statement
  55.  
  56.  
  57.  
  58. //$cookie_value = $user;
  59. //setcookie($cookie_name , $cookie_value, time() + (2000), "/");
  60.  
  61.  
  62. //header("Location: reg_.php");
  63. echo '<font color="green">Please Login Now</font>';
  64.  
  65.  
  66.  
  67. } // end isset register
  68.  
  69. ?>
  70.  
  71. <table>
  72. <form action ="actions/action_registration.php" method="POST" >
  73. <tr>
  74. <td> Username :</td>
  75. <td><input type="text" placeholder="Username" id="username" name="username"> </td>
  76. </tr>
  77.  
  78. <tr>
  79. <td>Password :</td>
  80. <td><input type="password" placeholder="Password" id="password" name="password" > </td>
  81. </tr>
  82.  
  83. <tr>
  84. <td> Email :</td>
  85. <td><input type="text" placeholder="Email"id="email" name="email" size="20"/></td>
  86. <br/>
  87. </tr>
  88. <tr>
  89. <td><td>
  90. <input type="submit" name="register" value="Register"></td> </tr>
  91. </table>
  92. </form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement