Forum Moderators: open

Message Too Old, No Replies

checking to see if a user exists

         

MrGecko

8:44 pm on Jun 8, 2007 (gmt 0)

10+ Year Member



i'm trying to mac a program that will check if a user exists as the user types in a name
here is my script that dose not work
<script type="text/javascript">
function isFolder(sFolderPath) {
var objFSO = new ActiveXObject("Scripting.FileSystemObject");
return objFSO.FolderExists(sFolderPath);
}
function checkuser(x)
{
if isFolder(document.getElementById(x).value) {
document.usernameimg.src='ue.png'
} else {
document.usernameimg.src='ua.png'
}
}
</script>
<input name="username" type="text" size="30" id="username" onchange="checkuser(this.id)"><img name="usernameimg" src="u.png">

please help

mehh

11:04 am on Jun 10, 2007 (gmt 0)

10+ Year Member



we need more info. where are the users kept? a MySql Database? JS file? TXT file? how do you want to access them? AJAX?

MrGecko

3:31 pm on Jun 11, 2007 (gmt 0)

10+ Year Member



i'm changing the way i want to check if the user exist
but i need to know how to see if a text document says true or false
because i have php echo true or false if the user exists or not
this is the url "index.php?page=usertest&username="+username
can any one help me

MrGecko

6:55 pm on Jun 11, 2007 (gmt 0)

10+ Year Member



i found a way to check it now
here is my script
<script type="text/javascript">
function checkuser()
{
var target = document.getElementById("username");
var userc = document.getElementById("userc");
var error = 0;
var coll = document.singupform;
if (target.value!= "") {
var userurl = "index.php?page=usertest&username=" + escape(target.value);
if (window.XMLHttpRequest) {
check = new XMLHttpRequest();
} else if (window.ActiveXObject) {
isIE = true;
check = new ActiveXObject("XMLHTTP");
}
check.onreadystatechange = CheckIfAvailable;
check.open("GET", userurl, true);
check.send(null);
} else {
userc.innerHTML = "<font color=#0000FF>^ Enter Username</font>";
}
}
function CheckIfAvailable() {
var checktext= check.responseText;
if (checktext == "false") {
userc.innerHTML = "<font color=red>Username Unavailable</font>";
} else {
userc.innerHTML = "<font color=green>Username Available</font>";
}
}
</script>