AddInfo.php 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. <?php
  2. require("../class/connect.php");
  3. require("../class/db_sql.php");
  4. require("../class/q_functions.php");
  5. require("../class/qinfofun.php");
  6. require("../member/class/user.php");
  7. require("../data/dbcache/class.php");
  8. require("../data/dbcache/MemberLevel.php");
  9. $link=db_connect();
  10. $empire=new mysqlquery();
  11. if($public_r['addnews_ok'])//关闭投稿
  12. {
  13. printerror("NotOpenCQInfo","",1);
  14. }
  15. //验证本时间允许操作
  16. eCheckTimeCloseDo('info');
  17. //验证IP
  18. eCheckAccessDoIp('postinfo');
  19. $classid=(int)$_GET['classid'];
  20. $mid=$class_r[$classid]['modid'];
  21. if(empty($classid)||empty($mid)||InfoIsInTable($class_r[$classid]['tbname']))
  22. {
  23. printerror("EmptyQinfoCid","",1);
  24. }
  25. $enews=RepPostStr($_GET['enews'],1);
  26. if(empty($enews))
  27. {
  28. $enews="MAddInfo";
  29. }
  30. $r=array();
  31. $memberinfor=array();
  32. $muserid=(int)getcvar('mluserid');
  33. $musername=RepPostVar(getcvar('mlusername'));
  34. $mrnd=RepPostVar(getcvar('mlrnd'));
  35. $id=0;
  36. $newstime=time();
  37. $r[newstime]=date("Y-m-d H:i:s");
  38. $todaytime=$r[newstime];
  39. $showkey="";
  40. $r['newstext']="";
  41. $rechangeclass='';
  42. //验证会员信息
  43. $mloginauthr=qCheckLoginAuthstr();
  44. //取得登陆会员资料
  45. if($muserid&&$mloginauthr['islogin'])
  46. {
  47. $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");
  48. }
  49. //增加
  50. if($enews=="MAddInfo")
  51. {
  52. $cr=DoQCheckAddLevel($classid,$muserid,$musername,$mrnd,0,1);
  53. $mr=$empire->fetch1("select qenter,qmname from {$dbtbpre}enewsmod where mid='$cr[modid]'");
  54. if(empty($mr['qenter']))
  55. {
  56. printerror("NotOpenCQInfo","history.go(-1)",1);
  57. }
  58. //IP发布数限制
  59. $check_ip=egetip();
  60. $check_checked=$cr['wfid']?0:$cr['checkqadd'];
  61. eCheckIpAddInfoNum($check_ip,$cr['tbname'],$cr['modid'],$check_checked);
  62. //验证单信息
  63. //qCheckMemberOneInfo($cr['tbname'],$cr['modid'],$classid,$muserid);
  64. //初始变量
  65. $word="增加信息";
  66. $ecmsfirstpost=1;
  67. $rechangeclass="&nbsp;[<a href='ChangeClass.php?mid=".$mid."'>重新选择</a>]";
  68. //验证码
  69. if($cr['qaddshowkey'])
  70. {
  71. $showkey="<tr bgcolor=\"#FFFFFF\">
  72. <td width=\"11%\" height=\"25\">验证码</td>
  73. <td height=\"25\">
  74. <table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
  75. <tr>
  76. <td width=\"52\"><input name=\"key\" type=\"text\" id=\"key\" size=\"6\">
  77. </td>
  78. <td id=\"infoshowkey\"><a href=\"#EmpireCMS\" onclick=\"edoshowkey('infoshowkey','info','".$public_r['newsurl']."');\" title=\"点击显示验证码\">点击显示验证码</a></td>
  79. </tr>
  80. </table>
  81. </td></tr>";
  82. }
  83. //图片
  84. $imgwidth=0;
  85. $imgheight=0;
  86. //文件验证码
  87. $filepass=time();
  88. }
  89. else
  90. {
  91. $word="修改信息";
  92. $ecmsfirstpost=0;
  93. $id=(int)$_GET['id'];
  94. if(empty($id))
  95. {
  96. printerror("EmptyQinfoCid","",1);
  97. }
  98. $cr=DoQCheckAddLevel($classid,$muserid,$musername,$mrnd,1,0);
  99. $mr=$empire->fetch1("select qenter,qmname from {$dbtbpre}enewsmod where mid='$cr[modid]'");
  100. if(empty($mr['qenter']))
  101. {
  102. printerror("NotOpenCQInfo","history.go(-1)",1);
  103. }
  104. $r=CheckQdoinfo($classid,$id,$muserid,$cr['tbname'],$cr['adminqinfo'],1);
  105. //检测时间
  106. if($public_r['qeditinfotime'])
  107. {
  108. if(time()-$r['truetime']>$public_r['qeditinfotime']*60)
  109. {
  110. printerror("QEditInfoOutTime","history.go(-1)",1);
  111. }
  112. }
  113. $newstime=$r['newstime'];
  114. $r['newstime']=date("Y-m-d H:i:s",$r['newstime']);
  115. //图片
  116. $imgwidth=170;
  117. $imgheight=120;
  118. //文件验证码
  119. $filepass=$id;
  120. }
  121. $tbname=$cr['tbname'];
  122. esetcookie("qeditinfo","dgcms");
  123. //标题分类
  124. $cttidswhere='';
  125. $tts='';
  126. $caddr=$empire->fetch1("select ttids from {$dbtbpre}enewsclassadd where classid='$classid'");
  127. if($caddr['ttids']!='-')
  128. {
  129. if($caddr['ttids']&&$caddr['ttids']!=',')
  130. {
  131. $cttidswhere=' and typeid in ('.substr($caddr['ttids'],1,-1).')';
  132. }
  133. $ttsql=$empire->query("select typeid,tname from {$dbtbpre}enewsinfotype where mid='$cr[modid]'".$cttidswhere." order by myorder");
  134. while($ttr=$empire->fetch($ttsql))
  135. {
  136. $select='';
  137. if($ttr[typeid]==$r[ttid])
  138. {
  139. $select=' selected';
  140. }
  141. $tts.="<option value='$ttr[typeid]'".$select.">$ttr[tname]</option>";
  142. }
  143. }
  144. //栏目
  145. $classurl=sys_ReturnBqClassname($cr,9);
  146. $postclass="<a href='".$classurl."' target='_blank'>".$class_r[$classid]['classname']."</a>".$rechangeclass;
  147. if($cr['bclassid'])
  148. {
  149. $bcr['classid']=$cr['bclassid'];
  150. $bclassurl=sys_ReturnBqClassname($bcr,9);
  151. $postclass="<a href='".$bclassurl."' target=_blank>".$class_r[$cr['bclassid']]['classname']."</a>&nbsp;>&nbsp;".$postclass;
  152. }
  153. //html编辑器
  154. $loadeditorjs='';
  155. if($emod_r[$mid]['editorf']&&$emod_r[$mid]['editorf']!=',')
  156. {
  157. include('../data/ecmseditor/eshoweditor.php');
  158. $loadeditorjs=ECMS_ShowEditorJS('../data/ecmseditor/infoeditor/');
  159. }
  160. if(empty($musername))
  161. {
  162. $musername="游客";
  163. }
  164. $modfile="../data/html/q".$cr['modid'].".php";
  165. //导入模板
  166. require(ECMS_PATH.'e/template/DoInfo/AddInfo.php');
  167. db_close();
  168. $empire=null;
  169. ?>