I have updated your code, but not tested. Backup your old file 1st.
Try to adjust where you need to, also i would suggest to work on the if else statements.
<?php
session_start();
//Database Information
$dbhost = "localhost";
$dbname = "masterdb";
$dbuser = "";
$dbpass = "";
//Connect to database
mysql_connect ($dbhost, $dbuser, $dbpass)or die("Error: " .mysql_error());
mysql_select_db($dbname) or die(mysql_error());
$email=mysql_real_escape_string($_POST['email']);
if(!$email){
include 'recover.php';
//echo "";
exit();
}
$query_email = mysql_query("SELECT email FROM db WHERE email='$email'") or die(mysql_error());
$num_email = mysql_num_rows($query_email);
if($num_email != 1){
include 'recover.php';
echo "";
exit();
}
else
{
$sql = mysql_query("SELECT * FROM db WHERE email='$email'") or die(mysql_error());
$result = mysql_query($sql);
// if found e-mail address, row must be 1 row
// keep value
$count = mysql_num_rows($result);
if($count==1){
$rows = mysql_fetch_array($result);
// keep password
$pass = $rows['pass'];
$name = $rows['name'];
}
if($_SESSION['captchaCheck'] != $_POST['providedCaptcha'] && !empty($_SESSION['captchaCheck'])){
// TODO
include 'recover.php';
echo "";
unset($_SESSION['captchaCheck']);
exit();
}
else
{
include 'blank.php';
echo "";
echo '<META HTTP-EQUIV="Refresh" Content="5; URL=index.php">';
}
$yoursite='';
$webmaster='Administrators';
$youremail='';
$subject="Υπενθύμιση Κωδικού Πελάτη";
$message="Αγαπητή/έ $name,
E-Mail: $email
Κωδικός Πελάτη: $pass
Ευχαριστώ,
$webmaster";
mail($email, $subject, $message, "From: $yoursite<$youremail>\nX-Mailer:PHP/" .phpversion());
}
?>