AddInfo.php
4.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
<?php
require("../class/connect.php");
require("../class/db_sql.php");
require("../class/q_functions.php");
require("../class/qinfofun.php");
require("../member/class/user.php");
require("../data/dbcache/class.php");
require("../data/dbcache/MemberLevel.php");
$link=db_connect();
$empire=new mysqlquery();
if($public_r['addnews_ok'])//關閉投稿
{
printerror("NotOpenCQInfo","",1);
}
//驗證本時間允許操作
eCheckTimeCloseDo('info');
//驗證IP
eCheckAccessDoIp('postinfo');
$classid=(int)$_GET['classid'];
$mid=$class_r[$classid]['modid'];
if(empty($classid)||empty($mid)||InfoIsInTable($class_r[$classid]['tbname']))
{
printerror("EmptyQinfoCid","",1);
}
$enews=RepPostStr($_GET['enews'],1);
if(empty($enews))
{
$enews="MAddInfo";
}
$r=array();
$memberinfor=array();
$muserid=(int)getcvar('mluserid');
$musername=RepPostVar(getcvar('mlusername'));
$mrnd=RepPostVar(getcvar('mlrnd'));
$id=0;
$newstime=time();
$r[newstime]=date("Y-m-d H:i:s");
$todaytime=$r[newstime];
$showkey="";
$r['newstext']="";
$rechangeclass='';
//驗證會員信息
$mloginauthr=qCheckLoginAuthstr();
//取得登陸會員資料
if($muserid&&$mloginauthr['islogin'])
{
$memberinfor=$empire->fetch1("select ".eReturnSelectMemberF('*','u.').",ui.* from ".eReturnMemberTable()." u LEFT JOIN {$dbtbpre}enewsmemberadd ui ON u.".egetmf('userid')."=ui.userid where u.".egetmf('userid')."='$muserid' limit 1");
}
//增加
if($enews=="MAddInfo")
{
$cr=DoQCheckAddLevel($classid,$muserid,$musername,$mrnd,0,1);
$mr=$empire->fetch1("select qenter,qmname from {$dbtbpre}enewsmod where mid='$cr[modid]'");
if(empty($mr['qenter']))
{
printerror("NotOpenCQInfo","history.go(-1)",1);
}
//IP發佈數限制
$check_ip=egetip();
$check_checked=$cr['wfid']?0:$cr['checkqadd'];
eCheckIpAddInfoNum($check_ip,$cr['tbname'],$cr['modid'],$check_checked);
//初始變量
$word="增加信息";
$ecmsfirstpost=1;
$rechangeclass=" [<a href='ChangeClass.php?mid=".$mid."'>重新選擇</a>]";
//驗證碼
if($cr['qaddshowkey'])
{
$showkey="<tr bgcolor=\"#FFFFFF\">
<td width=\"11%\" height=\"25\">驗證碼</td>
<td height=\"25\"><input name=\"key\" type=\"text\" size=\"6\">
<img src=\"../ShowKey/?v=info\" name=\"infoKeyImg\" id=\"infoKeyImg\" onclick=\"infoKeyImg.src='../ShowKey/?v=info&t='+Math.random()\" title=\"看不清楚,點擊刷新\"></td></tr>";
}
//圖片
$imgwidth=0;
$imgheight=0;
//文件驗證碼
$filepass=time();
}
else
{
$word="修改信息";
$ecmsfirstpost=0;
$id=(int)$_GET['id'];
if(empty($id))
{
printerror("EmptyQinfoCid","",1);
}
$cr=DoQCheckAddLevel($classid,$muserid,$musername,$mrnd,1,0);
$mr=$empire->fetch1("select qenter,qmname from {$dbtbpre}enewsmod where mid='$cr[modid]'");
if(empty($mr['qenter']))
{
printerror("NotOpenCQInfo","history.go(-1)",1);
}
$r=CheckQdoinfo($classid,$id,$muserid,$cr['tbname'],$cr['adminqinfo'],1);
//檢測時間
if($public_r['qeditinfotime'])
{
if(time()-$r['truetime']>$public_r['qeditinfotime']*60)
{
printerror("QEditInfoOutTime","history.go(-1)",1);
}
}
$newstime=$r['newstime'];
$r['newstime']=date("Y-m-d H:i:s",$r['newstime']);
//圖片
$imgwidth=170;
$imgheight=120;
//文件驗證碼
$filepass=$id;
}
$tbname=$cr['tbname'];
esetcookie("qeditinfo","dgcms");
//標題分類
$cttidswhere='';
$tts='';
$caddr=$empire->fetch1("select ttids from {$dbtbpre}enewsclassadd where classid='$classid'");
if($caddr['ttids']!='-')
{
if($caddr['ttids']&&$caddr['ttids']!=',')
{
$cttidswhere=' and typeid in ('.substr($caddr['ttids'],1,-1).')';
}
$ttsql=$empire->query("select typeid,tname from {$dbtbpre}enewsinfotype where mid='$cr[modid]'".$cttidswhere." order by myorder");
while($ttr=$empire->fetch($ttsql))
{
$select='';
if($ttr[typeid]==$r[ttid])
{
$select=' selected';
}
$tts.="<option value='$ttr[typeid]'".$select.">$ttr[tname]</option>";
}
}
//欄目
$classurl=sys_ReturnBqClassname($cr,9);
$postclass="<a href='".$classurl."' target='_blank'>".$class_r[$classid]['classname']."</a>".$rechangeclass;
if($cr['bclassid'])
{
$bcr['classid']=$cr['bclassid'];
$bclassurl=sys_ReturnBqClassname($bcr,9);
$postclass="<a href='".$bclassurl."' target=_blank>".$class_r[$cr['bclassid']]['classname']."</a> > ".$postclass;
}
//html編輯器
if($emod_r[$mid]['editorf']&&$emod_r[$mid]['editorf']!=',')
{
include('../data/ecmseditor/infoeditor/fckeditor.php');
}
if(empty($musername))
{
$musername="遊客";
}
$modfile="../data/html/q".$cr['modid'].".php";
//導入模板
require(ECMS_PATH.'e/template/DoInfo/AddInfo.php');
db_close();
$empire=null;
?>