want to show a small popup window, when user login.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
ali_engr
Forum Newbie
Posts: 12
Joined: Thu Jun 21, 2007 8:08 am

want to show a small popup window, when user login.

Post 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,
MalikBB
Forum Newbie
Posts: 11
Joined: Fri Jul 20, 2007 4:34 am
Contact:

Post by MalikBB »

you write JS-code INTO php?? 8O
ali_engr
Forum Newbie
Posts: 12
Joined: Thu Jun 21, 2007 8:08 am

Yes

Post 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();
MalikBB
Forum Newbie
Posts: 11
Joined: Fri Jul 20, 2007 4:34 am
Contact:

Post by MalikBB »

can write this:

Code: Select all

print '<meta http-equiv="refresh" content="2; index.php" />'; //redirect with HTML
User avatar
Chalks
Forum Contributor
Posts: 447
Joined: Thu Jul 12, 2007 7:55 am
Location: Indiana

Post 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.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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.
Phoenixheart
Forum Contributor
Posts: 123
Joined: Tue Nov 16, 2004 7:46 am
Contact:

Post by Phoenixheart »

Yes. I would not rely on javascript, especially in such serious situations...
Post Reply