Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- require_once("connect.php");
- $result = @mysql_query("SELECT username,password, FROM users");
- $username = $_POST["username"];
- $password = md5($_POST["password"]);
- $_SESSION['loggedin'] = false;
- while ($row = mysql_fetch_array($result) ) {
- if ( ($row["password"] == $password) && (strtoupper($row["username"]) == strtoupper($username))) {
- $_SESSION['loggedin'] = true;
- $_SESSION['username'] = $username;
- echo $result2;
- if($row["class"] == 'admin') {
- echo "you are an admin";
- $_SESSION['class'] = 'admin';
- header("location:admin.php");
- }
- else if ($row["class"] == 'user') {
- echo "you are a user";
- $_SESSION['class'] = 'user';
- header("location:index.php");
- }
- }
- }
- if ($_SESSION['loggedin'] == false) {
- include("index.php");
- echo "<h1 style='color:red;'><center>Login Failed!</center></h1>";
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement