Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include 'resource/database.php';
- if(isset($_POST['email'])){
- $email = $_POST['email'];
- $username = $_POST['username'];
- $password = $_POST['password'];
- try{
- $sqlInsert = "INSERT INTO user(username, password, email,join_date) VALUES(:username,:password,:email,now())";
- $statement = $db->prepare($sqlInsert);
- $statement->execute(array(':username'=>$username, ':email'=>$email, ':password'=>$password));
- if($statement->rowCount() == 1){
- $result = "<p style = 'padding: 20px; color: green;'>Registration Successful</p>";
- }
- }catch(PDOException $ex){
- $result = "<p style = 'padding: 20px; color: red;'>Registration Not Successful ".$ex->getMessage()."</p>";
- }
- }
- ?>
- <!DOCTYPE html>
- <html>
- <head lang = "en">
- <meta charset = "UTF-8">
- <title>Register page</title>
- </head>
- <body>
- <h2>User Authentication System</h2><br>
- </body>
- <h3>Register Form</h3>
- <?php if(isset($result))
- echo $result;
- ?>
- <form method = "post" action = "">
- <table>
- <tr>
- <td>Email: </td>
- <td><input type = "text" value = "" name = "email"></td>
- </tr>
- <tr>
- <td>Username: </td>
- <td><input type = "text" value = "" name = "username"></td>
- </tr>
- <tr>
- <td>Password: </td>
- <td><input type = "password" value = "" name = "password"></td>
- </tr>
- <tr><td></td><td><input style = "float:right;" type = "submit" value = "Signup"></td></tr>
- </table>
- </form>
- <p><a href = "index.php">Back</a></p>
- </html>
Add Comment
Please, Sign In to add comment