以下是我的代码,我正在尝试附加$vid
的值,而不是下次我的文件加载时,我正在尝试查找数组$vid
中当前传递的$ids
值,但每次我获得成功的时候,我出错了,我不能正确追加价值吗?
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);
}
}