boardom Forum Index boardom
b2 message board
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

password protected blog hack

 
Post new topic   Reply to topic    boardom Forum Index -> Hacks
View previous topic :: View next topic  
Author Message
Candle



Joined: 23 Dec 2002
Posts: 547

PostPosted: Thu Apr 24, 2003 11:18 pm    Post subject: password protected blog hack Reply with quote

Ok I think I seen somewhere that someone wanted to password protected their blog ?
Well found some code that will do that to any page you want to put a passwd to it .
Can have as many passwds as you want .

2 parts for installing this script:

1. Save this first information in a file (ex. login.pwd).
2. Include the include tag to the PHP document you want to secure.

Code:
SAVE THIS IN A FILE:

<?php
    if(!isset($PHP_AUTH_USER)) {
        Header("WWW-Authenticate: Basic realm=\"Title of the restricted area?\"");
        Header("HTTP/1.0 401 Unauthorized");
        exit;
    } else {
        if (

       ($PHP_AUTH_USER == "username01" && $PHP_AUTH_PW == "password01") ||
       ($PHP_AUTH_USER == "username02" && $PHP_AUTH_PW == "password02") ||
       ($PHP_AUTH_USER == "username03" && $PHP_AUTH_PW == "password03")

   ) {

       } else {
            Header("WWW-Authenticate: Basic realm=\"Try again!\"");
            Header("HTTP/1.0 401 Unauthorized");
       Print "

PRINT SOME HTML HERE WICH WILL BE SHOWN IF YOU ENTER WRONG USER/PASS 3 TIMES.

";
            exit;
        }
    }
?>


Code:
<?php
   include("source/to/login.file");
?>

_________________
My Game Forum


Last edited by Candle on Thu May 01, 2003 5:03 am; edited 1 time in total
Back to top
View user's profile Send private message
Ruud



Joined: 12 Oct 2002
Posts: 77

PostPosted: Mon Apr 28, 2003 12:51 am    Post subject: Reply with quote

Excellent one. Quite elegant to use, nice and simple.

Ruud
Back to top
View user's profile Send private message Visit poster's website
gooified



Joined: 09 Jul 2003
Posts: 19

PostPosted: Wed Jul 09, 2003 11:29 pm    Post subject: Reply with quote

could someone exlain this in idiot terms?

like when you say name the file "blah blah" can you be more specific? i have no concept of php whatsoever... and i really would like this to work for me. =/
Back to top
View user's profile Send private message Visit poster's website
Candle



Joined: 23 Dec 2002
Posts: 547

PostPosted: Wed Jul 09, 2003 11:46 pm    Post subject: ........... Reply with quote

Ok copy the first code and name it login.pwd ( i would name it to something else .pwd)
Then you put this at the top of the page to password protect it
<?php
include("source/to/login.file");
?>
So if your login.pwd is in your the same folder as your index just do at the top
<?php
include("what you name it.pwd");
?>
then change the usersnames and passwords here .
($PHP_AUTH_USER == "username01" && $PHP_AUTH_PW == "password01") ||
($PHP_AUTH_USER == "username02" && $PHP_AUTH_PW == "password02") ||
($PHP_AUTH_USER == "username03" && $PHP_AUTH_PW == "password03")
_________________
My Game Forum
Back to top
View user's profile Send private message
gooified



Joined: 09 Jul 2003
Posts: 19

PostPosted: Wed Jul 09, 2003 11:53 pm    Post subject: Reply with quote

thank you soooooo much!

i feel like an idiot lol... but thanks again. =)
Back to top
View user's profile Send private message Visit poster's website
Candle



Joined: 23 Dec 2002
Posts: 547

PostPosted: Wed Jul 09, 2003 11:54 pm    Post subject: ,,,,,,,,,, Reply with quote

Your welcome .
_________________
My Game Forum
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    boardom Forum Index -> Hacks 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 2 © 2001, 2002 phpBB Group