Time of Update: 2016-07-21
原因 php指令碼部分源碼: 複製代碼 代碼如下: $fp = fsockopen("udp://$ip", $rand, $errno, $errstr, 5); if($fp){ fwrite($fp, $out); fclose($fp); php指令碼中的 fsockopen 函數,對外部地址,通過UDP發送大量的資料包,攻擊對方。 應對 可通過 php.ini ,禁用 fsockopen 函數,及使用Windows 2003的 安全性原則 屏蔽原生UDP連接埠。 禁用函數 尋找到
Time of Update: 2016-07-21
複製代碼 代碼如下: error_reporting(0); session_start(); //資料庫連接 $conn = mysql_connect('localhost', 'root', ''); mysql_select_db('chenkun', $conn); mysql_query('SET NAMES UTF-8'); //定義常量 define('ALL_PS', 'PHP'); function user_shell($uid, $shell, $m_id) {
Time of Update: 2016-07-21
複製代碼 代碼如下: function showtext($text){ $search = array('|(http://[^ ]+)|', '|(https://[^ ]+)|', '|(www.[^ ]+)|'); $replace = array('$1', '$1', '$1'); $text = preg_replace($search, $replace, $text); return $text; }
Time of Update: 2016-07-21
打包下載Pain.php 複製代碼 代碼如下: class Pain { public $var=array(); public $tpl=array(); //this is the method to assign vars to the template public function assign($variable,$value=null) { $this->var[$variable]=$value; } public function display($template_name,
Time of Update: 2016-07-21
複製代碼 代碼如下: js 端 及判斷 $(function(){ //var url=$(this)[0].location.href; //alert(url); goPageFirst(); $('#selpage').bind('change',goPage); }); //返回當前頁數 function getNowPage() { return parseInt($('#nowPage').html()); } //返回每頁顯示的條數 function getPer() {
Time of Update: 2016-07-21
複製代碼 代碼如下: public static function countryList($local) { $locale = new Zend_Locale('en_US'); $countries = ($locale->getTranslationList('Territory', $local, 2)); asort($countries, SORT_LOCALE_STRING); $countries = array_combine($countries, $countries);
Time of Update: 2016-07-21
一、 記憶體 在PHP中,填充一個字串變數相當簡單,這隻需要一個語句"<?php $str = 'hello world '; ?>"即可,並且該字串能夠被自由地修改、拷貝和移動。而在C語言中,儘管你能夠編寫例如"char *str = "hello world ";"這樣的一個簡單的靜態字串;但是,卻不能修改該字串,因為它生存於程式空間內。為了建立一個可操縱的字串,你必須分配一個記憶體塊,並且通過一個函數(例如strdup())來複製其內容。{ char *str; str =
Time of Update: 2016-07-21
複製代碼 代碼如下: function createHashDir($sign) { $md5 = md5($sign); if(!is_dir(MB_CACHE)) mkdir(MB_CACHE); for($i=1;$i{ $dir .= $md5{$i}.'/'; if(!is_dir(MB_CACHE.$dir)) { mkdir(MB_CACHE.$dir); } } return MB_CACHE.$dir; } function setCacheFile($data,$sign =
Time of Update: 2016-07-21
複製代碼 代碼如下: //將數字轉換為漢字,比如1210轉換為一千二百一十 $num = "842105580";//九位元 function del0($num) //去掉數欄位前面的0 { return "".intval($num); } function n2c($x) //單個數字變漢字 { $arr_n = array("零","一","二","三","四","五","六","七","八","九","十"); return $arr_n[$x]; } function num_r($
Time of Update: 2016-07-21
複製代碼 代碼如下: //判斷遠程檔案 function check_remote_file_exists($url) { $curl = curl_init($url); // 不取回資料 curl_setopt($curl, CURLOPT_NOBODY, true); // 發送請求 $result = curl_exec($curl); $found = false; // 如果請求沒有發送失敗 if ($result !== false) { // 再檢查http響應碼是否為200 $
Time of Update: 2016-07-21
複製代碼 代碼如下: $url = ‘http://www.baidu.com'; $ch = curl_init(); $timeout = 10; curl_setopt ($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HEADER, 1); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
Time of Update: 2016-07-21
:密保卡入庫 複製代碼 代碼如下: $this->load->model('admin/m_mibao'); $data = array(); //產生隨機橫座標 $rand_str = $this->_rand_str(10); $arr = array(); for($k=0;$k{ for ($i = 1;$i { $rand = $this->_rand_num(3); //賦給所有code的容器 $arr[$rand_str{$k} . $i] = $rand; } } $data['
Time of Update: 2016-07-21
其實這個沒什麼技術含量,當然就直接貼代碼,不廢話了, 但是在其實開發中還是蠻有用的,譬如論壇文章,圍脖等都有相關應用 複製代碼 代碼如下: function tranTime($time) { $rtime = date("m-d H:i",$time); $htime = date("H:i",$time); $time = time() - $time; if ($time $str = '剛剛'; } elseif ($time $min = floor($time/60); $str =
Time of Update: 2016-07-21
該應用實現了即時統計輸入字數,並且通過ajax與後台互動,將輸入內容插入到話題列表中。我將整個流程分為兩部分,本文講解第一部分jquery實現前端互動操作。 首先查看樣本:DEMOXHTML 複製代碼 代碼如下: Demo發布的內容... XHTML是一個表單,裡面有輸入框textarea,發布按鈕,還有一個統計輸入字數的span#counter,和資訊提示span#msg,在沒有輸入的情況下就提交則會提示使用者要求輸入內容。 CSS 複製代碼 代碼如下:
Time of Update: 2016-07-21
參考phpinfo的資訊,iconv模組也已經正確載入。 google一下。原來才知道,原來在linux版本下iconv這個方法還是有點下下問題的。 csdn上的一個網友給出的解決方案為: view sourceprint?一種方法是把iconv換成 mb_convert_encoding 另一種方法是修改iconv 的實現,從glibc 改為libiconv 搞了半天,煩躁! 有朋友碰到的話,也可以這麼解決了
Time of Update: 2016-07-21
1、下載libiconv函數庫http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.9.2.tar.gz; 2、解壓縮tar -zxvf libiconv-1.9.2.tar.gz; 3、安裝libiconv 複製代碼 代碼如下: #configure --prefix=/usr/local/iconv #make #make install 4、重新編譯php 增加編譯參數--with-iconv=/usr/local/iconv windows下
Time of Update: 2016-07-21
2010-12-15.txt的檔案內容如下: 複製代碼 代碼如下: 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 T01 T02 T03 T04 T05 T06 T07 T08 T09 T10 T11 T12 T13 T14 T15 T16 思路如下:使用file_get_contents()擷取txt檔案的內容,然後通過explode()把獲得的字串轉化為數組。獲得數組長度可以使用count()
Time of Update: 2016-07-21
複製代碼 代碼如下: class mysql { private $db; // datebase connect private $result; // mysql result static private $mysql; // mysql object private function __construct() { // The work before Create an object $this->db = mysql_connect('localhost','root','');
Time of Update: 2016-07-21
複製代碼 代碼如下: include 'mysql.php'; $mysql= mysql::getObject(); $mysql->query("SELECT * FROM post"); $xml = new XMLWriter(); $xml->openUri('hello.xml'); // or 'php://output' $xml->setIndentString(' '); $xml->setIndent(true); // start $xml->startDocument(
Time of Update: 2016-07-21
in_array()定義和用法 in_array() 函數尋找數組中是否存在指定值。 文法 in_array(value,array,type)參數 描述 value 必需。規定要在數組搜尋的值。 array 必需。規定要搜尋的數組。 type 可選。如果設定該參數為 true,則檢查搜尋的資料與數組的值的類型是否相同。 說明 如果給定的值 value 存在於數組 array 中則返回 true。如果第三個參數設定為 true,函數只有在元素存在於數組中且資料類型與給定值相同時才返回 true。