Random Character String

Random Character String

am 05.03.2005 15:38:35 von Ron Piggott

Is there a way of generating an 8 character random string in PHP?

Is there a way to ignore UPPER and lower case when you are using the SELECT
command to find a record in the mySQL table?

I know this isn't an HTML forum ... I have one more question which is more
HTML in nature. I don't want some of the web pages to be indexed that my
PHP scripts are creating. Is there a tag you know of to prevent this from
happening?

Ron

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

RE: Random Character String

am 05.03.2005 16:45:24 von Bastien Koert

i use this function to generate a random 7 letter password...simple change
to make it 8
function change_password($id, $password)
{
//generate a random password
$pass = "";
$salt = "abchefghjkmnpqrstuvwxyz0123456789";
srand((double)microtime()*1000000);
$i = 0;
while ($i <= 7) {
$num = rand() % 33;
$tmp = substr($salt, $num, 1);
$pass = $pass . $tmp;
$i++;
}
//change the password in the db
$sql = "update cust_info set cust_pw ='".md5($pass)."', temp_pass = 1 where
cust_lg = '$id' and cust_pw = '$password'";
$result = connect($sql);
if ($result){
return $pass;
}else{
change_password($id, $password);
}
}//end function


SQL is case insensitive for most queries. but you can use UPPER or LOWER to
force case to one or the other if you feel its a problem


for the html tag

http://www.robotstxt.org/wc/meta-user.html


bastien


>From: "Ron Piggott"
>To: "PHP DB"
>Subject: [PHP-DB] Random Character String
>Date: Sat, 5 Mar 2005 09:38:35 -0500
>
>Is there a way of generating an 8 character random string in PHP?
>
>Is there a way to ignore UPPER and lower case when you are using the SELECT
>command to find a record in the mySQL table?
>
>I know this isn't an HTML forum ... I have one more question which is more
>HTML in nature. I don't want some of the web pages to be indexed that my
>PHP scripts are creating. Is there a tag you know of to prevent this from
>happening?
>
>Ron
>
>--
>PHP Database 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

Re: Random Character String

am 05.03.2005 17:41:49 von Ron Piggott

The robots that index the web.

Bastien gave me a web site to use for this.

Thanks.

Ron
----- Original Message -----
From: Zareef Ahmed
To: Ron Piggott
Cc: PHP DB
Sent: Saturday, March 05, 2005 11:56 AM
Subject: Re: [PHP-DB] Random Character String


> Hi,
> Look at uniqueid function,
> but it gives some lengthy string. You can use string functiions for
> your specific purpose.
> http://in.php.net/uniqueid
>
> On Sat, 5 Mar 2005 09:38:35 -0500, Ron Piggott
> wrote:
> > Is there a way of generating an 8 character random string in PHP?
> >
> > Is there a way to ignore UPPER and lower case when you are using the
SELECT
> > command to find a record in the mySQL table?
> >
> > I know this isn't an HTML forum ... I have one more question which is
more
> > HTML in nature. I don't want some of the web pages to be indexed that
my
> > PHP scripts are creating. Is there a tag you know of to prevent this
from
> > happening?
>
> what do you mean by indexed here? indexed by whom? search engines?
>
> zareef ahmed
>
> >
> > Ron
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
>
> --
> Zareef Ahmed :: A PHP Developer in India ( Delhi )
> Homepage :: http://www.zareef.net
>

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

Re: Random Character String

am 05.03.2005 17:56:35 von zareef ahmed

Hi,
Look at uniqueid function,
but it gives some lengthy string. You can use string functiions for
your specific purpose.
http://in.php.net/uniqueid

On Sat, 5 Mar 2005 09:38:35 -0500, Ron Piggott
wrote:
> Is there a way of generating an 8 character random string in PHP?
>
> Is there a way to ignore UPPER and lower case when you are using the SELECT
> command to find a record in the mySQL table?
>
> I know this isn't an HTML forum ... I have one more question which is more
> HTML in nature. I don't want some of the web pages to be indexed that my
> PHP scripts are creating. Is there a tag you know of to prevent this from
> happening?

what do you mean by indexed here? indexed by whom? search engines?

zareef ahmed

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


--
Zareef Ahmed :: A PHP Developer in India ( Delhi )
Homepage :: http://www.zareef.net

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