<?php session_start(); //引入静态常量 require_once '../../../util/StackConst.php'; //引入PicDao require_once '../dao/PicDao.php'; //实例化 $picDao = new PicDao(); //获得页数 $page = @$_GET['page']; $pic_type = @$_GET['pic_type']; //实例化 $picDao = new PicDao(); //获得图片列表 $arrPics = $picDao->getPicList($page, $pic_type); //获得图片分类数量 $eachPicCount = $picDao->getEachPicCount(); ?> <!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>itstack|糗图图库</title> <link rel="stylesheet" type="text/css" href="../../zcss/piclist.css" /> <script language="javascript" type="text/javascript" src="../../zjs/jquery-1.8.3.js"></script> <script language="javascript" type="text/javascript" src="../../zjs/jquery.corner.js"></script> <script language="javascript" type="text/javascript"> $(function(){
<?php //引入静态常量 require_once '../../../util/StackConst.php'; //引入PicDao require_once '../dao/PicDao.php'; //实例化PicDao $picDao = new PicDao(); //获取pic集合 $arrPics = $picDao->getPicList(); ?> <!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" /> <link rel="stylesheet" href="../zjs/pixelmatrix/css/uniform.default.css" type="text/css" media="screen"> <script language="javascript" type="text/javascript" src="../zjs/jquery-1.8.3.js"></script> <script language="javascript" type="text/javascript" src="../zjs/pixelmatrix/jquery.uniform.js"></script> <script language="javascript" type="text/javascript" src="../zjs/fzw_ht.js" charset="utf-8"></script> <title>图片资源管理</title> </head> <body> <table border="1" width="100%"> <tr align="center"> <th>图片名称</th> <th>图片地址</th> <th>保存日期</th> <th>缩略图展示</th> <th>操作</th>
require_once '../dao/PicDao.php'; //实例化数据库 $picDao = new PicDao(); //装载需要插入数据库的数据 $arrPicInfo = array("pic_name" => @$_POST['pic_name'], "pic_urlname" => $pic_urlname, "pic_savedate" => StackConst::get_date()); //保存图片信息到数据 if ($picDao->insertPic($arrPicInfo)) { echo "图片上传成功!"; StackConst::jump_page("../view/piclist.php"); } else { echo "图片上传失败!"; } } else { echo "图片上传失败!"; } } } else { if ("deletepic" == $type) { //删除图片 //图片上传成功后引入数据库操作 require_once '../dao/PicDao.php'; //实例化数据库 $picDao = new PicDao(); if ($picDao->deletePicById(@$_GET['pic_id'])) { echo "图片删除成功!"; StackConst::jump_page("../view/piclist.php"); } else { echo "图片删除失败!"; } } }
/** * 获取PicList * @return picList 集合 */ public function getPicList() { require_once '../../resourcepic/dao/PicDao.php'; $picDao = new PicDao(); return $picDao->getPicList(); }
require_once '../../../util/StackConst.php'; //开启session session_start(); //设置时间格式 date_default_timezone_set('Asia/Shanghai'); //获取操作类型值 $type = @$_POST['type']; $type = $type == "" ? @$_GET['type'] : $type; //uploadpic 上传图片 //ajaxgetpiclist 异步获得图片列表【分页方式获得】 if ("uploadpic" == $type) { $picArray = array("1" => "GIF", "2" => "JPG", "3" => "PNG"); //引入PicDao require_once '../dao/PicDao.php'; //实例化 $picDao = new PicDao(); //验证用户是否登录,或者登录信息已经失效 if (!isset($_SESSION['userLoginMessage'])) { echo "请先登录"; } //先验证图片是否提交 if (isset($_FILES["file"])) { $file = @$_FILES['file']; //上传验证 if ($file["error"] > 0) { echo "上传错误!"; exit; } //对文件大小对比1000KB以下的图片可以上传 $fileSize = sprintf("%.2f", $file["size"] / 1024 / 1024); //M