dwforrest
04-20-2006, 08:20 AM
Hi all, I am creating a site that allows people to login in, their details verified and then passed through to another page if their details are correct. Everything I have done so far works and there are no problems apart from one little inconvinience.
The problem comes in the form of a login window with a size of:
window.open(url,'NewWin','width=345, height=280');
In this window they enter their details, and if correct sends them on to the next page, but the page that I call gets shown in this small window.
What do I do to stop this from happening? I want a new window to appear and the one that they were entering their details from to disappear. The code below is from the authenticating of the details and the sending through of the validation.
<?
//fetch accountType, username and password
$accountType = $_POST['accountType'];
$username = $_POST['username'];
$password = $_POST['password'];
//write the sql statement
$query = "SELECT username, password, accountType
FROM ACCOUNTS
WHERE accountType = 'Author/Researcher' AND username = '$username' AND password = '$password'";
//including the connection page
include('./connect_to_db.php');
//get an instance
$db = new Connection();
//connect to database
$db->connect();
//query the database
$result = mysql_query( $query );
//close once finished to free up resources
$db->close();
if( mysql_num_rows( $result ))
{
header("Location: our.html?username=$username");
exit();
}
else
{
//else redirect to login page
header("Location: loginauthorform.php?is_authenticated=no");
exit();
}
?>
The problem comes in the form of a login window with a size of:
window.open(url,'NewWin','width=345, height=280');
In this window they enter their details, and if correct sends them on to the next page, but the page that I call gets shown in this small window.
What do I do to stop this from happening? I want a new window to appear and the one that they were entering their details from to disappear. The code below is from the authenticating of the details and the sending through of the validation.
<?
//fetch accountType, username and password
$accountType = $_POST['accountType'];
$username = $_POST['username'];
$password = $_POST['password'];
//write the sql statement
$query = "SELECT username, password, accountType
FROM ACCOUNTS
WHERE accountType = 'Author/Researcher' AND username = '$username' AND password = '$password'";
//including the connection page
include('./connect_to_db.php');
//get an instance
$db = new Connection();
//connect to database
$db->connect();
//query the database
$result = mysql_query( $query );
//close once finished to free up resources
$db->close();
if( mysql_num_rows( $result ))
{
header("Location: our.html?username=$username");
exit();
}
else
{
//else redirect to login page
header("Location: loginauthorform.php?is_authenticated=no");
exit();
}
?>