Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <h1>Register</h1>
- <form method="POST">
- <input style="margin-bottom: 5px;" type="text" name="username" placeholder="Username" required><br />
- <input style="margin-bottom: 5px;" type="password" name="password" placeholder="Password" required><br />
- <input style="margin-bottom: 5px;" type="password" name="cpassword" placeholder="Confirm Password" required><br />
- <input style="margin-bottom: 10px;" type="email" name="email" placeholder="Email Address" required><br />
- <input style="width: 175px;" type="submit">
- </form>
- <?php
- session_start();
- if(isset($_POST['username'], $_POST['password'], $_POST['cpassword'], $_POST['email'])){
- require 'core/connect.php';
- error_reporting(0);
- $username = $_POST['username'];
- $password = $_POST['password'];
- $cpassword = $_POST['cpassword'];
- $email = $_POST['email'];
- $query = dbConnect()->prepare("INSERT INTO users (username, password, cpassword, email) VALUES (:username, :password, :cpassword, :email)");
- $query->bindParam(':username', $_POST['username']);
- $query->bindParam(':password', md5($_POST['password']));
- $query->bindParam(':cpassword', md5($_POST['cpassword']));
- $query->bindParam(':email', $_POST['email']);
- if(strlen($username)<6) {
- echo "Username must be at least 6 characters";
- } else {
- $query->execute();
- header("Location: index.php");
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement