Having an issue with this script, the generator works if I just echo out the
password, however when I attempt to update the table, it times-out in IIS.
I've bumped the IIS Timeout up to over 20 minutes, and it still times out.
This is on a database with approximately 29,000 entries.  Any ideas?

Ryan



function rand_pass() {
$array = array(
                 "a","b","c","d","e","f","g","h","i","j","k","l",
                 "m","n","o","p","q","r","s","t","u","v","w","x","y",
                  "z","1","2","3","4","5","6","7","8","9"
                 );

  $num_letters = 10;
  $uppercased = 3;
  mt_srand ((double)microtime()*1000000);
  for($i=0; $i<$num_letters; $i++)
    $pass .= $array[mt_rand(0, (count($array) - 1))];
  for($i=1; $i<strlen($pass); $i++) {
    if(substr($pass, $i, 1) == substr($pass, $i-1, 1))
      $pass = substr($pass, 0, $i) . substr($pass, $i+1);
  }
  for($i=0; $i<strlen($pass); $i++) {
    if(mt_rand(0, $uppercased) == 0)
      $pass = substr($pass,0,$i) . strtoupper(substr($pass, $i,1)) .
substr($pass, $i+1);
  }
  $pass = substr($pass, 0, $num_letters);
  return($pass);
  }


MSSQL_CONNECT("XXXXXXX","XXXXXXXXXXXXXX","XXXXXXXXX");
MSSQL_SELECT_DB("XXXXXXXXX");

$query="SELECT * FROM TABLE";
$return=MSSQL_QUERY($query);
$count=MSSQL_NUM_ROWS($return);
$insertquery="UPDATE TABLE SET FIELD='$password' WHERE
DUNSNumber='$DUNSNumber'";
$row=MSSQL_FETCH_OBJECT($return);

for($i=1;$i<=$count;$i++){
$DUNSNumber=$row->DUNSNumber;

echo rand_pass()."<br>";
MSSQL_QUERY($insertquery);
}
MSSQL_CLOSE();


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to