Re: PHP IP Checking...
- From: "J.O. Aho" <user@xxxxxxxxxxx>
- Date: Tue, 31 May 2005 06:40:32 +0200
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 .
- References:
- PHP IP Checking...
- From: Josh \"Ramen\" Miller
- PHP IP Checking...
- Prev by Date: Re: STDIN on different OSs
- Next by Date: Re: How to change pictures everyday using php
- Previous by thread: PHP IP Checking...
- Index(es):
Relevant Pages
|