<?php
function bb_thread_ads_action_apply()
{
//Ki?m tra Cookie, n?u ko ??ng nh?p thì tr? v? false
$username=isset(Configs::$_['user_data']['user_id'])?Configs::$_['user_data']['user_id']:'';
try {
isValidAccessAPI();
} catch (\Exception $e) {
echo responseData($e->getMessage(),'yes');return false;
}
$list_id=addslashes(getPost('list_id',''));
$action=addslashes(getPost('action',''));
$split_post_c=explode(',', $list_id);
$reformat_post_c='';
$total=count($split_post_c);
for ($i=0; $i < $total; $i++) {
$reformat_post_c.="'".$split_post_c[$i]."',";
}
$reformat_post_c=substr($reformat_post_c, 0,strlen($reformat_post_c)-1);
$queryStr='';
if($action=='delete')
{
// if(!isset(Configs::$_['user_permissions']['post09']))
// {
// echo responseData('ERROR_01','yes'); return false;
// }
$queryStr="delete from bb_ads_thread_data where ads_id IN (".$reformat_post_c.")";
}
if($action=='activate')
{
// if(!isset(Configs::$_['user_permissions']['post09']))
// {
// echo responseData('ERROR_01','yes'); return false;
// }
$queryStr="update bb_ads_thread_data set status='1' where ads_id IN (".$reformat_post_c.")";
}
if($action=='deactivate')
{
// if(!isset(Configs::$_['user_permissions']['post09']))
// {
// echo responseData('ERROR_01','yes'); return false;
// }
$queryStr="update bb_ads_thread_data set status='0' where ads_id IN (".$reformat_post_c.")";
}
$db=new Database();
$db->nonquery($queryStr);
return 'OK';
}
|