Jump to content

Recommended Posts

hi i have created a login form. and a login-process form... the login form currently has the following jquery attached

 

$(document).ready(function() { 

$('#btn-submit').click(function() {  

    	$(".error").hide();
    	
    	var hasError = false;
    	
	    	var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;   	
	    	var emailblockReg = /^([\w-\.]+@(?!gmail.com)(?!yahoo.com)(?!hotmail.com)([\w-]+\.)+[\w-]{2,4})?$/;

		    	var emailaddressVal = $("#email").val();
		    	
					if(emailaddressVal == '') {
			      		$("#email").after('<span class="error">Please enter your email address.</span>');
			      		hasError = true;
			    	}

					else if(!emailReg.test(emailaddressVal)) {
			      		$("#email").after('<span class="error">Please enter a valid email address.</span>');
			      		hasError = true;
			    	}

		     	var passwordVal = $("#password").val();
		    	
					if(passwordVal == '') {
			      		$("#password").after('<span class="error">Please enter your password.</span>');
			      		hasError = true;
			    	}

    	if(hasError == true) { return false; }

});

});

 

now i would also like to add whats in the login-process.php

 

				$login_sql = mysql_query("SELECT * FROM members,people,people_emails
									  WHERE members_person=people_id
									  AND people_emails_person=people_id
									  AND people_emails_email='$email'
									  AND members_password='$password'");

			if(mysql_num_rows($login_sql)>0){

				echo"yes ok";

			}else{		

				echo"Email and/or password do not match";

			}

 

into the jquery check to check before submiting.. and then process an error on the form when email or password dont match.

Link to comment
https://forums.phpfreaks.com/topic/250963-login-form-without-refresh/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.