Re: [PHP] Removing Invalid Users

2001-07-04 Thread Steve Werby

"Clayton Dukes" <[EMAIL PROTECTED]> wrote:
> How can I write code that will search the database and check the validity
of
> an email address, and if it's bad, to remove that entry from the database?

Like Tom said, use regex to check the email is of a valid format.  A small
percentage of servers can be contacted to find whether an email address is
valid, but fewer and fewer are allowing this so it's completely unreliable.
You can use getmxrr() to see if a DNS MX record exists corresponding to the
domain.  You'll need explode() to pull out the domain itself from the email
address.  Unfortunately an email address can be valid without having a valid
MX record and also DNS could be unreachable at the exact moment your
requesting it.  It might be better to bypass getmxrr() and use checkdnsrr()
instead to find whether the host exists.  Of course this too could be
unreachable.  If you really want to determine if an email address is valid,
a better strategy may be to send an email to the address with a unique
string in it that must be mailed back or a unique URL that must be visited.
You'd then need a script that's triggered upon receipt of matching emails
and changes a flag in your DB record to designate the email address as valid
or a script in the webpage that does the same.

--
Steve Werby
President, Befriend Internet Services LLC
http://www.befriend.com/


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




Re: [PHP] Removing Invalid Users

2001-07-04 Thread Tom Carter

You can check that the *format* of the address is valid by using regular
expressions.. look at the regular expression pages on php.net (especially
the users comments.. they do exactly that!)

As for checking whether it is a real email or not.. you can't test this
without actually sending them an email (and even then you can't be sure)...
if you could check then it would be too nice for spammers!
What you can do in addition is to check that the domain is a valid domain
(ping?)

HTH,Tom
- Original Message -
From: "Clayton Dukes" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, July 04, 2001 7:16 PM
Subject: [PHP] Removing Invalid Users


> Howdy folks,
>
> How can I write code that will search the database and check the validity
of
> an email address, and if it's bad, to remove that entry from the database?
>
> Here's a dump one of the tables:
>
> INSERT INTO users VALUES
> (1,'','username','[EMAIL PROTECTED]','','','001.gif','Jul 04,
>
2001','','title','location','text','',0,0,'','','','field',10,'',0,0,0,'',0,
> '','Default',4096,0);
>
> ie:
> if the email field is bad (test using sendmail?)
> remove that entry from the database.
>
> How can I do this?
>
> TIA!
>
> Clayton Dukes
> CCNA, CCDA, CCDP, CCNP
> Download Free Essays, Term Papers and Cisco Training from
http://www.gdd.net
>
>
>
>
> --
> PHP General 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 General 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]