Zubrag.com
December 10, 2018, 08:46:53 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: password_protect to accept any string of certain length?  (Read 9017 times)
webthingz
Newbie
*
Posts: 3


« on: December 06, 2006, 07:02:35 PM »

I would love to use your script based on the rave reviews and success I've had installing, but I need to accept a password that can be ANY passphrase consisting of 10 digits (their member number).  Maybe something with strlen() or count()Huh?  If anyone could help I would really appreciate it!!! Undecided

Logged
zubrag
Administrator
Hero Member
*****
Posts: 788


WWW
« Reply #1 on: December 07, 2006, 04:11:02 AM »

You will need to edit the script. Change <input type="password" name="access_password" /> to <input type="password" name="access_password" maxlength="10" />
This will limit field length in the form to 10 characters.
Logged
webthingz
Newbie
*
Posts: 3


« Reply #2 on: December 07, 2006, 01:02:49 PM »

Thanks for your quick reply, you guys really are awesome.  I guess I was unclear, I don't want to limit the size of the field since not knowing that it's 10 numbers is the only security it would have (security obviously not a big concern)!  However, I want the $LOGIN_INFORMATION= , (password only) , where the passwords are programmed to accept any combination of numbers that is 10 digits long. (like a verification that checks length) Any ideas?  I would be happy to make a donation to the cause!

Thanks again!
Logged
zubrag
Administrator
Hero Member
*****
Posts: 788


WWW
« Reply #3 on: December 07, 2006, 04:26:31 PM »

Do you mean you want it to accept any numbers from 0000000000 to 9999999999?

Here is veeery custom script version, which is cut and heavily changed to support that (if I understood you correctly).

Code:
<?php
// show login form
function showLoginPasswordProtect($error_msg) {
?>

<html>
<head>
  <title>Please enter password to access this page</title>
  <META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
  <META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
</head>
<body>
  <style>
    input { border: 1px solid black; }
  </style>
  <form method="post">
    <h3>Please enter password to access this page</h3>
    <font color="red"><?php echo $error_msg?></font><br />
    <input type="password" name="access_password" maxlength="10" />
    <p></p><input type="submit" name="Submit" value="Submit" />
  </form>
</body>
</html>
<?php
  
die(); // stop at this point
}

// user provided password
if (isset($_POST['access_password'])) {
  
$pass $_POST['access_password'];
  if (
strlen($pass) != 10 || !preg_match("/^[0-9]+$/",$pass) ) {
    
showLoginPasswordProtect("Incorrect password.");
  }
  else {
    
// set cookie if password was validated
    
setcookie("verify""");
  }
}
else {
  
// check if password cookie is set
  
if (!isset($_COOKIE['verify'])) {
    
showLoginPasswordProtect("");
  }
}
?>
Logged
webthingz
Newbie
*
Posts: 3


« Reply #4 on: December 07, 2006, 07:42:04 PM »

Oh YES, THANK YOU.  I know it's odd (like why have a password at all?) but it's easier then programming 7000 numbers into something, or setting up a new DB or emailing that many people with a name and/or pass.

I appreciate your time due to my frustration and inability, how can I support zubrag.com?

THANK YOU AGAIN
Logged
zubrag
Administrator
Hero Member
*****
Posts: 788


WWW
« Reply #5 on: December 08, 2006, 04:53:56 AM »

Thank you for asking, but it is not possible, at least at this time Smiley This site is a kind of hobby site. So the best you could do for us is referring people to zubrag.com if they are in need of some script we have.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC