User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Web Developers' Lounge section within the Web Development category of DaniWeb, a massive community of 456,562 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,507 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Web Developers' Lounge advertiser: Search Engine Optimization
Views: 1428 | Replies: 1
Reply
Join Date: Oct 2007
Posts: 1
Reputation: firefly81189 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
firefly81189 firefly81189 is offline Offline
Newbie Poster

.htaccess password protect

  #1  
Oct 22nd, 2007
Any ideas on how i can password protect a folder on a website without using .htaccess files.
Last edited by firefly81189 : Oct 22nd, 2007 at 12:47 pm. Reason: Wrong Place
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Oct 2007
Location: Pennsylvania, US
Posts: 37
Reputation: maddog39 is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 3
maddog39 maddog39 is offline Offline
Light Poster

Re: Password Protect without .htaccess

  #2  
Oct 24th, 2007
Use a simple PHP script with a static username and password and maybe a javascript prompt form, or standard HTML prompt form.
  1. <?php
  2. $username = "myusername";
  3. $password = "mypassword";
  4.  
  5. if (!isset($_POST['submit'])) {
  6. ?>
  7. <form method="POST" action="<?=$_SERVER['PHP_SELF']?>">
  8. Username: <input type="text" name="username"><br/>
  9. Password: <input type="password" name="password"><br/>
  10. <input type="submit" name="submit" value="Login">
  11. <?php
  12. } else {
  13. if ($_POST['username'] == $username && $_POST['password'] == $password) {
  14. echo "<a href="privatepage.html">Click to continue...</a>";
  15. }
  16. }
  17. ?>
Or something like that. Not very secure though. But works.
Last edited by maddog39 : Oct 24th, 2007 at 9:06 pm.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb Web Developers' Lounge Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the Web Developers' Lounge Forum

All times are GMT -4. The time now is 5:42 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC