Post the data failed in php
I have some trouble during post my data, show 500 internal server error. So, I think it must be unsyncronize between client side and server side. I have check but I dont have any clue.This the following php script:
<input type="text" id="use" name="use">
<input type="password" id="pass" name="pass"></td>
<input type="hidden" name="action" value="logaccept">
if ($("#passlog").valid()){
var params = $("#passlog").serialize();
$.ajax({
type:"post",
url:"process3.php",
data:params,
cache:false,
async:false,
success: function(data){
//do something
}
});
}
This the server side:
switch(postVar('action')) {
case 'logaccept' :
passlog(postVar('use'),postVar('pass'));
break;
}
function passlog($use,$pass){
$Use = mysql_real_escape_string($use);
$Pass= mysql_real_escape_string($pass);
//build query
$sql = "SELECT Privilege FROM admin WHERE user='".$Use."' AND password='".$Pass."'";
echo $sql;
$data=mysql_query($sql) or die(_ERROR26.": ".mysql_error());
if($data){
$priv = mysql_fetch_assoc($sql);
}else{
echo 0; // If login fails
开发者_开发知识库 }
?> //show Parse error: syntax error, unexpected $end in /var/www/html/process3.php on line 74
Could you tell me what's wrong with my script?
You have a syntax error in file process3.php - thats why you get the internal server error - that is the first thing you have to correct
精彩评论