Ok, here’s another AJAX login form example…
In this example I am using 3 javascript files, 2 php files and 1 stylesheet.
click here for the demo
click here to download the files
Brief description:
_ajax.new.js: is the main ajax class. I have already explained this class here
_formdata2querystring.js: used for posting the element of a form
_applogin.js: specific ajax class to handle the login form
index.php: simple login form
style.css: simple stylesheet
If you like it digg it here
Next post will be a tutorial on how to make it
Stay tunned …
//Jo
Peace
Popularity: 100% [?]

I’m trying download the source files, but every time I try I get a page with a bunch of nothing on it.
Why this login form enables the back button?
D.Peterson: Try to right click on the file then Save As.
Its working fine here with me
Arnulfo Arias: The login form will redirect you to welcome page when the login is correct.
To FARAWAY:
The italian article talks about “Modern (Web 2.0?) ways of dealing with HTML Forms”. The article itself is a sort of link collection.
it`s not working..
it doesn’t accept the password
hi matej, can you please tell me what browser you are using ? and if you have javascript enabled or not.
the password should be : iwannalogin ( no spaces and case sensitive )
the email should be: email@gospam.biz
kind of ugly that the password is being send in the post.
you should encrypt the password before sending it with js to php and then decrypt it again with php.
Yeah you are right,
I will do it today and update the script… thank you mister p
When i submit i’ve always this message “going somewhere ?”
i don’t know why please help me
Hi jb
in the file js/_ajaxlogin.js
go to line 105, it should be:
self.ajax.doPost(’ouf.php?action=login’, postData, self.handleLoginResp);
In your case i think it is not
check it and if u need anythg more reply
Thank’s but i’ve always the same problem
go to
http://notedeletudiant.com/ndl/test2/testlogin/
Hi jb
Im sorry for this error, you should add this line at the beginning of ouf.php ( before switch($action) ).
###
$action=trim($HTTP_GET_VARS['action']);
###
or re-download the files… i fixed them
Let me know if that worked for you
perfect!! Thank you very much
It’s not working on IE, the submit button never gets activated… any ideas?
TheMan: Can you please tell me what IE version you have ?
I tested it on IE 6 and it seems to work.
Make sure you do not copy and paste the password, because then it wont work.
Or better yet, upload somewhere on the net so i can see it
You are right Jo, it does work, i have IE 6.0, mi mistake
help for this error!
self.form.Pass has no properties
[Break on this error] self.form.Pass.value = ”;
doesnt work very well…
or something i dont understand…got the same error that max…text “welcome.html” appears in the box…
can this be due to the fact i work on local server (easyphp) ?
Hi mcnk
Can you upload your script somewhere so i can see the error ?
Could you please help me with one thing ? I need the LOG-OUT thing. I made the login case at ouf.php to save the sessions, for keeping user on the page if he will try to refresh the page, but now i dont know how to create an AJAX Request for my ‘LOGOUT’ case, which i made and filled with session_unset(); session_destroy(); and etc. Could you please help me with this ? Best reguards, Tiesto )
Hi Dj Tiesto
All you have to do is add the javascript function in js/_applogin.js that will call your case at ouf.php
the function can be smthg like this:
this.a_logout(){
var self = Login;
self.ajax.doGet(’ouf.php?action=logout’, ‘text’, self.handleLogoutResp);
}
then implement the handleLogoutResp function
this.handleLogoutResp = function(str) {
var self = Login;
var respArr = str.split(’,');
var respType = respArr[0].toLowerCase();
var respMsg = respArr[1];
var respSes = respArr[2];
if (respType == ’success’) {
location = respMsg+’?'+respSes;
}
else {
self.showErrorPrompt(respMsg);
}
}
Finnally add this to the end of the _applogin.js
document.getElementById(’logout_id’).onClick = Login.a_logout;
where logout_id could be the id of ( Logout
If you need anything else tell me.
By the way can I see the website where u implemented my ajax function ?
Is it possible to have multiple login email addresses and passwords?
Google is my favorite search engine!
I agree, multiple users and the ability to change where the user ends up after hitting submit depending on their username would be great!!!
I will do second version of this login form and include the following:
1- logout
2- session/cookie for each multiple user
3- ability to redirect ppl depending on the user to a specific page
Sir, I want to create a login form, that will differentiated between the Administrator and User with their Authorty
Sir, I aslo have a problem to develop a page of on line exam, So that the User can not make copy of this form
Please reply soonly
It’s a good idea BUT…
You got some wrong things in the code.
1. you can type any email that you want
2. you don’t have to write the whole email just a letter or two.. not even the @
3. you can login how ever you want to.. you just ned the a correct password. It has nothing to do with the email.
its cool but i would prefer if it didn’t go to another page
Hi there,
Just came across this and whilst it seems to work okay if you click the button, if you press return whilst in any of the fields it will let you in no matter what you type into the fields.
Just thought you should know.
Best wishes,
Mark
This login form does not register any session/cookie.
You will have to this yourself
Thanks for this login page…. it works ……
Doesn’t want to work in IE 7
ghdfgh
self.form.ChangeAlert.checked is null or has no properties
t’s a good idea BUT…
You got some wrong things in the code.
1. you can type any email that you want
2. you don’t have to write the whole email just a letter or two.. not even the @
3. you can login how ever you want to.. you just ned the a correct password. It has nothing to do with the email.
——-
Just change:
if ($password == $good_pass){
To:
if (($password == $good_pass) && ($email == $good_email)){
yeah , thats pretty cool!
IT’S VERY NIC BUT I FOUND JS ERROR ON IE 7 IF U ENTER INCORRECT EMAIL AND PASSWORD
BUT OVERALL IT’S VERY GOOD EXCELLENT JOB
REGARDS
SALIK AHMED
When I put de User & pass text “welcome.html” appears in the box. I need to redirect another page or addresscom. Can u help me?
hi, it’s no work
same error going somewhere ?
ouf.php ( before switch($action) ).
###
$action=trim($HTTP_GET_VARS[’action’]);
### this line its ready
i am not sure what happend can u help me please
Wow!!!^
I uploaded all the files into the server it does not bring me to the welcome.html page. and i was still in the index.php page with the message display ‘ going somewhere ?’ but when i test it using localhost, it works. can you help me out with tis problem?
Hi, it wont load at all, in firefox it loads the message in the top box, but i get the error going somewhere? latest version used, in ie though, nothing, no messages nothing.. please help? Thanks
Also forgot to mention, running on IIS with php installed
Hi everone,
I have a question.
Could you please help me ?
How can a server understand when lots of users login simultaneously ?
I am working with PHP but I cant write a script for this.
thanks from now
Hi, Thats beautifullogin u implemented. I had to remake my login using ur code. but apparently the ajax part doesnt work. i have other works in ajax and they work fine. this is how it is now. wen i hit the submit button it starts loading the whole part no ajax working. and am using fire bug the error there is
self.form has no properties
http://127.0.0.1/_applogin.js?2122778914
Line 76
what could be there problem. its really frustrating me. thanx
Amazing really amazing script thank you
Very Cool Script….
I am waiting for your Version 2 : Login …
When I am downloading it, then ajax2.rar gets download but when I open it there is nothing in it.
Please help me. and send me the files to my email
thanx
cool script
great form.
but i dont understand how t use the javascript stuff.
wont open on my pc.
where do i put it in my site?
This is a nifty script
Well, it’s asked before. Do you know if it’s easy to use for a multi-login purpose. So integrate a variable which identifies the loginform.
That should be really great!! Hopefully someone can help me with this.
Thx!
Nice script, it was just what I was looking for, however, I noticed once you get to the welcome page you can bookmark it and return later bypassing the login. Is there a way to make someone always login?
nice cript. but what you do when you get to the page . how can i protect the pages and the files in the in there , so users MUST login to see the pages ?
thanks
jeff
Hi… good contribution.
Is there a way I can redirect to a url which has been typed in earlier, rather than to the welcome page.
Many thanks.
Thanks. Thanks all.
Great script, using it on my new project
thank you for share.
to Max
change self.form.Pass to self.form.password
to hone
self.form.ChangeAlert.checked is null or has no properties
in _applogin change uncoment //self.enableScreenReaderFeatures();//Joe
Hello!
I wondered if you planned a review & update of that script. It’s wonderful that way, but some options which are probably easy for any experienced PHP/MySQL coder would be awesome…
-Register form
-MySQL for accounts storage
-A mini admin panel allowing to add/delete accounts and to modify informations
-Sessions: to remember when the user has logged-in.
That’s all. Also, you promised us a tutorial and I haven’t seen it… is it still planned?
Regards,
Fox
Also, maybe a bit more secured features…?
Hi,
i have this message:undefined, and i don’t know why. Help me please.
Adress of website: http://jbv.ced.travel/connexion_utilisateur.php
hi,
i need to refresh two / {whatever is possible} at one time by clicking a button but not refreshing the other fields of a form, nor by posting other fields , it should just work as the captcha refresh works, and refreshes the captcha code by interfering the rest of the fields. A help will be highly appreciated and thankful.
hi,
i am trying to use the script on one of my site i was trying without chaining any of the script but still i get the error
“going somewhere ?”
i have this line in code as mentioned above
$action=trim($HTTP_GET_VARS['action']);
and this below line also
line numner 105, it is :
self.ajax.doPost(’ouf.php?action=login’, postData, self.handleLoginResp);
still i get the error can u help me please
its working thx guys..
thank you for share
How to “enable” the submit button “only” once all validation completes?
If the validation is not complete, no submit.
Is it possible and how to enable this function?
Cheers
Forgot to add.
I have used this to validate against the database by means of username, email address and would only like to allow the submit button to be available or enabled once the validation is happy:)
Cheers
Wow, thanks a lot for this one.
greetings from Amsterdam.
If Your On A Mac It Works So Perfectly! THANK YOU!
Thank you very much mr.
The login.php file in the current rar file seems to only be a partial file. The file ends with ‘<’.