By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,965 Members | 1,687 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,965 IT Pros & Developers. It's quick & easy.

loggout.php fails to properly redirect

P: n/a
loggout.php doesn't exactly redirect properly, and I have no idea what to do
about it... I need to bust out of the frame and go to top, so, how do I do
it?

Code that I have that fails:

<?
require_once('/home/nordicnet.no/include/nordicnet_global_vars_functions.php
');

setcookie('nordicnet_registration', 0, time() - 86400, '/'); // DELETE
COOKIE

?>

<html>
<head>
<meta http-equiv=Refresh content="0;URL=http://<?= $serverName
?>/index.php">
<script>
<!--
location.target = top;
location.href = 'http://<?= $serverName ?>/index.php';
//-->
</script>
</head>
<body>
<?= $font ?>Om du er her <a href=http://<?= $serverName ?>/index.php>klikk
her</a></font>
</body>
</html>

Phil
Jul 16 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a

"Phil Powell" <so*****@erols.com> schreef in bericht
news:U5s6b.126943$xf.100813@lakeread04...
loggout.php doesn't exactly redirect properly, and I have no idea what to do about it... I need to bust out of the frame and go to top, so, how do I do
it?

Code that I have that fails:


The following should work without the javascript:

<?
require_once('/path/to/nordicnet_global_vars_functions.php');
setcookie('nordicnet_registration', 0, time() - 86400, '/');
header("Location: http://$serverName/index.php");
?>
JW

Jul 16 '05 #2

P: n/a
[not croosposted to alt.php, comp.lang.javascript]

Phil Powell wrote:
loggout.php doesn't exactly redirect properly, and I have no idea what to do
about it... I need to bust out of the frame and go to top, so, how do I do
it?

Code that I have that fails:

<?
require_once('/home/nordicnet.no/include/nordicnet_global_vars_functions.php
');

setcookie('nordicnet_registration', 0, time() - 86400, '/'); // DELETE
COOKIE

?>

<html>
<head>
<meta http-equiv=Refresh content="0;URL=http://<?= $serverName
?>/index.php">
<script>
<!--
location.target = top;
location.href = 'http://<?= $serverName ?>/index.php';
//-->
</script>
</head>
<body>
<?= $font ?>Om du er her <a href=http://<?= $serverName ?>/index.php>klikk
her</a></font>
</body>
</html>

Phil


I'd do it differently

1. the logout link:
<a href="..../logout.php" target="_top">logout</a>

2. logout.php
<?php
### clear cookies
### update database
### whatever else you need
header('Location: /index.php'); ### should also have server
exit('Redirected to the <a href="/index.php">home page</a>.');
?>

--
"Yes, I'm positive."
"Are you sure?"
"Help, somebody has stolen one of my electrons!"
Two atoms are talking:
Jul 16 '05 #3

P: n/a
It does work, except that index.php opens up within the frame of
Palogget%20S1.php and not on _top, which is what I need for it to do.

Phil

"Janwillem Borleffs" <jw*@jwbfoto.demon.nl> wrote in message
news:3f***********************@news.euronet.nl...

"Phil Powell" <so*****@erols.com> schreef in bericht
news:U5s6b.126943$xf.100813@lakeread04...
loggout.php doesn't exactly redirect properly, and I have no idea what to
do
about it... I need to bust out of the frame and go to top, so, how do I

do it?

Code that I have that fails:


The following should work without the javascript:

<?
require_once('/path/to/nordicnet_global_vars_functions.php');
setcookie('nordicnet_registration', 0, time() - 86400, '/');
header("Location: http://$serverName/index.php");
?>
JW

Jul 16 '05 #4

P: n/a

"Phil Powell" <so*****@erols.com> schreef in bericht
news:JIs6b.126962$xf.41022@lakeread04...
It does work, except that index.php opens up within the frame of
Palogget%20S1.php and not on _top, which is what I need for it to do.


Don't you just hate frames? This calls for the dirty approach:

<?
require_once('/path/to/nordicnet_global_vars_functions.php');
setcookie('nordicnet_registration', 0, time() - 86400, '/');
?>
<html>
<head>
<script>top.location='http://<?=$serverName?>/index.php';</script>
</head>
<body>
<noscript>
Please click <a href="http://<?=$serverName?>/index.php"
target="_top">here</a>
To continue
</noscript>
</body>
</html>
JW

Jul 16 '05 #5

P: n/a
OUCH! I forgot all about that!!!

window.parent.location.href = ....

That does the trick! Thanx
Phil

"Janwillem Borleffs" <jw*@jwbfoto.demon.nl> wrote in message
news:3f***********************@news.euronet.nl...

"Phil Powell" <so*****@erols.com> schreef in bericht
news:JIs6b.126962$xf.41022@lakeread04...
It does work, except that index.php opens up within the frame of
Palogget%20S1.php and not on _top, which is what I need for it to do.


Don't you just hate frames? This calls for the dirty approach:

<?
require_once('/path/to/nordicnet_global_vars_functions.php');
setcookie('nordicnet_registration', 0, time() - 86400, '/');
?>
<html>
<head>
<script>top.location='http://<?=$serverName?>/index.php';</script>
</head>
<body>
<noscript>
Please click <a href="http://<?=$serverName?>/index.php"
target="_top">here</a>
To continue
</noscript>
</body>
</html>
JW

Jul 16 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.