⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 badwords.php

📁 脏话过滤程序 使用方法如下: 先包含下面文件 require "badwords/badwords.php" 运用类中的函数replace_bad($text) 参数$text为要过滤
💻 PHP
字号:
<?



	
	//获得数据库的替换数据

		require "mysql.php";
		require "global_badwords.php";
		function ifHaveChinese($str){
		$result=false;
		for($i=0;$i<strlen($str);$i++){
			if(ord($str[$i])>127){
				$result=true;
			}
		}
		return $result;
	}
	function formatch($content){
		$content=trim($content);
		$content=htmlspecialchars($content);
		$content=nl2br($content);
		if (!get_magic_quotes_gpc()) {
			$content = addslashes($content);
			} 
		return $content;
}

		$ddb = new DB_MySQL;
		$ddb->servername=$dbhost;
		$ddb->dbname=$dbname;
		$ddb->dbusername=$dbuser;
		$ddb->dbpassword=$dbpwd;
		$ddb->connect();
		$ddb->selectdb();

$sql="SELECT * from plog_articles_comments";
		$result=$ddb->query($sql);
		while($result1=$ddb->fetch_array($result))
			{
				foreach($result1 as $key => $value){
					$$key=$value;
				}
		$normalized_text=strip_tags($text);
		$normalized_topic=strip_tags($topic);

$text=formatch($text);
$topic=formatch($topic);




echo"INSERT INTO `plog_articles_comments` ( `id` , `article_id` , `topic` , `text` , `date` , `user_email` , `user_url` , `user_name` , `parent_id` , `client_ip` , `send_notification` , `status` , `spam_rate` , `properties` , `normalized_text` , `normalized_topic` )VALUES ('".$id."', '".$article_id."', '".$topic."', $text ,'".$date."', '".$user_email."', '".$user_url."', '".$user_name."', '".$parent_id."', '".$client_ip."', '".$send_notification."', '".$status."', '".$spam_rate."', '', \"$normalized_text\", \"$normalized_topic\");";


		//$normalized_description=strip_tags($description);


//$description=formatch($description);


//echo"INSERT INTO `plog_mylinks` ( `id` , `category_id` , `url` , `name` , `description` , `blog_id` , `rss_feed` , `date` , `properties` )VALUES ('".$id."','".$category_id."', '".$url."',\"$name\", \"$description\", '".$blog_id."', '', '' , 'a:0:{}');";

//echo"INSERT INTO `plog_gallery_resources` ( `id` , `owner_id` , `album_id` , `description` , `date` , `flags` , `resource_type` , `file_path`,`file_name` , `metadata` , `thumbnail_format`, `normalized_description` , `properties`  )VALUES ('".$id."', '".$owner_id."', '".$album_id."', \"$description\" ,'".$date."' ,'".$flags."', '".$resource_type."' , '".$file_path."', '".$file_name."', '".$metadata."' , '".$thumbnail_format."', '".$normalized_description."', '');";



//echo"INSERT INTO `plog_gallery_albums` ( `id` , `owner_id` , `description` , `name` , `flags` , `parent_id` , `date` , `properties` , `show_album` , `normalized_description` , `normalized_name` , `mangled_name` )VALUES ('".$id."', '".$owner_id."', \"$description\", \"$name\", '".$flags."', '".$parent_id."', '".$date."' , 'a:0:{}', '".$show_album."', \"$normalized_description\", \"$normalized_name\", \"$normalized_name\");";
//echo"INSERT INTO `plog_blogs` ( `id` , `blog` , `owner_id` , `about` , `settings` , `mangled_blog` , `status` , `show_in_summary` )VALUES ('".$id."', \"$blog\", '".$owner_id."', \"$about\" ,'' , \"$blog\", '1', '1');";



//echo"INSERT INTO `plog_articles_comments` ( `id` , `article_id` , `topic` , `text` , `date` , `user_email` , `user_url` , `user_name` , `parent_id` , `client_ip` , `send_notification` , `status` , `spam_rate` , `properties` , `normalized_text` , `normalized_topic` )VALUES ('".$id."', '".$article_id."', '".$topic."', '".$text."' ,'".$date."', '".$user_email."', '".$user_url."', '".$user_name."', '".$parent_id."', '".$client_ip."', '".$send_notification."', '".$status."', '".$spam_rate."', '', '".$normalized_text."', '".$normalized_topic."');";

				}




?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -