在php中发布数据失败
我在发布数据时遇到一些问题,显示 500 内部服务器错误。 所以,我认为客户端和服务器端之间一定是不同步的。我已经检查过,但没有任何线索。这是以下 php 脚本:
<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
}
});
}
这是服务器端:
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
你能告诉我我的脚本有什么问题吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
文件 process3.php 中有语法错误 - 这就是为什么你收到内部服务器错误 - 这是你必须纠正的第一件事
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