art.php和artadd.php和artedit.php

Contributor:奋斗的少年 Type:代码 Date time:2017-08-03 20:26:23 Favorite:7 Score:0
返回上页 Report
请选择举报理由:




Collection Modify the typo
<?php
date_default_timezone_set("PRC");
include('./lib/func.php');
require('./lib/mysql.php');
$sql='select * from cat';
$cat = myGetAll($sql);
if(empty($_POST)) {
include('./view/admin/artadd.html');
}else
{
$art['title'] = trim($_POST['title']);
$art['cat_id'] = trim($_POST['cat_id']);
$art['content'] = $_POST['content'];
$art['pubtime'] = date('y-m-d h:i:s');
$art['arttag'] = trim ($_POST['tag']);
if(empty($art['title'])) {
exit('栏目不能为空');
}
if(!myExec('art',$art)){
echo mysql_error();
} else{
//echo $cat['catname'] ;
$art['tag'] = trim($_POST['tag']);
if($art['tag'] == ''){
$sql = "update cat set num=num+1 where cat_id=$art[cat_id]";
myQuery($sql);
succ();
}else{
$sql = "update cat set num=num+1 where cat_id=$art[cat_id]";
myQuery($sql);
$art_id =getLastId();
$sql = "insert into tag(art_id,tag) values (";
$tag = explode(',',$art['tag']);
foreach ($tag as $a){
$sql .= $art_id.",'" . $a . "' ) , (" ;
}
$sql = rtrim($sql,",( ,");
$resu = myQuery($sql);
if ($resu){
succ('success');
header("Location: artedit.php");
}else{
echo mysql_error();
}
}
}
}
?>
<?php
include("./lib/init.php");
$art_id = $_GET['art_id'];
if (isset($_GET['art_id'])){
$where = " and art_id =$_GET[art_id] ";
}else{
$where = '';
}
$sql2 = 'select title,content,pubtime,comm ,catname
from art left join cat on art.cat_id = cat.cat_id where 1 '.$where;
$art = myGetAr($sql2);
$sql = "select * from comment where art_id = $art_id";
$comment = myGetAll($sql);
if(!empty($_POST)){
$comm['nick']= trim($_POST['nick']);
$comm['email']= trim($_POST['email']);
$comm['content']= trim($_POST['content']);
$comm['pubtime']= date('y-m-d H:i:s',time());
$comm['art_id']= $art_id;
$comm['ip'] = sprintf('%u',ip2long(getRealIp()));
$rs=myExec('comment',$comm);
if($rs)
{
$sql = "update art set comm =comm+1 where art_id =$art_id";
myQuery($sql);
$ref = $_SERVER['HTTP_REFERER'];
header("Location:$ref");
}
}
include('./view/front/art.html');
?>
<?php
require("./lib/func.php");
require("./lib/mysql.php");
$art_id = $_GET["art_id"];
$sql = 'delete from art where art_id = '.$art_id;
if(!is_numeric($art_id)){
fail('ʧ°Ü');
}else{
myQuery($sql);
header('Location:artlist.php');
}
?>
<?php
date_default_timezone_set("PRC");
include('./lib/func.php');
require('./lib/mysql.php');
$art_id=$_GET['art_id'];
$sql1='select * from cat';
$cat = myGetAll($sql1);
$sql2 = 'select * from art where art_id ='.$art_id;
$art = myGetAr($sql2);
if(empty($_POST)) {
include('./view/admin/artedit.html');
}else
{
$art['title'] = trim($_POST['title']);
$art['cat_id'] = trim($_POST['cat_id']);
$art['content'] = $_POST['content'];
$art['pubtime'] = date('y-m-d H:i:s');
$art['arttag'] = trim($_POST['tag']);
if(empty($art['title'])) {
exit('栏目不能为空');
}
if(!myExec('art',$art,'update','art_id ='.$art_id)){
echo mysql_error();
} else{
//echo $cat['catname'] ;
succ();
}
}
?>
<?php
require('./lib/init.php');
if(!acc()){
header('Location:login.php');
exit();
}
$art = myGetAll('select art.* , cat.catname from art left join cat on art.cat_id = cat.cat_id');
include('./view/admin/artlist.html');
?>
声明:以上文章均为用户自行添加,仅供打字交流使用,不代表本站观点,本站不承担任何法律责任,特此声明!如果有侵犯到您的权利,请及时联系我们删除。
Hot degree:
Difficulty:
quality:
Description: the system according to the heat, the difficulty, the quality of automatic certification, the certification of the article will be involved in typing!

This paper typing ranking TOP20

登录后可见

用户更多文章推荐