Charan Gadhvi International Foundation
[insert_php] function DBVarConv($var)
{
return addslashes(html_entity_decode($var,ENT_COMPAT,’UTF-8′));
}
global $wpdb;
$errors =array();
if(isset($_POST[’email’]) && !empty($_POST[’email’]))
{
$email= $_POST[’email’];
$results = $wpdb->get_results( “SELECT * FROM wp_members where email= ‘”.DBVarConv($email).”‘ or username = ‘”.DBVarConv($email).”‘ “);

if(count($results) == 0)
{
$errors[] = “Please enter valid Email Address/Username.”;
}
else
{
$username = $results[0]->username;
$password = $results[0]->mob_number;
$email = $results[0]->email;

wp_mail($email, “CGIF Forgot Password”, “Your Username\nUsername: “.$username.” and Password: “. $password );
wp_redirect(” http://cgif.org.in/index.php/member_registration/”);
exit;
}
}
echo “

“.implode(” “,$errors).’

‘;
[/insert_php]

Forgot Password