Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!doctype html>
- <html>
- <head>
- <meta charset="utf-8">
- <title>Registration</title>
- <link href="img/favicon/unihez.JPG" rel="shortcut icon"/>
- <link rel="stylesheet" href="login_style.css">
- </head>
- <body>
- <div class="loginBox">
- <img src="img/favicon/unihez.JPG" class="user">
- <h2>Register In Here</h2>
- <form role="form" method="post" action="register.php">
- <p>Username</p>
- <input type="text" name="name" placeholder="Enter your username" required="">
- <p>Email</p>
- <input type="email" name="email" placeholder="Enter your Email" />
- <p>Password</p>
- <input type="password" name="pass" placeholder="••••••" required="">
- <input type="submit" name="register" value="register">
- <a href="login.php">login Here</a>
- <br />
- <a href="index.html">Main-Page</a>
- </form>
- </div>
- </body>
- </html>
- <?php
- include ('db_connect.php');//CONNECTION
- if(isset($_POST["register"]))
- {
- $user_name = $_POST['name'];//Getting the post from the array after submitting form
- $user_pass = $_POST['pass'];
- $user_email = $_POST['email'];
- if($user_email=='')
- {
- echo"<script>alert('Please enter the email')</script>";
- exit();
- }
- //its check weather if user already registered so can't register again.
- $check_email_query="select * from users WHERE user_email='$user_email'";
- $run_query=mysqli_query($dbcon,$check_email_query);
- if(mysqli_num_rows($run_query)>0)
- {
- echo "<script>alert('Email $user_email is already exist in our database, Please try another one!')</script>";
- exit();
- }
- //insert the user into the database.
- $insert_user="insert into users (user_name,user_pass,user_email) VALUE ('$user_name','$user_pass','$user_email')";
- if(mysqli_query($dbcon,$insert_user))
- {
- echo"<script>window.open('login.php','_self')</script>";
- }
- }
- ?>
Add Comment
Please, Sign In to add comment