There's a bunch of ways to accomplish what you request.  Therefore, I'll
offer what I would do.   Other folks, more brilliant than, will provide
better ideas.

1.  Do you have access to the mail server?  For instance, I run qmail on my
SOHO system and, therefore, have full sys-admin rights.  If you do, you can
include a unique identifier in the return address.  When the newly-signed
user responds to the email, your mail server could send the email to the
authentication program which would then update the database to reflect a
valid user.

2.  I would search for all users name Fred%:
SELECT username FROM mytable WHERE username LIKE "Fred%" ORDER BY username;

in your PHP program:
$base = "Fred"; //you've set $base from the submitted form
$query = "SELECT username FROM mytable WHERE username LIKE "$base%" ORDER BY
$result = mysql_query($query) or die(...);
if( mysql_num_rows($result) == 0 )
        ... this is a unique name...
        $i = 0; $validname = $base."1";
        while( list($uname) = mysql_fetch_array($result) )
                if( ! strcmp($uname, $validname ) { $i++; $ validname =
$base${i}; }

Therefore, $validname holds the unused user name to suggest.

-----Original Message-----
From: Dave Carrera [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 25, 2002 8:15 AM
Subject: [PHP-DB] 2 related ?'s email & users

Hi All


I hope you can shed some light on the logic behind these 2 issues.


1)       How do I make an email verify type of thing? So user enter
there email address as part of the sign up process and we send an email
to that address. That bit I've got. But how do you check the reply to
the address stored and then activate the account. It's a for online
support manager im writing hence the importance of a verified email

2)       Suggest a Username? I have seen some places that when you put
in an onscreen name and click send it checks against the list of
usernames already stored and if it matches it comes back an error saying
that username already exists but how about this one, which is the name
you chose plus a incremental number. So visitor puts in say "Fred" but
Fred exists and so does Fred up to Fred19. How do I check this and offer
Fred20 as a suggestion.


I hope someone can help with this.


As always I thank you in advance of any help, code samples or pointers.



Dave Carrera

Php Developer



PHP Database Mailing List (
To unsubscribe, visit:

Reply via email to