$fpath = "../slave/clientproxy.xml"; $clientProxy = new OpXML('clientProxy', $fpath); /* // safephp一次,过滤XSS $qstr = urldecode($_POST['anehtaInput_anehtaPostClientProxy']); $qstr = $parser->parse($qstr); $parser->clear(); // 重新编码$qstr $qstr = urlencode($qstr); */ $qstr = htmlentities($_POST['anehtaInput_anehtaPostClientProxy']); //echo $qstr; //增加记录 $arr = array('pageContent' => "\r\n<![CDATA[\r\n" . $qstr . "\r\n]]>\r\n"); if ($clientProxy->getRecordById(1)) { $clientProxy->updateRecordById(1, $arr); } else { $clientProxy->insert($arr); } exit; } } } } /******************************************************* * 解码并去除[NoCryptMark] ********************************************************/ // 使用strpos 而不是 strchr ,因为更快,消耗内存更小 if (strpos($qstr, "NoCryptMark") === false) { $qstr = base64_decode($qstr);
$arr = array('homepage' => 'http://anehta.googlecode.com', 'author' => 'axis', 'blog' => 'http://hi.baidu.com/aullik5', 'team' => 'http://www.ph4nt0m.org'); $anehtaConfig->insert($arr); } else { //配置文件存在,开始更新记录 $anehtaConfig = new OpXML('anehtaConfig', $fpath); //增加一条记录 $arr = array('homepage' => 'http://anehta.googlecode.com', 'author' => 'axis', 'blog' => 'http://hi.baidu.com/aullik5', 'team' => 'http://www.ph4nt0m.org'); $anehtaConfig->updateRecordById(1, $arr); // 根据提交的配置信息插入xml文件 if ($anehtaurl != "" && $boomerangtarget != "" && $boomerangsrc != "") { $arr = array('anehtaurl' => $anehtaurl, 'boomerangtarget' => $boomerangtarget, 'boomerangsrc' => $boomerangsrc); } else { echo "Please complete the configure!"; exit; } if ($anehtaConfig->getRecordById(2)) { // 有记录则更新 $anehtaConfig->updateRecordById(2, $arr); } else { // 没有则插入 $anehtaConfig->insert($arr); } } //读取配置 $config = $anehtaConfig->getRecordById(2); reset($config); while (list($key, $val) = each($config)) { $val = htmlspecialchars(base64_decode($val)); echo "<b>{$key}</b> => {$val}<br />"; } //更新配置文件