Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Redirect Syntax Help

Status
Not open for further replies.

DonP

IS-IT--Management
Jul 20, 2000
684
US
This is working fine as it is but how can a frame target be specified? I am new to PHP:

[tt]<?
function process_form() {
global $referer;
}
if ($referer >= ' {
$new_url = 'header(&quot;Location: $new_url&quot;);
} else {
?>

rest of the HTML is here

}[/tt]

The URLs shown are only for reference. Is it possible to target a particular frame and if so, how do I do it here? Don
don@pc-homepage.com
Experienced in HTML, Perl, VBScript, PWS, IIS and Apache. Run OS/2 Warp 4, BeOS v5 and Windows NT/2000 (only when I have to!)
 
The &quot;Location&quot; header cannot do that.

You would be better served to have PHP produce some JavaScript to do the same thing.
 
I suspected as much but have only a basic knowledge of JavaScript. How can I do it? Don
don@pc-homepage.com
Experienced in HTML, Perl, VBScript, PWS, IIS and Apache. Run OS/2 Warp 4, BeOS v5 and Windows NT/2000 (only when I have to!)
 
if ($referer == ' { // valid refer so do this
echo &quot;<script Language=\&quot;JavaScript\&quot;>&quot;;
echo &quot;location.href= ('new_page.php');&quot;;
echo &quot;</script>&quot;;
}else{
// invalid refer so we do this instead
echo &quot;<script Language=\&quot;JavaScript\&quot;>&quot;;
echo &quot;location.href= ('bad_monkee_page.php');&quot;;
echo &quot;</script>&quot;;
}
***************************************
***************************************
Party on, dudes!
[cannon]
 
Thanks! Can I invert the valid and invalid sections as I had it in my example? Invalid needs only load the page in which the script exists and does not need to go anywhere else.

But how to I apply a target frame here? Is there a JavaScript command for that - maybe something like (a guess here) &quot;location.target&quot; something like this?

[tt]if ($referer >= ' { // invalid refer so do this
echo &quot;<script Language=\&quot;JavaScript\&quot;>&quot;;
echo &quot;location.href= ('bad_monkee_page.php');&quot;;
echo &quot;location.target= ('top');&quot;; // a guess
echo &quot;</script>&quot;;
}else{
// valid refer so we do this instead
?>

HTML page contents here

<? } ?>[/tt] Don
don@pc-homepage.com
Experienced in HTML, Perl, VBScript, PWS, IIS and Apache. Run OS/2 Warp 4, BeOS v5 and Windows NT/2000 (only when I have to!)
 
No idea ablut targets, best post that one in the java forum.

I only use the redirect as a last resort occasionally :) ***************************************
Party on, dudes!
[cannon]
 
oh and yes you can invert it ... the (more politically correct) code I believe is
if ($referer != ' {

which signifies not equal to (otherwise shown as <>

As you have it it reads &quot;greater than equal&quot; .
Hope this helps a little.

***************************************
Party on, dudes!
[cannon]
 
Thanks, actually I tried the != first but it crashes. The >= does not but I am at a loss to know why. I work a little with so many programming kanguages that I am getting confused! Don
don@pc-homepage.com
Experienced in HTML, Perl, VBScript, PWS, IIS and Apache. Run OS/2 Warp 4, BeOS v5 and Windows NT/2000 (only when I have to!)
 
Here is what ended up working with some additional help from the JavaScript forum, in case anyone here is interested in the outcome:

[tt]if ($referer >= ' {
echo &quot;<script Language=\&quot;JavaScript\&quot;>&quot;;
echo &quot;parent.frame_name.location.href='badlink.php/';&quot;;
echo &quot;</script>&quot;;
}else{
?>
Non-redirected HTML page contents here

<? } ?>[/tt] Don
don@pc-homepage.com
Experienced in HTML, Perl, VBScript, PWS, IIS and Apache. Run OS/2 Warp 4, BeOS v5 and Windows NT/2000 (only when I have to!)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top