Page 1 of 1
want to show a small popup window, when user login.
Posted: Fri Jul 20, 2007 5:32 am
by ali_engr
I want to show pop-up window when user login.
i write JavaScript pop-up window code in login functions, which open a new pop-up. but my php code execution stop there and not proceed to show my home page.
any idea?
thanks,
Posted: Fri Jul 20, 2007 5:44 am
by MalikBB
you write JS-code INTO php??

Yes
Posted: Fri Jul 20, 2007 5:53 am
by ali_engr
in login checking & validation file, after checking & session is stored i write follwoing code before page redirect
print '<SCRIPT LANGUAGE="javascript">';
print 'window.open("test.html","Window1", "menubar=no,width=430,height=360,toolbar=no");' ;
print '</SCRIPT>';
header('location: index.php');
exit();
Posted: Fri Jul 20, 2007 5:57 am
by MalikBB
can write this:
Code: Select all
print '<meta http-equiv="refresh" content="2; index.php" />'; //redirect with HTML
Posted: Fri Jul 20, 2007 8:02 am
by Chalks
wouldn't it make more sense to have a "mypage.php" that you can only access after going through login.php (which is what you probably have), then...
on mypage.php, do this:
Code: Select all
<?php
//make sure session exists, if it does:
?>
<html><body><head>
<SCRIPT type="text/javascript">
function loaded()
{
window.open("test.html","Window1", "menubar=no,width=430,height=360,toolbar=no");
}
</SCRIPT>
</head>
<body onLoad="loaded()">
</body>
</html>
<?php
//if it doesn't, kick em in the pants.
?>
That way you don't have unnecessary code in your login.php file, and it's easy to change in the future if you want to.
Posted: Fri Jul 20, 2007 5:42 pm
by feyd
And if Javascript is disabled or pop-ups are filtered... nothing will show. This might need a rethink. It certainly doesn't mean much to PHP though.
Posted: Sun Jul 22, 2007 10:41 pm
by Phoenixheart
Yes. I would not rely on javascript, especially in such serious situations...