GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   PHP question (https://gfy.com/showthread.php?t=472630)

Zester 05-26-2005 06:21 AM

PHP question
 
is there a way in a php script to detect if it was called with this url:
http://domain.com/myscript.php#12

or this:
http://domain.com/myscript.php

some kind of server variable I don't know of?

arnette 05-26-2005 06:34 AM

nope, those pages are considered one and the same with php.
it could probably be done with a php/javascript combo

StuartD 05-26-2005 06:36 AM

$_SERVER[HTTP_HOST]

Fetish Gimp 05-26-2005 06:36 AM

Is the php script you're talking about running on the same server? Cuz depending on the situation you can use the $_SERVER['REFERER'] or $_SERVER['SCRIPT_FILENAME']. Here's more about the server variables
http://ca3.php.net/reserved.variables

AcidMax 05-26-2005 06:37 AM

You could probably use a preg_match to look at the url and see if its being called that way.

Andy

Serge Litehead 05-26-2005 06:55 AM

Code:

if (isset($_SERVER['HTTP_REFERER']))
{
        if (strpos($_SERVER['HTTP_REFERER'],"domain.com/myscript.php") !hahahaha false)
        {
                echo "this script called with domain.com/myscript.php";
        }
        else
        {
                echo "call by ".$_SERVER['HTTP_REFERER'];
        }
}
else
{
        echo "no referer";       
}

replace hahahaa with double equal signs (=)

Serge Litehead 05-26-2005 07:04 AM

regarding previous post
that code will work only if myscript.php is linking to the php file this code is on.
if its not the case then more info needed how is current script beign called by myscript.php

Zester 05-26-2005 07:08 AM

i tried every server variable, everything in $_SERVER , the #12 is mentioned no where.
referer is not set - it is a bookmark

Zester 05-26-2005 07:12 AM

Quote:

Originally Posted by arnette
nope, those pages are considered one and the same with php.
it could probably be done with a php/javascript combo

yes, i have no problem detecting it in javascript, but in order to use a combo with PHP, i have to use either a cookie or post or get to that same page which i want to avoid

and as far as i know and tried you can not pass a javascript var to a php var - only the other way around

Serge Litehead 05-26-2005 08:24 AM

Quote:

Originally Posted by Zester
i tried every server variable, everything in $_SERVER , the #12 is mentioned no where.
referer is not set - it is a bookmark

unless you going to your script from myscript.php you wont see the referer
may need to check your apache logs to see if there were any referer from that particular location, or write your own log


All times are GMT -7. The time now is 01:49 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123