|
楼主 |
发表于 2013-8-16 14:48:55
|
显示全部楼层
来自 中国–广东–深圳–福田区
guest.php代码如下:
<?php
/**
*
* 留言板
*
* @version $Id: guestbook.php 1 10:09 2010-11-10 tianya $
* @package DedeCMS.Site
* @copyright Copyright (c) 2007 - 2010, DesDev, Inc.
* @license http://help.dedecms.com/usersguide/license.html
* @link http://www.dedecms.com
*/
require_once(dirname(__FILE__).'/guestbook/guestbook.inc.php');
require_once(DEDEINC.'/datalistcp.class.php');
if(empty($action)) $action = '';
//修改留言
if($action=='admin')
{
include_once(dirname(__FILE__).'/guestbook/edit.inc.php');
exit();
}
//保存留言
else if($action=='save')
{
if(!empty($_COOKIE['GUEST_BOOK_POS'])) $GUEST_BOOK_POS = $_COOKIE['GUEST_BOOK_POS'];
else $GUEST_BOOK_POS = 'guestbook.php';
if(empty($validate)) $validate=='';
else $validate = strtolower($validate);
$svali = GetCkVdValue();
if($validate=='' || $validate!=$svali)
{
ShowMsg("Security Code is Incorrect!","-1");
exit();
}
$ip = GetIP();
$dtime = time();
$uname = trimMsg($uname);
$email = trimMsg($email);
$homepage = trimMsg($homepage);
$homepage = preg_replace("#http:\/\/#", '', $homepage);
$qq = trimMsg($qq);
$msg = trimMsg(cn_substrR($msg, 1024), 1);
$tid = empty($tid) ? 0 : intval($tid);
$reid = empty($reid) ? 0 : intval($reid);
if($msg=='' || $uname=='') {
showMsg('Your name and message can not be empty!','-1');
exit();
}
if($email=='') {
showMsg('Your Email can not be empty!','-1');
exit();
}
$title = HtmlReplace( cn_substrR($title,60), 1 );
if($title=='') $title = 'No Subject';
if($reid != 0)
{
$row = $dsql->GetOne("SELECT msg FROM `#@__guestbook` WHERE id='$reid' ");
$msg = "<div class=\\'rebox\\'>".addslashes($row['msg'])."</div>\n".$msg;
}
$query = "INSERT INTO `#@__guestbook`(title,tid,mid,uname,email,homepage,qq,face,msg,ip,dtime,ischeck)
VALUES ('$title','$tid','{$g_mid}','$uname','$email','$homepage','$qq','$img','$msg','$ip','$dtime','$needCheck'); ";
$dsql->ExecuteNoneQuery($query);
$gid = $dsql->GetLastID();
if($needCheck==1)
{
require_once(DEDEINC."/oxwindow.class.php");
$mailbody = '';
$mailtitle = "您的网站上有新留言";
$mailbody .= "留言者:$uname \r\n";
$mailbody .= "标题:$title \r\n";
$mailbody .= "内容:$msg \r\n";
$mailbody .= "E-mail:$email \r\n";
$mailbody .= "Powered by http://www.g4ledonline.com";
$headers = "From: ".$cfg_adminemail."\r\nReply-To: ".$cfg_adminemail;
$email='jakexiao82@163.com';//改为要接收邮件的邮箱
if($cfg_sendmail_bysmtp == 'Y' && !empty($cfg_smtp_server))
{
$mailtype = 'TXT';
require_once(DEDEINC.'/mail.class.php');
$smtp = new smtp($cfg_smtp_server,$cfg_smtp_port,true,$cfg_smtp_usermail,$cfg_smtp_password);
$smtp->debug = false;
$smtp->sendmail($email,$cfg_webname,$cfg_smtp_usermail, $mailtitle, $mailbody, $mailtype);
}
else
{
@mail($email, $mailtitle, $mailbody, $headers);
}
$msg = "
<font color='red'><b>Successfully send or reply to a message!</b></font> <a href='guestbook.php' style='font-size:14px;font-weight:bold'><u>Click here to return!>></u></a>";
$wintitle = "留言发布成功提示";
$wecome_info = "留言发布成功:";
$win = new OxWindow();
$win->Init("","js/blank.js","post");
$win->AddTitle("提示:");
$win->AddMsgItem("<div style='padding:20px;line-height:300%;font-size:14px'>$msg</div>");
$winform = $win->GetWindow("hand");
$win->Display();
}
else {
$mailbody = '';
$mailtitle = "您的网站上有新留言";
$mailbody .= "留言标题:$title \r\n\r\n";
$mailbody .= "Powered by http://www.g4ledonline.com";
$headers = "From: ".$cfg_adminemail."\r\nReply-To: ".$cfg_adminemail;
$email=$cfg_toemail;
if($cfg_sendmail_bysmtp == 'Y' && !empty($cfg_smtp_server))
{
$mailtype = 'TXT';
require_once(DEDEINC.'/mail.class.php');
$smtp = new smtp($cfg_smtp_server,$cfg_smtp_port,true,$cfg_smtp_usermail,$cfg_smtp_password);
$smtp->debug = false;
$smtp->sendmail($email,$cfg_webname,$cfg_smtp_usermail, $mailtitle, $mailbody, $mailtype);
}
else
{
@mail($email, $mailtitle, $mailbody, $headers);
}
ShowMsg('Successfully send a message, but need to be displayed after the audit!','guestbook.php',0,3000);
}
exit();
}
//显示所有留言
else
{
setcookie('GUEST_BOOK_POS',GetCurUrl(),time()+3600,'/');
if($g_isadmin) $sql = 'SELECT * FROM `#@__guestbook` ORDER BY id DESC';
else $sql = 'SELECT * FROM `#@__guestbook` WHERE ischeck=1 ORDER BY id DESC';
$dlist = new DataListCP();
$dlist->pageSize = 10;
$dlist->SetParameter('gotopagerank',$gotopagerank);
$dlist->SetTemplate(DEDETEMPLATE.'/plus/guestbook1.htm');
$dlist->SetSource($sql);
$dlist->Display();
}
后台 发送邮箱SMTP也设置好了,就是不发送,什么原因呢? |
|