Submitted by 孤魂 on 2010, January 14, 7:16 PM
PHP代码
- <?php
- function vcurl($url, $post = '', $cookie = '', $cookiejar = '', $referer = ''){
- $tmpInfo = '';
- $cookiepath = getcwd().'./'.$cookiejar;
- $curl = curl_init();
- curl_setopt($curl, CURLOPT_URL, $url);
- curl_setopt($curl, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
- if($referer) {
- curl_setopt($curl, CURLOPT_REFERER, $referer);
- } else {
- curl_setopt($curl, CURLOPT_AUTOREFERER, 1);
- }
- if($post) {
- curl_setopt($curl, CURLOPT_POST, 1);
- curl_setopt($curl, CURLOPT_POSTFIELDS, $post);
- }
- if($cookie) {
- curl_setopt($curl, CURLOPT_COOKIE, $cookie);
- }
- if($cookiejar) {
- curl_setopt($curl, CURLOPT_COOKIEJAR, $cookiepath);
- curl_setopt($curl, CURLOPT_COOKIEFILE, $cookiepath);
- }
-
- curl_setopt($curl, CURLOPT_TIMEOUT, 100);
- curl_setopt($curl, CURLOPT_HEADER, 0);
- curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
- $tmpInfo = curl_exec($curl);
- if (curl_errno($curl)) {
- echo '<pre><b>错误:</b><br />'.curl_error($curl);
- }
- curl_close($curl);
- return $tmpInfo;
- }
- ?>
新版函数,更加简洁了,HOHO!
Tags: php, curl
学习┊取长补短 | 评论:6
| 阅读:3777
Submitted by 孤魂 on 2010, January 11, 12:05 AM
XML/HTML代码
- <div style="filter: alpha(opacity=50);-moz-opacity: 0.5;opacity: 0.5;width: 100%;">
- from www.kalvin.cn
- </div>
Tags: css
学习┊取长补短 | 评论:5
| 阅读:3057
Submitted by 孤魂 on 2009, October 13, 10:30 AM
PHP代码
- <?php
-
-
- define('db_host','localhost');
- define('db_user','root');
- define('dbpw','');
- define('dbname','test');
- define('dbcharset','utf8');
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- class mysql {
-
-
-
-
-
- var $querynum = 0;
-
-
-
-
-
- var $link;
-
-
-
-
- private $dbhost = db_host;
- private $dbname = dbname;
- private $dbuser = db_user;
- private $dbpw = dbpw;
- private $dbcharset = dbcharset;
-
-
-
-
-
-
-
-
-
-
- function mysql($dbhost='', $dbuser='', $dbpw='', $dbname = '', $pconnect = 0) {
-
- $dbhost==''?$dbhost=$this->dbhost:$dbhost;
- $dbuser==''?$dbuser=$this->dbuser:$dbuser;
- $dbpw==''?$dbpw=$this->dbpw:$dbpw;
- $dbname==''?$dbname=$this->dbname:$dbname;
-
- if($pconnect) {
- if(!$this->link = @mysql_pconnect($dbhost, $dbuser, $dbpw)) {
- $this->halt('Can not connect to MySQL server');
- }
- } else {
- if(!$this->link = @mysql_connect($dbhost, $dbuser, $dbpw)) {
- $this->halt('Can not connect to MySQL server');
- }
- }
- if($this->version() > '4.1') {
- if($this->dbcharset) {
- mysql_query("SET character_set_connection=$this->dbcharset, character_set_results=$this->dbcharset, character_set_client=binary", $this->link);
- }
-
- if($this->version() > '5.0.1') {
- mysql_query("SET sql_mode=''", $this->link);
- }
- }
-
- if($dbname) {
- mysql_select_db($dbname, $this->link);
- }
-
- }
-
-
-
-
-
-
- function select_db($dbname) {
- return mysql_select_db($dbname, $this->link);
- }
-
-
-
-
-
-
-
- function fetch_array($query, $result_type = MYSQL_ASSOC) {
- return mysql_fetch_array($query, $result_type);
- }
-
-
-
-
-
-
-
-
- function fetch_all($query, $result_type = MYSQL_ASSOC) {
- $result = array();
- $num = 0;
-
- while($ret = mysql_fetch_array($query, $result_type))
- {
- $result[$num++] = $ret;
- }
- return $result;
-
- }
-
-
-
-
-
-
-
- function fetch_row($query) {
- $query = mysql_fetch_row($query);
- return $query;
- }
-
-
-
-
-
-
-
-
- function result($query, $row) {
- $query = @mysql_result($query, $row);
- return $query;
- }
-
-
-
-
-
-
-
-
-
- function query($sql, $type = '') {
-
- $func = $type == 'UNBUFFERED' && @function_exists('mysql_unbuffered_query') ?
- 'mysql_unbuffered_query' : 'mysql_query';
- if(!($query = $func($sql, $this->link)) && $type != 'SILENT') {
- $this->halt('MySQL Query Error: ', $sql);
- }
-
- $this->querynum++;
- return $query;
- }
-
-
-
-
-
- function affected_rows() {
- return mysql_affected_rows($this->link);
- }
-
-
-
-
-
- function error() {
- return (($this->link) ? mysql_error($this->link) : mysql_error());
- }
-
-
-
-
-
- function errno() {
- return intval(($this->link) ? mysql_errno($this->link) : mysql_errno());
- }
-
-
-
-
-
-
-
- function num_rows($query) {
- $query = mysql_num_rows($query);
- return $query;
- }
-
-
-
-
-
-
- function num_fields($query) {
- return mysql_num_fields($query);
- }
-
-
-
-
-
-
- function free_result($query) {
- return mysql_free_result($query);
- }
-
-
-
-
-
- function insert_id() {
- return ($id = mysql_insert_id($this->link)) >= 0 ? $id : $this->result($this->query("SELECT last_insert_id()"), 0);
- }
-
-
-
-
-
-
-
- function fetch_fields($query) {
- return mysql_fetch_field($query);
- }
-
-
-
-
-
- function version() {
- return mysql_get_server_info($this->link);
- }
-
-
-
-
-
- function close() {
- return mysql_close($this->link);
- }
-
-
-
-
-
-
- function halt($message = '', $sql = '') {
- echo $message . ' ' . $sql;
- exit;
-
- }
- }
- ?>
Tags: php, mysql
学习┊取长补短 | 评论:0
| 阅读:2751
Submitted by 孤魂 on 2009, October 8, 10:01 PM
JavaScript代码
- <script type="text/javascript">
- <!--
- if(parent.window.opener)
- parent.window.opener.location='http://www.kalvin.cn/';
-
- </script>
刚才发现一个网站,从百度进去的,浏览这个网站过后,我原来的其它标签页全部转向了一些激情视频的广告网址,抓包发现了以上代码,比较有效!
学习┊取长补短 | 评论:11
| 阅读:4603
Submitted by 孤魂 on 2009, September 21, 10:09 AM
XML/HTML代码
- <form action="" method="GET" id="reportOverviewControlForm">
- <select name="timePeriod" id="timePeriod" onchange="this.form.submit()">
- <option value="today">今天</option>
- <option value="yesterday">昨天</option>
- <option value="last7days">过去 7 天</option>
- <option value="thismonth">本月(9月)</option>
- <option value="lastmonth">上月(8月)</option>
- <option value="alltime" selected>所有时间</option>
- </select>
- </form>
Tags: html
学习┊取长补短 | 评论:0
| 阅读:1910