Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- $name = "";
- $password = "";
- $type = "";
- $active = "";
- $username="";
- $pwd="";
- $con = mysqli_connect("192.168.100.75:3307","dac18","welcome","dac18") or die("not connected properly");
- if(isset($_REQUEST["submit"]))
- {
- $username=$_REQUEST["username"];
- $pwd=$_REQUEST["password"];
- $query="select ID,name,password,type,activated from user where name='$username' and password='$pwd'";
- $run=mysqli_query($con,$query);
- if(mysqli_num_rows($run)>0)
- {
- while($row=mysqli_fetch_array($run))
- {
- $id =$row["ID"];
- $name=$row["name"];
- $password=$row["password"];
- $type=$row["type"];
- $active=$row["activated"];
- }
- }
- if($active==1)
- {
- switch ($type)
- {
- case 1:
- $_SESSION["login"]=$id;
- $_SESSION["userName"]=$name;
- header('location:../Administrator/home.php');
- break;
- case 4:
- $_SESSION["login"]=$id;
- $_SESSION["userName"]=$name;
- header('location:../Faculty/home.php');
- break;
- case 8:
- $_SESSION["login"]=$id;
- $_SESSION["userName"]=$name;
- header('location:../Student/home.php');
- break;
- case 16:
- $_SESSION["login"]=$id;
- $_SESSION["userName"]=$name;
- header('location:../Sales/home.php');
- break;
- }
- }
- else
- {
- header('location:index.php');
- }
- }
Add Comment
Please, Sign In to add comment