// check input essay to see if it contains wrong chinese as defined in table 'sowers.chinese' foreach( $_POST as $a=>$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 .= "
| 誤 | 正 | 解釋 | 例外 | 次數 |
|---|