<?php $str = '<a href="http://www.baidu.com/sad.html">asdfasf</a>lsdakl<a href=http://te.com target=_blank>t0</a>sdakl;ja;klfkjl;<a href="sdf.html" >t2</a>ddd<a href="/t/s/.html" alt="sss " >t3</a>'; echo $str; preg_match_all("~<a\\s*href=([\"\\']?)?(.*?)\\1(.*?)>(.*?)<\\/a>~isx", $str, $arr); m_exit($arr); //调试变量 function m_exit($var, $exit = false) { echo "<pre>\n"; print_r($var); echo "</pre>\n"; if ($exit) { exit; } }
<?php //==================================================== // FileName: login.php // Summary: 后台登录入口 // Author: millken(迷路林肯) // LastModifed:2008-3-9 // copyright (c)2008 millken@gmail.com //==================================================== include '../common.inc.php'; $imgcode = imgcode(); if (imgcode($checkcode, false)) { die('ok'); } else { m_exit($_POST); } $tpl = new template(basename(__FILE__, '.php') . '.html'); $tpl->tpl_dir = 'templates/default/'; $tpl->debug = true; include $tpl->compiledFile();
<?php include './curl.class.php'; $curl = new CurlTool(); $url = base64_decode(substr($_SERVER['REDIRECT_URL'], 1)); $match_part = parse_url((substr($url, 0, 4) != 'http' ? 'http://' : '') . $url); $host = $match_part["scheme"] . "://" . $match_part["host"]; $contents = $curl->fetchContent($url); //file_put_contents('test.html',$contents); $images = $curl->_stripimages($contents); $images = $curl->_expandlinks($images); $images = array_map('addlink', $images); $links = $curl->_striplinks($contents); m_exit($links); $expandlinks = $curl->_expandlinks($links); $expandlinks = array_map('addlink', $expandlinks); $contents = str_replace($links, $expandlinks, $contents); echo $contents; //function removelink($matches) { // $url = parse_url($matches[2]); // if(strstr($url['scheme']."://".$url['host'],$GLOBALS['host'])) { // return $matches[0]; // } // return $matches[3]; //} //echo preg_replace_callback("~<img\s*=([\"\'])?(.*?)\\1[\/]>~i","removelink",$contents;); function addlink($link) { $url = parse_url($link); if (strstr($url['scheme'] . "://" . $url['host'], $GLOBALS['host'])) { return 'http://' . $_SERVER['HTTP_HOST'] . '/' . base64_encode($link);
<%3$s> '), $GLOBALS['sys_name'], util_make_url('/account/'), util_make_url('/account/unsubscribe.php?ch=_' . $row['confirm_hash'])); } else { $tail = ""; } util_send_message($row['email'], $subj, $body . "\r\n" . $tail, 'noreply@' . $sys_default_domain); $last_userid = $row['user_id']; sleep($SLEEP); } $sql = "UPDATE massmail_queue\n\t\tSET failed_date=0,\n\t\tlast_userid='{$last_userid}',\n\t\tfinished_date='" . time() . "'\n\t\tWHERE id='{$mail_id}'"; db_query($sql); if (db_error()) { $err .= $sql . db_error(); } $mess = "massmail {$compt} mails sent"; m_exit($mess); function m_exit($mess = '') { global $err; if (!cron_remove_lock(__FILE__)) { $err .= "Could not remove lock\n"; } if (!cron_entry(6, $mess . $err)) { # rely on crond to report the error echo "cron_entry error: " . db_error() . "\n"; } exit; } // Local Variables: // mode: php // c-file-style: "bsd"