[PHP-DB] RE: [PHP-WIN] Password generator

2003-06-18 Thread Svensson, B.A.T. (HKG)

Create a string which is six char long,
(for instance shop the head and tail
of the first string if you are not able
to generate a six char string)

If you chop an 8 char string and MUST have
the special chars in the string then check
that the chopped char's is not a memember of
the special char's- If they are, regenerate a
new string an loop until they are not

Finally randomize the head and the tail with
you custom algorithm. E.g. an algoritm that
does not contain your 


Med vanliga halsningar fran Amsterdam. =) ;)


-Original Message-
From: Davy Obdam
To: PHP; PHP-WIN; PHP-DB
Sent: 2003-06-17 11:45
Subject: [PHP-WIN] Password generator

Hi people,

I have to make a password generator, but i have a little problem.

- It needs to generate password 8 characters long, and including 1 or 2 
special characters(like #$%*@).
- Those special characters can never appear as the first or last 
character in the string... anywhere between is fine.

I have a password generator script now that does the first thing... but 
the special character can be in front or back of the string wich it 
shouldnt.. i have been looking on the web for this but i havent found 
the answer. Below is my scripts so far.. 

Any help is appreciated, thanks for your time,

Best regards,

Davy Obdam




?php
// A function to generate random alphanumeric passwords in PHP
// It expects to be passed a desired password length, but it
// none is passed the default is set to 8 (you can change this)
function generate_password($length = 8) {

// This variable contains the list of allowable characters
// for the password.  Note that the number 0 and the letter
// 'O' have been removed to avoid confusion between the two.
// The same is true of 'I' and 1
$allowable_characters =
abcdefghefghijklmnopqrstuvwxyz0123456789%#*;
   
// We see how many characters are in the allowable list
$ps_len = strlen($allowable_characters);

// Seed the random number generator with the microtime stamp
// (current UNIX timestamp, but in microseconds)
mt_srand((double)microtime()*100);

// Declare the password as a blank string.
$pass = ;

// Loop the number of times specified by $length
for($i = 0; $i  $length; $i++) {
   
// Each iteration, pick a random character from the
// allowable string and append it to the password.
$pass .= $allowable_characters[mt_rand(0,$ps_len-1)];
   
}

// Retun the password we've selected
return $pass;
}

$password = generate_password();
echo $password;

?

-- 
---
Davy Obdam 
Web application developer

Networking4all
email: [EMAIL PROTECTED]
email: [EMAIL PROTECTED]
internet: http://www.networking4all.com
---




-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] RE: [PHP-WIN] MSSQL connect

2001-12-26 Thread Svensson, B.A.T. (HKG)

What the heck are you talking about?


-Original Message-
From: Thomas omega Henning [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, December 26, 2001 7:50 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED];
[EMAIL PROTECTED]
Subject: Re: [PHP-WIN] MSSQL connect


I don't know who's a moron that can;t even see straight
B.A.T. Svensson [EMAIL PROTECTED] wrote in message
27E647E5629ED211BF78009027289C6302157DAB@mail1">news:27E647E5629ED211BF78009027289C6302157DAB@mail1...
 You must be an extremely intelligent person, almost literary 
quoting my
 answer, and then pinpointing down things I already pointed 
out! Moron...

 From: Thomas omega Henning
 Sent: Wednesday, December 26, 2001 8:50 AM
 To: [EMAIL PROTECTED]; [EMAIL PROTECTED];
 [EMAIL PROTECTED]
 Subject: Re: [PHP-WIN] MSSQL connect
 
 
 ?php
 $h = server adr; //don't forget 2 change this
 $u = user; //don't forget 2 chage this
 $p = passw; //don't forget 2 change this
 $b = db; //don't forget 2 change this
 $connexion = mssql_connect($h, $u, $p);
 
  Why do you uses quotes here?
 
 mssql_select_db($b);
 
 $sql_temp = select * from test;
 //.
 $result = mssql_query($sql_temp);
 //  ^^
 
 //??
 
 mssql_close($connexion);
 ?
 
 Here is the problem $sql != $sql_temp
 so the $result = NULL; because mssql_query( ) has no query
 to send to the MsSQL server.
 This should work try it out!!!
 
 Thomas omega Henning



-- 
PHP Windows 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]


-- 
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]




[PHP-DB] RE: [PHP-WIN] MSSQL connect

2001-12-24 Thread Svensson, B.A.T. (HKG)

From: Jerry [mailto:[EMAIL PROTECTED]]

I tried something like:

?pup
$h = server adr;
$u = user;
$p = passw;
$b = db;
$connexion = mssql_connect($h, $u, $p);

Why do you uses quotes here?

mssql_select_db($b);

$sql = select * from test;
.
$result = mssql_query($sql_temp);
.  ^^

??

mssql_close($connexion);
?



But it didn't work. Please help me.

-- 
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]