PHP URL Forwarding
Hi, I have a PHP script, here...
Quote: <?
session_start();
if(!session_is_registered(username)){
header("location:SOMEPAGE");
}
?>
and I wanted to convert the...
Quote: header("location:SOMEPAGE");
To do this...
Quote: <script language="javascript">
function UpdateClose()
{
opener.window.location = "SOMEPAGE";
self.close();
}
</script>
Can someone please tell me if this is possible, and if so, how it can be done?
Thanks in advance.
All the best news here: https://newsbotnet.com
pr0gr4mm3r posted this at 14:23 — 30th November 2007.
He has: 1,502 posts
Joined: Sep 2006
What exactly are you trying to accomplish?
DarkLight posted this at 15:17 — 30th November 2007.
He has: 287 posts
Joined: Oct 2007
A downloader file.
It boots up in a popup window, and if they are loggin in, it converts the popup window into a "save file" window.
if they are not, it closes the window, and directs the main page into the login area.
with me?
All the best news here: https://newsbotnet.com
pr0gr4mm3r posted this at 15:37 — 30th November 2007.
He has: 1,502 posts
Joined: Sep 2006
Is the "save file" window one of your pages, or are you referring to the browser's safe file dialog?
DarkLight posted this at 15:41 — 30th November 2007.
He has: 287 posts
Joined: Oct 2007
The browser default.
pr0gr4mm3r posted this at 15:45 — 30th November 2007.
He has: 1,502 posts
Joined: Sep 2006
I'm thinking you don't need a popup window at all then. Just use a PHP conditional. Redirect them to the file if they are active, or redirect them to the login page if they are not.
<?php
session_start();
if(!session_is_registered(username)){
header(\"Location: LOGIN\");
}
else
{
header(\"Location: FILE\");
}
?>
DarkLight posted this at 15:49 — 30th November 2007.
He has: 287 posts
Joined: Oct 2007
ahh, of course.
I was doing it wrong, the success status would leave the page as it is, and just open the file saver over the parent page.
the failed status would redirect the parent to login. this is great.
Cheers, i do make life complicated for myself. thanks a lot m8.
All the best news here: https://newsbotnet.com
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.