极酷的PHP文本留言本

源代码在线查看: function.inc.php

软件大小: 138 K
上传用户: cnnotes
关键词: PHP 留言本
下载地址: 免注册下载 普通下载 VIP

相关代码

								basename(__FILE__) == basename($PHP_SELF) ? die('function.inc.php, contains all functions for langfang.info. Local guestbook is here') : '';
				
				function BadnessIp(){
					global $con,$lang,$ip;
					$badnessip_array = explode("|",$con[badness_ip]);
					for($i = 0; $i < count($badnessip_array); $i++){
						if($badnessip_array[$i]=="") continue;
						if($ip==$badnessip_array[$i]){
							Head();Top();errorview($lang[error][generic],$lang[error][e0013]);exit;
							break;
						}
					}
				
				}
				
				function AddGuestContent($username="",$useremail="",$useroicq="",$userhomepage="",$usersex=0,$headportrait,$posticon="00.gif",$content=""){
					global $con,$lang,$myfile;
					global $time,$ip,$nowtime;
					global $myfilemenu;
					if($myfilemenu!="admin"){
						if(isset($_SESSION['myintervaltime'])){
							if($nowtime - $_SESSION['myintervaltime'] < $con['post_interval']){Head();Top();errorview($lang[error][generic],$lang[error][e0014]);exit;}
						}
					}
					if($username != ""){
						$username=WM_htmlspecialchars($username);
						if(strlen($username) > 15){Head();Top();errorview($lang[error][generic],$lang[error][e0002]);exit;}
						$reserve_array = explode(",",$con[reserve_name]);
						$n=0;
						while($n							if($username==$reserve_array[$n]){Head();Top();errorview($lang[error][generic],$lang[error][e0003]);exit;}
							$n++;
						}
						$bad_array = explode(",",$con[filtratemsg]);
						$m=0;
						while($m							$username = eregi_replace($bad_array[$m],  "×", $username);
							$m++;
						}
					}else{Head();Top();errorview($lang[error][generic],$lang[error][e0004]);exit;}
					if($useremail != ""){
						$useremail=WM_htmlspecialchars($useremail,1,1);
						if(!IsEmailAddress($useremail)){Head();Top();errorview($lang[error][generic],$lang[error][e0005]);exit;}
					}
					if($useroicq != ""){
						$useroicq=WM_htmlspecialchars($useroicq,1,1);
						if(strlen($useroicq) > 10){Head();Top();errorview($lang[error][generic],$lang[error][e0009]);exit;}
						if(!IsDigit($useroicq)){Head();Top();errorview($lang[error][generic],$lang[error][e0011]);exit;}
					}
					if($userhomepage != ""){
						$userhomepage=WM_htmlspecialchars($userhomepage,1,1);
						if(!IsUrl($userhomepage)){Head();Top();errorview($lang[error][generic],$lang[error][e0012]);exit;}
						$userhomepage=ereg_replace("http://","",$userhomepage);
					}
					if($content != ""){
						$contentlen=$con[content_len];
						if(!is_int($contentlen)){$contentlen=intval($contentlen);}
						if(strlen($content) > $contentlen){Head();Top();errorview($lang[error][generic],$lang[error][e0006]);exit;}
						$bad_array = explode(",",$con[filtratemsg]);
						$i=0;
						while($i							$content = eregi_replace( $bad_array[$i],  "×", $content);
							$i++;
						}
						$content=WM_htmlspecialchars($content);
					}else{Head();Top();errorview($lang[error][generic],$lang[error][e0007]);exit;}
					if($posticon==""){$posticon="00.gif";}
					$posticon=WM_htmlspecialchars($posticon,1,1);
					$usersex=WM_htmlspecialchars($usersex,1,1);
					$headportrait=WM_htmlspecialchars($headportrait,1,1);
					
					$line = openfile($con[data_path].$con[data_name]);
					list($lno,$ltime) = explode("\t", $line[1]);
					$no=$lno+1;
					if($con[censor]==1){$censor=0;}else{$censor=1;}
					$title="";#备用
					$newline = $no."\t".$time."\t".$username."\t".$useremail."\t".$useroicq."\t".$userhomepage."\t".$usersex."\t".$headportrait."\t".$posticon."\t".$ip."\t".$censor."\t".$title."\t".$content."\n";
					$indata="";
					$indata="\n".$newline.implode('', $line);
					writeover($con[data_path].$con[data_name],$indata);
					session_register("myintervaltime");
					$_SESSION["myintervaltime"] = time();
					Head();Top();
					SucceedRegister($lang[msg][s0001],$myfile);
				
				}
				
				function ShowContentList($page){
					global $con,$lang,$myfile;
					global $line,$nextint;
					global $myfilemenu;
					$imgurl="$con[img_url]";
					include(ROOT.'function/wmcode.php');
					if(!isset($page)) {$page=1; $nextint=1;}
					if(($page>$nextint)||($page					$star = ($page - 1) * $con[perpage] + 1;
					$end= $star - 1 + $con[perpage];
				
					for($i = $star; $i 						if($line[$i]=="") break;
						list($sno,$stime,$sname,$semail,$soicq,$shomepage,$ssex,$sportrait,$sicon,$sip,$scensor,$stitle,$scontent,$sanswer) = explode("\t", $line[$i]);
						switch($ssex){
							case "1";
							$user=" $sname ";
							break;
							case "2";
							$user=" $sname ";
							break;
							default:
							$user=" $sname ";
						}
						if($shomepage != ""){
							$outhp="";
						}else{
							$outhp="";
						}
						if($soicq != ""){
							$outoicq="";
						}else{
							$outoicq="";
						}
						if($semail != ""){
							$outmail="";
						}else{
							$outmail="";
						}
						$myfilemenu == "admin" ? $outip="" : $outip="";
						$scontent = str_replace("\n",  "", $scontent);
						if($scensor!=1){
							$myfilemenu == "admin" ? $scontent=$lang[msg][e0010]."".Convert($scontent) : $scontent=$lang[msg][e0009];
						}else{$scontent=Convert($scontent);}
						$sanswer = str_replace("\n",  "", $sanswer);
						if($sanswer!=""){
							list($answer_msg,$answer_time) = explode(",", $sanswer);
							$answer_msg=Convert($answer_msg);
							$show_answer = "".$lang[msg][e0004]."$answer_msg".$lang[msg][e0005].$answer_time."";
						}else{$show_answer = "";}
						$myfilemenu == "admin" ? $admin_menu='' : $admin_menu="";
						
						include($con[theme_path].$con[template].'/list.html');
						
					}
					
				}
				
				function ShowSearchList($page){
					global $con,$lang,$myfile;
					global $searcharray,$nextint;
					global $myfilemenu;
				
					$imgurl="$con[img_url]";
					include(ROOT.'function/wmcode.php');
					if(!isset($page)) {$page=1; $nextint=1;}
					if(($page>$nextint)||($page					$star = ($page - 1) * $con[perpage] + 1;
					$end= $star - 1 + $con[perpage];
				
					for($i = $star-1; $i < $end; $i++){
						if($searcharray[$i]=="") break;
						list($sno,$stime,$sname,$semail,$soicq,$shomepage,$ssex,$sportrait,$sicon,$sip,$scensor,$stitle,$scontent,$sanswer) = explode("\t", $searcharray[$i]);
						switch($ssex){
							case "1";
							$user=" $sname ";
							break;
							case "2";
							$user=" $sname ";
							break;
							default:
							$user=" $sname ";
						}
						if($shomepage != ""){
							$outhp="";
						}else{
							$outhp="";
						}
						if($soicq != ""){
							$outoicq="";
						}else{
							$outoicq="";
						}
						if($semail != ""){
							$outmail="";
						}else{
							$outmail="";
						}
						$myfilemenu == "admin" ? $outip="" : $outip="";
						$scontent = str_replace("\n",  "", $scontent);
						if($scensor!=1){
							$myfilemenu == "admin" ? $scontent=$lang[msg][e0010]."".Convert($scontent) : $scontent=$lang[msg][e0009];
						}else{$scontent=Convert($scontent);}
						$sanswer = str_replace("\n",  "", $sanswer);
						if($sanswer!=""){
							list($answer_msg,$answer_time) = explode(",", $sanswer);
							$answer_msg=Convert($answer_msg);
							$show_answer = "".$lang[msg][e0004]."$answer_msg".$lang[msg][e0005].$answer_time."";
						}else{$show_answer = "";}
						$myfilemenu == "admin" ? $admin_menu='' : $admin_menu="";
						
						include($con[theme_path].$con[template].'/list.html');
						
					}
					
				}
				
				function PageLib($page){
					global $con,$lang,$myfile;
					global $nextint,$keyword,$action;
					if(isset($page)){
						if (($page==1)&&($nextint==0)){
						}else{
							if(($page>$nextint)||($page						}
					}else {
						$page=1;
					}
					if($nextint==1){
						$show_page = " [1] ";
					}else{
						$show_page .= "".$lang[template][p0001]." ";
						if($nextint>6){
							if(($page>3)&&($page+3								$page_a=$page;
								$page_b=$page_a+3;
								for($i=$page_a-2;$i									if($i==$page){
										$show_page .= "[$page] ";
									}else {
										$show_page .= "[$i] ";
									}
								}
								$show_page .= "... [$nextint] ";
							}
							if($page								for($k=1;$k									if($k==$page){
										$show_page .= "[$page] ";
									}else {
										$show_page .= "[$k] ";
									}
								}
								$show_page .= "... [$nextint] ";
							}
							if($page+3>=$nextint){
								for($m=$nextint-4;$m									if($m==$page){
										$show_page .= "[$page] ";
									}else {
										$show_page .= "[$m] ";
									}
								}
							}
						}else {
							for($n=1;$n								if($n==$page){
									$show_page .= "[$page] ";
								}else{
									$show_page .= "[$n] ";
								}
							}
						}
						$show_page .= "".$lang[template][p0002]."";
					}
				include($con[theme_path].$con[template].'/page.html');
				}
				
				function Head() {
					global $con,$lang,$myfile;
					global $myfilemenu;
					$myfilemenu == "admin" ? $delvalidatejs="\n function delete_confirm(aaa){\n question = confirm(\"".$lang[msg][e0008]."\")\n if (question != \"0\"){ window: location=\"".$myfile."?action=delete&id=\"+aaa;\n}\n}\n" : $delvalidatejs='';
					include_once($con['theme_path'].$con['template'].'/head.html');
				}
				
				function Top() {
					global $con,$lang,$myfile;
					global $myfilemenu;
					include($con[theme_path].$con[template].'/top.html');
				}
				
				function Foot() {
					global $con,$lang,$myfile;
					include($con[theme_path].$con[template].'/foot.html');
				}
				
				function ShowFormAdd() {
					global $con,$lang,$myfile;
					include($con[theme_path].$con[template].'/post_form.html');
				}
				
				?>			

相关资源