?
Path : /home/admin/domains/happytokorea.com/public_html/backend/modules/tour/ |
Current File : /home/admin/domains/happytokorea.com/public_html/backend/modules/tour/q1.php |
<? session_start(); require_once('../../../config.php'); require_once('../../../libs/MySql.php'); require_once('../../../libs/function.php'); require_once('../../../libs/global.php'); require_once('../../../libs/backoff_ajax.php'); require_once('../../../libs/backoff.php'); require_once('../../../libs/xajax/xajax.inc.php'); $db=new MySql; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <? $ct=$db->count_data('tour_content',"WHERE content_tour_id='{$_POST['content_tour_id']}'"); $ct=$ct+1; $add=Array('content_topic'=>$_POST['TopicRound'],'content_tour_id'=>$_POST['content_tour_id'],'content_order'=>$ct); if ($_SESSION["la"] == 1){ $db->Insert('tour_content',$add); $id=$db->getRow('tour_content',"WHERE content_topic='{$_POST['TopicRound']}' AND content_tour_id='{$_POST['content_tour_id']}' And content_order='".$ct."'"); }else{ $db->Insert('tour_content_en',$add); $id=$db->getRow('tour_content_en',"WHERE content_topic='{$_POST['TopicRound']}' AND content_tour_id='{_POST['content_tour_id']}' And content_order='".$ct."'"); } $i=1; foreach($_POST['subTopic'] as $k=>$v){ $ContentPhoto1=""; $ContentPhoto2=""; $ContentPhoto3=""; if($_FILES['photos1']['name'][$k] != ''){ $filename = $_FILES['photos1']['name'][$k]; $filetype = $_FILES['photos1']['type'][$k]; $filetmp = $_FILES['photos1']['tmp_name'][$k]; $pic=Random_Int(8).date('dmYHism',time()); if($filetype == "image/gif"){ $ContentPhoto1=$pic.".gif"; }else if ( $filetype == "image/png"){ $ContentPhoto1=$pic.".png"; }else if (($filetype =="image/jpg")||($filetype =="image/jpeg")||($filetype =="image/pjpeg")){ $ContentPhoto1=$pic.".jpg"; } if($ContentPhoto1 != ""){ if ($filetype != ""){ move_uploaded_file($filetmp, "../../images/tour/".$ContentPhoto1); } } } if($_FILES['photos2']['name'][$k] != ''){ $filename = $_FILES['photos2']['name'][$k]; $filetype = $_FILES['photos2']['type'][$k]; $filetmp = $_FILES['photos2']['tmp_name'][$k]; $pic=Random_Int(8).date('dmYHism',time()); if($filetype == "image/gif"){ $ContentPhoto2=$pic.".gif"; }else if ( $filetype == "image/png"){ $ContentPhoto2=$pic.".png"; }else if (($filetype =="image/jpg")||($filetype =="image/jpeg")||($filetype =="image/pjpeg")){ $ContentPhoto2=$pic.".jpg"; } if($ContentPhoto2 != ""){ if ($filetype != ""){ move_uploaded_file($filetmp, "../../images/tour/".$ContentPhoto2); } } } if($_FILES['photos3']['name'][$k] != ''){ $filename = $_FILES['photos3']['name'][$k]; $filetype = $_FILES['photos3']['type'][$k]; $filetmp = $_FILES['photos3']['tmp_name'][$k]; $pic=Random_Int(8).date('dmYHism',time()); if($filetype == "image/gif"){ $ContentPhoto3=$pic.".gif"; }else if ( $filetype == "image/png"){ $ContentPhoto3=$pic.".png"; }else if (($filetype =="image/jpg")||($filetype =="image/jpeg")||($filetype =="image/pjpeg")){ $ContentPhoto3=$pic.".jpg"; } if($ContentPhoto3 != ""){ if ($filetype != ""){ move_uploaded_file($filetmp, "../../images/tour/".$ContentPhoto3); } } } //if($v!=''){ $data1=Array( 'content_order'=>$i, 'content_parent'=>$id['content_id'], 'content_tour_id'=>$_POST['content_tour_id'], 'content_time'=>$v, 'content_detail'=>$_POST['detail'][$k], 'Content_photo1'=>$ContentPhoto1, 'Content_photo2'=>$ContentPhoto2, 'Content_photo3'=>$ContentPhoto3 ); $db->Insert('tour_content',$data1); //} $i++; } if($db->mysqlError()==''){ $error="บันทึกสำเร็จ"; echo "<SCRIPT>alert(\"$error\"); window.history.back(); </SCRIPT>\n"; }else{ $error="ไม่สามารถบันทึกข้อมูลได้"; echo "<SCRIPT>alert(\"$error\"); window.history.back(); </SCRIPT>\n"; } ?> </body> </html>