<?php
if (isset ( $_POST ['sub_mail'] ) && $_POST ['checkmail'] == 'mail') {
	$umail = $_POST ['mail'];
	
	$emailcheck = $form_validation->emptyfields ( $umail );
	if ($emailcheck) {
		// print_r($emailcheck);
		$getemail = implode ( ',', $emailcheck );
	} else {
		$email = $umail ['email'];
		$newpass = $generatepass->create ( 30 );
		$encrypt_pass = $password->stringbreak ( $newpass );
		
		$message = "Your New Password is:$newpass";
		$query = $db->get_row ( 'users', array ('email' => $email ) );
		if (isset ( $query ) && $query ['name'] != '') {
			
			$return = $mail->send_email ( $email, $message, $query ['name'], C_NAME, C_EMAIL );
			if ($return === true) {
				$update = $db->update ( 'users', array ('password' => $encrypt_pass ), array ('email' => $email ) );
				$donemail = "<p class='text-error'>&nbsp;Password Send, Please Check Your Email...</p>";
			} else {
				$avin = "<p class='text-error'>&nbsp;Sorry...</p>";
			}
		} else {
			$notfound = "<p class='text-error'>&nbsp;No User Exists With This Email...</p>";
		}
	}
}
?>