Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <center>
- <h1> <strong> Register Page </strong> </h1>
- <style>
- body{
- background-color: #FF0000;
- }
- </style>
- <?php
- if(ISSET($_POST['login'])){
- header('Location:login.php');
- if(ISSET($_POST['submitButton'])){
- $fname = $_POST['firstname'];
- $lname = $_POST['lastname'];
- $email = $_POST['email'];
- $username = $_POST['username'];
- $password = $_POST['password'];
- $hash = password_hash($password, PASSWORD_DEFAULT);
- require('conn.php');
- $query = "INSERT INTO `users` (`users_id`, `fname`, `lname`, `email`, `username`, `password`) VALUES (NULL, '$fname', '$lname', '$email', '$username', '$hash');";
- mysqli_query($conn,$query) or DIE('Bad query');
- echo "GG, you registered.";
- ?>
- <form method="POST" action="<?php echo $_SERVER['PHP_SELF']; ?>">
- <br><br>
- <br><br>
- <input type="submit" name = "login" value = "Login">
- <?php
- if(ISSET($_POST['login'])){
- header('Location:login.php');
- }
- } else{
- ?>
- <body>
- <strong>
- <form method="POST" action="<?php echo $_SERVER['PHP_SELF']; ?>">
- first name:
- <input type ="text" name="firstname" value="fname">
- <br><br>
- last name:
- <input type ="text" name="lastname" value="lname">
- <br><br>
- email:
- <input type ="text" name="email" value="E-mail">
- <br><br>
- username:
- <input type ="text" name="username" value="Username">
- <br><br>
- password:
- <input type ="text" name="password" value="Password">
- <br><br>
- <input type="submit" name = "submitButton" value = "Submit">
- <br><br>
- <?php
- echo "already logged in?"
- ?>
- <br><br>
- <input type="submit" name = "login" value = "Login">
- </form>
- <?php } ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement