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.
Sign In
Not a member yet? Click here to register.

Ajax Username Availability Check

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,
CodeDownload  
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 :
CodeDownload  
add_to_head("<script type='text/javascript' src='".INCLUDES."ajaxusernamecheck.js'></script>");



4. Now, Search for the below line in register.php :
CodeDownload  
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 :
CodeDownload  
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 :
CodeDownload  
// 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 !!!
Thanks, Ankur!
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.

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
Your code is vulnerable young padavan.
Check the $name carefully.
Any suggestions how to check $name carefully Polarfox?

Teach the guy. heheh

Thanks
Polarfox can you please show me which part of his code is vulnerable?

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]
Woops I also missed the Zip Archive I was looking at his snippits. lol

Thanks man.
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)
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
/*-------------------------------------------------------+
| PHP-Fusion 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]

Quote

Didn't found any meaning

Because it's http://en.wikipedia.org/wiki/Padawan lol :)
@PolarFox : LOL !! :P You have written wrong spellings that why I wasn't able to !!!
BTW, Thanks ..... ;)

@Fangree : Yeah ! That Looks Nice ... :)
Next we need Email checker, yes!

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/
Email checker not needed. Guess why? :)

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

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... ;)
Thread Information
Author
Replies
32 posts
Views
11,118 times
Last Post
Last updated on 8 years ago
You can view all discussion threads in this forum.
You cannot set up a bounty in this discussion thread.
You can start a new discussion thread in this forum.
You cannot reply in this discussion thread.
You cannot start on a poll in this forum.
You cannot upload attachments in this forum.
You can download attachments in this forum.
You cannot up or down-vote on the post in this discussion thread.
Users who participated in discussion: Christian, Craig, smokeman, PolarFox, emilife93, Rolf Mayer, Ankur, Dwaynesoft