HTTP_REFERER
Moderator: General Moderators
-
codewarrior
- Forum Commoner
- Posts: 81
- Joined: Wed Aug 07, 2002 1:28 pm
HTTP_REFERER
I was looking @ PHP Manual but can't seem to find HTTP_REFERER. Did google search still nothing, any other manuals out there? 
- hob_goblin
- Forum Regular
- Posts: 978
- Joined: Sun Apr 28, 2002 9:53 pm
- Contact:
didnt look hard enough
http://www.php.net/manual/en/print/rese ... iables.php
'REMOTE_ADDR'
The IP address from which the user is viewing the current page.
http://www.php.net/manual/en/print/rese ... iables.php
'REMOTE_ADDR'
The IP address from which the user is viewing the current page.
-
codewarrior
- Forum Commoner
- Posts: 81
- Joined: Wed Aug 07, 2002 1:28 pm
Found it!!
'HTTP_REFERER'
The address of the page (if any) which referred the user agent to the current page. This is set by the user agent. Not all user agents will set this, and some provide the ability to modify HTTP_REFERER as a feature. In short, it cannot really be trusted.
Any other sites with a bit more details?
'HTTP_REFERER'
The address of the page (if any) which referred the user agent to the current page. This is set by the user agent. Not all user agents will set this, and some provide the ability to modify HTTP_REFERER as a feature. In short, it cannot really be trusted.
Any other sites with a bit more details?
-
codewarrior
- Forum Commoner
- Posts: 81
- Joined: Wed Aug 07, 2002 1:28 pm
hob_goblin wrote:didnt look hard enough
http://www.php.net/manual/en/print/rese ... iables.php
'REMOTE_ADDR'
The IP address from which the user is viewing the current page.
- hob_goblin
- Forum Regular
- Posts: 978
- Joined: Sun Apr 28, 2002 9:53 pm
- Contact:
- hob_goblin
- Forum Regular
- Posts: 978
- Joined: Sun Apr 28, 2002 9:53 pm
- Contact:
-
codewarrior
- Forum Commoner
- Posts: 81
- Joined: Wed Aug 07, 2002 1:28 pm
Trying to do this
It works fine with:
But having prob making the above work with arrays.
It works fine with:
Code: Select all
<?php
if(!eregi("domain.com",$refr)) {
error
} else {
pass
}
?>- hob_goblin
- Forum Regular
- Posts: 978
- Joined: Sun Apr 28, 2002 9:53 pm
- Contact:
Code: Select all
<?php
if(!strpos("domain.com", $_SERVERї'HTTP_REFERER'])) {
die('error')
}
?>- hob_goblin
- Forum Regular
- Posts: 978
- Joined: Sun Apr 28, 2002 9:53 pm
- Contact:
well, here is how I do it:
Code: Select all
$block = array('bar.com', 'foo.com');
$ref = $_SERVERї'HTTP_REFERER'];
$ref = str_replace('http://www.', '', $ref);
$ref = str_replace('http://', '', $ref);
$ref = explode('/', $ref);
$ref = $refї0];
function checkblock($block_array, $url){
foreach($block_array as $key){
if($key == $url)
return TRUE;
}
}
if(!checkblock($block, $ref)){
echo 'they passed';
}-
codewarrior
- Forum Commoner
- Posts: 81
- Joined: Wed Aug 07, 2002 1:28 pm
- hob_goblin
- Forum Regular
- Posts: 978
- Joined: Sun Apr 28, 2002 9:53 pm
- Contact:
-
codewarrior
- Forum Commoner
- Posts: 81
- Joined: Wed Aug 07, 2002 1:28 pm
- hob_goblin
- Forum Regular
- Posts: 978
- Joined: Sun Apr 28, 2002 9:53 pm
- Contact:
Code: Select all
function check($array, $url){
foreach($array as $val){
if(!eregi($url, $val)){
return FALSE;
} else {
return TRUE;
}
}
$urls = array("foo.com", "bar.com"); // ALLOWED SITES
if(!check($urls, $_SERVERї'HTTP_REFERER'])){
echo 'you're not from my site';
} else {
echo 'heres what you want';
}-
codewarrior
- Forum Commoner
- Posts: 81
- Joined: Wed Aug 07, 2002 1:28 pm