PHP help
- Started
- Last post
- 4 Responses
- skonge
I'm doing a simple login for a site using:
if($name == "name2" && $pass == "pass2"){
Header ("Location: page2.html");
exit;But I want to open a new browser window when the login is correct. At this point it opens in the same window that has the login fields. What can I use with or instead of Header to open a new browser window?
Thanks.
- mike0
based on the validated login, you could write some js to pop the window... then also verify the login on the receiving page (from a cookie or session).
- skonge0
So replace the Header with window.open
I was getting errors when i tried that.
- meph5040
just check for the session var in the popup (file.php)
if($_SESSION['login_check'])
{
//show page
}
else
{
//error message
}Hope that helps
- meph5040
[head]
[script language="JavaScript1.2"]
function opener()
{
window.open("filename.php","name...
}
[/script]
[/head][body]
[?
if($name == "name" && $pass =="pass")
{
$_SESSION['login_check'] = 1;
?]
[script] opener(); [/script]
[?
}
?]
[/body]