doucitan2544 2016-05-10 21:31
浏览 16

php / sql数据库更新无法在登台服务器上运行

I have a local copy of a custom app that deploys to the staging server through git. My php versions are matched up. My local machine is a mac and the staging is a linux with centos.

It's confusing because the issue seems to only be happening with one feature, any advice for debugging would be helpful since I have no errors displaying locally it doesn't make sense.

Locally it works perfectly, on the staging server it display the confirmation but it's returning false for all permissions: check_associate_perm() even though I can verify in the DB that they exist. Any attempt to add or remove permissions fails to write to the database.

my form:

<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>

my form action:

<?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";
            }
 ?>

my model methods:

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; }
                }
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 wireshark抓不到vlan
    • ¥20 关于#stm32#的问题:需要指导自动酸碱滴定仪的原理图程序代码及仿真
    • ¥20 设计一款异域新娘的视频相亲软件需要哪些技术支持
    • ¥15 stata安慰剂检验作图但是真实值不出现在图上
    • ¥15 c程序不知道为什么得不到结果
    • ¥40 复杂的限制性的商函数处理
    • ¥15 程序不包含适用于入口点的静态Main方法
    • ¥15 素材场景中光线烘焙后灯光失效
    • ¥15 请教一下各位,为什么我这个没有实现模拟点击
    • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来