Jump to content

Evilzebra

New Members
  • Posts

    1
  • Joined

  • Last visited

    Never

Everything posted by Evilzebra

  1. On the form page I have <script language="javascript" type="text/javascript"> var xmlHttp function showUser(str) { xmlHttp=GetXmlHttpObject() if (xmlHttp==null) { alert ("Browser does not support HTTP Request") return } var url="check.php" url=url+"?check_user="+str xmlHttp.onreadystatechange=stateChanged xmlHttp.open("GET",url,true) xmlHttp.send(null) } function stateChanged() { if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { document.getElementById("displayConfirm").innerHTML=xmlHttp.responseText } } 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; } </script> <H1 align="center">Login</H1> <form name="form1" method="post" action="index.php?p=login"> <p align="center"> <b>Username:</b><br><input name="username" type="text" id="username" onblur="showUser(this.value);"><div id="displayConfirm"></div> <p align="center"> <b>Password:</b><br><input name="password" type="password" id="password"><br> <a href="index.php?p=forgot">Forgot your password?</a><br><br> <input type="checkbox" name="keep" id="keep">Keep me logged in.<a href="#" onmouseover="Tip('Checking this box will keep you logged in for 30 days.')">[?]</a><br><br> <input class="button" onClick="ajaxFunction();" value="Login" type="button"> </p> </form> And a separate file(check.php) I have <? $loginUsername = $_GET['check_user']; $query = "SELECT * FROM users WHERE Name='$loginUsername'"; $result = mysql_query($query); if($result && mysql_num_rows($result) == 1){ Echo "Username found"; } else { Echo $loginUsername; } ?> When I test out the code it will dynamically print the username as you type it in but it won't seem to find the username in the database. I am using Firefox. I have triple check my DB and it that is all correct.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.