<?php //引用类文件 require './config.php'; require './common.php'; //执行sql语句 $s = new sqlhelper($G); //点击新增导航条按钮 if (@$_POST['function'] == 'addnav') { @($sql = "insert into nav_table (navid,navname,navsort) VALUES (" . $_POST[navid] . ",'" . $_POST[navname] . "'," . $_POST[navsort] . ")"); @$s->execute_sql($sql); header("Location: admin.php"); exit; } //点击删除导航条按钮 if (@$_POST['function'] == 'delnav') { @($sql = "delete from nav_table WHERE navid=" . $_POST['navid'] . ""); } //点击更新导航栏信息 if (@$_POST['function'] == 'update_nav') { @($sql = "UPDATE nav_table SET navname='" . $_POST['nname'] . "',navsort=" . $_POST['nid'] . " WHERE navid=" . $_POST['navid'] . ""); } //点击新增子菜单按钮 if (@$_POST['function'] == 'addsub') { @($sql = "insert into sub_table (subid,subname,subsort,navid) VALUES (" . $_POST[subid] . ",'" . $_POST[subname] . "'," . $_POST[subsort] . "," . $_POST[navid] . ")"); } //点击删除子菜单按钮 if (@$_POST['function'] == 'delsub') { @($sql = "delete from sub_table WHERE subid=" . $_POST['subid'] . ""); } //点击更新子菜单栏信息
//连接成功 $con = 1; } //$s->print_config($G); if (!empty($_POST['admininfo']['password']) && $_POST['admininfo']['password'] != $_POST['admininfo']['password2']) { $smarty->assign('password', "diffent"); $passwd = 0; } else { $smarty->assign('password', "same"); $passwd = 1; } if ($con && $passwd) { // //创建数据库、数据表 $s = new sqlhelper($G); $s->create_db(); $q = new sqlhelper($G); $q->create_table(); // //新增管理员账号 $password = sha1($_POST['admininfo']['password2']); $s->insert_user($_POST['admininfo']['username'], $password); // //延时跳转到登录界面 echo "网站应用已安装,如需重新安装,请删除根目录的lock.php文件<br><br><a href='login.php'>自动跳转</a>"; header("Refresh:3;url=login.php"); // // //已安装。加锁 $lockfile = "lock.php"; $fp2 = fopen($lockfile, 'w'); fwrite($fp2, 'installed'); fclose($fp2); //创建空文件夹 if (!file_exists('./editor/attached')) { mkdir("./editor/attached");
unset($_SESSION["delaytime"]); //清空密码输入错误时间 } } @session_start(); //开启session //自动登录 if (!empty($_SESSION['username'])) { header("Location: admin.php"); } //提交表单过来 if (!empty($username) && !empty($password)) { $password = sha1($password); //查询账号信息 $sql = "select username from user_table where username = '******' and password = '******'"; $s = new sqlhelper($G); $array = $s->select_nav($sql); //用户名密码是否正确 if (!empty($array)) { //保留登录信息 @session_start(); $_SESSION['username'] = $_POST['username']; $_SESSION['password'] = $_POST['password']; $_SESSION['identity'] = "admin"; //密码输入正确,不提示错误 $smarty->assign('password', "true"); //跳转页面 @session_start(); $_SESSION['logincount'] = 0; //清空登录错误次数 header("Location: admin.php");
<?php header("Content-Type: text/html;charset=utf-8"); require 'common.php'; require 'config.php'; $s = new sqlhelper($G); @session_start(); //开启session //注销 if (@$_POST['action'] == 'logout') { session_destroy(); header("Location: login.php"); } //未登录 if (empty($_SESSION['username'])) { header("Location: login.php"); } if (!empty($_FILES['myFile'])) { $fileInfo = $_FILES['myFile']; $filename = time(); //1.判断下错误号,只有为0或者是UPLOAD_ERR_OK,没有错误发生,上传成功 if ($fileInfo['error'] == UPLOAD_ERR_OK) { //判断上传文件的大小 $maxSize = 2097152; //允许上传文件的最大值 if ($fileInfo['size'] > $maxSize) { exit('上传文件不能大于2M'); } // $ext=strtolower(end(explode('.',$fileInfo['name']))); //检测上传文件的类型 $allowExt = array('jpeg', 'jpg', 'png', 'gif', 'wbmp', 'bmp');
<?php $s = new sqlhelper($G); $s->execute_sql("set @mycnt=0;"); $smarty->assign('array2', $s->select_nav("select @mycnt := @mycnt +1 as top1,id,title from article_table order by date desc limit 0,10;")); // $smarty->display("top.tpl");
<?php require './config.php'; require './common.php'; $s = new sqlhelper($G); @session_start(); //开启session //未登录 if (empty($_SESSION['username'])) { 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)";
<?php require './config.php'; require './common.php'; $s = new sqlhelper($G); $s->delete_table(); //删除数据表 $s->delete_db(); //删除数据库失效 //删除安装后产生的文件及目录_函数(方法) function deldir($dir) { $dh = opendir($dir); while ($file = readdir($dh)) { if ($file != "." && $file != "..") { $fullpath = $dir . "/" . $file; if (!is_dir($fullpath)) { unlink($fullpath); } else { deldir($fullpath); } } } @rmdir($dir); } $filename = 'lock.php'; //是否已安装的提示文件 unlink($filename); //调用方法 deldir('./templates/article'); deldir('./templates/templates_c'); deldir('./editor/attached/image');
@($sql = "update article_table set count=count+1 where id='" . $_POST['artid'] . "'"); $result = mysql_query($sql); } else { $sql = "update article_table set count=count+1 where id='" . $_GET['artid'] . "'"; $result = mysql_query($sql); } //获取导航文章id if (empty($_GET['navartid'])) { @($sql = "update navart_table set count=count+1 where navartid='" . $_POST['navartid'] . "'"); $result = mysql_query($sql); } else { $sql = "update navart_table set count=count+1 where navartid='" . $_GET['navartid'] . "'"; $result = mysql_query($sql); } //赋值 $s = new sqlhelper($G); //导航条 $smarty->assign('navarray', @$s->select_nav("select navname,navid from nav_table order by navsort;")); $smarty->assign('subarray', @$s->select_nav("select subname,navid,subid from sub_table order by subsort;")); //文章列表 if (empty($subid)) { @($artlist = $s->select_nav("select * from article_table limit 0,1;")); } else { @($artlist = $s->select_nav("select * from article_table where subid=" . $subid . " order by id ;")); } $smarty->assign('articlearray', $artlist); //设置各个模块背景颜色 $smarty->assign('navbgcolor', $G['NAVBGCOLOR']); $smarty->assign('hotbgcolor', $G['HOTBGCOLOR']); $smarty->assign('lastbgcolor', $G['LASTBGCOLOR']); $smarty->assign('artbgcolor', $G['ARTBGCOLOR']);
//获取编辑器内容 $htmlData = ''; if (!empty($_POST['content1'])) { if (get_magic_quotes_gpc()) { $htmlData = stripslashes($_POST['content1']); } else { $htmlData = $_POST['content1']; } } //获取哪个子菜单跳转过来的id $smarty->assign('subid', $_GET['subid']); if (!empty($_POST['subid'])) { $content1 = mysql_real_escape_string($htmlData); //插入 $time = time(); $s = new sqlhelper($G); if ($_POST['function'] == "updateart") { $sql = "update article_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 article_table(id, title, subid,date,count) VALUES (" . $time . ",'" . $_POST['title'] . "'," . $_POST['subid'] . ",now(),0)"; $filename = "templates/article/" . $time . ".tpl"; $s->execute_sql($sql); } file_put_contents($filename, $htmlData); header("Location: admin.php"); exit;
<?php //引用类文件 require './common.php'; require './config.php'; $s = new sqlhelper($G); //检测是否安装过 $filename = 'lock.php'; if (!file_exists($filename)) { echo "网站应用还未安装<br><br><a href='install.php'>自动跳转</a>"; header("Refresh:3;url=install.php"); exit; } @($oldpassword = $_POST['oldpassword']); @($newpassword = $_POST['newpassword']); @($yanz = $_POST['yanz']); // echo $oldpassword.$newpassword.$yanz.$_SESSION['username']; // exit; @session_start(); if (!empty($_SESSION['delaytime'])) { date_default_timezone_set("Asia/Shanghai"); $nowdate = date("y-m-d h:i:sa"); //获取当前时间 $delay = strtotime($nowdate) - strtotime($_SESSION['delaytime']); //输入3次错误的时间到现在过了多久 if ($delay <= 30) { @session_start(); $time = 30 - $delay; //重新刷新还是会继续计时 $smarty->assign('delaytime', $time); $smarty->display('delay.tpl');
<?php //引用类文件 require './common.php'; require './config.php'; //赋值 $s = new sqlhelper($G); //获取当前文章id if (empty($_GET['artid'])) { $artid = $_POST['artid']; } else { $artid = $_GET['artid']; } //获取当前子菜单id if (empty($_GET['subid'])) { $subid = $_POST['subid']; } else { $subid = $_GET['subid']; } @($article = $s->select_nav("select * from article_table where id=" . $artid . " ;")); $article[0]['filename'] = "./templates/article/" . $article[0]['id'] . ".tpl"; $smarty->assign('articletitle', $article[0]['title']); $smarty->assign('subid', $subid); $smarty->assign('artid', $artid); $smarty->display('admin.tpl'); echo "<br>"; $articlecontent = file_get_contents($article[0]['filename']); $smarty->assign('articlecontent', $articlecontent); $smarty->display('editarticle.tpl');
<?php //引用类文件 require './config.php'; require './common.php'; @session_start(); //开启session //未登录 if (empty($_SESSION['username'])) { header("Location: login.php"); } $s = new sqlhelper($G); //点击更新按钮 if (@$_POST['function'] == 'updatelink') { $sql = "update link_table set name = '" . $_POST['name'] . "' where src = '" . $_POST['src'] . "'"; $s->execute_sql($sql); } //点击新增按钮 if (@$_POST['function'] == 'addlink') { $sql = "insert into link_table(src,name) VALUES ('" . $_POST['src'] . "','" . $_POST['name'] . "')"; $s->execute_sql($sql); } //点击删除按钮 if (@$_POST['function'] == 'dellink') { $sql = "delete from link_table WHERE src='" . $_POST['src'] . "'"; $s->execute_sql($sql); } $smarty->assign('linkarray', $s->select_nav("select * from link_table;")); //引用模板文件 $smarty->display('admin.tpl'); $smarty->display('addlink.tpl');
<?php require './config.php'; require './common.php'; $s = new sqlhelper($G); //获取编辑器内容 $htmlData = ''; if (!empty($_POST['content1'])) { if (get_magic_quotes_gpc()) { $htmlData = stripslashes($_POST['content1']); } else { $htmlData = $_POST['content1']; } } //修改后重新提交内容 if (@$_POST['function'] == "updateart") { $sql = "update navart_table set title ='" . $_POST['title'] . "' where navartid ='" . $_POST['artid'] . "';"; $s->execute_sql($sql); // file_put_contents("aaaaaaaaa.txt", $sql); $sql = "update navart_table set date = now() where navartid =" . $_POST['artid']; $s->execute_sql($sql); $sql = "update navart_table set artsort = " . $_POST['sort'] . " where navartid =" . $_POST['artid']; $s->execute_sql($sql); $filename = "templates/article/" . $_POST['artid'] . ".tpl"; file_put_contents($filename, $htmlData); header("Location: addpage.php"); exit; } //编辑功能显示原始内容 if (!empty($_POST['artid'])) { $navart = @$s->select_nav("select * from navart_table where navartid = " . $_POST['artid'] . ";");
<?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");
<?php //引用类文件 require './common.php'; require './config.php'; $smarty->assign('logined', 'false'); session_start(); //开启session //自动登录 if (!empty($_SESSION['username'])) { $smarty->assign('logined', 'true'); } //赋值 $snav = new sqlhelper($G); $smarty->assign('navarray', $snav->select_nav("select navname,navid from nav_table order by navsort;")); $smarty->assign('subarray', $snav->select_nav("select * from sub_table order by subsort;")); //引用模板文件 // $smarty->display('nav.tpl'); ?>
<?php //引用类文件 require 'nav.php'; //赋值 $s = new sqlhelper($G); //管理员登录状态 @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 ;"));
<?php //引用类文件 require './config.php'; require './common.php'; $s = new sqlhelper($G); @($yanz = $_POST['yanz']); $smarty->assign('yanz', "true"); //点击新增留言 if (@$_POST['function'] == 'add' && !empty($yanz)) { @session_start(); @($abc = $_SESSION['verify']); if ($yanz == $abc) { $id = time(); @($sql = "insert into message_table (id,name,email,text,date) VALUES (" . $id . ",'" . $_POST['name'] . "','" . $_POST['email'] . "','" . $_POST['text'] . "',now())"); $s->execute_sql($sql); header("Location: index.php"); } else { $smarty->assign('yanz', "false"); } } //引用模板文件 //导航条 $smarty->assign('navarray', @$s->select_nav("select navname,navid from nav_table order by navsort;")); $smarty->assign('subarray', @$s->select_nav("select subname,navid,subid from sub_table order by subsort;")); $smarty->assign('navbgcolor', $G['NAVBGCOLOR']); session_start(); //是否登录 if (!empty($_SESSION['username'])) { $smarty->assign('logined', 'true'); } $smarty->display('nav.tpl');