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.

Post New Thread Reply

Register GFY Rules Calendar Mark Forums Read
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 01-28-2006, 02:48 AM   #1
Jakke PNG
ex-TeenGodFather
 
Jakke PNG's Avatar
 
Industry Role:
Join Date: Nov 2001
Location: Suomi Finland Perkele
Posts: 20,306
PHP help?

I have a list of urls that I only want to be accessible from 1 specific url, is this the correct php-way to do it. I tested it and it seemed to work...

PHP Code:
<?
$ref=getenv("HTTP_REFERER");

if ($ref hahahaha "http://www.URL.com/page.shtml") {
   echo "OK";
} elseif ($ref hahahaha "http://URL.com/page.shtml") {
   echo "OK";
} else {
   echo "Redirect this";
}
?>
__________________
..and I'm off.
Jakke PNG is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-28-2006, 02:48 AM   #2
Jakke PNG
ex-TeenGodFather
 
Jakke PNG's Avatar
 
Industry Role:
Join Date: Nov 2001
Location: Suomi Finland Perkele
Posts: 20,306
the hahahaha is = and another =
__________________
..and I'm off.
Jakke PNG is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-28-2006, 02:50 AM   #3
Jakke PNG
ex-TeenGodFather
 
Jakke PNG's Avatar
 
Industry Role:
Join Date: Nov 2001
Location: Suomi Finland Perkele
Posts: 20,306
spoofing and such is not a concern, this is a free site and bandwidth usage etc isn't a problem.. I just don't want people to be able to move thru the directories by typing.. as my directory structure is very easily guessable. lol.
__________________
..and I'm off.
Jakke PNG is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-28-2006, 03:00 AM   #4
grumpy
Too lazy to set a custom title
 
grumpy's Avatar
 
Join Date: Jan 2002
Location: Holland
Posts: 9,870
would be better to use .htaccess then

http://www.javascriptkit.com/howto/htaccess.shtml
__________________
Don't let greediness blur your vision | You gotta let some shit slide
icq - 441-456-888
grumpy is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-28-2006, 03:03 AM   #5
Jakke PNG
ex-TeenGodFather
 
Jakke PNG's Avatar
 
Industry Role:
Join Date: Nov 2001
Location: Suomi Finland Perkele
Posts: 20,306
No.. There's a reason though.
anyhow, is *that* a correct PHP-way to do it?
also, if I send the users thru a hyperlink say;
http://www.URL.com/cgi-bin/script/sc...hecodeisat.php

will the original referer be the script or the .shtml page? It 'seemed' to be the .shtml page in my tests, but as I'm a php-n00bie, I have no idea how it really works.
__________________
..and I'm off.
Jakke PNG is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-28-2006, 03:10 AM   #6
Tempest
Too lazy to set a custom title
 
Industry Role:
Join Date: May 2004
Location: West Coast, Canada.
Posts: 10,217
Depending on how many urls I was going to do, I might do it something like this instead.

<?php
$okrefs=array();
$okrefs['http://www.url1.com/page.shtml']=1;
$okrefs['http://url1.com/page.shtml']=1;
$okrefs['http://www.url2.com/page.shtml']=1;
$okrefs['http://url2.com/page.shtml']=1;
$ref=strtolower($HTTP_SERVER_VARS['HTTP_REFERER']);
if($okrefs[$ref]= =1){
echo("OK");
}else{
echo("Redirect this");
exit();
}
?>

But some browsers/surfers will hide the referer so then you can't really do this at all. Is it for admin type purposes?
Tempest is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-28-2006, 03:12 AM   #7
Jakke PNG
ex-TeenGodFather
 
Jakke PNG's Avatar
 
Industry Role:
Join Date: Nov 2001
Location: Suomi Finland Perkele
Posts: 20,306
Quote:
Originally Posted by Tempest
But some browsers/surfers will hide the referer so then you can't really do this at all. Is it for admin type purposes?
No it's not, but it doesn't matter if some browsers hide the referer..then they're just sent away on something else. buahahahaha.
__________________
..and I'm off.
Jakke PNG is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-28-2006, 03:12 AM   #8
Tempest
Too lazy to set a custom title
 
Industry Role:
Join Date: May 2004
Location: West Coast, Canada.
Posts: 10,217
Quote:
Originally Posted by TeenGodFather
No.. There's a reason though.
anyhow, is *that* a correct PHP-way to do it?
also, if I send the users thru a hyperlink say;
http://www .URL.com/cgi-bin/script/s...hecodeisat.php

will the original referer be the script or the .shtml page? It 'seemed' to be the .shtml page in my tests, but as I'm a php-n00bie, I have no idea how it really works.
The referer is going to be the page you sent them from.. Don't understand your question I guess.
Tempest is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-28-2006, 03:15 AM   #9
Jakke PNG
ex-TeenGodFather
 
Jakke PNG's Avatar
 
Industry Role:
Join Date: Nov 2001
Location: Suomi Finland Perkele
Posts: 20,306
Quote:
Originally Posted by Tempest
The referer is going to be the page you sent them from.. Don't understand your question I guess.
well,
I send them from say
http://ww.url.com/page.shtml
that page as a hyperlink
<a hreF="/cgi-bin/script.cgi?=http://www.urlwiththecode.com>link</A>

So basically I send to the cgi-bin page, which in turn sends them to the 'end page'. So which is the referer? The page where user clicks the link, or the cgi-script that redirects them to the right place?
__________________
..and I'm off.
Jakke PNG is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-28-2006, 03:25 AM   #10
Tempest
Too lazy to set a custom title
 
Industry Role:
Join Date: May 2004
Location: West Coast, Canada.
Posts: 10,217
Quote:
Originally Posted by TeenGodFather
well,
I send them from say
http://ww.url.com/page.shtml
that page as a hyperlink
<a hreF="/cgi-bin/script.cgi?=http://www.urlwiththecode.com>link</A>

So basically I send to the cgi-bin page, which in turn sends them to the 'end page'. So which is the referer? The page where user clicks the link, or the cgi-script that redirects them to the right place?
Ah... Well if I remember correctly (haven't checked that sort of detailed thing in awhile), it's "usually" the page and not the script.. But.. it's not 100% and I'm not sure why that is.. Could be different browser types or could be spiders/crawlers. Perhaps you should run a test script or something.. setup your links to send to a test page and have that test page display the referer.

<?php
echo("'$HTTP_SERVER_VARS['HTTP_REFERER']'");
?>

There IS another server variables for "redirect" referers as well. Can't remember the name of it right now.
Tempest is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks
Thread Tools



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.