Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include ("includes/dbh.php");
- $error = "";
- if(isset($_POST['submit'])) {
- $name = $_POST ['name'];
- $username = $_POST['username'];
- $email = $_POST['email'];
- $password = $_POST['password'];
- $confirmpassword = $_POST['confirmpassword'];
- }
- if(strlen($name) < 3) {
- $error = "Name is too short";
- } elseif(!preg_match("/^''[a-zA-Z]*$/", $username)) {
- $error = "Space Not Allowed";
- } elseif (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
- $error = "Please Insert a valid email address";
- } elseif (strlen($password) < 😎 {
- $error = "Password Must Be 8 character";
- } elseif($password !== $confirmpassword) {
- $error = 'Password Is Incorrect';
- } else{
- $password = md5($password);
- $insertQuery = "INSERT INTO users(name, username, email, password) VALUES('$name', '$username', '$email', '$password')";
- if(mysqli_query($con, $insertQuery)) {
- $error = "You Are successfully Registered.To Login Your Account Please <a style='text-decoration: none; color: green; ' href = 'login.php'> Click Here</a>";
- }
- }
- ?>
- <!DOCTYPE html>
- <head>
- <title>Untitled</title>
- <meta charset="UTF-8"/>
- <meta name = "viewport" content = "width=device-width" />
- <title>Signup Page || TechPress CMS</title>
- <link rel="stylesheet" href="css/signup-style.css" type="text/css"/>
- </head>
- <body>
- <div class="container">
- <div class="wrapper">
- Please Signup To acces The System...
- </div>
- <div class="error">
- <?php echo $error; ?> !
- </div>
- <form method= "POST" action="index.php">
- <lebel>Name:</lebel><br>
- <input type="text" name="name" class="input" placeholder= "Please enter your desired Name" required><br>
- <lebel>Username:</lebel><br>
- <input type="text" name="username" class="input" placeholder= "Please enter a valid Username" required><br>
- <lebel>Email:</lebel><br>
- <input type="text" name="email" class="input" placeholder= "Please enter a valid Email Address" required><br>
- <lebel>Password:</lebel><br>
- <input type="password" name="password" class="input" placeholder= "Enter Your Password" required><br>
- <lebel>Confirm Password</lebel><br>
- <input type="password" name="confirmpassword" class="input" placeholder= "Please enter the password again." required><br>
- <div class="signup">
- Are You Aleready A Member?.So, Please <a href="login.php">Login</a> Here.
- <div class="bottom">
- <input type="checkbox" name= "keep" class="checkbox">
- <lebel class="check">Agree With Us</lebel>
- <input class="submit" type="submit" name= "submit" value="Sign Up">
- </div>
- </div>
- </form>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement