Zubrag.com
July 17, 2018, 03:34:39 AM *
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: Daily Random Password?  (Read 5455 times)
aliceaod
Newbie
*
Posts: 4


« on: September 12, 2009, 09:34:51 AM »

I would love if the password changed every day because like here, I needed this awesome script to keep spammers off my contact form, community forums, guest books and site registrations...I don't have time to baby sit that stuff and it had gotten out of hand. I was using .htaccess for it, but this handy dandy little script is way better imho...

But...just to keep things even more spammer deterent, would it be feasible to have a password randomly generated every day from a list and how would we go about doing that? Not just a randmly generated one (although that would be cool too) but one from a list, I could have 30 words in a file and every day it uses one of them...

 I'm not a coder...but if I ever figure this out before someone else does, I'll post it but it'll take me forever since I'm not at all proficient in php...but if someone knows that would be awesome. Thanks!

Logged
aliceaod
Newbie
*
Posts: 4


« Reply #1 on: September 12, 2009, 12:04:51 PM »

OK, I'm getting close to my goal.

I found a "quote of the day" script which uses cron to change a txt file based on words in another txt file.

I got it incorporated into password_protect.php...the only thing I don't know how to do is make it not look for the array when it goes to verify the password upon submit.

Instead of the $LOGIN_INFORMATION being an array, it's using the information in the flat txt file, therefore, I need to know how to change this part to reflect that:

Code:
  $login = isset($_POST['access_login']) ? $_POST['access_login'] : '';
  $pass = $_POST['access_password'];
  if (!USE_USERNAME && !in_array($pass, $LOGIN_INFORMATION)
  || (USE_USERNAME && ( !array_key_exists($login, $LOGIN_INFORMATION) || $LOGIN_INFORMATION[$login] != $pass ) )
  ) {
    showLoginPasswordProtect("Incorrect password.");
  }

Here's how I have the $LOGIN_INFORMATION set up:

Code:
  $file = "todaysQuote.txt";
  $fh = fopen($file, "r");
  $string = fread($fh, filesize($file));
  fclose($fh);

$LOGIN_INFORMATION = $file;

and the form:

Code:
  <div style="width:500px; margin-left:auto; margin-right:auto; text-align:center">
   Today's password is: <?php
  
// display quote of the day
  
$file "todaysQuote.txt";

  
$fh fopen($file"r");
  
$string fread($fhfilesize($file));
  
fclose($fh);

  echo 
"<p><span style='color:red'><b>$string</b></span></p>";
?>


  <form method="post">
    <h3>To continue, <br>
    please enter today's password <br>
    and press submit:</h3>
    <font color="red"><?php echo $error_msg?></font><br />
<?php if (USE_USERNAME) echo 'Login:<br /><input type="input" name="access_login" /><br />Password:<br />'?>
    <input type="password" name="access_password" /><p></p><input type="submit" name="Submit" value="Submit" />
  </form>
  <br />
  <a style="font-size:9px; color: #B0B0B0; font-family: Verdana, Arial;" href="http://www.zubrag.com/scripts/password-protect.php" title="Download Password Protector">Powered by Password Protect</a>
  </div>

Logged
aliceaod
Newbie
*
Posts: 4


« Reply #2 on: September 12, 2009, 01:12:07 PM »

I think I have it figured out! Cheesy

Code:
if (isset($_POST['access_password'])) {

  $login = isset($_POST['access_login']) ? $_POST['access_login'] : '';
  $pass = $_POST['access_password'];
  if  ($pass !== $string)
   {
    showLoginPasswordProtect("Incorrect password.");
  }
Logged
aliceaod
Newbie
*
Posts: 4


« Reply #3 on: September 12, 2009, 02:22:22 PM »

Oh poo... that wasn't it cos now I have a problem with the cookies thing...invalid argument or something. sigh.
Logged
Pages: [1]
  Print  
 
Jump to:  

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