feedbackfun.php 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <?php
  2. //提交反馈
  3. function AddMemberFeedback($add){
  4. global $empire,$dbtbpre;
  5. //验证码
  6. $keyvname='checkspacefbkey';
  7. ecmsCheckShowKey($keyvname,$add['key'],1);
  8. //用户
  9. $userid=intval($add['userid']);
  10. $ur=$empire->fetch1("select ".egetmf('userid')." from ".eReturnMemberTable()." where ".egetmf('userid')."='$userid' limit 1");
  11. if(empty($ur['userid']))
  12. {
  13. printerror("NotUsername","",1);
  14. }
  15. //发表者
  16. $uid=(int)getcvar('mluserid');
  17. if($uid)
  18. {
  19. $uname=RepPostVar(getcvar('mlusername'));
  20. }
  21. else
  22. {
  23. $uid=0;
  24. $uname='';
  25. }
  26. //实名验证
  27. eCheckHaveTruenameCK('msps',0);
  28. $uname=dgdb_tosave($uname);
  29. $name=dgdb_tosave($add['name']);
  30. $company=dgdb_tosave($add['company']);
  31. $phone=dgdb_tosave($add['phone']);
  32. $fax=dgdb_tosave($add['fax']);
  33. $email=dgdb_tosave($add['email']);
  34. $address=dgdb_tosave($add['address']);
  35. $zip=dgdb_tosave($add['zip']);
  36. $title=dgdb_tosave($add['title']);
  37. $ftext=dgdb_tosave($add['ftext']);
  38. if(!trim($name)||!trim($title)||!trim($ftext))
  39. {
  40. printerror("EmptyMemberFeedback","history.go(-1)",1);
  41. }
  42. $addtime=date("Y-m-d H:i:s");
  43. $ip=egetip();
  44. $eipport=egetipport();
  45. $sql=$empire->query("insert into {$dbtbpre}enewsmemberfeedback(name,company,phone,fax,email,address,zip,title,ftext,userid,ip,uid,uname,addtime,eipport) values('$name','$company','$phone','$fax','$email','$address','$zip','$title','$ftext',$userid,'$ip',$uid,'$uname','$addtime','$eipport');");
  46. ecmsEmptyShowKey($keyvname);//清空验证码
  47. if($sql)
  48. {
  49. printerror("AddMemberFeedbackSuccess",EcmsGetReturnUrl(),1);
  50. }
  51. else
  52. {
  53. printerror("DbError","history.go(-1)",1);
  54. }
  55. }
  56. //删除反馈
  57. function DelMemberFeedback($add){
  58. global $empire,$dbtbpre;
  59. $user_r=islogin();//是否登陆
  60. $fid=intval($add['fid']);
  61. if(!$fid)
  62. {
  63. printerror("NotDelMemberFeedbackid","history.go(-1)",1);
  64. }
  65. $sql=$empire->query("delete from {$dbtbpre}enewsmemberfeedback where fid='$fid' and userid='$user_r[userid]'");
  66. if($sql)
  67. {
  68. printerror("DelMemberFeedbackSuccess",EcmsGetReturnUrl(),1);
  69. }
  70. else
  71. {
  72. printerror("DbError","history.go(-1)",1);
  73. }
  74. }
  75. //批量删除反馈
  76. function DelMemberFeedback_All($add){
  77. global $empire,$dbtbpre;
  78. $user_r=islogin();//是否登陆
  79. $fid=$add['fid'];
  80. $count=count($fid);
  81. if(empty($count))
  82. {
  83. printerror("NotDelMemberFeedbackid","history.go(-1)",1);
  84. }
  85. for($i=0;$i<$count;$i++)
  86. {
  87. $addsql.="fid='".intval($fid[$i])."' or ";
  88. }
  89. $addsql=substr($addsql,0,strlen($addsql)-4);
  90. $sql=$empire->query("delete from {$dbtbpre}enewsmemberfeedback where (".$addsql.") and userid='$user_r[userid]'");
  91. if($sql)
  92. {
  93. printerror("DelMemberFeedbackSuccess",EcmsGetReturnUrl(),1);
  94. }
  95. else
  96. {
  97. printerror("DbError","history.go(-1)",1);
  98. }
  99. }
  100. ?>