一区二区久久-一区二区三区www-一区二区三区久久-一区二区三区久久精品-麻豆国产一区二区在线观看-麻豆国产视频

function.inc.php超越php

<?php
/**
 * Global Function
 *
 * @author   Avenger <avenger@php.NET>
 * @version 1.14 $Id 2003-05-30 10:10:08 $
 */
/**
 * 彈出提示框
 *
 * @access public
 * @param string $txt 彈出一個提示框,$txt為要彈出的內容
 * @return void
 */
function popbox($txt) {
    echo "<script language='JavaScript'>alert('".$txt."')</script>";
}
/**
 * 非法操作警告
 *
 * @access public
 * @param string $C_alert   提示的錯誤信息
 * @param string $I_goback  返回后返回到哪一頁,不指定則不返回
 * @return void
 */
function alert($C_alert,$I_goback='main.php') {
    if(!empty($I_goback)) {
        echo "<script>alert('$C_alert');window.location.href='$I_goback';</script>";
    } else {
        echo "<script>alert('$C_alert');</script>";
    }
}
/**
 * 產生隨機字符串
 *
 * 產生一個指定長度的隨機字符串,并返回給用戶
 *
 * @access public
 * @param int $len  產生字符串的位數
 * @return string 
 */
function randstr($len=6) {
    $chars='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-@#~'; // characters to build the password from
    mt_srand((double)microtime()*1000000*getmypid()); // seed the random number generater (must be done)
    $password='';
    while(strlen($password)<$len)
        $password.=substr($chars,(mt_rand()%strlen($chars)),1);
    return $password;
}
/**
 * 判斷下拉菜音的選取項
 *
 * 可以判斷字符串一和字符串二是否相等.從而使相等的項目在下拉菜單中被選擇
 *
 * @access public
 * @param string $str1  要比較的字符串一
 * @param string $str2  要比較的字符串二
 * @return string       相等返回字符串"selected",否則返回空字符串
 */
function ckselect($str1,$str2) {
    if($str1==$str2) {
        return ' selected';
    }
    return '';
}
/**
 * 一個自定義的Ftp函數
 *
 * @access private
 * @return void
 */
function myftp($ftp_server,$ftp_port,$ftp_username,$ftp_password,$ftp_path='/') {
    $ftpid=@ftp_connect($ftp_server,$ftp_port) or die('Connect To Ftp Server Error!');
    @ftp_login($ftpid,$ftp_username,$ftp_password) or die('Login Ftp Error!');
    @ftp_chdir($ftpid,'/'.$ftp_path) or die('Chdir Error!');
    return $ftpid;
}
/**
 * 截取中文部分字符串
 *
 * 截取指定字符串指定長度的函數,該函數可自動判定中英文,不會出現亂碼
 *
 * @access public
 * @param string    $str    要處理的字符串
 * @param int       $strlen 要截取的長度默認為10
 * @param string    $other  是否要加上省略號,默認會加上
 * @return string
 */
function showtitle($str,$strlen=10,$other=true) {
    $j = 0;
    for($i=0;$i<$strlen;$i++)
      if(ord(substr($str,$i,1))>0xa0) $j++;
    if($j%2!=0) $strlen++;
    $rstr=substr($str,0,$strlen);
    if (strlen($str)>$strlen && $other) {$rstr.='...';}
    return $rstr;
}
/**
 * 制作鏈接
 *
 * @access public
 * @param string    url         要鏈接到的網址
 * @param string    linktext    顯示的鏈接文字
 * @param string    target      目標框架
 * @param string    extras      擴展參數
 * @return string
 */
function make_link ($url, $linktext=false, $target=false, $extras=false) {
    return sprintf("<a href=/"%s/"%s%s>%s</a>",
        $url,
        ($target ? ' target="'.$target.'"' : ''),
        ($extras ? ' '.$extras : ''),
        ($linktext ? $linktext : $url)
    );
}
/**
 * 格式化用戶評論
 *
 * @access public
 * @param string
 * @return void
 */
function clean_note($text) {
    $text = htmlspecialchars(trim($text));
    /* turn urls into links */
    $text = preg_replace("/((mailto|http|ftp|nntp|news):.+?)(>|/s|/)|/"|/./s|$)/","<a href=/"/1/">/1</a>/3",$text);
    /* this 'fixing' code will go away eventually. */
    $fixes = array('<br>', '<p>', '</p>');
    reset($fixes);
    while (list(,$f) = each($fixes)) {
        $text = str_replace(htmlspecialchars($f), $f, $text);
        $text = str_replace(htmlspecialchars(strtoupper($f)), $f, $text);
    }
    /* <p> tags make things look awfully weird (breaks things out of the <code>
       tag). Just convert them to <br>'s
    */
    $text = str_replace (array ('<P>', '<p>'), '<br>', $text);
    /* Remove </p> tags to prevent it from showing up in the note */
    $text = str_replace (array ('</P>', '</p>'), '', $text);
    /* preserve linebreaks */
    $text = str_replace("/n", "<br>", $text);
    /* this will only break long lines */
    if (function_exists("wordwrap")) {
        $text = wordwrap($text);
    }
    // Preserve spacing of user notes
    $text = str_replace("  ", "  ", $text);
    return $text;
}
/**
 * 獲取圖象信息的函數
 *
 * 一個全面獲取圖象信息的函數
 *
 * @access public
 * @param string $img 圖片路徑
 * @return array
 */
function getimageinfo($img) {
    $img_info = getimagesize($img);
    switch ($img_info[2]) {
    case 1:
    $imgtype = "GIF";
    break;
    case 2:
    $imgtype = "JPG";
    break;
    case 3:
    $imgtype = "PNG";
    break;
    }
    $img_size = ceil(filesize($img)/1000)."k";
    $new_img_info = array (
        "width"=>$img_info[0],
        "height"=>$img_info[1],
        "type"=>$imgtype,
        "size"=>$img_size
    );
    return $new_img_info;
}
/**
 * 計算當前時間
 *
 * 以微秒為單位返回當前系統的時間
 *
 * @access public
 * @return real
 */
function getmicrotime() {
    $tmp = explode(' ', microtime());
    return (real)$tmp[1]. substr($tmp[0], 1);
}
/**
 * 寫文件操作
 *
 * @access public
 * @param bool
 * @return void
 */
function wfile($file,$content,$mode='w') {
    $oldmask = umask(0);
    $fp = fopen($file, $mode);
    if (!$fp) return false;
    fwrite($fp,$content);
    fclose($fp);
    umask($oldmask);
    return true;
}
/**
 * 加載模板文件
 *
 * @access public
 * @return void
 */
function tpl_load($tplfile,$path='./templates/',$empty='remove') {
    global $tpl;
    $path ? '' : $path='./templates/'; 
    require_once 'HTML/Template/phpLIB.php';
    $tpl = new Template_phpLIB($path,$empty);
    $tpl->setFile('main',$tplfile);
}
/**
 * 模板解析輸出
 *
 * @access public
 * @return void
 */
function tpl_output() {
    global $tpl;
    $tpl->parse('output','main');
    $tpl->p('output');
}
/**
 * 郵件發送函數
 *
 * @access public private
 * @param bool
 * @return void
 */
function mailSender($from, $to, $title, $content) {
    $from ? $from = 'sender@phpe.NET' : '';
    $title ? $title = 'From Exceed php...' : '';
    $sig = "
      感謝您使用我們的服務./n/n
                                                Exceed php(超越php)/n
                                                $maildate/n/n
---------------------------------------------------------------------------------------
/n/n
去發現極限方法的唯一辦法就是去超越它/n
超越php歡迎您(http://www.phpe.NET)/n
";
    $content .= $sig;
    if (@mail($to, $title, $content, "From:$from/nReply-To:$from")) {
        return true;
    } else {
        return false;
    }
}
function br2none($str) {
    return str_replace(array('<br>', '<br />'), "", $str);
}
/**
 * UBB解析
 *
 * @param      none
 * @access     public
 * @return     void
*/
function ubbParse($txt, $coverhtml=0) {
    if ($coverhtml == 0) $txt = nl2br(new_htmlspecialchars($txt));  //BR和HTML轉換
    //只轉換BR,不轉換HTML
    if ($coverhtml == 1) {
        if (!preg_match('/</s*(p|br)/s*>/is', $txt) && !preg_match('/<table.+<//table>/is', $txt)) {
            $txt = strip_tags($txt);
            $txt = nl2br($txt);
        } else {
            $txt = str_replace('<?', '<?', $txt);
        }
    }
    // pre and quote
    //error_reporting(E_ALL);
    $txt = preg_replace( "#/[quote/](.+?)/[/quote/]#is", "<blockquote>/1</blockquote>", $txt );
    $txt = preg_replace( "#/[code/](.+?)/[/code/]#ise", "'<pre class=php>'.br2none('').'</pre>'", $txt );
    // Colors 支持 主站蜘蛛池模板: 国产精品一区二区在线观看 | 91欧美在线| 超91在线 | 久久狠狠干 | 亚洲小视频在线 | 免费一区二区三区 | 国产中文字幕第一页 | 韩国日本理论片 | 黄篇网站在线观看 | 日本网络视频www色高清免费 | 久久久国产精品福利免费 | 伊人狼人久久 | 亚洲二区视频 | 久久国产精品超级碰碰热 | 中文字幕久久久久久久系列 | 男女男精品视频网站 | 美国bbbbbbbbb免费毛片 | 亚洲免费福利 | 男人把女人c爽的免费视频 男人操女人免费视频 | 欧美精品一国产成人性影视 | 欧美视频在线观看网站 | 亚洲伊人久久大香线蕉结合 | 伊人中文网 | 美美女高清毛片视频免费观看 | 色噜噜噜噜噜 | 91麻豆高清国产在线播放 | 精品一区二区三区五区六区七区 | 亚洲视频区 | 国产亚洲精品九九久在线观看 | 久久极品视频 | 久久这里有精品视频任我鲁 | 青草欧美| 国产区在线观看 | 国产精品久久1024 | 国产成人免费午夜在线观看 | 国产资源视频在线观看 | 在线免费一区二区 | 国内精品欧美久久精品 | 一级做a | 色啦啦 | 久久免费精品视频 |