Solved

AJAX or jQuery Login Field Validation Form / HTML - PHP

Posted on 2010-09-04
8
1,030 Views
Last Modified: 2012-06-22
Hello,

I'm running a family website which is coded purely in HTML. In some pages I used simple jQuery. I would like to put a simple AJAX or jQuery based login form to athenticate family members. The form will contains only Username and Password. I would like to verify the credentials on Server Side.

The website is running on CentOS 5.4 using cPanel. All s/w is up to date. This is a dedicated server. Any further solution or resources would be appreciated.

Thanks.
0
Comment
Question by:SrinathS
8 Comments
 
LVL 83

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 200 total points
ID: 33605632
HTML by itself doesn't support 'authentication'.  It won't check every page to see if the user is logged in.  You can use '.htpassword' in Apache and that will require a login to the directory you put it in.  http://httpd.apache.org/docs/2.0/programs/htpasswd.html  Or you can convert your pages to PHP which is a server side language that can be used to control access along with other things.
0
 

Author Comment

by:SrinathS
ID: 33605666
I would like to put login authentication files under login folder and will redirect the vistor to certain folder if he entered the login details correctly. Can I do that? Is there any such kind of simple login scripts available?

I don't need any database, I prefer to check pre-defined user credentials on server side. I'm okay to use php, because the validation/authentication is done on seperate folder on website.
0
 
LVL 83

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 200 total points
ID: 33605780
There are many login scripts available.  You have to include the login check on every page that you want to protect.  If you don't then someone who finds out what the page address is can skip the login and just go directly to the page.
0
Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

 
LVL 5

Assisted Solution

by:onemadeye
onemadeye earned 100 total points
ID: 33605887
Hi,
check this out and see if you can integrate it with your site :

http://roshanbh.com.np/2008/04/ajax-login-validation-php-jquery.html
0
 
LVL 110

Accepted Solution

by:
Ray Paseur earned 200 total points
ID: 33606431
The process for login validation is one part of the issue and the AJAX or jQuery wrapper is an entirely separate part of the issue.  I have an article here at EE that will help with the first part.
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/A_2391-PHP-login-logout-and-easy-access-control.html?sfQueryTermInfo=1+30+login+logout

There is really no magic to using AJAX, but it is harder to debug code that is hidden behind the asynchronous calls.  Suggest you get the login validation part working first with regular HTTP calls, then modify the scripts to use AJAX (if you feel that really adds value).

Best, ~Ray
0
 

Author Comment

by:SrinathS
ID: 33607206
Yes,

If I implement  login system, I need to update all the existing HTML pages to protect entire website. As per one of Expert's comment, protecting the folders using .htaccess file looks simple.

Is there any way to customize the .htaccess authentication? i.e., Instead of simple login pop-up box, can I customize it to appear as regular website login? I'm thinking to protect entire public_html folder using .htaccess or similar. So that only authenticated users can see the website.

Any further comments would be greatly appreciated. Thanks!
0
 
LVL 83

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 200 total points
ID: 33607303
".htaccess authentication" is not put up by the HTML pages but by the server and the browser.  There is nothing to customize.
0
 

Author Closing Comment

by:SrinathS
ID: 33617083
I've deicided to implement PHP login system. To do this, I converted all HTML files into PHP pages and currently studying some  basic PHP login systems.

Most probably I will hire a freelancer to do customized Ajax login validation system in PHP using jQuery.

Thanks.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Find out what you should include to make the best professional email signature for your organization.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question