Script work on xampp but this is not work online server same php versions

function login() {
	if(isset($_POST['login-submit'])) {
		$user_email = mysql_real_escape_string(trim($_POST['username']));
		$user_password = mysql_real_escape_string(trim($_POST['password']));
		$sql = "SELECT id, username, password, email,type,delete_status FROM admin WHERE email='$user_email' and password ='$user_password'";
		$resultset = mysqli_query($this->conn, $sql) or die("database error:". mysqli_error($this->conn));
		$row = mysqli_fetch_assoc($resultset);
		if($user_password!==$row['password'] && $user_email!==$row['email']){
			echo "Password or email incorrect ";
		}else if($row['delete_status']=='1'){
        echo "Ohhh ! Your Account is Block.Please Contact Your Administrator"; 
		}else{
		if($row['type'] == 'admin'){
			echo "1";
			$_SESSION['user_session'] = $row['id'];
		} else if($row['type'] == 'center'){
			echo "2";
			$_SESSION['user_session'] = $row['id'];
		}else{
			echo "Ohhh ! Wrong Credential."; // wrong details
		}
	}
	}
}

$(document).ready(function(){
/* handling form validation */
$("#login-form").validate({
rules: {
password: {
required: true,
},
username: {
required: true,
email: true
},
},
messages: {
password:{
required: “Please enter your password”
},
username: “Please enter your username”,
},
submitHandler: submitForm
});

$(’#btnforgot’).on(‘click’, function(e) {
document.getElementById(“login”).style.display=“none”;
document.getElementById(“forgot”).style.display=“block”;
});
$(’#btnlogin’).on(‘click’, function(e) {
document.getElementById(“forgot”).style.display=“none”;
document.getElementById(“login”).style.display=“block”;
});
$(’#btnsign’).on(‘click’, function(e) {
document.getElementById(“forgot”).style.display=“none”;
document.getElementById(“login”).style.display=“block”;
});

/* Handling login functionality */
function submitForm() {		
	var data = $("#login-form").serialize();
	$.ajax({				
		type : 'POST',
		url  : 'loginauth.php',
		data : data,
		beforeSend: function(){	
			$("#error").fadeOut();
			$("#login-submit").html('<img src="images/loading.gif"></img> &nbsp; sending ...');
		},
		success : function(response){			
			if($.trim(response) === "1"){
				console.log('dddd');									
				$("#login-submit").html('Signing In ...');
				$("#success").fadeIn(1000, function(){$("#success").html('<img src="images/loading.gif"/>&nbsp;Authantication..').show();});
				setTimeout(' window.location.href ="admin/index.php"; ',2000);
			} else if($.trim(response) === "2"){									
				console.log('dddd');									
				$("#login-submit").html('Signing In ...');
				$("#success").fadeIn(1000, function(){$("#success").html('<img src="images/loading.gif"/>&nbsp;Authantication..').show()
					;});
				setTimeout(' window.location.href ="center/index.php"; ',2000);
			}else{
				$("#error").fadeIn(1000, function(){						
					$("#error").html(response).show();
					setTimeout(' window.location.href ="login.php"; ',2000);
				});
			}
		}
	});
	return false;
}

Our team would be more than happy to help you with any problem you encounter. However, we will only provide free support for our system and services. We will help you with basic problems associated with getting scripts running such as advising you of the correct hostname, username, database name and information to us, but if you need help with third-party software, contact the authors of that software or query Google with error message you get.

It is not possible for us to provide help for everyone, fix PHP errors or develop your website as it would require a lot of administrative time. We focus in getting our servers and services up and running.

However, you can upgrade your account at https://www.hostinger.com/special/000webhost and we will provide you with full help in installing your scripts, developing your website and fixing errors.

Thank you,

If you are a beginner checkout http://bitdegree.org or
https://stackoverflow.com/questions/ask to troubleshoot your code with other developers/coders etc.

This topic was automatically closed after 2 days. New replies are no longer allowed.