Reply to Re: Limit access to just one IP

Your name:

Reply:


Posted by shimmyshack on 06/15/07 07:16

On Jun 15, 7:07 am, Nosferatum <John.Ola...@gmail.com> wrote:
> Hi, on my Apache server I want to limit access to a certain file ouput
> (from php/MySQL) to just one IP. The idea is that users from another
> site should click a link whic redirects them to my special page on my
> server. Only those who access my page from one particulary URL are
> allowed to see my file. All others are denied.
> Is it possible to solve this with a .htaccess file, or do I need a php
> solution?

the honest answer is neither, you cannot guarantee that their IP
address will not change between the two requests, taken together with
proxies, NAT etc..., IP is not an acceptable method to use to uniquely
identify your visitor.
A better solution would be to set a cookie using a javascript include
for the domain you intend to redirect your users to,
siteA
....
<javascript src="http://siteB/setcookie.js"></script></head>
<body><p>see the <a href="http://siteB/checkcookie.php">document</a></
p>
....

then when the user clicks to visit the domain you can use php to
check the value of that cookie and redirect to display the file

siteB

<?php

//if cookie exists and is right value
//display file (optionally kill cookie)
//else
//a message explaining what to do or a redirect to siteA

?>

I take it you can't use php on siteA, or you could just serve the file
from there by opening it using fopen('http://siteB/file.doc'); etc...
if fopen is URL enabled on siteA's config

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация