$b ) { unset($$a); $$a = $b; } foreach( $_GET as $a=>$b ){ unset($$a); $$a = $b; } foreach( $_SERVER as $a=>$b ) { unset($$a); $$a = $b; } $s1 = array("\n\r", '"','<','>',"\n","\r", ' ', '<', '>',' ',' ', ' '); $s2 = array('','','','','','','','','','','', ''); function remove($s, $t1, $t2) { // remove segment $t1??$t2 from string $s do { $i = strpos( $s, $t1); if ($i === false) return $s; $j = strpos( $s, $t2, $i); $s = substr($s, 0, $i) . (($j === false) ? '' : substr($s, $j+strlen($t2))); //print $s.'xx'.$t1.'xx'.$t2; } while (1); } function post($cc1, $base='') { preg_match("/^((.*?):\/\/)?(([^:]*):([^@]*)@)?([^\/:]*)(:([^\/]*))?([^\?]*\/?)?(\?(.*))?$/",$cc1,$cc); //list(,,$Protocol,,$Username,$Password,$Host,,$Port,$Path,,$Query) = $cc; //print"(,,$Protocol,,$Username,$Password,$Host,,$Port,$Path,,$Query)from($cc1)\n"; global $java; $java = ( strtolower($cc[2])=='javascript' || strtolower($cc[6])=='javascript')?1:0 ; if ($java) return ''; $i = strrpos($cc[6],'.'); if ( $i===false || strpos(' .com .org .edu .hk .tw .cn ',substr($cc[6],$i) )===false ) { $cc[9] = $cc[6].$cc[9]; $cc[6] = '';} if (!empty($cc[11])) $cc[9] .= "?$cc[11]"; if (empty($cc[6])) $cc[6] = $base; $i = "$cc[6]/$cc[9]"; return htmlentities (str_replace('//', '/', $i)); } function collect($s, $t1, $t2) { // collect segment ?? from $s in the form $t1..>??$t2 $i = strpos( $s, $t1); $j = strpos( $s, $t2); if ($i === false ) return ' '; if ($j === false ) $j = strlen($s); $i = strpos( $s, '>', $i); $q = str_replace( chr(13), '', substr($s, $i+1, $j-$i-1)); //print $q; return $q; } $act = array('檢查', '清除'); $txt = stripslashes($txt); $url = stripslashes($url); if (isset($url)) $submit=$act[0]; if ( strpos("\"'", substr($url,0,1) ) !== false ) $url = substr($url,1,-1); switch ($submit) { case $act[0]: include 'inc.php'; $qry = "select wrong,correct,des,except from chinese"; if ( !($res = mysql_db_query($db, $qry, $sql))) {die(mysql_error(). " in $qry"); } $num_rows = mysql_num_rows($res); for ($i = 1; $i <= $num_rows; $i++) { $ch[] = mysql_fetch_array($res); } // $rem = "$num_rows 組正誤字紀錄\n"; $rem .= "\n"; if ( !empty($url) ) { if ( substr( $url,0,7)=='http://' ) $url = substr($url,7); $fn = 'http://' . $url; $txt2 = @file_get_contents($fn,"r"); if ( $txt2===false ) $txt2 = "不能開啟網頁: $fn"; // $txt = $txt2; $txt = ''; $txt2 = str_replace( 'BODY', 'body', $txt2); if ( strpos($txt2,'0 ) $txt2 = collect($txt2, ''); preg_match("/^((.*?):\/\/)?(([^:]*):([^@]*)@)?([^\/:]*)(:([^\/]*))?([^\?]*\/?)?(\?(.*))?$/",$url,$base1); $base = $base1[6]; } else { $txt2 = $txt; } $ip1 = getenv("REMOTE_ADDR"); $ip2 = getenv("HTTP_X_FORWARDED_FOR"); $ip3 = getenv("HTTP_CLIENT_IP"); $ip4 = $good; $ip = ( strlen($ip4)>0 ) ? $ip4 : ( ( strlen($ip3)>0 ) ? $ip3 : ( ( strlen($ip2)>0 ) ? $ip2 : $ip1 ) ); $txt2 = str_replace( 'FONT', 'font', $txt2); $txt2 = remove( $txt2, ''); $txt2 = remove( $txt2, ''); $txt2 = str_replace( '', '', $txt2); $txt2 = str_replace( 'onmouseover', 'onmouse', $txt2); $txt2 = str_replace( 'onmouseout', 'onmouse', $txt2); $txt2 = str_replace( ' target=', ' xtarget=', $txt2); $ins = 'chinese2.php?url='; $txt2 = str_replace( ' HREF=', ' href=', $txt2); $tt = explode('href=',$txt2); for($i=1; $i'); if (($k = strpos( $tt[$i], ' '))!==false && $k<$j ) $j = $k; if (($k = strpos( $tt[$i], "\n"))!==false && $k<$j ) $j = $k; $more = post(substr($tt[$i],0,$j), $base); if ( $java==0) $tt[$i] = $ins. $more. substr($tt[$i],$j) ; } } $txt2 = implode('href=', $tt); $ins = '//'; $txt2 = str_replace( ' SRC=', ' src=', $txt2); $tt = explode(' src=',$txt2); for($i=1; $i'); if (($k = strpos( $tt[$i], ' '))!==false && $k<$j ) $j = $k; if (($k = strpos( $tt[$i], "\n"))!==false && $k<$j ) $j = $k; $tt[$i] = $ins . post(substr($tt[$i],0,$j), $base) . substr($tt[$i],$j) ; } } $txt2 = implode(' src=', $tt); foreach($ch as $ch1) { if ( strstr( $txt2, $ch1[0] ) !== false) { $c1 = substr_count($txt2, $ch1[0]); // print "-->found $c1 times $ch1[0]
"; if (!empty($ch1[3])) { $exc = explode(',', $ch1[3]); foreach($exc as $exc1) { $c2 = substr_count($txt2, $exc1); // print "-->found $c2 times $ch1[3]
"; $c1 -= $c2; } } if (1==2 || $c1>0) { $rem .= "
\n"; $bad .= "$ch1[0] => $ch1[1]\n"; } } } $rem .= "
解釋例外 次數
$ch1[0]$ch1[1]"; $rem .= nl2br($ch1[2]). " "; $rem .= nl2br($ch1[3]). "   $c1
\n"; $qry = "insert into ch_hist (ip, time, url, txt, result) values (\"$ip\",\"$now\",\"".addslashes($url)."\",\"".addslashes($txt)."\", \"$bad\")"; // $res1 = @mysql_db_query($db, $qry, $sql); // $url = ''; break; case $act[1]: // already cared by javascript $txt = ''; break; } $txt = str_replace ( chr(38), chr(38).'amp;', $txt); $txt = str_replace ( chr(60), chr(38).'lt;', $txt); print" 中文辭彙常見錯誤--網上檢查 v1.2
網頁: http://    文稿:
$rem 如何使用: 1)輸入網頁地址或者文稿 2)按[檢查]. ©保留所有權利. Ray Sin

***下列是原來網頁



".str_repeat("\n",30)." $txt2 "; ?>