thing is, I just cleaned up the code, and now I ahve index.php include a common file with the login function
so when you try to login I have it goto login.php which is this code and is working...
<?
require("common.php");
// Login Check
// See if the user clicks on Login
if ($_POST["Submit"] == "Login") {
include('cfg.php');
$uname = $_POST["uname"];
$upass2 = md5($_POST["upass"]);
// Get Database Information
// Database Connection String ------Start------
$connect = mysql_connect("localhost", "root", "") or die ("<b><center>".mysql_errno().": ".mysql_error()."</b></center>\n");
$db = mysql_select_db("serials", $connect) or die ("<b><center>".mysql_errno().": ".mysql_error()."</b></center>\n");
$sql = "SELECT * FROM account WHERE Account_Username='$uname' and Account_Password='$upass2'";
$sql_result = mysql_query($sql, $connect) or die ("<b><center>".mysql_errno().": ".mysql_error()."</b></center>\n");
while ($account_row = mysql_fetch_array($sql_result)){
$admin = $account_row["Account_Rights"];
}
// Database Connection String ------End------
if (mysql_num_rows($sql_result) == 0) {
//Erorr Show Login Again!
echo "<p align='center' class='links'>You do not have access to these pages!<br>Please Try Again!</p>";
loginmenu($uname,$upass2);
} else {
//Set Cookies
$admin = md5($admin);
setcookie ("sb[0]", $uname, time()+7200);
setcookie ("sb[1]", $upass2, time()+7200);
setcookie ("sb[2]", $admin, time()+7200);
header("Location: index2.php"); /* Redirect browser */
}
//Close Database Connection
mysql_close($connect);
}
?>
then the header function sends the user to index2.php 🙂