PHP ajax login form using Jquery

Because a lot of responses to the previous post php ajax tutorial create ajax based login form using jquery, and asking about some bug fixxing incl IE bugs, i decide to create a new PHP ajax login functionality using Jquery, and here it is…
Whats new?
- Completely recoded
- Tested in IE6, FF3, Opera9 and i think should be worked in other modern browsers as well
- Easliy switch the data source between database and PHP array
- Login authentication can be using username or email, or even both of ‘em by changing the config
- Automattic redirection could be done within the javascript config
- Redirect target (on success) can be changed in config file
- Message and Text controled by array variable which could be changed in 1 file

dependency:
- Jquery 1.2.3, never tested with the prior version
- PHP5, If you running prior version then you need to make some changes, probably but not limited at class constructor to make it compatible with your PHP version.
How to?
- Switch the data source : Turn the value of USEDB constant in login.config.php into true, and modify the db_config array values as needed, to use array vars turn it false and modify the user_config array values
- change the authentication method : change the LOGIN_METHOD constant value, possible values:
- user : match the username and password
- email : match the user email and password
- both : match the username or user email and password
- switch automattic redirection : turn the value of autoRedir var in login.js to true
- change the redirect target : change the value of SUCCESS_URL constant in login.config.php, for example you need to automatically redirect to user profile, so change it into “index.php?profile=”.$_SESSION['exp_user']['username']
- change error message and text : change the array values accordingly at login.lang.php
Notes:
- Thanks to John resig and the jquery developer team, thanks guys you made my life easier
- Please do not link to the download file directly, link to this page instead
- This script is absolutely free, credits nor link is not required but will be great if this site got ‘em
Demo & Download
- The demo available here use admin|admin@localhost|123456 as the test account
- Download the source again please do not link to the file directly, link to this page instead.
SQL
CREATE TABLE `tbl_user` ( `userid` integer (11) NOT NULL AUTO_INCREMENT , `username` varchar (50) NOT NULL, `useremail` varchar (100) NOT NULL, `userpassword` varchar (50) NOT NULL, PRIMARY KEY (`userid`) ) TYPE=MyISAM CHARACTER SET utf8 COLLATE utf8_general_ci; BEGIN; INSERT INTO `tbl_user` (`userid`, `username`, `useremail`, `userpassword`) VALUES(1, 'admin', 'admin@chazzuka.com', 'e10adc3949ba59abbe56e057f20f883e'); INSERT INTO `tbl_user` (`userid`, `username`, `useremail`, `userpassword`) VALUES(2, 'user', 'user@chazzuka.com', 'e10adc3949ba59abbe56e057f20f883e'); COMMIT;
The Jquery file can be downloded at jquery.com If you found something doesnt work as expected just let me know.
Update
Bug in google chrome beta which reported by Azo has fixed, the problem is caused by 2 byte chunk data in ajax JSON response which makes the response not valid JSON format, those chunks produced by files which include (required) in login.post.php (“login.lang.php” & “login.class.php”).
Now worked in IE6+, FF 2+, Opera 9+, Safari 3+ (for windows), Google Chrome beta





Hey there! I could have sworn I’ve been to this blog before but after checking through some of the post I realized it’s new to me. Nonetheless, I’m definitely delighted I found it and I’ll be book-marking and checking back frequently!
Survival Kit Container_Closed ViewBuilding a quality survival kit that has quality equipment and supplies. Then I started looking at survival due to some reasons I wont go into here but let us just say I though and still think we might need it in the near future. A few examples of what you may find useful: Repair a broken lace on a boot or pack. One of the most important tools to carry in your camping gear. Keep a survival tent in your survival preparedness kits.
My partner and I stumbled over here coming from a different page and thought I might as well check things out. I like what I see so now i’m following you. Look forward to checking out your web page yet again.
Just desire to say your article is as astonishing. The clearness to your publish is just spectacular and that i can suppose you are an expert in this subject. Fine with your permission allow me to grab your feed to stay updated with impending post. Thank you 1,000,000 and please keep up the enjoyable work.
I do not even know the way I stopped up here, however I believed this submit was good. I do not realize who you might be but certainly you’re going to a well-known blogger in case you aren’t already. Cheers!
But you require real amount of money and time to moving to be several dissimilar slipways in which one can apply facebook likes commercialising to their advantage. The likes besides maped out to relationship status, figure are up 30 per centum concluded the terminal five years, which she credited to Bloomberg’s tries.
Thanks for sharing your thoughts on web 2.0. Regards
I recommend buying white cord and then dying it bright red or orange so that you can carry in your survival kits.
The kit is meant for a single user, but many of the things that go with that make it special. Since the forend removes easily, it’s just as quick to install the sling stud with the forend detached. Just about anything in your survival preparedness kit, then you grew up camping and find great solace in nature, and go through withdrawals without your fill of the great outdoors.
I got this website from my buddy who told me about this website and now this time I am visiting this website and reading very informative articles at this time.
At this time I am going away to do my breakfast, afterward having my breakfast coming over again to read additional news.
My brother suggested I may like this website. He was totally right. This publish truly made my day. You can not imagine just how much time I had spent for this information! Thanks!
Survival Gear should include enough water and food that can last for about 3 days per person. This was one of the few survival gear designed to be carried in a pocket, but it does require a stationary object to provide its support.
Howdy! This is my first comment here so I just wanted to give a quick shout out and say I truly enjoy reading through your articles. Can you suggest any other blogs/websites/forums that deal with the same topics? Thanks for your time!
Have you ever thought about writing an ebook or guest authoring on other blogs? I have a blog centered on the same subjects you discuss and would really like to have you share some stories/information. I know my subscribers would value your work. If you are even remotely interested, feel free to shoot me an e-mail.
I’m gone to say to my little brother, that he should also pay a visit this blog on regular basis to obtain updated from newest gossip.
Hi there! This article couldn’t be written any better! Looking at this post reminds me of my previous roommate! He continually kept preaching about this. I most certainly will send this article to him. Fairly certain he’s going to have a great read. I appreciate you for sharing!
I think the admin of this web page is actually working hard for his web page, for the reason that here every material is quality based stuff.
Hi! I’m at work surfing around your blog from my new apple iphone! Just wanted to say I love reading through your blog and look forward to all your posts! Keep up the great work!
What’s up, I want to subscribe for this blog to obtain hottest updates, therefore where can i do it please assist.
Its like you read my mind! You seem to know a lot about this, like you wrote the book in it or something. I think that you can do with some pics to drive the message home a bit, but other than that, this is fantastic blog. A great read. I’ll certainly be back.