Browse Source

添加自定义表单留言通知站长邮件功能

develop
叙述、别离 6 months ago
parent
commit
6fc1cf5fc2
4 changed files with 21 additions and 6 deletions
  1. +1
    -1
      src/admin/ad_add.php
  2. +4
    -4
      src/admin/sys_info.php
  3. +15
    -0
      src/apps/diy.php
  4. +1
    -1
      src/apps/showphoto.php

+ 1
- 1
src/admin/ad_add.php View File

@@ -55,7 +55,7 @@ if ($dopost == "save") {
}
$query = "INSERT INTO `#@__myad` (clsid,typeid,tagname,adname,timeset,starttime,endtime,normbody,expbody) VALUES ('$clsid','$typeid','$tagname','$adname','$timeset','$starttime','$endtime','$normbody','$expbody');";
$dsql->ExecuteNoneQuery($query);
ShowMsg("成功添加一广告", "ad_main.php");
ShowMsg("成功添加一广告", "ad_main.php");
exit();
}
$dsql->Execute('dd', 'SELECT * FROM `#@__myadtype` ORDER BY id DESC');


+ 4
- 4
src/admin/sys_info.php View File

@@ -68,12 +68,12 @@ else if ($dopost == 'add') {
$nvarvalue = preg_replace("[^0-9.]","", $nvarvalue);
}
if (trim($nvarname) == '' || preg_match("#[^a-z_]#i", $nvarname)) {
ShowMsg("变量名不能为空并且必须为[a-z_]组成", "-1");
ShowMsg("变量名不能为空并且必须为a-z_组成", "-1");
exit();
}
$row = $dsql->GetOne("SELECT varname FROM `#@__sysconfig` WHERE varname LIKE '$nvarname' ");
if (is_array($row)) {
ShowMsg("变量名称已经存在", "-1");
ShowMsg("变量名称已经存在", "-1");
exit();
}
$row = $dsql->GetOne("SELECT aid FROM `#@__sysconfig` ORDER BY aid DESC");
@@ -86,11 +86,11 @@ else if ($dopost == 'add') {
exit();
}
if (!is_writeable($configfile)) {
ShowMsg("成功保存变量,由于".$configfile."无法写入,因此不能更新配置文件", "sys_info.php?gp=$vargroup");
ShowMsg("成功保存变量,由于".$configfile."无法写入,更新配置文件失败", "sys_info.php?gp=$vargroup");
exit();
} else {
ReWriteConfig();
ShowMsg("成功保存变量并更新配置文件", "sys_info.php?gp=$vargroup");
ShowMsg("成功添加一则变量", "sys_info.php?gp=$vargroup");
exit();
}
}


+ 15
- 0
src/apps/diy.php View File

@@ -70,6 +70,21 @@ if ($action == 'post') {
$query = "INSERT INTO `{$diy->table}` (`id`, `ifcheck` $addvar) VALUES (NULL, 0 $addvalue); ";
if ($dsql->ExecuteNoneQuery($query)) {
$id = $dsql->GetLastID();
$mailtitle = "{$diy->name}-留言通知";
$mailbody = '';
foreach($diy->getFieldList() as $field=>$fieldvalue)
{
$mailbody .= "{$fieldvalue[0]}:{${$field}}\r\n";
}
if ($cfg_sendmail_bysmtp == 'Y' && !empty($cfg_smtp_server)) {
$mailtype = 'TXT';
require_once(DEDEINC.'/libraries/mail.class.php');
$smtp = new smtp($cfg_smtp_server, $cfg_smtp_port, true, $cfg_smtp_usermail, $cfg_smtp_password);
$smtp->debug = false;
$smtp->sendmail($cfg_adminemail, $cfg_webname, $cfg_smtp_usermail, $mailtitle, $mailbody, $mailtype);
} else {
@mail($cfg_adminemail, $mailtitle, $mailbody, $headers);
}
if ($diy->public == 2) {
$goto = "diy.php?action=list&diyid={$diy->diyid}";
$bkmsg = '提交成功,正在前往表单列表';


+ 1
- 1
src/apps/showphoto.php View File

@@ -37,7 +37,7 @@ if (is_array($arcRow)) {
$arcRow['sitepath']
);
} else {
ShowMsg('无法浏览未知文档!', '-1');
ShowMsg('无法浏览未知文档', '-1');
exit();
}
if (empty($mx)) $mx = $cfg_album_width;


Loading…
Cancel
Save