Please login or register. Welcome to the Studio, guest!


Quick Links:


newBookmarkLockedFalling

Mithras

Mithras Avatar

****
Studio Member

600


July 2006
How do you check for the location in PHP (like location.href in javascript). I googled it, but nothing came up :P



Support Rob Scuderi, the #1 Penguins Defender!

lucifer said:
"Behold: me! I have authority in this building."

Chris

Chris Avatar

******
Head Coder

19,519


June 2005
The constant __SELF__ I believe. Or maybe its __FILE__.... You'd have to mess with it to figure out.

Why do you need that though? I'd just use PHP's $_GET and $_POST to get the data from the URL.

Mithras

Mithras Avatar

****
Studio Member

600


July 2006
__FILE__ returns the location of the file, not the URL.

And what I'm trying to do is have a file, so that it will only work on a specified board... so if someone tries to put it on their board, nothing will happen.


Support Rob Scuderi, the #1 Penguins Defender!

lucifer said:
"Behold: me! I have authority in this building."

Chris

Chris Avatar

******
Head Coder

19,519


June 2005
Oh. Wait. You mean you're trying to get a remotely hosted PHP file to only work on your board? I'd try the referrer then.

Mithras

Mithras Avatar

****
Studio Member

600


July 2006
And that is...?


Support Rob Scuderi, the #1 Penguins Defender!

lucifer said:
"Behold: me! I have authority in this building."

Chris

Chris Avatar

******
Head Coder

19,519


June 2005

Llanilek

Llanilek Avatar
Former Elite Mod

****
Dedicated Studio Member

931


October 2005
$uri = $_SERVER['REQUEST_URI'];


$location = "http://www.yoursite.com/".$uri;


Mithras

Mithras Avatar

****
Studio Member

600


July 2006
Thanks, I finally got it to work, using the $_SERVER['HTTP_REFERER'] and strpos().

Edit:

bakura said:
$uri = $_SERVER['REQUEST_URI'];


$location = "www.yoursite.com/".$uri;


Uhh... I'm not sure what that is, but this is what I'm using right now:

<?php
$boardURL = $_SERVER['HTTP_REFERER'];
$requiredURL = 'mithstestsite';
$pos = strpos($boardURL,$requiredURL);
$code = 'document.write(\'You win\');';

if($pos === false) {
   echo 'document.write(\'You lose\');';
} else {
   echo $code;
}
?>



Last Edit: Oct 22, 2006 22:07:18 GMT by Mithras


Support Rob Scuderi, the #1 Penguins Defender!

lucifer said:
"Behold: me! I have authority in this building."

Llanilek

Llanilek Avatar
Former Elite Mod

****
Dedicated Studio Member

931


October 2005
mithras said:
Thanks, I finally got it to work, using the $_SERVER['HTTP_REFERER'] and strpos().

Edit:

bakura said:
$uri = $_SERVER['REQUEST_URI'];


$location = "www.yoursite.com/".$uri;


Uhh... I'm not sure what that is, but this is what I'm using right now:

<?php
$boardURL = $_SERVER['HTTP_REFERER'];
$requiredURL = 'mithstestsite';
$pos = strpos($boardURL,$requiredURL);
$code = 'document.write(\'You win\');';

if($pos === false) {
   echo 'document.write(\'You lose\');';
} else {
   echo $code;
}
?>


basically request uri gets the path from the document root of the file your viewing

so the uri of this page would be cgi-bin/index.cgi if you put the url of this in it would be studiozero.proboards44.com/cgi-bin/index.cgi

Mithras

Mithras Avatar

****
Studio Member

600


July 2006
Oh, I see now.


Support Rob Scuderi, the #1 Penguins Defender!

lucifer said:
"Behold: me! I have authority in this building."

newBookmarkLockedFalling