我有一个自定义应用程序的本地副本,它通过git部署到登台服务器。我的PHP版本匹配。我的本地机器是一个mac,而升级是一个带有centos的linux。
这令人困惑,因为问题似乎只发生在一个功能上,任何调试建议都会有所帮助,因为我没有在本地显示错误没有意义。
在本地运行完美,在登台服务器上它显示确认但是它为所有权限返回false:check_associate_perm(),即使我可以在DB中验证它们是否存在。任何添加或删除权限的尝试都无法写入数据库。
我的表格:
<form method='post' action='account.php'>
<input type="hidden" name="uid" value="<?php echo $ass['uid']; ?>">
<input type="hidden" name="f_name" value="<?php echo $ass['first_name']; ?>">
<input type="hidden" name="l_name" value="<?php echo $ass['last_name']; ?>">
<p>Allow this <?php echo user::get_role_name($ass['rid']); ?> to:</p>
<label class="checkbox-inline"><input type="checkbox" id="inlineCheckbox21" name="incentives" <?php if(user::check_associate_perm($ass['uid'],1)){echo "checked";} ?>> Incentive Program <?php echo var_dump(user::check_associate_perm($ass['uid'],1)); ?> <i data-toggle="tooltip" data-placement="right" title="Sign up, choose item(s), see status." class="fa fa-info-circle"></i></label>
<label class="checkbox-inline"><input type="checkbox" id="inlineCheckbox21" name="history" <?php if(user::check_associate_perm($ass['uid'],2)){echo "checked";} ?>> View Orders History <i data-toggle="tooltip" data-placement="right" title="Including completed orders, returns and posted credits." class="fa fa-info-circle"></i></label>
<label class="checkbox-inline"><input type="checkbox" id="inlineCheckbox21" name="order" <?php if(user::check_associate_perm($ass['uid'],3)){echo "checked";} ?>> Place Orders <i data-toggle="tooltip" data-placement="right" title="See pending orders & order status." class="fa fa-info-circle"></i></label>
<input type='submit' class='btn btn-xs green' name='save_ass' value='Save'>
<input type='submit' class='btn btn-xs red' name='delete_ass' value='Delete'>
</form>
我的表单行动:
<?php
if(isset($_POST['save_ass'])){
if(isset($_POST['incentives'])){user::add_associate_perm($_POST['uid'],1);} else{user::delete_associate_perm($_POST['uid'],1);}
if(isset($_POST['history'])){user::add_associate_perm($_POST['uid'],2);}else{user::delete_associate_perm($_POST['uid'],2);}
if(isset($_POST['order'])){user::add_associate_perm($_POST['uid'],3);} else{user::delete_associate_perm($_POST['uid'],3);}
if(isset($_POST['reports'])){user::add_associate_perm($_POST['uid'],4);}else{user::delete_associate_perm($_POST['uid'],4);}
if(isset($_POST['catalog'])){user::add_associate_perm($_POST['uid'],5);}else{user::delete_associate_perm($_POST['uid'],5);}
$error="Permissions Saved for ".$_POST['f_name']." ".$_POST['l_name'];
$color="green";
}
?>
我的模型方法:
public static function add_associate_perm($uid,$apid){
global $db;
if(!self::check_associate_perm($uid,$apid)){
$db->InsertRow("associates_user_permissions",array("uid"=>$uid,"apid"=>"'".$apid."'"));
}
}
public static function delete_associate_perm($uid,$apid){
global $db;
$db->DeleteRows("associates_user_permissions",array("uid"=>$uid,"apid"=>"'".$apid."'"));
}
public static function check_associate_perm($uid,$apid){
global $db;
if($db->HasRecords("SELECT * FROM associates_user_permissions WHERE uid=$uid AND apid=$apid")) {
return TRUE;
} else { return FALSE; }
}