Locking out non local users!

 
Post new topic   Reply to topic    Aprelium Forum Index -> Off Topic Discussions
View previous topic :: View next topic  
Author Message
TRUSTAbyss
-


Joined: 29 Oct 2003
Posts: 3752
Location: USA, GA

PostPosted: Sun Apr 25, 2004 12:13 am    Post subject: Locking out non local users! Reply with quote

I just created a script that allows only localhost or 127.0.0.1
to access the Abyss Web Server , I know i catch on to PHP fast
lol , any way here it is , only localhost is granted permission.

Name this index.php

Code:

<?php
if ($REMOTE_ADDR == "127.0.0.1") {
header("Location: /main.html");
}else{
print "Only localhost is allowed in!";
}
?>


If I can learn PHP so fast than you too can do the
exact same crap I do , Larry Ullman's books rule!

You have to check his books out , by the way
I didn't get that code from the book , I made it up

Edit: This code will only work inside index.php , if you want to
add this to your other php pages , you will need to insert that
code in every php page in order to validate all web pages in php.


Last edited by TRUSTAbyss on Sun Apr 25, 2004 12:25 am; edited 1 time in total
Back to top View user's profile Send private message Visit poster's website
Anonymoose
-


Joined: 09 Sep 2003
Posts: 2192

PostPosted: Sun Apr 25, 2004 12:21 am    Post subject: Reply with quote

... Which is great as long as your whole site is in PHP and no-one knows or guesses any direct links to anything... I guess you could use it to protect a small admin area but it's not really useful for protecting a whole site.
Back to top View user's profile Send private message
TRUSTAbyss
-


Joined: 29 Oct 2003
Posts: 3752
Location: USA, GA

PostPosted: Sun Apr 25, 2004 12:28 am    Post subject: Reply with quote

Yeah , its just a small sample that I may add
to my File Uploader program when I create my
admin section , I thought you all might want that
piece of code I came up with , I think its cool!


Last edited by TRUSTAbyss on Sun Apr 25, 2004 12:56 am; edited 4 times in total
Back to top View user's profile Send private message Visit poster's website
Anonymoose
-


Joined: 09 Sep 2003
Posts: 2192

PostPosted: Sun Apr 25, 2004 12:33 am    Post subject: Reply with quote

Similar to http://www.aprelium.com/forum/viewtopic.php?t=2966 but without the backend database. Shame his was stolen :)
Back to top View user's profile Send private message
TRUSTAbyss
-


Joined: 29 Oct 2003
Posts: 3752
Location: USA, GA

PostPosted: Sun Apr 25, 2004 12:55 am    Post subject: Reply with quote

At least this one doesn't require a database and also the
new redirection code that I posted does not work so im
a complete NewB to PHP but just wanted post code!
Back to top View user's profile Send private message Visit poster's website
iNaNimAtE
-


Joined: 05 Nov 2003
Posts: 2381
Location: Everywhere you're not.

PostPosted: Sun Apr 25, 2004 1:00 am    Post subject: Reply with quote

You can also put the script on each page, checking if the referrer was from the main page.

That is also sort of easy to get around, but it is better than nothing. You can always use cookies.
_________________
Bienvenidos!
Back to top View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> Off Topic Discussions All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB phpBB Group