• Home
  • Services
  • Profile
  • Portfolio
  • Contact
  • Links
  • Blog
  • Archives
  • Sitemap
Subscribe: Posts | Comments | E-mail
  • Ajax XMLHttpRequestAsynchronous HTTP Request How To's
  • FreebiesBest Freebies Collection
  • MiscellaneousNews, Announcements & General Stuffs
  • Print & Web DesignPhotoshop, Vector, CSS, XHTML
  • ProgrammingProgramming PHP, ASP, .NET and more

Bali Web Design

Posted on August 17, 2008 - by webmaster

PHP ajax login form using Jquery

Ajax XMLHttpRequest Freebies Programming Tutorials Web 2.0

ajax stuffs

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

Share this article:
  • Digg
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • LinkedIn
  • MySpace
  • Ping.fm
  • Pownce
  • Slashdot
  • StumbleUpon
  • Technorati
  • Tumblr
  • TwitThis
This entry was posted on Sunday, August 17th, 2008 at 00:32 and is filed under Ajax XMLHttpRequest, Freebies, Programming, Tutorials, Web 2.0. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

108 Comments

We'd love to hear yours!



  1. Visit My Website

    August 17, 2008

    Permalink

    php ajax tutorial create ajax based login form using jquery said:

    [...] have update the php ajax login to fix some bugs that exists, can be found here. Bookmark [...]



  2. Visit My Website

    August 21, 2008

    Permalink

    Website Designer | Mike said:

    I’m such a huge fan of Jquery, it’s been a blessing in disguise of us on many a project.



  3. Visit My Website

    August 27, 2008

    Permalink

    apex said:

    how to set the session limit?



  4. Visit My Website

    September 1, 2008

    Permalink

    Craig said:

    Hi, I just uploaded all this to my test site. All I get is a loading …. message in the upper left corner. When I debug this, I notice it never steps into the $.getJSON(postFile, function(data){ ….. code of the login.js file. I also had to include the jquery.js file in the root of the dir as it was not in the download file. Any suggestions? Thanks, Craig.



  5. Visit My Website

    September 1, 2008

    Permalink

    demonita said:

    @apex
    you could find the answer at http://www.captain.at/howto-php-sessions.php, provides a great tutorial dealing with php session along with sample codes.

    @craig
    it is never reach? or never return correct data?, try to use firebug to trace the error, it is important to ESCAPE the returned data including the HTML FORM because it will be proccessed through javascript.



  6. Visit My Website

    September 1, 2008

    Permalink

    Craig said:

    Thanks demonita,
    You are right, there is something wrong in the return data. The file that gets loaded on the getJSON call is: login.post.php.
    Near the top of that file are these lines:

    require(‘login.config.php’);
    require(‘login.lang.php’);
    require(‘login.class.php’);

    It is corrupting the return data when it includes the login.class.php file. If I comment out lines this login.class.php file, it fails on the first public function statement (all of them actually).

    Does anyone have any ideas? My server is using PHP ver. 5.2.5.

    Thanks for your help,

    -Craig.



  7. Visit My Website

    September 2, 2008

    Permalink

    demonita said:

    @craig
    if you comment out the class include statement, you loose all functionality required in the server process, is there any error message as guidelines?, again use firebug to track the response data to see the error message, also the simple thing make sure VALID_ACL_ is defined.



  8. Visit My Website

    September 2, 2008

    Permalink

    Craig said:

    Understood, I was commenting things out to see where they fail. I will try firebug later today.



  9. Visit My Website

    September 2, 2008

    Permalink

    Craig said:

    Still not working for me demonita. I installed firebug but do not know how to use it well enough to make any sense of anything. I know from my previous debugging efforts there is something wrong when $.getJSON call includes that class file. Also, you are missing a jquery.js file from rar file.



  10. Visit My Website

    September 2, 2008

    Permalink

    Craig said:

    Here’s an error if you’re interested:

    Error: uncaught exception: [Exception... "Component returned failure code: 0x80070057 (NS_ERROR_ILLEGAL_VALUE) [nsIWebNavigation.loadURI]” nsresult: “0×80070057 (NS_ERROR_ILLEGAL_VALUE)” location: “JS frame :: chrome://global/content/viewSource.js :: viewSource :: line 156″ data: no]



  11. Visit My Website

    September 3, 2008

    Permalink

    demonita said:

    Thats not the correct error message i think, well you need to verify the returned data, do not use ajax first let the form submitted in normal HTTP POST and see if it is works.

    if it is worked then you may have “NOT JS SAFE” data format, or you can send me your codes.



  12. Visit My Website

    September 3, 2008

    Permalink

    Craig said:

    Demonita, all I did was download your code and upload to my server. Here’s the link below. I know that the repsonsse is bad from getJSON, but my point is, I have not changed the code. Also, as I have explained, the jquer.js file is not included in the rar file. I had to download my own, I could not get the 1.2 ver. Do you think this is the problem. Here’s the link:

    http://www.craigdobson.com/aba/php/portal/src/login.html



  13. Visit My Website

    September 4, 2008

    Permalink

    demonita said:

    @Craig
    you stated uyour server running PHP 5.2.x, but here the error saying that you are running old version of PHP

    syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR

    Thats the error i found, thats is because the access modifier at login class not recognize by prior PHP version



  14. Visit My Website

    September 4, 2008

    Permalink

    Craig said:

    Thanks demonita. I removed the access modifiers and it works! My provider claims php 5.2.5 is installed. I’ll check with them to make sure this is indeed the case. Thank you very much for the help. –Craig



  15. Visit My Website

    September 9, 2008

    Permalink

    Azo said:

    I’ve tried the demo 9http://www.chazzuka.com/experiments/php-ajax-login/login.html) using Chrome browser, “loading” text seems forever & the login form never load.



  16. Visit My Website

    September 9, 2008

    Permalink

    demonita said:

    yes you’re right, but unfortunately i didnt know how to javascript debugging in chrome as i used firebug in FF

    and dont forget it is still in beta version, but i will try to investigate further this issue



  17. Visit My Website

    September 9, 2008

    Permalink

    demonita said:

    Tested well in :
    FF 3, IE6, IE7, Opera 9+, Safari for Windows 3.1+

    Still Failed in Google Chrome Beta



  18. Visit My Website

    September 17, 2008

    Permalink

    Rick said:

    That SQL file:

    1.
    CREATE TABLE `tbl_user`
    2.
    (
    3.
    `userid` integer (11) NOT NULL AUTO_INCREMENT ,
    4.
    `username` varchar (50) NOT NULL,
    5.
    `useremail` varchar (100) NOT NULL,
    6.
    `userpassword` varchar (50) NOT NULL,
    7.
    PRIMARY KEY (`userid`)
    8.
    ) TYPE=MyISAM CHARACTER SET utf8 COLLATE utf8_general_ci;
    9.

    10.
    BEGIN;
    11.
    INSERT INTO `tbl_user` (`userid`, `username`, `useremail`, `userpassword`) VALUES(1, ‘admin’, ‘admin@chazzuka.com’, ‘e10adc3949ba59abbe56e057f20f883e’);
    12.
    INSERT INTO `tbl_user` (`userid`, `username`, `useremail`, `userpassword`) VALUES(2, ‘user’, ‘user@chazzuka.com’, ‘e10adc3949ba59abbe56e057f20f883e’);
    13.
    COMMIT;

    where can i make that?
    And is that jquery the same as that sql file?



  19. Visit My Website

    September 17, 2008

    Permalink

    Rick said:

    okey, the jquery is okey now. But how can i make that sql file?



  20. Visit My Website

    September 17, 2008

    Permalink

    demonita said:

    @Rick
    Simply create a database in your mysql server, then copy paste those SQL command in the query browser or SQL command line. if you’r using PHPMyAdmin then it would be easy.



  21. Visit My Website

    September 21, 2008

    Permalink

    Komang said:

    #Azo

    Bug at google chrome beta has fixed, no worked in IE6+, FF 2+, Opera 9+, Safari 3+, and Google Chrome.



  22. Visit My Website

    October 12, 2008

    Permalink

    jktaguswebid said:

    Tutorial yang bagus sekali chazzuka…Acung jempol buat Anda!



  23. Visit My Website

    October 17, 2008

    Permalink

    william said:

    Great script – newbie question… is it possible to show the user that is currently logged in?



  24. Visit My Website

    October 17, 2008

    Permalink

    william said:

    Great tutorial! Is it possible to show the current logged in user after they successfully login?



  25. Visit My Website

    October 17, 2008

    Permalink

    ari said:

    I’d suggest using session cookies instead of sessions, as they are much more secure.



  26. Visit My Website

    October 21, 2008

    Permalink

    Tyler said:

    Okay, i got it working, but what about profiles? cause u said something up above about redirecting to a profile, or was that an example. And how do u register? or make new accs? Cause i’m so confused.

    Email: badblindboy13@comcast.net

    Please help =(



  27. Visit My Website

    November 12, 2008

    Permalink

    steve said:

    Can you help me out with whatever changes need to be made for PHP 4.4.1?

    I don’t understand what “craig” did above to fix this problem.

    stupid webhost has older version running.

    thanks!



  28. Visit My Website

    November 19, 2008

    Permalink

    Symbioxys said:

    I’m also facing a problem with the host running PHP < 5, any tips would be great.

    Thanks!



  29. Visit My Website

    November 20, 2008

    Permalink

    Symbioxys said:

    @Steve

    In the login.class.php, change the properties to var instead of private and delete all the public and private keywords in the methods in that file.

    My problem now is that I get a redirect loop.



  30. Visit My Website

    November 25, 2008

    Permalink

    rodrigopoloDOTcom said:

    WebKit sucks parsing Dynamic XML, I had ‘parererror’ problem and I found it was because Gzip…

    The SOLUTION in PHP, add the fallowing code in your PHP code:

    header(‘Content-Type: application/xml’);
    ob_start(‘ob_gzhandler’);

    another problem reasons could be that your dynamic XML is not a real XML, my advice for tests:

    Use Firefox and Firebug
    save your dynamic XML in the same dir where is your dyamic one
    open both, the dynamic and the saved on firefox
    check if the headers look the same

    good luck.



  31. Visit My Website

    December 3, 2008

    Permalink

    JP said:

    Demonita,

    The login doesnt work on firefox 3.0.4

    Help please!



  32. Visit My Website

    December 15, 2008

    Permalink

    ARTI said:

    Wow it is cool and very estetic. Thanks you my friends. This is very nice and usefully. Thanks again.



  33. Visit My Website

    December 16, 2008

    Permalink

    Scream said:

    works fine here…



  34. Visit My Website

    December 21, 2008

    Permalink

    retrolaser said:

    Thanks for this great script it works perfectly and looks very good!
    I was just wondering if you know how to display the username once logged in … I tried using but to no avail… Thanks!



  35. Visit My Website

    December 21, 2008

    Permalink

    retrolaser said:

    hum… the code in my previous post didn’t show up it was : echo $_SESSION['user'];



  36. Visit My Website

    December 23, 2008

    Permalink

    joseph said:

    hello am looking for this kind of login form but the idea is i want it to show when the user click on a button to load to another page and this login form shows as a popup could it happend ?? am new in web dev any help please.



  37. Visit My Website

    January 1, 2009

    Permalink

    dr.emi said:

    hi…… bali web designer :)
    I love your tutorials, you looks likely a cool coder

    Thanks for share, Your form login is really usefull :)

    Keep rock and roll \m/



  38. Visit My Website

    January 8, 2009

    Permalink

    DrZeeshan said:

    Its a great script. Thanks.

    Can you please tell me how to set different user levels? I mean for ‘admin’ full access is available but for ‘user’ only selected feature of the website is available.

    Regards,
    MZ



  39. Visit My Website

    January 16, 2009

    Permalink

    phil said:

    having trouble with the redirect. i am trying to use the example above. For some reason the php is broken when i try to use the following:

    define(‘SUCCESS_URL’, “index.php?id=”.$_SESSION['exp_user']['username']);

    I am using email instead of username to validate -

    but this doesn’t work either

    define(‘SUCCESS_URL’, “index.php?id=”.$_SESSION['exp_user']['email']);

    in fact i can not use any of the _SESSION variables in there and have the page load.

    any ideas?



  40. Visit My Website

    January 17, 2009

    Permalink

    phil said:

    Ok I figured this one out. Instead of appending querystring data which could be insecure, i decided to try to just call the session variables on the index.php page.

    $Profile = $_SESSION['exp_user']['ID'];

    With the exp_user variable any field in your user table is accessable. Very nice!

    Just a confirmation that I could not get it to work on the Querystring but I think this is a much better method.

    Hope this helps someone!



  41. Visit My Website

    January 20, 2009

    Permalink

    carscx said:

    Hi! The script works OK, but I can’t create new users and modifiy passwords. What encriptation is? I need help. Thank you.



  42. Visit My Website

    January 27, 2009

    Permalink

    Komang said:

    @41 simple md5 encryption



  43. Visit My Website

    January 29, 2009

    Permalink

    Big said:

    hi : when a reeplace the SUCCESS_URL …
    define(‘SUCCESS_URL’, ‘“index.php?profile=”.$_SESSION['exp_user']['username']‘);

    Parse error: syntax error, unexpected T_STRING in login.config.php on line 15
    _______________

    i need a especific page for a couple users . tnx



  44. Visit My Website

    January 29, 2009

    Permalink

    Komang said:

    You put the wrong single quotes
    define(“SUCCESS_URL”, “index.php?profile={$_SESSION['exp_user']['username']}”);



  45. Visit My Website

    January 30, 2009

    Permalink

    Big said:

    Komang, still wrong the same problem with parse error, i dont know why … ??? =(… another solution only i have a one admin and 5 users specials … ty



  46. Visit My Website

    January 30, 2009

    Permalink

    Komang said:

    post here your line 15 of login.config.php



  47. Visit My Website

    January 31, 2009

    Permalink

    Big said:

    my line 15:
    define(“SUCCESS_URL”, “index.php?profile={$_SESSION['exp_user']['username']}”);

    ok no problem with parse error,

    but when I try to access the login page, this gets the message “loading” and does not disappear… why ??



  48. Visit My Website

    January 31, 2009

    Permalink

    Big said:

    when i remove ::::: {$_SESSION['exp_user']['username']} ::: in login.config.php …works fine and load the login page, but links to index.php?profile=… how can i modify this for work with a user especific.. on session ?



  49. Visit My Website

    January 31, 2009

    Permalink

    Komang said:

    use firebug to track the response, thats the easiest way to know what is going on.



  50. Visit My Website

    February 3, 2009

    Permalink

    William said:

    please help, trying to show the current logged in user however keeps coming up blank…

    echo $_session['exp_user']['userID'];
    echo $_session['exp_user'];
    echo $_session['exp_user']['username'];



  51. Visit My Website

    February 5, 2009

    Permalink

    Komang said:

    is your session already started? and PHP is case sensitive $_SESSION['exp_user']['username'];



  52. Visit My Website

    February 6, 2009

    Permalink

    sergio mendoza said:

    Hi, great job! thanks to share it. Please, Can you put some working example for PHP 4.4.2. I can’t do to working on my site. I’ll hope you can help us, many that have php4 on our hosting server



  53. Visit My Website

    March 5, 2009

    Permalink

    Younten Jamtsho said:

    I have been trying to download the source code.. but i am not able to do so… have you removed the file ? looking forward to hear from you. and receive the source code



  54. Visit My Website

    March 6, 2009

    Permalink

    Mayoulti said:

    Hello Bali, i dont find the code source file, “page not found”
    thanks



  55. Visit My Website

    March 14, 2009

    Permalink

    webmaster said:

    source re-uploaded, sorry for the inconvenient



  56. Visit My Website

    March 19, 2009

    Permalink

    RP said:

    Thanks for the example, very nice!
    I have a problem tho, or maybe question: when loading a login-form like this it doesn’t seem the brower can use saved username/password?



  57. Visit My Website

    April 6, 2009

    Permalink

    20 Useful PHP + jQuery Components & Tuts for Everyday Project | Noupe said:

    [...] 4. PHP ajax login form using Jquery [...]



  58. Visit My Website

    April 7, 2009

    Permalink

    beckerist said:

    If you are getting only a “Loading…” box and the form doesn’t appear, use Firefox and get Firebug. Open Firebug on your login.html page and go to the “Console” tab. Turn on script support, and go back to the console tab. Click the plus sign next to the “GET” element. If you are receiving the — parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR on line 15 error, remove the word “public” before each “function” declaration. This should resolve your issue.



  59. Visit My Website

    April 25, 2009

    Permalink

    yayan said:

    I have change the table from the original tbl_user to wp_users from wordpress, but i can’t login to them .. can you help me..

    I also change the table the name of table in wp and the row…

    please help me



  60. Visit My Website

    April 27, 2009

    Permalink

    Zulfiqar Ali Soomro said:

    I need some help. What should i need to do if i want to login someone with email only not password. I want to create a system in which there is a email list already in database. I need to remove the password text field.



  61. Visit My Website

    May 14, 2009

    Permalink

    Billa said:

    Wonderful.
    Just wondering, if we can add some security check if user fails to authenticate in some tries, (Eg. we can show captcha if user enters wrong password/username 5 times)?
    That will be so wonderful.



  62. Visit My Website

    May 17, 2009

    Permalink

    PHP Ajax Login com jQuery | Links Web said:

    [...] Site: http://www.chazzuka.com/blog/?p=82 [...]



  63. Visit My Website

    May 29, 2009

    Permalink

    piyush said:

    i have seen your demo that is quite impressive but there is some problem in source code
    i have made changes in config file and also changed the redirecting url but its not working
    even it is not showing the login form and loading message



  64. Visit My Website

    June 28, 2009

    Permalink

    njoay said:

    Hi, can someone provide detail explanations on how the got it to work? I get the following error messages through Firebug:

    Warning: session_start() [function.session-start]: open
    (/var/php_sessions/sess_2d2d7357a7e8b879be98a9e6a16c819a, O_RDWR) failed: No such file or directory
    (2) in /hermes/bosweb/web021/b213/d5.DIRECTORY/files/login.post.php on line 15

    Warning: session_start() [function.session-start]: Cannot
    send session cookie – headers already sent by (output started at /hermes/bosweb/web021/b213/d5.DIRECTORY
    /files/login.post.php:15) in /hermes/bosweb/web021/b213/d5.DIRECTORY/files/login.post.php on line
    15

    Warning: session_start() [function.session-start]: Cannot send session cache limiter – headers already sent (output started
    at /hermes/bosweb/web021/b213/d5.DIRECTORY/files/login.post.php:15) in /hermes/bosweb/web021/b213/d5
    .DIRECTORY/files/login.post.php
    on line 15
    {’status’:false,’message’:'Username/E-mail:Password
    ‘}
    Warning: Unknown: open(/var/php_sessions/sess_2d2d7357a7e8b879be98a9e6a16c819a, O_RDWR) failed
    : No such file or directory (2) in Unknown on line 0

    Warning: Unknown: Failed to write session data (files). Please verify that the current setting
    of session.save_path is correct (/var/php_sessions) in Unknown on line 0

    Please help! Or feel free to send me an email at njoay@netscape.net



  65. Visit My Website

    June 28, 2009

    Permalink

    njoay said:

    Hi,

    I get the following error messages from Firebug. If anyone can help me figure them out, I’d really appreciate it. The login page just hangs at loading…

    Warning: session_start() [function.session-start]: open
    (/var/php_sessions/sess_52e765c237aeeaebed34d690362d49d2, O_RDWR) failed: No such file or directory
    (2) in /hermes/bosweb/web021/b213/d5.DIRECTORY/files/login.post.php on line 15

    Warning: session_start() [function.session-start]: Cannot
    send session cookie – headers already sent by (output started at /hermes/bosweb/web021/b213/d5.DIRECTORY
    /files/login.post.php:15) in /hermes/bosweb/web021/b213/d5.DIRECTORY/files/login.post.php on line
    15

    Warning: session_start() [function.session-start]: Cannot send session cache limiter – headers already sent (output started
    at /hermes/bosweb/web021/b213/d5.DIRECTORY/files/login.post.php:15) in /hermes/bosweb/web021/b213/d5
    .DIRECTORY/files/login.post.php
    on line 15
    {’status’:false,’message’:'Username/E-mail:Password
    ‘}
    Warning: Unknown: open(/var/php_sessions/sess_52e765c237aeeaebed34d690362d49d2, O_RDWR) failed
    : No such file or directory (2) in Unknown on line 0

    Warning: Unknown: Failed to write session data (files). Please verify that the current setting
    of session.save_path is correct (/var/php_sessions) in Unknown on line 0



  66. Visit My Website

    July 16, 2009

    Permalink

    Keyur Surati said:

    the above given example is really good and helpful for the developers.

    I heard that now-a-days the database is not created and all the database is maintained through XML so is it also possible in PHP and if yes hen how can i implement in php?



  67. Visit My Website

    August 6, 2009

    Permalink

    Zashkaser said:

    Great post! Just wanted to let you know you have a new subscriber- me!



  68. Visit My Website

    August 21, 2009

    Permalink

    Kajolas said:

    I have put all the files in my localhost, created an sql database and dump the sql but nothing loads in my form, only show up a red bar and the square where was supposed to show up the form.

    Please help, thanks



  69. Visit My Website

    August 21, 2009

    Permalink

    Kajolas said:

    solved, downloaded the last version of jQuery



  70. Visit My Website

    October 1, 2009

    Permalink

    Marcio said:

    HI.

    Why the script dont accept ccs styles in google chrome 3.0.195.21?
    In FF and IE its works correctly, but in chrome don´t.

    Thanks, and Congratulations, very cool script!



  71. Visit My Website

    October 5, 2009

    Permalink

    Bugs said:

    Delicious post! Just wanna let you know you have a new subscriber – me! Can’t wait your next post..



  72. Visit My Website

    October 5, 2009

    Permalink

    Dan said:

    I downloaded the source and I can’t find the ”
    the jquery.js wasn’t in the folder

    my website is http://www.danhannigan.co.uk – as you can see it doesn’t work.



  73. Visit My Website

    October 5, 2009

    Permalink

    Dan said:

    I’ve got the jquery downloaded but still all it says is Loading… I am using PHP 5.2

    http://www.danhannigan.co.uk – any help?



  74. Visit My Website

    October 10, 2009

    Permalink

    osa2t said:

    hello,

    I have problem with script, I have always loading window in right corner and I don’t have html input username and password. I create database and add my user and password too login.config.php and I set USEDB to true, I have jquery file. If I have define(‘SUCCESS_URL’, ‘index.php’); I have this error message in firebug:

    ďťż{’status’:false,’message’:'Username/E-mail:Password’}
    If I change too define(‘SUCCESS_URL’, ‘index.php?profile={$_SESSION['exp_user']['username']}’); I have this message:

    Parse error: syntax error, unexpected T_STRING in /var/www/src/login.config.php on line 16

    What I can do with this? Please help me!



  75. Visit My Website

    November 17, 2009

    Permalink

    brixton said:

    I had the Problem that your scipt didn’t work in Firefox.
    I figured out that the login.post.php
    returned Json with an wrong not jquery complient charset. I’ve added header directive to login.post.php
    header(‘Content-Type: text/plain; charset=utf-8′);

    now jquery is able to read the Json data.

    I dont know how the php interpreter figures out which character set to use,
    but in my case it was not the one I’ve needed.

    thanks for the tutorial
    great job



  76. Visit My Website

    December 9, 2009

    Permalink

    devian said:

    Doesn’t work for me and got some error
    Parse error: syntax error, unexpected T_STRING in /var/www/src/login.config.php on line 16,recently got a problem also with the js but I downloaded the latest jquery package and it was solve.

    Anyway found something related http://www.phpstring.co.cc/ajax-login-module/

    And I’m currently using that.

    But thanks a lot anyway.



  77. Visit My Website

    December 18, 2009

    Permalink

    Amit said:

    Thanks A lots Good one



  78. Visit My Website

    December 22, 2009

    Permalink

    PHP ajax login form using Jquery | Ajaxmint – Endless Ajax samples on jQuery, MooTools, ExtJS, Dojo, Prototype and PHP said:

    [...] Demo  Tutorial  Posted in ajax | Tags: ajax, jquery, login, php « Asynchronous Comments with [...]



  79. Visit My Website

    January 5, 2010

    Permalink

    pollution said:

    creative one.Just keep running..



  80. Visit My Website

    January 16, 2010

    Permalink

    Maks said:

    worked only in IE :( not work in Opera 10, FF 3.5.5

    maybe problems in prototype?



  81. Visit My Website

    February 20, 2010

    Permalink

    Tony said:

    I just want to say it works well but there is a problem that would be nice to fix. Using any jquery version after 1.3.2 doesn’t work at all. It just says loading. So if anyone is having problems with is not working and just saying loading make sure you have jquery 1.3.2 and not a newer version such as 1.4.1. Just a heads up.



  82. Visit My Website

    February 28, 2010

    Permalink

    Paul said:

    Like many people here, I could not get this code to work. First thing, JQuery is not included in the rar file as previously mentioned. So I grabbed the latest version of JQuery (1.4.2) but the form still would not load! I noticed that the version included in the demo is older, so I tried that and it worked! So BEWARE! THIS CODE DOES NOT WORK WITH THE LATEST VERSION OF JQuery!

    Replace the script tag to include the following version in the login.html file:

    That’s the only thing I changed from the original downloaded files.

    Now I would like to use the latest version of JQuery, anyone know what to fix to get it to work?



  83. Visit My Website

    February 28, 2010

    Permalink

    20 Useful PHP + jQuery Components & Tuts for Everyday Project | Dummies Garage V3 said:

    [...] 4. PHP ajax login form using Jquery [...]



  84. Visit My Website

    March 2, 2010

    Permalink

    Tony said:

    The json in this file is malformed and needs to be fixed to use the lastest version of jquery. Otherwise you have to keep using 1.3.2.



  85. Visit My Website

    March 10, 2010

    Permalink

    jameel said:

    can you please let me know how to change the password?



  86. Visit My Website

    March 11, 2010

    Permalink

    Russian dvd said:

    Thank you, I regularly read your blog, I have some questions for you, let me know if you want to contact me by e-mail



  87. Visit My Website

    March 13, 2010

    Permalink

    ramoneariel said:

    In my local server works perfectly, but the web server does not.

    -Connection data are corrects.
    -The php version is 5.2

    Please, i dont find where is the error.

    The form with username adn password is not visible.

    This is the link

    http://www.ramosboulevard.com.ar/login.html

    TNX.
    –
    Ariel Ramone



  88. Visit My Website

    March 13, 2010

    Permalink

    ramoneariel said:

    sorry, the page is

    http://www.ramosboulevard.com.ar

    and the link is the padlook in the top right.

    Gracias



  89. Visit My Website

    March 19, 2010

    Permalink

    marika said:

    Hi. Thanks for the code. However, I uploaded the code and it works with jQuery 1.2.3 (the version that your demo uses) but the login form doesn’t load succesfully with the latest version of jQuery 1.4.2…?!

    Anyone worked this out? I am about to give up…

    Thanks!



  90. Visit My Website

    March 25, 2010

    Permalink

    35 Really Useful PHP Tutorials And Development Techniques | Smashing Buzz said:

    [...] PHP ajax login form using Jquery [...]



  91. Visit My Website

    April 7, 2010

    Permalink

    PHP Forms with jQuery Validation Tutorials | Geekatude.com said:

    [...] PHP ajax login form using Jquery – Demo 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… [...]



  92. Visit My Website

    April 22, 2010

    Permalink

    lovemobile said:

    And you so tried to do?
    And on what we shall stop?
    You commit an error. I can defend the position.
    I think, that you are mistaken. I can prove it.
    It is a valuable phrase



  93. Visit My Website

    May 12, 2010

    Permalink

    Zephir said:

    @marika I can confirm it’s not working with 1.4.2, but I tested it with 1.2.3 and 1.3.2 and works perfect.

    Thanks for this great login form :)



  94. Visit My Website

    May 15, 2010

    Permalink

    Kiley Sita said:

    Hi. I read a few of your other posts and i wanted to say thank you for the informative posts.



  95. Visit My Website

    May 15, 2010

    Permalink

    15+ Useful PHP & jQuery Components | WEBAXES.COM said:

    [...] 4. PHP ajax login form using Jquery [...]



  96. Visit My Website

    May 19, 2010

    Permalink

    Carlos said:

    Hi, thanks for this, i have one error, I need to redirect to a directory with the name of the user and i try:

    define(‘SUCCESS_URL’, ‘index.php?profile=’.$_SESSION['exp_user']['username']);

    But the page get stuck in LOADING and never show the login box. What can I do?

    Thanks and congrats!



  97. Visit My Website

    June 1, 2010

    Permalink

    CASSIE ENGLAND said:

    I don’t think I’ve seen this depicted in such an informative way before. You really have clarified this for me. Thanks!



  98. Visit My Website

    June 2, 2010

    Permalink

    30 Useful PHP Tutorials « Web Creation in Cambodia said:

    [...] PHP ajax login form using Jquery [...]



  99. Visit My Website

    June 10, 2010

    Permalink

    fw said:

    Does not degrade in any way shape or form. Not everyone has js enabled, you need to write for everyone first then use jquery to add the nice features if js is available.



  100. Visit My Website

    June 14, 2010

    Permalink

    kim lee said:

    it only show “Loading…”, not load form, help me



  101. Visit My Website

    July 1, 2010

    Permalink

    hellolsd said:

    not working with jquery 1.4.2 release ;)



  102. Visit My Website

    July 2, 2010

    Permalink

    Michael J said:

    Keep in mind that the password will be completely visible in the Firebug console and similar utilities when the user logs in using this method. There are ways to log with without reloading the page that do not get logged in the Firebug console (many professionally developed sites do it), but unfortunately I can’t seem to find any available code anywhere.



  103. Visit My Website

    July 5, 2010

    Permalink

    60 Awesome jQuery Tutorials | Web.Dtuts – Web Development Tutorials said:

    [...] Read this tutorial >> [...]



  104. Visit My Website

    July 10, 2010

    Permalink

    75+ jQuery Plugins: Download Powerful and Elegent jQuery Plugins & Tutorials | jQuery | Graphic Design Junction said:

    [...] Tutorial [...]



  105. Visit My Website

    July 13, 2010

    Permalink

    Alan said:

    I’ve implemented the script on my server using with DB set to false.

    I’ve put 3 users into the $user_config array however, when there is a successful login the details stored in the session are always the final record in the $user_config array no matter which login is used.



  106. Visit My Website

    July 23, 2010

    Permalink

    Todd said:

    to get it to work in jquery 1.4.* you need to make valid json reponses.
    { foo: “bar” } is a valid JavaScript object but it is not a valid JSON.

    { “foo” : “bar” } is a valid JSON.

    Also note that JSON demands double quotes. Following two examples are ,once again, valid JavaScript objects but they are not valid JSON.

    { ‘foo’: “bar” }

    { “foo” : ‘bar’ }

    by changing the reponses in login.post.php to follow these methods i got the script to work. do forget to open login.class.php and escape all the double quotes in the form that returns in the form function



  107. Visit My Website

    August 19, 2010

    Permalink

    webmaster said:

    @Todd thanks for spotting the fix

    for those who has problem with jquery 1.4.2, please follow Todd update

    or you can use jQuery JSON.stringify to fix the invalid json format



  108. Visit My Website

    August 25, 2010

    Permalink

    Lorem Ipsum said:

    I have downloaded the source and pasted in local, done everything as your instruction mentioned in this site such changed login.config.php file, setting username and password of db, and created db also. But no form at least displayed. Can’t understand. Please can u help me. I will be thankful for your answer.



Leave a Comment

Here's your chance to speak.

  1. Name (required)

    Mail (required)

    Website

    Message

  • Most Popular Posts

    • { 108 } ResponsesPHP ajax login form using Jquery
    • { 79 } Responsesphp ajax tutorial create ajax based login form using jquery
    • { 71 } ResponsesASP Classic Programming Still Alive
    • { 53 } Responses63+ best practice to optimize PHP code performances
    • { 44 } ResponsesVideobox: Lightbox for videos
  • Latest Posts

    • PHP Newbie: Proper handling of Error & Exception in PHP
    • Why SEO lost importance
    • jQuery Mobile Announced : Touch-Optimized Web Framework for Smartphones & Tablets
    • Multiple Google Account Signin
    • Install, Configure & Running Memcache in Windows as Service
    • DynamicWP Image Cube Wordpress Plugin
    • New Wordpress 3.0 API menu_page_url
    • Wordpress 3.0 Custom Taxonomy
    • JQuery DataGrid Plugin Compass
    • Upgrading to upcoming CodeIgniter 2.0
  • Categories

    • advertorial
    • Ajax XMLHttpRequest
    • Featured
    • Freebies
    • Miscellaneous
    • Print & Web Design
    • Programming
    • Tutorials
    • Web 2.0
  • Featured News

    • PHP Newbie: Proper handling of Error & Exception in PHP by webmaster on August 18, 2010
    • Why SEO lost importance by webmaster on August 16, 2010
    • jQuery Mobile Announced : Touch-Optimized Web Framework for Smartphones & Tablets by webmaster on August 16, 2010
    • Install, Configure & Running Memcache in Windows as Service by webmaster on June 27, 2010
    • Website Optimization Best Practices, speed up your website load by ruby on May 21, 2009
  • Tag Cloud

    • Actionscript advertorial Ajax XMLHttpRequest API best practices CakePHP chat Classic ASP CMS CSS Development facebook firefox Flash flickr Freebies gmail HTML icons Javascript Jobs jQuery jQuery Plugins Library Lightbox memcache Mootools news Personal PHP PHP Frameworks plurk Print & Web Design prism Prototype regex regular expression Scriptaculous SEO Tutorial twitter Web 2.0 Wordpress Works YUI
  • Archives

    • August 2010
    • June 2010
    • May 2010
    • September 2009
    • June 2009
    • May 2009
    • April 2009
    • March 2009
    • February 2009
    • January 2009
    • December 2008
    • November 2008
    • October 2008
    • September 2008
    • August 2008
    • July 2008
    • June 2008
    • May 2008
    • April 2008
    • March 2008
    • February 2008
    • January 2008
    • December 2007
    • November 2007
    • October 2007
copyleft 2007 - 2010 Bali Website Design Studio