Password Protect Directories

Questions and discussions regarding web-scripting languages like HTML and PHP.

Moderator: Community Moderators

User avatar
ICT Tech
Community Master Admin
Posts: 1415
Joined: Thu Jul 26, 2007 6:33 pm
Location: In my chair!

Re: Password Protect Directories

Postby ICT Tech » Fri May 01, 2009 10:29 pm

muto wrote:Did the code work for you?


Really sorry, I haven't even tried it yet, I haven't had time, I will try it tomorrow (Saturday) as it is my day off.
Although, do I need to do the whole sub-site which I give you in a PM, in php because of the login?

Thanks :P
ICT Tech
Senior Community Admin

muto
Posts: 417
Joined: Sat Mar 29, 2008 12:46 pm

Re: Password Protect Directories

Postby muto » Fri May 01, 2009 10:35 pm

Yes, they'll all need to be .php files, but if it's written in html you can just rename them to .php and add that block of code at the top - the rest will just be treated as html as long as it's outside of the <?php ?> tags..

User avatar
ICT Tech
Community Master Admin
Posts: 1415
Joined: Thu Jul 26, 2007 6:33 pm
Location: In my chair!

Re: Password Protect Directories

Postby ICT Tech » Fri May 01, 2009 11:13 pm

Okay, 2 questions.

1. When you click the "Login" button, what page is it trying to go to?

2. How do you create other users?

Cheer :P
ICT Tech
Senior Community Admin

muto
Posts: 417
Joined: Sat Mar 29, 2008 12:46 pm

Re: Password Protect Directories

Postby muto » Sat May 02, 2009 9:43 am

When you login, it tries to take you to main.php (my test page), line 11 of what I posted.

As for adding more users, you need to change line 5. Currently it is:

Code: Select all

if ($_POST['username'] == "test" && $_POST['password'] == "test")

To add another use, change it to this:

Code: Select all

if($_POST['username'] == "test" && $_POST['password'] == "test")($_POST['username'] == "test2" && $_POST['password'] == "test2")

The `||` operator is an `or` statement, so you can just add more lines.

When I've got a bit more time, I'll redo this properly, pulling username/hashes from a file/database, but I'll a littlle busy at the moment.

Todd91
Posts: 29
Joined: Sat May 02, 2009 4:51 am

Re: Password Protect Directories

Postby Todd91 » Sat May 02, 2009 6:17 pm

from what i hav seen, you guys dont even know what your talking ABOUT! just a bunch of code monkey s trying to make it sound like your hackers, told you so!

User avatar
TJ_2k7
Posts: 878
Joined: Wed Jul 04, 2007 6:31 pm

Re: Password Protect Directories

Postby TJ_2k7 » Sun May 03, 2009 7:32 pm

:roll:

Ok Todd, your really p**sing me off now. None of us said we were great 'hackers' we just have an interest in Computers. Thats all.
When you going to get that into your 10 year old mind!
Why dont you just leave this forum, why do you even need it if you can 'hack the FBI' ;) ?

Never heard such a load of poop in my whole life.

Dear me...

muto
Posts: 417
Joined: Sat Mar 29, 2008 12:46 pm

Re: Password Protect Directories

Postby muto » Sun May 03, 2009 7:36 pm

Don't feed the troll...

User avatar
ICT Tech
Community Master Admin
Posts: 1415
Joined: Thu Jul 26, 2007 6:33 pm
Location: In my chair!

Re: Password Protect Directories

Postby ICT Tech » Thu May 07, 2009 2:37 am

Quaon wrote:
muto wrote:Don't feed the troll...


I have to say, in all my years of using google, stumbleupon, and email links, I have never read something that made me laugh so much, and for so long. That made my day.


Ha, Nice 8-)
ICT Tech
Senior Community Admin


Return to “Web Development”

Who is online

Users browsing this forum: No registered users and 2 guests