Thanks for offering to help! I know it's something small like a ' or a ), but I'm not seeing it.
Here is the whole file:
Code: Select all
<?
// Connect to the MySQL database
$host = "localhost";
$sql_user = "blah";
$sql_pwd = "blah";
$db = "validate_email";
mysql_pconnect("$host","$sql_user","$sql_pwd");
mysql_select_db("$db");
// Query the database and setup a loop. Grab an email and process the sucker.
$query=mysql_query("select * from temp");
while($query_result=mysql_fetch_array($query)) {
$qvar = $query_result["address"];
$id = $query_result["id"];
if (eregi ("^([a-z0-9_]|\\-|\\.)+@(([a-z0-9_]|\\-)+\\.)+[a-z]{2,4}$", $qvar)) {
echo "Syntax is good: $qvar <br>";
mysql_query("update temp set syntax='y',valid='n',already_checked='y' where id='$id'");
echo "Checking email validity now...<br>";
// Explode out the domain name for the user so we can connect to the MX server (if any)
// for that domain and see if this user even exists when we telnet in.
list ($user, $domain) = split ("@", strtolower($qvar), 2);
// Try to telnet to mail server and say hi and send some stuff to confirm account!
$c_smtp = fsockopen ($domain, 25);
if (ereg ("^220", $out=fgets($c_smtp ,1024))) {
fputs ($c_smtp ,"HELO $HTTP_HOST \r\n ");
$out = fgets ($c_smtp ,1024 );
fputs ($c_smtp ,"MAIL FROM: <validate_email@blah.com>\r\n ");
$from = fgets ($c_smtp ,1024 );
fputs ($c_smtp ,"RCPT TO: <$qvar>\r\n ");
$to =fgets ($c_smtp ,1024 );
fputs ($c_smtp ,"QUIT\r\n" );
fclose ($c_smtp);
if (! ereg ("^250" ,$to )) {
// On no RCPT TO hello we break the loop.
echo "Looks like an invalid user.<br>";
mysql_query("update temp set syntax='y', valid='n', already_checked='y' where id='$id'");
}
else {
// Otherwise we have a winner!
echo "Valid user!<br><br>";
mysql_query("update temp set syntax='y', valid='y', already_checked='y' where id='$id'");
}
}
else {
echo "Couldn't connect to the mail server.. moving on.";
mysql_query("update temp set syntax='y', valid='n', already_checked='y' where id='$id'");
}
}
else {
echo "Syntax is bad: $qvar <br>";
mysql_query("update temp set syntax='n',valid='n',already_checked='y' where id='$id'");
}
}
?>
Error is:
Parse error: parse error in /path/validate_emails.php on line 23