Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

Username availability checker

Quote Reply
Username availability checker
Hi,

Did somebody already use a plugin to check if the name of user is already recorded (taken) ?

An example with Ajax : http://ielliott.com/utest.php or http://64.26.31.27/...erName/UserName.aspx

Thanks for your answer.

Mick

Last edited by:

MJ_: Dec 11, 2008, 7:06 AM
Quote Reply
Re: [MJ_] Username availability checker In reply to
Hi,

I did something similar, although not with AJAX (it was an IFRAME, with an onChange() function reloading the frame - when the username was changed)

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
Quote Reply
Re: [Andy] Username availability checker In reply to
Hi Andy,

Thanks for your answer.

Is that perhaps better protected than Ajax ?

You have an example ?

Mick
Quote Reply
Re: [MJ_] Username availability checker In reply to
Hi,

Sorry, "better protected" ???

Quote:
You have an example ?

Just went to the site where I did it, and its coming up with a placeholder for the main page (I seem to remember they put the project on hold, which working on some other stuff - so maybe thats why I'm seeing it).

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
Quote Reply
Re: [Andy] Username availability checker In reply to
Hi Andy,

In fact, Ajax frightens me for security of the database.

Your opinion ?

If not, you have a plugin ?

Mick
Quote Reply
Re: [MJ_] Username availability checker In reply to
Hi,

Something like this should do it (afraid I don't have any more free time to provide exact step by step instructions - so if you stuggle setting it up, lemme know - and I'll try and set it up for you at some point, but may have to charge)

Code:
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>

<%-- add this into your <head></head> section in user_signup.html --%>
<script>
function checkUserAvail(thisuser) {
document.getElementById('inline_check_avail').src = '<%config.db_cgi_url%>/page.cgi?p=user_avail_check;user=' + thisuser;
}
</script>

</head>

<body>

<%-- be sure to add the name="" bit into the form action, otherwise it won't be accessing the right bit of the form =))
<form name="signup_form" action="<%config.db_cgi_url%>/user.cgi">

<%-- add the bit in bold to your signup_form.html template, in the Username field --%>
<input type="text" name="Username" size="20" onkeyup="checkUserAvail(this.value);">

<%-- this is the important bit, as it will change from red to green, depending on if the user is available --%>
<p>
<iframe name="inline_check_avail" name="inline_check_avail" src="<%config.db_cgi_url%>/page.cgi?p=user_avail_check" width="113" height="43" scrolling="no" border="0" frameborder="0">
Your browser does not support inline frames or is currently configured not to display inline frames.
</iframe>
</p>

</form>



</body>

</html>

Then, make a new template called "user_avail_check.html" , with the following:


Code:
<%set isAvail = check_availability_username($user)%>
<html>
<%if isAvail%>
<body bgcolor="green">
<%else%>
<body bgcolor="red">
<%endif%>
</html>

Then, add a new global - called "check_availability_username", with the following code:
Code:
sub {
if (!$_[0]) { return 0; }

if ($DB->table('Users')->count( { Username => $_[0] } ) > 0) { return 0; } else { return 1; }

}

As I said, none of this is really tested (I quickly tested the HTML in Frontpage, but that doesn't guarantee it'll work =))

Hope that helps

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates

Last edited by:

Andy: Dec 11, 2008, 10:11 AM
Quote Reply
Re: [Andy] Username availability checker In reply to
Hi Andy,

That functions perfectly, and that is very astute !

Thanks,

Mick

Quote Reply
Re: [MJ_] Username availability checker In reply to
Hi,

Glad to hear it Angelic

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
Quote Reply
Re: [Andy] Username availability checker In reply to
Hi Andy,

You think that it is possible to obtain 3 conditions ?

0 == No available
1 == Available
' ' == You must indicate a name of user

Thanks,

Mick
Quote Reply
Re: [MJ_] Username availability checker In reply to
Hi,

Sure, just do that in the template. i.e:

Code:
<%set isAvail = check_availability_username($user)%>
<html>
<%if not user%>
<body bgcolor="orange">
<%else%>
<%if isAvail%>
<body bgcolor="green">
<%else%>
<body bgcolor="red">
<%endif%>
<%endif%>
</html>

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
Quote Reply
Re: [Andy] Username availability checker In reply to
It is perfect ! Thanks Smile

Mick