:::

MarkDown

$files_list
form; return $main; } //儲存新聞 function save_news($sn=""){ if(!isset($_SESSION['uid']) or empty($_SESSION['uid'])){ return; } //過濾外面傳來的變數 $op=isset($_POST['op'])?$_POST['op']:""; $password=isset($_POST['password'])?$_POST['password']:""; $news_title=isset($_POST['news_title'])?check_input($_POST['news_title']):""; $news_content=isset($_POST['news_content'])?check_input($_POST['news_content']):""; $author=isset($_POST['author'])?check_input($_POST['author']):""; $ip=isset($_POST['ip'])?check_input($_POST['ip']):""; $post_time=isset($_POST['post_time'])?check_input($_POST['post_time']):""; $status=isset($_POST['status'])?check_input($_POST['status']):""; $cate_title=isset($_POST['cate_title'])?check_input($_POST['cate_title']):""; $cate_sn=isset($_POST['cate_sn'])?intval($_POST['cate_sn']):""; link_db(); //新增分類 if(empty($cate_sn) and !empty($cate_title)){ $sql="insert into eznews_cate (cate_title) values('$cate_title')"; mysql_query($sql) or die($sql."
".mysql_error()); $cate_sn=mysql_insert_id(); }elseif(!empty($cate_sn) and !empty($cate_title)){ //修改分類 $sql="update eznews_cate set cate_title='$cate_title' where cate_sn='$cate_sn'"; mysql_query($sql) or die($sql."
".mysql_error()); } //存到資料庫 if($sn){ $sql="update eznews set cate_sn='$cate_sn', news_title='$news_title', news_content='$news_content', ip='$ip', author='$author', post_time='$post_time', status='$status' where sn='$sn' and uid='{$_SESSION['uid']}'"; mysql_query($sql) or die($sql."
".mysql_error()); }else{ $sql="insert into eznews (cate_sn,news_title, news_content, ip, author, uid, post_time,status) values('$cate_sn','$news_title', '$news_content', '$ip', '$author', '{$_SESSION['uid']}','$post_time', '$status')"; mysql_query($sql) or die($sql."
".mysql_error()); $sn=mysql_insert_id(); } //刪除勾選的檔案 if(isset($_POST['del_files'])){ foreach ($_POST['del_files'] as $file_new_name) { //刪除實體檔案 if(unlink("uploads/{$file_new_name}")){ //刪除資料庫紀錄 $sql="delete from eznews_files where file_new_name='$file_new_name'"; mysql_query($sql) or die($sql."
".mysql_error()); } } } //上傳檔案 if(isset($_FILES)){ //建立資料夾 if(!is_dir('uploads')){ mkdir('uploads'); } foreach($_FILES['files']['tmp_name'] as $i =>$tmp_name){ $ext=pathinfo($_FILES['files']['name'][$i], PATHINFO_EXTENSION); $new=substr(md5($_FILES['files']['name'][$i]), -5); $new_name="uploads/{$sn}_{$new}.{$ext}"; if(move_uploaded_file($tmp_name, $new_name)){ $sql="insert into eznews_files ( sn, file_name, file_size, file_type, file_new_name) values('$sn','{$_FILES['files']['name'][$i]}', '{$_FILES['files']['size'][$i]}}', '{$_FILES['files']['type'][$i]}', '{$sn}_{$new}.{$ext}')"; mysql_query($sql) or die($sql."
".mysql_error()); } } } } //替特殊符號加入反斜線 function check_input($value){ if (!get_magic_quotes_gpc()){ $value = addslashes($value); } return $value; } ?> ```
:::

搜尋

QR Code 區塊

https%3A%2F%2Ftad0616.cp22.secserverpros.com%2Fmodules%2Ftad_book3%2Fmarkdown.php%3Ftbdsn%3D1115

書籍目錄

展開 | 闔起

線上使用者

244人線上 (73人在瀏覽線上書籍)

會員: 0

訪客: 244

更多…