Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Not a member yet? Click here to register.
Forgot Password?

Ajax Username Availability Check

Asked Modified Viewed 12,981 times
A
Ankur
A
Ankur 10
Hi! Its me, Ankur Thakur! smile
  • Veteran Member, joined since
  • Contributed 1,277 posts on the community forums.
  • Started 60 threads in the forums
  • Started this discussions
asked
Veteran Member

Ajax Username Availability Check


About : This will add an Automated Function into the Registration, which will show to User, if the Username is Available or Not.

Live Demo : www.clan-icsl.com/register.php

Installation :

1. Download the File: http://rapidshare.com/files/444233372...cludes.zip and upload the files to the includes folder.

2. Backup your Original register.php and then Edit register.php.

3. After the First 4 Lines, i.e,
require_once "maincore.php";
require_once THEMES."templates/header.php";
include LOCALE.LOCALESET."register.php";
include LOCALE.LOCALESET."user_fields.php";


Add after the above code :
add_to_head("<script type='text/javascript' src='".INCLUDES."ajaxusernamecheck.js'></script>");


4. Now, Search for the below line in register.php :
echo "<td class='tbl'><input type='text' name='username' maxlength='30' class='textbox' style='width:200px;' /></td>\n";


Change this Line to the given below line :
echo "<td class='tbl'><input type='text' name='username' maxlength='30' id='username' class='textbox' style='width:200px;' /><div id='usernamecheckstatus'><img src='".IMAGES."checking.gif' width='0' height='0' /></div></td>\n";


5. Now Search for the text closetable(); in the file. After this line, add the below code :
// Code Added for Automatic Username Availability Check
echo "<script type='text/javascript' src='".INCLUDES."typewatch.js'></script>";
echo "<script type='text/javascript'>$('#username').typeWatch( { wait: 1000, captureLength: 3, highlight:false, callback:checkingname } );</script>";
// Code Ends Here


All Settings are Done !!!

Now, Upload the image www.clan-icsl.com/images/checking.gif into images folder.
Or you can also make your Own Loading Image yourself from http://ajaxload.info/. I advice you to not to use Transparent Background image as it doesn't displays much good(reduced alpha) kind of image. So, it is better to use the background color of your page as your background color in the Loading image while making it throught this website.

Also, you can adjust the Text displayed from the filde includes/ajaxusernamecheck.php

Done !!!

Have Fun !!!
Edited by Ankur on 24-01-2011 08:33,
0 replies

31 posts

R
Rolf Mayer
R
Ex
  • Senior Member, joined since
  • Contributed 391 posts on the community forums.
  • Started 7 threads in the forums
answered
Senior Member

Thanks, Ankur!
0 replies
C
Craig
C
Craig 14
  • Fusioneer, joined since
  • Contributed 4,462 posts on the community forums.
  • Started 212 threads in the forums
answered
Fusioneer

You don't need this....

[syntaxhighlighter brush=php,first-line=1,highlight=0,collapse=false,html-script=false]echo "<script type='text/javascript' src='".INCLUDES."jquery1.2.1.js'></script>";[/syntaxhighlighter]

Jquery is already in the core.
0 replies
A
Ankur
A
Ankur 10
Hi! Its me, Ankur Thakur! smile
  • Veteran Member, joined since
  • Contributed 1,277 posts on the community forums.
  • Started 60 threads in the forums
  • Started this discussions
answered
Veteran Member

Quote

Ypsilon wrote:
Thanks

No Problem !!!!!


[quote]Fangree_Craig wrote:
You don't need this....

[syntaxhighlighter brush=php,first-line=1,highlight=0,collapse=false,html-script=false]echo "<script type='text/javascript' src='".INCLUDES."jquery1.2.1.js'></script>";[/syntaxhighlighter]

Jquery is already in the core.


Oh Ya !!!

Its there B) Didn't tested without it as it is working with it too...

But please remobe if it work with the jquery given in the core in case to ignore the overlapping of functions... :P
Edited by Ankur on 23-01-2011 19:08,
0 replies
P
PolarFox
P
  • Veteran Member, joined since
  • Contributed 1,633 posts on the community forums.
  • Started 29 threads in the forums
answered
Veteran Member

Your code is vulnerable young padavan.
Check the $name carefully.
0 replies
C
Craig
C
Craig 14
  • Fusioneer, joined since
  • Contributed 4,462 posts on the community forums.
  • Started 212 threads in the forums
answered
Fusioneer

Any suggestions how to check $name carefully Polarfox?

Teach the guy. heheh

Thanks
Edited by Craig on 23-01-2011 20:55,
0 replies
P
PolarFox
P
  • Veteran Member, joined since
  • Contributed 1,633 posts on the community forums.
  • Started 29 threads in the forums
answered
Veteran Member

0 replies
C
Craig
C
Craig 14
  • Fusioneer, joined since
  • Contributed 4,462 posts on the community forums.
  • Started 212 threads in the forums
answered
Fusioneer

Polarfox can you please show me which part of his code is vulnerable?
0 replies
C
Christian
C
Best regards,
Christian Damsgaard Jørgensen.
  • Member, joined since
  • Contributed 125 posts on the community forums.
  • Started 4 threads in the forums
answered
Member

Quote

PolarFox wrote:
Your code is vulnerable young padavan.
Check the $name carefully.

What variable are you referring to? I don't see any variable called $name wink

The code snippet should not be vulnerable smile

EDIT: Wooups, I missed the ZIP archive - you're right... nice spot wink
ajaxusernamecheck.php, line 26:
[syntaxhighlighter brush=php,first-line=1,highlight=0,collapse=false,html-script=false]$name = $_POST['username'];[/syntaxhighlighter]
That should do the trick:
[syntaxhighlighter brush=php,first-line=1,highlight=0,collapse=false,html-script=false]$name = stripinput($_POST['username']);[/syntaxhighlighter]
Edited by Christian on 23-01-2011 21:48,
0 replies
C
Craig
C
Craig 14
  • Fusioneer, joined since
  • Contributed 4,462 posts on the community forums.
  • Started 212 threads in the forums
answered
Fusioneer

Woops I also missed the Zip Archive I was looking at his snippits. lol

Thanks man.
0 replies
A
Ankur
A
Ankur 10
Hi! Its me, Ankur Thakur! smile
  • Veteran Member, joined since
  • Contributed 1,277 posts on the community forums.
  • Started 60 threads in the forums
  • Started this discussions
answered
Veteran Member

Oh My God !!! :o

As I already know myself, that I am not Good in PHP and Ajax, I should not have posted this before revising atleast 5 times... :|

Whatever, But this made me know about my mistake ... B)

By the Way, Thanks to you all Guys, for Noticing and Reporting and Giving the Solution... :D

DOWNLOAD UPDATED
- Removed the jquery file from the Archive as it is already in Core.

Quote

PolarFox wrote:
Your code is vulnerable young padavan.

Sorry ! Didn't found any meaning for the word padavan on Google. Whats the meaning ? :P

Quote

Fangree_Craig wrote:
Teach the guy. heheh

Yeah !!! You Guys have to Teach me PHP now ! ;)

Thanks PMM B)
Edited by Ankur on 24-01-2011 08:38,
0 replies
C
Craig
C
Craig 14
  • Fusioneer, joined since
  • Contributed 4,462 posts on the community forums.
  • Started 212 threads in the forums
answered
Fusioneer

Nice Ankur and here is my interpretation of this.

I have added icons.

Upload these icons to root/images/
www.fangree.co.uk/images/available.gif www.fangree.co.uk/images/unavailable.gif

ajaxusernamecheck.php
[syntaxhighlighter brush=php,first-line=1,highlight=0,collapse=false,html-script=false]<?php
/*-------------------------------------------------------+
| PHPFusion Content Management System
| Copyright (C) 2002 - 2010 Nick Jones
| http://www.php-fusion.co.uk/
+--------------------------------------------------------+
| Filename: ajaxusernamecheck.php
| Author: Ankur Thakur
| Web: http://www.php-fusion.in/
| Web: http://www.clan-icsl.com/
| Web: http://ankurthakur.co.cc/
+--------------------------------------------------------+
| Modified by Fangree Productions
| Site: http://www.fangree.co.uk
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/


include "../maincore.php";

if ((isset($_POST['username']) && is_string($_POST['username']))) {

$username = stripinput($_POST['username']);
$result = dbquery("SELECT * FROM ".DB_USERS." WHERE user_name='".$username."'"wink;

if (dbrows($result)>0){

echo " <img src='images/unavailable.gif' alt='Unavailable' style='border: 0px; padding-right: 3px; padding-top: 2px; vertical-align: middle; /> <br /><span style=\"color: #ff0000;\">Username Not Available</span>";
}else{
echo " <img src='images/available.gif' alt='Available' style='border: 0px; padding-right: 3px; padding-top: 2px; vertical-align: middle; /><br /> <span style=\"color: #00ff00;\">Username Available</span>";
}
}else{
echo "<span style=\"color: #ff0000;\"><b>Access Denied !</b></span>";
}


?>[/syntaxhighlighter]
Edited by Craig on 24-01-2011 10:00,
0 replies
P
PolarFox
P
  • Veteran Member, joined since
  • Contributed 1,633 posts on the community forums.
  • Started 29 threads in the forums
answered
Veteran Member

Quote

Didn't found any meaning

Because it's http://en.wikipedia.org/wiki/Padawan lol :)
0 replies
A
Ankur
A
Ankur 10
Hi! Its me, Ankur Thakur! smile
  • Veteran Member, joined since
  • Contributed 1,277 posts on the community forums.
  • Started 60 threads in the forums
  • Started this discussions
answered
Veteran Member

@PolarFox : LOL !! :P You have written wrong spellings that why I wasn't able to !!!
BTW, Thanks ..... ;)

@Fangree : Yeah ! That Looks Nice ... :)
0 replies
C
Craig
C
Craig 14
  • Fusioneer, joined since
  • Contributed 4,462 posts on the community forums.
  • Started 212 threads in the forums
answered
Fusioneer

Next we need Email checker, yes!
0 replies
A
Ankur
A
Ankur 10
Hi! Its me, Ankur Thakur! smile
  • Veteran Member, joined since
  • Contributed 1,277 posts on the community forums.
  • Started 60 threads in the forums
  • Started this discussions
answered
Veteran Member

Quote

Fangree_Craig wrote:
Next we need Email checker, yes!


Hmm... ! But Normally in registration, only Usernames are checked. Byt the way, you can implement that for email checker too... B)

But I am currently searching for a JS for the Registrations field to check if the Details entered are correct or not...
Ex: email is : something@something.com ..... not something@something etc etc !!! ;)

Ex: Live Validation kind of thing which will do this checking on the spot...
http://andreaslagerkvist.com/jquery/l...alidation/
Edited by Ankur on 24-01-2011 14:45,
0 replies
P
PolarFox
P
  • Veteran Member, joined since
  • Contributed 1,633 posts on the community forums.
  • Started 29 threads in the forums
answered
Veteran Member

Email checker not needed. Guess why? :)
0 replies
A
Ankur
A
Ankur 10
Hi! Its me, Ankur Thakur! smile
  • Veteran Member, joined since
  • Contributed 1,277 posts on the community forums.
  • Started 60 threads in the forums
  • Started this discussions
answered
Veteran Member

Quote

PolarFox wrote:
Email checker not needed. Guess why? :)


Hmm... !!! Thinking but not getting the Exact point www.php-fusion.in/images/smiley/confused.gif , that why there isn't any need....

May be, so that the E-Mails would not be Public/Leak for Misuse.... :P

Don't know......... :( You tell ...... :P
0 replies
E
emilife93
E
  • Member, joined since
  • Contributed 176 posts on the community forums.
  • Started 49 threads in the forums
answered
Member

Quote

Ankur wrote:

1. Download the File: http://rapidshare.com/files/444233372...cludes.zip and upload the files to the includes folder.



why i cannot download?
0 replies
A
Ankur
A
Ankur 10
Hi! Its me, Ankur Thakur! smile
  • Veteran Member, joined since
  • Contributed 1,277 posts on the community forums.
  • Started 60 threads in the forums
  • Started this discussions
answered
Veteran Member

Quote

emilife93 wrote:

Quote

Ankur wrote:

1. Download the File: http://rapidshare.com/files/444233372...cludes.zip and upload the files to the includes folder.



why i cannot download?


My Friend, the Link is Public and you can Download it. Please wait for the rapidshare page to load as it don't show the file until the page is loaded... ;)
0 replies

Labels

None yet

Statistics

  • Views 0 views
  • Posts 31 posts
  • Votes 0 votes
  • Topic users 8 members

8 participants

C
C
Best regards,
Christian Damsgaard Jørgensen.
  • Member, joined since
  • Contributed 125 posts on the community forums.
  • Started 4 threads in the forums
C
C
Craig 14
  • Fusioneer, joined since
  • Contributed 4,462 posts on the community forums.
  • Started 212 threads in the forums
S
S
  • Veteran Member, joined since
  • Contributed 920 posts on the community forums.
  • Started 79 threads in the forums
P
P
  • Veteran Member, joined since
  • Contributed 1,633 posts on the community forums.
  • Started 29 threads in the forums
E
E
  • Member, joined since
  • Contributed 176 posts on the community forums.
  • Started 49 threads in the forums
R
R
Ex
  • Senior Member, joined since
  • Contributed 391 posts on the community forums.
  • Started 7 threads in the forums
A
A
Ankur 10
Hi! Its me, Ankur Thakur! smile
  • Veteran Member, joined since
  • Contributed 1,277 posts on the community forums.
  • Started 60 threads in the forums
  • Started this discussions
D
D
  • Newbie, joined since
  • Contributed 1 post on the community forums.

Notifications

Track thread

You are not receiving notifications from this thread.

Related Questions

Not yet