Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » General Discussions » General Discussion » Password Page
Password Page [message #116097] Wed, 22 September 2004 16:28 Go to previous messageGo to previous message
Madtone is currently offline  Madtone
Messages: 713
Registered: February 2003
Location: United Kingdom
Karma:
Colonel
Ok, heres a basic page for you, name it index.php

<?

//the password
$the_pass = "pass123";

if ($action == "login") {
   if ($_POST['pass'] == $the_pass) {
   
   //set them as logged in
   $_SESSION['pass'] = $the_pass;

   }else{

   echo "wrong password, please hit back";

   }

}else{

   //checks if you have typed in the pass
   if ($_SESSION['pass'] == $the_pass) {
   
   //your page content goes here
   echo "
   <html>
   <head>
   <title>my page - members section</title>
   </head>
   <body>
     welocme to members section
    </body>
   </html>
   ";

   }else{

   //login page goes here
   echo "
   <html>
   <head>
   <title>my page - login</title>
   </head>
   <body>
   <form action='index.php?action=login' method='post'>
   Username:<br>
   <input type='text' name='pass'>
   <p></p>
   <input type='submit' name='submit' value='Login'>
   </form>
   </body>
   </html>
   ";
   }

}

?>


I just wrote this from scratch just now, so they're might be errors, basicly this is just a quick script that checks if the pass session is registered and if it is, does the pass match the supplied pass.

If you want something more secure i suggest mySQL, sessions and MD5 encryption.

If you would like me to code you a proper login and user management system i have low prices.

Hope this helps Wink


http://www.freeflow-solutions.com/sigs/ffsig.gif

[Updated on: Wed, 22 September 2004 16:33]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Big-ass Wave
Next Topic: Website Tips
Goto Forum:
  


Current Time: Tue Jul 16 19:40:38 MST 2024

Total time taken to generate the page: 0.00660 seconds