📄 comment.php
字号:
<?php
/**
* Title: comment logs
* File Name: ./mods/comment.php
* Copyright (c) 2004 M-logger
* Author: milkliker
* Modify: milkliker
* Last Change: 11:13 04-9-1
* Version: 0.3.1
**/
//---[Page Start]-------------------------------------------
$commentData=array();
$id=trim($_POST['id']);
$tblTime=explode("-",trim($_POST['date']));
$tblName='content/'.$tblTime[0].'_'.$tblTime[1].'_'.$tblTime[2];
$tpl->set_file('tplModule','outmsg.htm');
$tpl->set_var('MASTERMAIL',$config['MasterMail']);
$pageTitle=$lang['Defeat'];
//---[Check Right]------------------------------------------
if($user->user['rank'] <= $config['AddComment'] and $user->exists($tblName)){
$logData=$user->get("'{id}'=='$id'",false,null,$tblName);
if(empty($logData)){
$tpl->set_var('MSGTITLE',$lang['Defeat']);
$tpl->set_var('MSGCONTENT',$lang['NoSuchLog']);
//---[Save Comment]-----------------------------------------
}else{
$name=trim($_POST['name']);
$address=trim($_POST['address']);
$comment=trim(str_replace(array("<",">","\n","\r","\t"," ","\\'",'\\"','\\\\'),array("<",">","<br/>","",""," ","'",'"','\\'),$_POST['comment']));
if(empty($name) or empty($comment)){
if(empty($name)) $nameColor=array('<font class="warning">','</font>');
if(empty($comment)) $commentColor=array('<font class="warning">','</font>');
$msgTitle=$lang['Defeat'];
$msgContent=$lang['NeedComment'];
}else{
$logData['value']['comment']++;
$user->change($logData['value'],intval($logData['id']),false,null,$tblName);
$commentData['author']=$name;
if(!empty($address)){
if(ereg("^.+@.+\\..+$",$address)){
$commentData['author'].=' <'.str_replace(array('@','.'),array(' at ',' dot '),$address).'>';
}else{
if(substr($address,0,7)!='http://') $address='http://'.$address;
$commentData['author']='<a class="Link" href="'.$address.'" target="_blank">'.$commentData['author'].'</a>';
}
}
$commentData['content']=$comment;
$commentData['type']='comment';
$commentData['comment']=$id;
$commentData['time']=$thisTime;
$user->append($commentData);
if($user->save()){
$num=$user->get('0',false,null,'num',$config['UseCache']);
$num[0]['comment']++;
$user->change($num[0],false,0,'0,1','num');
$user->save();
$newcomment['author']=$name;
$newcomment['item']=$comment;
$newcomment['pid']=$id;
$newcomment['date']=$_POST['date'];
$newcomment['day']=date("n-j");
$user->append($newcomment,0,'comment');
$user->save();
$pageTitle=$lang['Success'];
$msgTitle=$lang['Success'];
$msgContent=$lang['AddCommentSuc'];
if($_POST['remember']=='y' and !$user->logined){
$cookietime = time() + 1000000000;
setcookie('remember','y',$cookietime);
setcookie('username',$name,$cookietime);
setcookie('address',$address,$cookietime);
}
if($_COOKIE['remember']=='y' and ($_COOKIE['username']!=$name or $_COOKIE['address']!=$address)){
$cookietime = time() + 1000000000;
setcookie('remember','y',$cookietime);
setcookie('username',$name,$cookietime);
setcookie('address',$address,$cookietime);
}
}else{
$msgTitle=$lang['Defeat'];
$msgContent=$lang['CheckDBWriteable'];
}
}
$msgContent.='<br>'.$lang['YourSubmitData'].'<br><br><table class="bordertbl" width="70%">';
$msgContent.='<tr><td>'.$nameColor[0].$lang['Name'].$nameColor[1].'</td><td width="90%">'.$name.'</td></tr>';
$msgContent.='<tr><td>'.$lang['Address'].'</td><td>'.$address.'</td></tr>';
$msgContent.='<tr><td>'.$commentColor[0].$lang['Comment'].$commentColor[1].'</font></td><td>'.$comment.'</td></tr></table>';
$tpl->set_var('MSGTITLE',$msgTitle);
$tpl->set_var('MSGCONTENT',$msgContent);
}
}else{
$tpl->set_var('MSGTITLE',$lang['Defeat']);
$tpl->set_var('MSGCONTENT',$lang['NoRightToAddComment']);
}
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -