Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <form class="user" action="code.php" method="POST">
- <div class="form-group">
- <input type="email" class="form-control form-control-user" name="email" placeholder="Enter Email Address...">
- </div>
- <div class="form-group">
- <input type="password" class="form-control form-control-user" name="password" placeholder="Password">
- </div>
- <button type="submit" name="login_btn" class="btn btn-primary btn-user btn-block">
- Login
- </button>
- <hr>
- </form>
- if(isset($_POST['login_btn'])) {
- $password_login = $_POST['password'];
- $email_login = $_POST['email'];
- $query="select * from register where email='$email_login' and password='$password_login'";
- $query_run=mysqli_query($cnx,$query);
- $usertypes=mysqli_fetch_array($query_run);
- if( $usertypes['usertype'] == "admin")
- {
- $_SESSION['username']=$email_login;
- header('Location: index.php');
- }
- else if($usertypes['usertype'] == "user")
- {
- $_SESSION['username']=$email_login;
- header('Location: ../index.php');
- }
- else{
- $_SESSION['status']='Login or password is wrong ! Try again ';
- header('Location: login.php');
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement