duandiaoqian5795 2015-05-09 07:50
浏览 17

无法获得正确的值并打印相应的消息

Below is my code , I am trying to append values of $vid ,and than next time when my file loads i am trying to find currently passed value of $vid in array $ids, but every time i am getting success msg ,where i am going wrong, am i not able to append values properly ?

process.php

session_start();
if(isset($_POST)) {
    $reason_data = trim($_POST['abuse_data']);
    if($reason_data ==  "Video is offensive")
    {
        $reason = 'a:1:{i:0;s:18:"' . $reason_data .'";}';
    }
    else 
    {
            $reason = 'a:1:{i:0;s:19:"' . $reason_data .'";}';
    }       
   $motive = trim($_POST['remark_data']);
   $uid = trim($_POST['abuse_uid']);
   $vid = trim($_POST['abuse_vid']);
   if(trim($_SESSION['abuse_vdo_id']) == '')
   { 
    $_SESSION['abuse_vdo_id'] = $vid;  
        $str = $_SESSION['abuse_vdo_id'];           
   }
   else {
    $str = $str."," .$vid;
    $_SESSION['abuse_vdo_id'] = $str;
   }
    print_r($_SESSION['abuse_vdo_id']);
    echo "break";
    print_r($str);
    $ids = explode(',',$_SESSION['abuse_vdo_id']);
    echo "break 2";
    print_r($ids);
   if(in_array($vid, $ids))
        {       
            echo "already abused";
        }  
        else
        {
            echo "success"; 
            $query = "INSERT INTO ".DB_PREFIX."reports ( reason, motive, uid, vid ) VALUES ( '{$reason}','{$motive}', '{$uid}', '{$vid}' )";                
            $result = mysql_query($query);   
        }
}
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
    • ¥16 mybatis的代理对象无法通过@Autowired装填
    • ¥15 可见光定位matlab仿真
    • ¥15 arduino 四自由度机械臂
    • ¥15 wordpress 产品图片 GIF 没法显示
    • ¥15 求三国群英传pl国战时间的修改方法
    • ¥15 matlab代码代写,需写出详细代码,代价私
    • ¥15 ROS系统搭建请教(跨境电商用途)
    • ¥15 AIC3204的示例代码有吗,想用AIC3204测量血氧,找不到相关的代码。
    • ¥20 CST怎么把天线放在座椅环境中并仿真