Hello, I am running a script with JQuery's $.POST the code is PHP though.It's just a basic login script
that that loads from the main login page.The script itself runs fine till the end when I try to direct the user into the control panel with the header() function and for some reason it gives me 2 pages on top of eachother.
Here is the script called by Ajax.
<?php
error_reporting(E_ALL ^ E_NOTICE);
$usernm = $_REQUEST['usernm'];
$passrd = $_REQUEST['passrd'];
include "../php_scripts/connection.php";
mysql_select_db ("database2")or die(mysql_error());
$query = mysql_query ("SELECT * FROM users WHERE '$usernm' = username AND '$passrd' = password ");
$row = mysql_fetch_array($query);
$usernm1 = $row['username'];
$passrd1 = $row['password'];
echo $usernm1;
if (empty($usernm)&&empty($passrd))
{echo " You must enter a username and a password. ";exit();}
if ($usernm == "")
{ echo " Please type in a Username. ";exit();}
if ($passrd == "")
{echo " Please enter a password. ";exit();}
if ($passrd != $passrd1)
{echo " Password doesn't match this Username. ";exit();}
if (($usernm == $usernm1) && ($passrd == $passrd1))
{ echo " Welcome $usernm1. ";
header('Location:user_cp.php');
exit();
}