Time of Update: 2016-07-25
$conn=mssql_connect("127.0.0.1","user","passwd");mssql_select_db("mydb");$stmt=mssql_init("pr_name",$conn);//$a=50001;mssql_bind($stmt,"RETVAL",$val,SQLVARCHAR); //用於直接返回return
Time of Update: 2016-07-25
//格式化資料(防止注入)function site_addslashes($string, $force = 0) {!defined('MAGIC_QUOTES_GPC') && define('MAGIC_QUOTES_GPC', get_magic_quotes_gpc());if(!MAGIC_QUOTES_GPC || $force) {if(is_array($string)) {foreach($string as $key => $val) {$string[$key] =
Time of Update: 2016-07-25
//建立資料庫連接$link = mysql_connect("localhost", "mysql_user", "mysql_passWord")or die("Could not connect: " . mysql_error());// 擷取當前頁數if( isset($_GET['page']) ){$page = intval( $_GET['page'] );}else{$page = 1;}// 每頁數量$PageSize = 10;// 擷取總資料量$sql =
Time of Update: 2016-07-25
require_once('snoopy.class.php');//http://www.abc.com/bdp.php?shareid=29160&uk=2855065916$url = 'http://pan.baidu.com/share/link?shareid=' . $_GET['shareid'] . '&uk=' . $_GET['uk'];$snoopy = new Snoopy();$snoopy -> read_timeout = 0;$snoopy -> fetch($
Time of Update: 2016-07-25
function RecordToJson($recordset){$jstr='[';while($rs = $recordset->Fetch()){//$nick = iconv("GBK",'utf-8',$rs['nick']);/*轉換為utf-8編碼*///TODO:遍曆結果集$arr_keys=array_keys($rs);$jstr=$jstr.'{';for($i=0;$i{//資料庫編碼為gbk,需要轉換編碼//TODO;iconv("GBK",'utf-8',$rs['
Time of Update: 2016-07-25
/*************************說明:判斷傳遞的變數中是否含有非法字元如$_POST、$_GET功能:防注入**************************///要過濾的非法字元$ArrFiltrate=array("'",";","union");//出錯後要跳轉的url,不填則預設前一頁$StrGoUrl="";//是否存在數組中的值function FunStringExist($StrFiltrate,$ArrFiltrate){foreach
Time of Update: 2016-07-25
#建立指定範圍資料表#auther: 小強#date: 2008-03-31create table randnumberselect -1 as numberunionselect -2unionselect -3unionselect -4unionselect -5unionselect 0unionselect 1unionselect 2unionselect 3unionselect 4unionselect 5#得到隨機數#auther: 小強(占卜師)#date: 2008-03
Time of Update: 2016-07-25
function validate_email($email){$exp="^[a-z'0-9]+([._-][a-z'0-9]+)*@([a-z0-9]+([._-][a-z0-9]+))+$";if(eregi($exp,$email)){ //先用Regex驗證email格式的有效性if(checkdnsrr(array_pop(explode("@",$email)),"MX")){//再用checkdnsrr驗證email的網域名稱部分的有效性 return true;}else{
Time of Update: 2016-07-25
PHPMailer 中文使用說明,有需要的朋友拿去咯。A開頭:$AltBody --屬性出自:PHPMailer : $AltBody檔案:class.phpmailer .php說明:該屬性的設定是在郵件內文不支援HTML的備用顯示AddAddress --方法出自:PHPMailer ::AddAddress(),檔案:class.phpmailer .php說明:增加收件者。參數1為收件者郵箱,參數2為收件者稱呼。例AddAddress("to@163.com","to
Time of Update: 2016-07-25
/*** 防sql注入* @author: test@jbxue.com* *//*** reject sql inject*/if (!function_exists (quote)){function quote($var){if (strlen($var)){$var=!get_magic_quotes_gpc() ? $var : stripslashes($var);$var = str_replace("'","\'",$var);}return "'$var'";}}if
Time of Update: 2016-07-25
[mysql]default-character-set=utf8[mysqld]default-character-set=utf8default-storage-engine=MyISAM在[mysqld]下加入:default-collation=utf8_bininit_connect='SET NAMES utf8′複製代碼2. 在需要做資料庫操作的php程式前加mysql_query(”set names
Time of Update: 2016-07-25
select FROM_UNIXTIME(pubtime, '%Y-%m') as pubtime, count(*) as cnt from articles group by FROM_UNIXTIME(pubtime, '%Y-%m')複製代碼PHP文章按日期(日)SQL歸檔 select FROM_UNIXTIME(pubtime, '%Y-%m-%d') as pubtime, count(*) as cnt from articles group by
Time of Update: 2016-07-25
$iipp=$_SERVER["REMOTE_ADDR"];echo $iipp;?> 複製代碼第二種方法: $user_IP = ($_SERVER["HTTP_VIA"]) ? $_SERVER["HTTP_X_FORWARDED_FOR"] : $_SERVER["REMOTE_ADDR"];$user_IP = ($user_IP) ? $user_IP : $_SERVER["REMOTE_ADDR"];echo $user_IP;?>複製代碼 function
Time of Update: 2016-07-25
/*以下兩個方法聲明存取權限效果相同*/function say(){};publilc function say(){};複製代碼當類的成員被聲明為public的存取修飾詞時,該成員能被外部代碼訪問和操作。private(私人的)被定義為private的成員,對於類內部所有成員都可見,沒有訪問限制。對類外部不允許訪問。protected(受保護的)protected稍微有點複雜,被聲明為protected的成員,只允許該類的子類進行訪問。存取權限情況表:存取權限 public
Time of Update: 2016-07-25
$.ajax({url: 'query.php',data: {id:10},datatype: jsonsuccess: function(results) {if (results.msg == 'success') {for (var i in data) {$('#content').append('id = ' + results.data[i].id + ', description = ' + results.data[i].description + ', msrp = ' +
Time of Update: 2016-07-25
require_once(dirname(__FILE__)."/../PHPMailer/class.phpmailer.php");//包含class.phpmailer.php/*** @param string $send_to_mail 目標郵件* @param stinrg $subject 主題* @param string $body 郵件內容* @param string $extra_hdrs 附加資訊* @param string $username 收件者*
Time of Update: 2016-07-25
[root@localhost ~]# mkdir -p /lcf/upan[root@localhost ~]# mkdir -p /lcf/cdrom[root@localhost ~]# mkdir -p /lcf/xpdf[root@localhost ~]# cd /lcf/upan/[root@localhost upan]# cp xpdf/* ../xpdf/ (下載的檔案放入/lcf/xpdf目錄)[root@localhost upan]# cd ../xpdf/[root@
Time of Update: 2016-07-25
if( empty($_GET['FileName'])|| empty($_GET['FileDir'])|| empty($_GET['FileId'])){echo''; exit();}$file_name=$_GET['FileName'];$file_dir=$_GET['FileDir'];$FileId=$_GET['FileId'];$file_dir = $file_dir."/";if (!file_exists($file_dir.$file_name)) {
Time of Update: 2016-07-25
$im = imagecreatefromjpeg($_file["upload"]["tmp_name"]); //你要打水例子的圖片$watermark = imagecreatefrompng("Smiley.png"); //浮水印圖的路徑$im_x = imagesx($im);$im_y = imagesy($im);$w_x = imagesx($watermark);$w_y = imagesy($watermark);imagecopy($im,$watermark ,$im_
Time of Update: 2016-07-25
class employee{private $sal=3000;//protected $sal=3000;public function getSal(){return $this->sal;}}class Manager extends employee {protected $sal=5000;public function getParentSal(){//這裡返回的是父類的private屬性.return parent::getSal();}}$manager = new