Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Warning: Cannot modify header information - headers already sent by ERROR [closed]
- <?php
- $username = $password = $token = $fName = "";
- include_once 'header.php';
- if (isset($_POST['username'])&& isset($_POST['password']))
- $username = sanitizeString($_POST['username']);
- $password = sanitizeString($_POST['password']); //set temporary username and password variables
- $token = md5("$password");//encrypt temp password
- if ($username != 'admin')
- {
- header("Location:summary.php");
- }
- elseif($username == 'admin')
- {
- header("Location:admin.php");
- }
- elseif($username == '')
- {
- header("Location:index.php");
- }
- else die ("<body><div class='container'><p class='error'>Invalid username or password.</p></div></body>");
- if ($username == "" || $token == "")
- {
- echo "<body><div class='container'><p class='error'>Please enter your username and password</p></div></body>";
- }
- else
- {
- $query="SELECT * FROM members WHERE username='$username'AND password = '$token'";//look in table for username entered
- $result=mysql_query($query);
- if (!$result) die ("Database access failed: " . mysql_error());
- elseif (mysql_num_rows($result)> 0)
- {
- $row= mysql_fetch_row($result);
- $_SESSION['username'] = $username;//set session variables
- $_SESSION['password'] = $token;
- $fName = $row[0];
- }
- }
- ?>
- ob_start();
- output_buffering = On
Add Comment
Please, Sign In to add comment