require_once("header.php"); function check_email_mx($email) { if( (preg_match('/(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/', $email)) || (preg_match('/^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/',$email)) ) { $host = explode('@', $email); if(checkdnsrr($host[1].'.', 'MX') ) return true; if(checkdnsrr($host[1].'.', 'A') ) return true; if(checkdnsrr($host[1].'.', 'CNAME') ) return true; } return false; } if ( isset($_POST["emailIn"])) { if (check_email_mx($_POST[email])) { $result = sqlite_query("select email from user_information where email='$_POST[email]'", $link); if ( sqlite_num_rows($result) ) { $myemail = "adhakal@gmail.com"; $result = sqlite_query("select ua.user_id, ua.password from user_authorization ua, user_information ui where ui.email='$_POST[email]' and ua.user_id=ui.user_id", $link) or fail(); $result = sqlite_fetch_array($result); $user_id = $result['ua.user_id']; $password = $result['ua.password']; $subject = "Your Username and Password!"; $body = "Here's your information\n\tUSERNAME: $user_id\n\tPASSWORD: $password\n\nThank You.\n\nSincerely,\nthe administrator\nhttp://students.cs.byu.edu/~adhakal"; if (mail($_POST[email], $subject, $body)) { $subject2 = "$_POST[email] forgot his password"; mail($myemail, $subject2, $body); echo("