Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <center>
- <?php
- include ("database.php");
- ?>
- <?php
- session_start();
- $username = $_POST['username'];
- $password = $_POST['password'];
- $query = "select role from users where
- username = '$username' and
- password = '$password'";
- $result = mysql_query ($query);
- if(!$result)
- {
- echo 'Cannot run query.';
- exit;
- }
- $row = mysql_fetch_assoc ($result);
- if ($username = '')
- {
- echo 'You are not authorized to view this page.';
- }
- else
- {
- $_SESSION['username']=$username;
- $role=$row['role'];
- if ( $role == 1 )
- {
- header('Location: admin_center.php');
- }
- elseif ( $role == 2 )
- {
- header('Location: teacher_center.php');
- }
- else
- {
- header('Location: stundent_center.php');
- }
- }
- ?>
- </center>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement