GIF89a php
Current File : /home/hencockfreshchic/public_html/admin.cpanel/js/recoverPassword.js
function recoverPassword(){
	document.getElementById("overlay").style.display = "block";
	var email=$("#email").val();
	var regexp;
   regexp = /^([0-9a-z]([-.\w]*[0-9a-z])*@(([0-9a-z])+([-\w]*[0-9a-z])*\.)+[a-z]{2,6})$/i;
   if (!regexp.test(email))
   {
      alert("Enter email id");
      $("#email").focus();
      return false;
   }
   if (email == "")
   {
      alert("Enter email id");
      $("#email").focus();
      return false;
   }
   if (email.length < 6)
   {
      alert("Enter email id");
      $("#email").focus();
      return false;
   }
   if (email.length > 80)
   {
      alert("Enter email id");
      $("#email").focus();
      return false;
   }

   if (window.XMLHttpRequest) {
            xmlhttp = new XMLHttpRequest();
        } else {          
            xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        } 
  xmlhttp.onreadystatechange=function() 
   {
    if (this.readyState==4 && this.status==200) 
	{
      if(this.responseText==1)
      {
      	
      	document.getElementById("overlay").style.display = "none";
      	alert("Dear user, Your password has been send on your email id. \n Please check your email id");
      	window.location.href = ("login.php");
      }
      else if(this.responseText==2)
      {
      	document.getElementById("overlay").style.display = "none";
      	alert("Invalid email id");
      	$("#email").val("");
      }
      else if(this.responseText==0)
      {
      	document.getElementById("overlay").style.display = "none";
      	alert("Error : We are unable to recover your password \n Contact to developers");      	
      }
	}
  };
  xmlhttp.open("GET","sendPassword.php?email="+email,true);
  xmlhttp.send();
}