|
楼主 |
发表于 2010-10-21 10:42:28
|
显示全部楼层
MODEL
PHP复制代码 function add ($upfile){
$rn="\n";
$kg=" ";
$br="<br />";
$str="";
$string="";
$baohan=str_replace('\\','',$_POST['baohan']);
$baohan=str_replace($br,$str,$baohan);
$baohan=str_replace($rn,$br,$baohan);
$buhan=str_replace('\\','',$_POST['buhan']);
$buhan=str_replace($br,$str,$buhan);
$buhan=str_replace($rn,$br,$buhan);
$biaozhun=str_replace('\\','',$_POST['biaozhun']);
$biaozhun=str_replace($br,$str,$biaozhun);
$biaozhun=str_replace($rn,$br,$biaozhun);
$xuzhi=str_replace('\\','',$_POST['xuzhi']);
$xuzhi=str_replace($br,$str,$xuzhi);
$xuzhi=str_replace($rn,$br,$xuzhi);
$ts=str_replace('\\','',$_POST['ts']);
$ts=str_replace($br,$str,$ts);
$ts=str_replace($rn,$br,$ts);
$tour_category2="";
$num1=count($_POST['tour_category2']);
for($i=0;$i<$num1;$i++){
if($_POST['tour_category2'][$i]!=""){
if($tour_category2==""){
$tour_category2.=$_POST['tour_category2'][$i];
}else{
$tour_category2.="-".$_POST['tour_category2'][$i];
}
}
}
$ts_category="";
$num2=count($_POST['ts_category']);
for($j=0;$j<$num2;$j++){
if($_POST['ts_category'][$j]!=""){
if($ts_category==""){
$ts_category.=$_POST['ts_category'][$j];
}else{
$ts_category.="-".$_POST['ts_category'][$j];
}
}
}
$px = $_POST['px']? $_POST['px']:'1';
$hidden = empty($_POST['hidden'])? 0:$_POST['hidden'];
$tuijian = empty($_POST['tuijian'])? 0:$_POST['tuijian'];
$qinzi = empty($_POST['qinzi'])? 0:$_POST['qinzi'];
$tejia = empty($_POST['tejia'])? 0:$_POST['tejia'];
$remai = empty($_POST['remai'])? 0:$_POST['remai'];
$zhifei = empty($_POST['zhifei'])? 0:$_POST['zhifei'];
$content = empty($_POST['content'])? '':$_POST['content'];
$code = empty($_POST['code'])? '':$_POST['code'];
$data = array(
'title'=>$_POST['title'],
'tour_category'=>$_POST['tour_category'],
'tour_category2'=>$tour_category2,
'ts_category'=>$ts_category,
'code'=>$code,
'days'=>$_POST['days'],
'tel'=>$_POST['tel'],
'departure_date'=>$_POST['departure_date'],
'reference_price'=> $_POST['reference_price'],
'tuijian'=> $tuijian,
'qinzi'=> $qinzi,
'tejia'=> $tejia,
'remai'=> $remai,
'zhifei'=> $zhifei,
'hidden'=>$hidden,
'px'=>$px,
'upfile'=>$upfile,
'content'=> $content,
'xc'=>$_POST['xc'],
'ts'=> $ts,
'baohan'=> $baohan,
'buhan'=> $buhan,
'biaozhun'=> $biaozhun,
'xuzhi'=> $xuzhi,
'addtime'=>date("Y-m-d"),
'modifytime'=>date("Y-m-d")
);
$this->db->insert('tour',$data);
$id = $this->db->insert_id();
$this->get_code($id,$code);
if($_POST['xc']==2){
$total=count($_POST['daytitle']);
$data_xc = array();
for($i=0;$i<$total;$i++){
unset($data_xc);
if($_POST['daytitle'][$i]!=""){
$data_xc["daytitle"]=$_POST['daytitle'][$i];
$data_xc["daycontent"]=str_replace('\\','',$_POST['daycontent'][$i]);
$data_xc["daycontent"]=str_replace($br,$str,$data_xc["daycontent"]);
$data_xc["daycontent"]=str_replace($rn,$br,$data_xc["daycontent"]);
$data_xc["breakfast"]=$_POST['breakfast'][$i];
$data_xc["lunch"]=$_POST['lunch'][$i];
$data_xc["supper"]=$_POST['supper'][$i];
$data_xc["zs"]=$_POST['zs'][$i];
$data_xc["jt"]=$_POST['jt'][$i];
$data_xc["tour_id"]=$id;
}
$this->db->insert('foolishtour',$data_xc);
}
}
return $id;
} 复制代码 |
|