| Server IP : 74.208.236.18 / Your IP : 216.73.216.45 Web Server : Apache System : Linux infong654 4.4.400-icpu-108 #2 SMP Wed Feb 11 10:12:42 UTC 2026 x86_64 User : u39365822 ( 135825) PHP Version : 8.4.23 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /homepages/7/d147067425/htdocs/js/ |
Upload File : |
$('document').ready(function() {
/* handle form validation */
$("#register-form").validate({
rules:
{
first_name: {
required: true,
minlength: 3
},
last_name: {
required: true,
minlength: 3
},
email: {
required: true,
email: true
},
password: {
required: true,
minlength: 5
},
confirm_password: {
required: true,
equalTo: '#password'
},
},
messages:
{
first_name: {
required:"please enter first name",
minlength:"first name at least have 3 characters"
},
last_name: {
required:"please enter last name",
minlength:"last name at least have 3 characters"
},
email: {
required:"please enter email address",
email:"please enter a valid email address"
},
password:{
required: "please provide a password",
minlength: "password at least have 5 characters"
},
confirm_password:{
required: "please retype your password",
equalTo: "password doesn't match !"
}
},
submitHandler: submitForm
});
/* handle form submit */
function submitForm() {
var data = $("#register-form").serialize();
console.log(data);
$.ajax({
type : 'POST',
url : 'includes/register.php',
data : data,
beforeSend: function() {
$("#error").fadeOut();
$("#btn-submit").html('<span class="glyphicon glyphicon-transfer"></span> sending ...');
},
success : function(response) {
console.log(response);
$("#error").html('');
if(response==1){
$("#error").fadeIn(1000, function(){
$("#error").html('<div class="alert alert-danger"> <span class="glyphicon glyphicon-info-sign"></span> Sorry email already taken!</div>');
$("#btn-submit").html('Create Account');
});
} else if($.trim(response)=="success"){
$("#error").fadeIn(1000, function(){
$("#error").html('<div class="alert alert-success">Click here to <a href="index.php">Login</a></div>');
$("#btn-submit").html('Create Account');
});
} else {
$("#error").fadeIn(1000, function(){
$("#error").html('<div class="alert alert-danger"><span class="glyphicon glyphicon-info-sign"></span> Fail To Register </div>');
$("#btn-submit").html('Create Account');
});
}
}
});
return false;
}
$("#login-form").validate({
rules:
{
username: {
required: true,
email: true
},
password: {
required: true,
minlength: 5
},
},
messages:
{
username: {
required:"please enter email address",
email:"please enter a valid email address"
},
password:{
required: "please provide a password",
minlength: "password at least have 5 characters"
}
},
submitHandler: submitForm
});
/* handle form submit */
function submitForm() {
var data = $("#login-form").serialize();
$.ajax({
type : 'POST',
url : 'includes/register.php',
data : data,
beforeSend: function() {
$("#error").fadeOut();
$("#btn-submit").html('<span class="glyphicon glyphicon-transfer"></span> sending ...');
},
success : function(response) {
$("#error").html('');
if($.trim(response)=="success"){
$("#btn-login").html('Signing In ...');
setTimeout('window.location.href = "dashboard.php";',2000);
} else {
$("#error").fadeIn(1000, function(){
$("#error").html('<div class="alert alert-danger">'+response+'</div>').show();
});
}
}
});
return false;
}
});