Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if (isset($_POST['register'])){
- // connection handler link
- $conreg = new mysqli('localhost', 'x', '123456', 'db.x.x');
- // in case theres no link to connection
- if (mysqli_connect_error()){
- echo mysqli_connect_error();
- exit();
- } // end error if
- else // when connection is okay
- {
- echo "we good on connection so far";
- echo "<br>";
- } // end else connection okay
- $userreg = $_POST['username'];
- $passreg =$_POST['password'];
- $phash = sha1(sha1($passreg."salt")."salt");
- $emailreg = $_POST['email'];
- $sqlreg = "INSERT INTO tbl1 (`username` , `password`, `email` , `comment_value`, `Member_Since`) VALUES (?,?,?,'1' , now() ) ";
- // prepare link, and function statement
- $stmtreg = $conreg->prepare($sqlreg);
- // bind variable parameters
- mysqli_stmt_bind_param($stmtreg, "sss", $userreg , $phash , $emailreg ); // bind variables s' is a string for username , s' is a string for password
- if ( !mysqli_execute($stmtreg) )
- {
- echo "Died on bind variable parameters";
- die( 'stmt error: '.mysqli_stmt_error($stmtreg) );
- } // end error if
- mysqli_stmt_execute($stmtreg); //excute the preapared register statement
- //$cookie_value = $user;
- //setcookie($cookie_name , $cookie_value, time() + (2000), "/");
- //header("Location: reg_.php");
- echo '<font color="green">Please Login Now</font>';
- } // end isset register
- ?>
- <table>
- <form action ="actions/action_registration.php" method="POST" >
- <tr>
- <td> Username :</td>
- <td><input type="text" placeholder="Username" id="username" name="username"> </td>
- </tr>
- <tr>
- <td>Password :</td>
- <td><input type="password" placeholder="Password" id="password" name="password" > </td>
- </tr>
- <tr>
- <td> Email :</td>
- <td><input type="text" placeholder="Email"id="email" name="email" size="20"/></td>
- <br/>
- </tr>
- <tr>
- <td><td>
- <input type="submit" name="register" value="Register"></td> </tr>
- </table>
- </form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement