| Current Path : /home/zqegovsj/public_html/us3.supplierlist.com/member/master/ |
| Current File : /home/zqegovsj/public_html/us3.supplierlist.com/member/master/comment.php |
<?php
$inc_path = "../../haibo/en/";$ua_sm_compile_dir = "newmember/";
require($inc_path."global.php");
require($inc_path .APP_NAME. 'configs/db_session.php');
uses("comment","member","company","product");
require($inc_path.APP_NAME.'include/page_admin.php');
require("session.php");$tb_prefix= $_SESSION['Version']."_";
$member = new Members();$member->table = 'members2';
$company=new Companies();$product=new Products();
$comment = new Comment();$comment->table = $tb_prefix.'comment';
$conditions = null;
$tpl_file = "comment_index";
if (isset($_REQUEST['del'])){
$deleted = false;
if(!empty($_POST['id'])) {
$deleted = $comment->del($_POST['id']);
}
if(!empty($_GET['id'])){
$deleted = $comment->del($_GET['id']);
}
}
if (isset($_REQUEST['state'])){
foreach($_POST['id'] as $k=>$v){
$vals = array();
$vals['status']=1;
array_walk($vals,"uatrim");
$comment->save($vals, "update", $v);
}
}
if($_GET['action'] == "view"){
$sql = "SELECT * FROM ".$comment->getTable(true)." WHERE uid='".$_SESSION['MemberID']."' and id=".$_GET['id'];
$res = $g_db->GetRow($sql);
if (empty($res)) {
flash("./tip.php","./comment.php","没有此记录",0);
}else {
setvar("s",$res);
}
$tpl_file = "comment_edit";
}
if (isset($_POST['save']) && !empty($_POST['comment'])) {
$vals = array();
$vals = $_POST['comment'];
$vals['uid']=$_SESSION['MemberID'];
array_walk($vals,"uatrim");
$comment->save($vals, "update", $_POST['id']);
}
if($_GET['action'] = "list"){
$conditions= "uid=".$_SESSION['MemberID'];
$amount = $comment->findCount($conditions,"id");
pageft($amount,20);
$fields = "id,pid,mid,content,star,status,`update`"; $res = $comment->findAll($fields, $conditions, "id DESC ",$firstcount,$displaypg); foreach($res as $k=>$v){ $sql = "SELECT * FROM ".$member->getTable(true)." WHERE id=".$v['mid']; $res2 = $g_db->GetRow($sql); $res[$k]['username']=$res2['username']; $sql = "SELECT * FROM ".$product->getTable(true)." WHERE id=".$v['pid']; $res2 = $g_db->GetRow($sql); $res[$k]['product']=$res2['name']; $res[$k]['update'] =date('Y-m-d H:i:s',$res[$k]['update']); }
setvar("commentList",$res);
setvar("count",count($res));
setvar("Amount",$amount);
setvar("PageHeader",$page_header);
setvar("ByPages",$pagenav);
}
include("head.php");template("newmember/".$tpl_file);
?>