Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if(isset($_POST['login'])){
- include('db.php');
- $user = $_POST['username'];
- $pass = $_POST['password'];
- $l_query = "select * from users where username='$user' AND password='$pass'";
- $r_query = mysqli_query($con, $l_query);
- $n_rows = mysqli_num_rows($r_query);
- if($n_rows == 1){
- while($lq=mysqli_fetch_array($r_query)){
- $type = $lq['position'];
- }
- if($type == "admin"){
- $_SESSION['account'] = $user;
- echo "<script>window.open('admin','_self')</script>";
- }
- else if($type == "cluster"){
- $_SESSION['account'] = $user;
- echo "<script>window.open('cluster','_self')</script>";
- }
- else if($type == "teacher"){
- $_SESSION['account'] = $user;
- echo "<script>window.open('teacher','_self')</script>";
- }
- else {
- echo "<script>alert('Position not found')</script>";
- echo "<script>window.open('login.php','_self')</script>";
- }
- }
- else {
- echo "<script>alert('Account not found')</script>";
- echo "<script>window.open('login.php','_self')</script>";
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement