PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
spamyboy
Forum Contributor
Posts: 266 Joined: Sun Nov 06, 2005 11:29 am
Location: Lithuania, vilnius
Post
by spamyboy » Tue Dec 26, 2006 4:00 am
Arghh.. I'm realy pi**ed off on this. I never had such expirience playing with headers so... here is what I got.
Code: Select all
<?php header("Referer : http://www.googler.com/"); ?>
<html>
<head>
<title>test</title>
</head>
<body>
<?php
echo getenv("http_referer");
?>
</body>
</html>
Isnt
Code: Select all
<?php header("Referer : http://www.googler.com/"); ?>
same like set variable ?
Anyway, here is what I'm trying to do. Send fake headers to "banners exchange" company (468x60.lt).
So if I'm thinking right... then if I set headers in top of my page like
Code: Select all
<?php header("Referer : http://www.googler.com/"); ?>
then when some one clicks on banner, they should get referer
but they don't... what's wrong, anyone ?
volka
DevNet Evangelist
Posts: 8391 Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger
Post
by volka » Tue Dec 26, 2006 4:40 am
The client/browser sets the referer header to its liking when sending a request to a http server and there's nothing you can do about it server-side.
spamyboy
Forum Contributor
Posts: 266 Joined: Sun Nov 06, 2005 11:29 am
Location: Lithuania, vilnius
Post
by spamyboy » Tue Dec 26, 2006 4:50 am
So you mean, it's imposible to fake header (referrer) with php ?
Last edited by
spamyboy on Tue Dec 26, 2006 5:04 am, edited 1 time in total.
volka
DevNet Evangelist
Posts: 8391 Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger
Post
by volka » Tue Dec 26, 2006 4:58 am
It's impossible to make the browser fake the referer header with php, yes.
spamyboy
Forum Contributor
Posts: 266 Joined: Sun Nov 06, 2005 11:29 am
Location: Lithuania, vilnius
Post
by spamyboy » Thu Dec 28, 2006 5:13 am
Ok then I got some other ideas...
Code: Select all
<?php
$string = file_get_contents ("http://www.468x60.lt/serve.php?5766,1,1");
$string = strstr($string, 'click.php?');
$piece = 10;
$piece2 = strstr($string,substr($string,$piece,$piece));
$skaiciai = substr($piece2,0,"16");
echo '<div><iframe src="http://www.468x60.lt/click.php?'.$skaiciai.'"></iframe></div>';
?>
but now 468x60.lt system get's servers IP addres, how could I make that it would get current broswering this script user IP ?
volka
DevNet Evangelist
Posts: 8391 Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger
Post
by volka » Thu Dec 28, 2006 5:40 am
You can't. php runs server-side. All its actions are performed server-side, thus if php sends a http-request it does it from the server with the server's ip.
spamyboy
Forum Contributor
Posts: 266 Joined: Sun Nov 06, 2005 11:29 am
Location: Lithuania, vilnius
Post
by spamyboy » Thu Dec 28, 2006 5:42 am
Argh... then how about HTTP_X_FORWARDED_FOR ?
volka
DevNet Evangelist
Posts: 8391 Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger
Post
by volka » Thu Dec 28, 2006 5:52 am
May work only if the counter script accepts HTTP_X_FORWARDED_FOR.
spamyboy
Forum Contributor
Posts: 266 Joined: Sun Nov 06, 2005 11:29 am
Location: Lithuania, vilnius
Post
by spamyboy » Thu Dec 28, 2006 5:55 am
Could I get any example of using it ?
phpdevuk
Forum Contributor
Posts: 220 Joined: Mon Jul 04, 2005 5:31 am
Location: UK
Contact:
Post
by phpdevuk » Thu Dec 28, 2006 7:27 am
I believe its possible to set the user agent and referer using something like the snoopy class, but obviously the server ip address would not be correct for what ever referer you are pretending to be.
spamyboy
Forum Contributor
Posts: 266 Joined: Sun Nov 06, 2005 11:29 am
Location: Lithuania, vilnius
Post
by spamyboy » Thu Dec 28, 2006 7:56 am
anyone pleas, help to "trick" this systeam
jayshields
DevNet Resident
Posts: 1912 Joined: Mon Aug 22, 2005 12:11 pm
Location: Leeds/Manchester, England
Post
by jayshields » Thu Dec 28, 2006 7:58 am
You could accomplish this. You will need some client-side scripting too, to get the client's IP address and send it to the server. Look into AJAX.
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Thu Dec 28, 2006 8:03 am
spamyboy wrote: anyone pleas, help to "trick" this systeam
Your patience is amazingly low. Be warned we do not tolerate bumping well.
You've been given multiple things to look into by users. Check them out.
cURL is another to check out while looking at
Snoopy .