@session_start(); if (@$_SESSION['identity'] == 'admin') { $smarty->assign('identity', 'admin'); } else { $smarty->assign('identity', ''); } //获取当前子菜单id if (empty($_GET['subid'])) { $subid = $_POST['subid']; } else { $subid = $_GET['subid']; } //删除文件 if (@$_POST['function'] == "delart") { $sql = "delete from article_table WHERE id=" . $_POST['artid']; $s->execute_sql($sql); //删除本地缓存 $filename = "templates/article/" . $_POST['artid'] . ".tpl"; @unlink($filename); } $smarty->display('nav.tpl'); echo "<br>"; @$smarty->assign('navarray', $s->select_nav("select * from article_table;")); @($article = $s->select_nav("select title,id from article_table where subid=" . $subid . " order by id ;")); $i = 0; foreach ($article as $b) { //依次取出数组中元素,$a是元素的键名$b是键值 $article[$i]['filename'] = "../article/" . $article[$i]['id'] . ".tpl"; $i++; } $smarty->assign('articlearray', $article);
header("Location: login.php"); } //获取编辑器内容 $htmlData = ''; if (!empty($_POST['content1'])) { if (get_magic_quotes_gpc()) { $htmlData = stripslashes($_POST['content1']); } else { $htmlData = $_POST['content1']; } $content1 = mysql_real_escape_string($htmlData); //插入 $time = time(); if (@$_POST['function'] == "updateart") { $sql = "update navart_table set title ='" . $_POST['title'] . "' where id =" . $_POST['artid']; $s->execute_sql($sql); $sql = "update article_table set date = now() where id =" . $_POST['artid']; $s->execute_sql($sql); $filename = "templates/article/" . $_POST['artid'] . ".tpl"; // file_put_contents("aaaaaaaaa.txt", $sql); } else { $sql = "insert into navart_table(navartid, title, artsort\t,date,count) VALUES (" . $time . ",'" . $_POST['title'] . "',1,now(),0)"; $filename = "templates/article/" . $time . ".tpl"; $s->execute_sql($sql); } file_put_contents($filename, $htmlData); // header("Location: admin.php"); // exit; } // print_r($s->select_nav("select * from navart_table order by artsort;")); //点击删除导航条按钮
<?php header("Content-Type: text/html;charset=utf-8"); $s = new sqlhelper($G); $s->execute_sql("set @mycnt=0;"); $smarty->assign('picarray', $s->select_nav("select @mycnt := @mycnt +1 as id, picname from image_table ;")); $piccount = $s->select_nav("select count(*) as piccount from image_table ;"); @$smarty->assign('piccount', $piccount[0][piccount]); // $smarty->display("carousel.tpl");
$sql = "select username from user_table where username = '******'username'] . "' and password = '******'"; $array = $s->select_nav($sql); // print_r($array); @session_start(); @($abc = $_SESSION['verify']); //用户名密码是否正确 if (!empty($array) && $yanz == $abc) { //密码输入正确,不提示错误 $smarty->assign('password', "update"); $newpassword = sha1($newpassword); //保留登录信息 @session_start(); $_SESSION['password'] = $newpassword; $sql = "update user_table set password= '******' where username = '******'username'] . "'"; // echo $sql; $array = $s->execute_sql($sql); //跳转页面 @session_start(); $_SESSION['logincount'] = 0; //清空登录错误次数 $smarty->display('admin.tpl'); $smarty->display('updatepasswd.tpl'); exit; } else { //引用模板文件 $smarty->assign('password', "error"); //密码错误 @session_start(); @$_SESSION['logincount']++; //输入错误次数累加 $trycount = 3 - $_SESSION['logincount'];