![]() |
![]() |
![]() |
||||
Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact us. |
![]() ![]() |
|
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed. |
|
Thread Tools |
![]() |
#1 |
Confirmed User
Industry Role:
Join Date: Jul 2003
Posts: 5,344
|
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? |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#2 |
Confirmed User
Join Date: Feb 2005
Posts: 283
|
nope, those pages are considered one and the same with php.
it could probably be done with a php/javascript combo |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#3 |
Sofa King Band
Join Date: Jul 2002
Location: Outside the box
Posts: 29,903
|
$_SERVER[HTTP_HOST]
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#4 |
Confirmed User
Industry Role:
Join Date: Feb 2005
Posts: 1,699
|
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 |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#5 |
Confirmed User
Join Date: May 2002
Location: MI
Posts: 1,827
|
You could probably use a preg_match to look at the url and see if its being called that way.
Andy
__________________
Latest MMA news. http://www.mmawrapup.com |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#6 |
Confirmed User
Industry Role:
Join Date: Dec 2002
Location: Behind the scenes
Posts: 5,190
|
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"; }
__________________
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#7 |
Confirmed User
Industry Role:
Join Date: Dec 2002
Location: Behind the scenes
Posts: 5,190
|
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
__________________
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#8 |
Confirmed User
Industry Role:
Join Date: Jul 2003
Posts: 5,344
|
i tried every server variable, everything in $_SERVER , the #12 is mentioned no where.
referer is not set - it is a bookmark |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#9 | |
Confirmed User
Industry Role:
Join Date: Jul 2003
Posts: 5,344
|
Quote:
and as far as i know and tried you can not pass a javascript var to a php var - only the other way around |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#10 | |
Confirmed User
Industry Role:
Join Date: Dec 2002
Location: Behind the scenes
Posts: 5,190
|
Quote:
may need to check your apache logs to see if there were any referer from that particular location, or write your own log
__________________
|
|
![]() |
![]() ![]() ![]() ![]() ![]() |