You are here: Re: PHP IP Checking... « All PHP « IT news, forums, messages
Re: PHP IP Checking...

Posted by J.O. Aho on 10/02/32 11:17

Josh "Ramen" Miller wrote:
> Ok, this seems like it should be really simple.
>
> On my server/website I have a very basic upload script and page. It takes
> file, it uploads it to a directory, you may browse the directory. Anyone
> can upload files etc.
>
> I want to create a second "copy" of this page and script (which I've done)
> but I want it to only accpept uploads from PCs with the same IP as the
> server (ie only I can upload to it). This seems like it would be a realy
> easy thing to add to my upoad script.
>
> Actually on a related note I wouldn't mind adding usernames and password and
> a bit more sophistication to the upload page but freankly, I know nothing
> about PHP. I picked up the upload script off of a simple tutorial
> somewhere.

$_SERVER['REMOTE_ADDR'] gives you the ip of the machine that loads the page,
just use an if statement to see if it's your server or not, don't forget that
both the 127.0.0.1 and the public-ip are valid for your server.

When it comes to logins, you just have another if-statement where you compare
the form-password/username to what you have stored somewhere
(file/database/directly in your php-script).

For more information about php, visit http://www.php.net/manual/en


//Aho

 

Navigation:

[Reply to this 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

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