﻿// JavaScript Document
function GetXmlHttpObject()
{
var xmlHttp=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp;
}


var xmlHttp;
function CheckMemberLogin(uname,passwd,rem,siteurl)
{ 
	xmlHttp=GetXmlHttpObject();
	
	if (xmlHttp==null){
		alert ("Your browser does not support AJAX!");
		return;
	} 
	var url=siteurl+"checklogin.php?uname="+uname+"&passwd="+passwd+"&rem="+rem;	
	xmlHttp.onreadystatechange=function(){
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{ 	
			var result=xmlHttp.responseText;
			var reg = result.split("name");
			if(result=="blank"){
					alert("Lütfen kullanıcı adinizi ve sifrenizi girin.");
			}else if(result=="NO"){
					alert("Böyle bir kullanıcı bulunmamaktadir. Lütfen tekrar deneyin.");
			}else if(result=="Inactive"){
				alert("Yönetim tarafindan durduruldunuz, lütfen sorulariniz için buzla yönetimiyle temasa geçin.");
			}else if(result=="Confirm"){
				alert("Üyeliginizi baslatmak için lütfen e-posta adresinizi onaylayin.");
			}else if(result=="Password"){
				alert("Lütfen dogru sifreyi girin.");
			}else{
				if(reg[1]==siteurl+"registration.php"){
					window.location.href='uye/'+reg[0];
					//window.location.href=siteurl+'index.php';
				}else{
					//window.location.href=reg[1];
					window.location.href=window.location.href;
					//window.location.href=siteurl+'index.php';
				}
			}
		}
	}
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}