来自 编程 2019-11-22 20:49 的文章
当前位置: 澳门三合彩票 > 编程 > 正文

并显示所有域名的相关信息

文件一:index.php -->\n"; /* ######################################################################################### ## #本域名查询系统由mydowns收集整理汉化,汉化归把握时间网站所有( #该程序是2001年5月18日发布的最新版本,本站将对此程序继续进行修改完善,敬请关注本站!# #该程序可以查询域名所有者的详细资料信息,现提供9个类型的域名以供查询!# #演示地址: #源程序打包下载: #把握时间网站提供PHP、ASP、CGI、HTML、JSP等源程序、电子教材、文章资料# #把握时间网站 #请保留此信息,谢谢!# ## ######################################################################################### MWhois - a Whois lookup script written in PHP and Perl Copyright 2000 Matt Wilson This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA02111-1307USA */ if(!isset($use_global_templates)) $use_global_templates = 1;// whether to use the global templates $template_header = "gheader.tml";// the global header template $template_footer = "gfooter.tml";// the global footer template /* Template information stuff ---------------------------- The following strings in your templates are replaced with the description; [>DOMAINRAWOUTPUTWHOIS_SERVERAVAIL_LISTUNAVAIL_LISTERROR_MSGEXTEXT_HTML_LISTEXT_LIST\n"; $whois_server = $whois_servers[$ext]; } else { echo "\n"; fputs($co, $domain.".".$ext."\n"); while $output .= fgets; $he = strpos($output, $whois_si_servers[$ext]) + strlen($whois_si_servers[$ext]); $le = strpos($output, "\n", $he); $whois_server = substr($output, $he, $le-$he); echo "\n"; } } else { $whois_server = $whois_info_servers[$ext]; } $whois_server = trim; } // make all the changes function make_changes { global $domain; global $errormsg; global $titlebar; global $rawoutput; global $avail; global $unavail; global $ext; global $whois_exts; global $whois_servers; global $script_name; $f = implode("",file; $f = str_replace("[>WHOIS_SERVERTITLE_BARDOMAINERROR_MSGRAWOUTPUT".$avail[$l]."
"; } for($l=0; $l".$unavail[$l]."
"; } $f = str_replace("[>AVAIL_LISTUNAVAIL_LISTSCRIPT_NAMEEXTEXT_LIST",$whois_exts),$f); $f = str_replace("[>EXT_HTML_LIST\n".implode("\n",$whois_exts)."\n",$f); return $f; } // show the error page function do_error() { global $use_global_templates; global $template_header; global $template_footer; global $template_error; global $domain; global $titlebar; global $error_title; global $errormsg; $titlebar = $error_title; if($use_global_templates) echo make_changes; echo make_changes; if($use_global_templates) echo make_changes; exit(); } // checks the domain is legal function check_domain() { global $errormsg; global $domain; global $ext; global $whois_exts; if{ if{ $errormsg = "没有选择域名后缀"; return 0; } if(!my_in_array{ $errormsg = "不支持此域名后缀"; return 0; } } if{ if < 2 || strlen{ $errormsg = "域名太长或太短"; return 0; } if == 2 && !ereg{2}",$domain)){ $errormsg = "在2个字节的域名中不能包含有字母"; return 0; } if(ereg("^-|-$",$domain)){ $errormsg = "域名前和域名后不能使用-,也不可以连续使用-"; return 0; } if(!ereg("{".strlen."}",$domain)){ $errormsg = "域名只可以包含字母数字组合和-"; return 0; } } return 1; } // perform_whois function returns 0 if domain is available otherwise returns either the raw info or 1 function perform_whois($domainname,$ext,$raw) { global $errormsg; global $whois_servers; global $rawoutput; global $whois_avail_strings; $rawoutput = ""; if return do_raw; if(($ns = fsockopen($whois_servers[$ext],43)) == false){ $errormsg = "无法连接到域名查询服务器 ".$whois_servers[$ext].""; return -1; } fputs($ns,"$domainname.$ext\n"); while $rawoutput .= fgets; echo "\n"; if(!ereg($whois_avail_strings[$whois_servers[$ext]], $rawoutput)) return 0; return 1; } // this performs the whois lookup and then shows the data returned function do_raw { global $titlebar; global $template_raw_output; global $use_global_templates; global $template_header; global $template_footer; global $raw_output_title; global $whois_info_servers; global $whois_servers; global $rawoutput; global $errormsg; global $whois_info_servers_backup; global $whois_avail_strings; global $whois_server; choose_info_server; if(($ns = fsockopen == false){ if(($ns = fsockopen($whois_info_servers[$ext],43)) == false){ if(($ns = fsockopen($whois_info_servers_backup[$ext], 43)) == false){ return -1; } else { $whois_server = $whois_info_servers_backup[$ext]; } } else { $whois_server = $whois_info_servers[$ext]; } } print "\n"; fputs($ns,"$domainname.$ext\n"); while $rawoutput = $rawoutput.fgets; echo ""; //$pos = @strpos($rawoutput,$whois_avail_strings[$server]); //if && !$pos){} //else{ //if || $pos){ //if(($ns = fsockopen($whois_info_servers_backup[$ext],43)) == false) //return -1; //else{ //$rawoutput = ""; //fputs($ns,"$domainname.$ext\n"); //while //$rawoutput = $rawoutput.fgets; //$pos = @strpos($rawoutput,$whois_avail_strings[$whois_info_servers_backup[$ext]]); //if || $pos){} //else //return -1; //} //} $titlebar = $raw_output_title; if($use_global_templates) echo make_changes; echo make_changes; if($use_global_templates) echo make_changes; exit(); } function do_getsearch_mini() { global $template_search_mini; echo make_changes($template_search_mini); exit(); } function do_getsearch() { global $template_footer; global $template_header; global $use_global_templates; global $titlebar; global $template_search; global $search_title; $titlebar = $search_title; if($use_global_templates) echo make_changes; echo make_changes; if($use_global_templates) echo make_changes; exit();} function do_avail() { global $template_footer; global $template_header; global $use_global_templates; global $titlebar; global $template_available; global $available_title; $titlebar = $available_title; if($use_global_templates) echo make_changes; echo make_changes; if($use_global_templates) echo make_changes; exit(); } function do_taken() { global $template_footer; global $template_header; global $use_global_templates; global $template_taken; global $titlebar; global $taken_title; $titlebar = $taken_title; if($use_global_templates) echo make_changes; echo make_changes; if($use_global_templates) echo make_changes; exit(); } function do_exts() { global $template_footer; global $template_header; global $use_global_templates; global $template_exts_list; global $titlebar; global $exts_list_title; $titlebar = $exts_list_title; if($use_global_templates) echo make_changes; echo make_changes; if($use_global_templates) echo make_changes; exit(); } function do_glob() { global $domain; global $whois_exts; global $avail; global $unavail; global $template_header; global $template_footer; global $use_global_templates; global $titlebar; global $global_title; $titlebar = $global_title; if($use_global_templates) echo make_changes; if{ global $template_global; echo make_changes; } else{ global $template_global_results; for($l=0; $l

<?
//php教程生成pdf文件代码
/*
生成pdf文件如果真的生成很好,是很复杂的,下面我们来看看一款完整理的php生成pdf文件代码吧,他可以把文本文件生成pdf文件也可以利用图片文件生成pdf文件哦。

每位程序员和开发者都喜欢讨论他们最爱的代码片段,尤其是当PHP开发者花费数个小时为网页编码或创建应用时,他们更知道这些代码的重要性。为了节约编码时间,笔者收集了一些较为实用的代码片段,帮助开发者提高工作效率。>>>

这款生成pdf文件用到文件有
fpdf.php
chinese.php
picpdf.php

1) Whois query using PHP ——利用PHP获取Whois请求

*/
//fpdf.php代码

利用这段代码,在特定的域名里可获得whois信息。把域名名称作为参数,并显示所有域名的相关信息。

define('fpdf_version','1.6');

 

class fpdf
{
var $page;               //current page number
var $n;                  //current object number
var $offsets;            //array of object offsets
var $buffer;             //buffer holding in-memory pdf
var $pages;              //array containing pages
var $state;              //current document state
var $compress;           //compression flag
var $k;                  //scale factor (number of points in user unit)
var $deforientation;     //default orientation
var $curorientation;     //current orientation
var $pageformats;        //available page formats
var $defpageformat;      //default page format
var $curpageformat;      //current page format
var $pagesizes;          //array storing non-default page sizes
var $wpt,$hpt;           //dimensions of current page in points
var $w,$h;               //dimensions of current page in user unit
var $lmargin;            //left margin
var $tmargin;            //top margin
var $rmargin;            //right margin
var $bmargin;            //page break margin
var $cmargin;            //cell margin
var $x,$y;               //current position in user unit
var $lasth;              //height of last printed cell
var $linewidth;          //line width in user unit
var $corefonts;          //array of standard font names
var $fonts;              //array of used fonts
var $fontfiles;          //array of font files
var $diffs;              //array of encoding differences
var $fontfamily;         //current font family
var $fontstyle;          //current font style
var $underline;          //underlining flag
var $currentfont;        //current font info
var $fontsizept;         //current font size in points
var $fontsize;           //current font size in user unit
var $drawcolor;          //commands for drawing color
var $fillcolor;          //commands for filling color
var $textcolor;          //commands for text color
var $colorflag;          //indicates whether fill and text colors are different
var $ws;                 //word spacing
var $images;             //array of used images
var $pagelinks;          //array of links in pages
var $links;              //array of internal links
var $autopagebreak;      //automatic page breaking
var $pagebreaktrigger;   //threshold used to trigger page breaks
var $inheader;           //flag set when processing header
澳门三合彩票,var $infooter;           //flag set when processing footer
var $zoommode;           //zoom display mode
var $layoutmode;         //layout display mode
var $title;              //title
var $subject;            //subject
var $author;             //author
var $keywords;           //keywords
var $creator;            //creator
var $aliasnbpages;       //alias for total number of pages
var $pdfversion;         //pdf version number

 代码如下

/*******************************************************************************
*                                                                              *
*                               public methods                                 *
*                                                                              *
*******************************************************************************/
function fpdf($orientation='p', $unit='mm', $format='a4')
{
 //some checks
 $this->_dochecks();
 //initialization of properties
 $this->page=0;
 $this->n=2;
 $this->buffer='';
 $this->pages=array();
 $this->pagesizes=array();
 $this->state=0;
 $this->fonts=array();
 $this->fontfiles=array();
 $this->diffs=array();
 $this->images=array();
 $this->links=array();
 $this->inheader=false;
 $this->infooter=false;
 $this->lasth=0;
 $this->fontfamily='';
 $this->fontstyle='';
 $this->fontsizept=12;
 $this->underline=false;
 $this->drawcolor='0 g';
 $this->fillcolor='0 g';
 $this->textcolor='0 g';
 $this->colorflag=false;
 $this->ws=0;
 //standard fonts
 $this->corefonts=array('courier'=>'courier', 'courierb'=>'courier-bold', 'courieri'=>'courier-oblique', 'courierbi'=>'courier-boldoblique',
  'helvetica'=>'helvetica', 'helveticab'=>'helvetica-bold', 'helveticai'=>'helvetica-oblique', 'helveticabi'=>'helvetica-boldoblique',
  'times'=>'times-roman', 'timesb'=>'times-bold', 'timesi'=>'times-italic', 'timesbi'=>'times-bolditalic',
  'symbol'=>'symbol', 'zapfdingbats'=>'zapfdingbats');
 //scale factor
 if($unit=='pt')

function whois_query($domain) {
 
    // fix the domain name:
    $domain = strtolower(trim($domain));
    $domain = preg_replace('/^', '', $domain);
    $domain = preg_replace('/^www./i', '', $domain);
    $domain = explode('/', $domain);
    $domain = trim($domain[0]);
 
    // split the TLD from domain name
    $_domain = explode('.', $domain);
    $lst = count($_domain)-1;
    $ext = $_domain[$lst];
 
    // You find resources and lists
    // like these on wikipedia:
    //
    // <a href=";
    //
    $servers = array(
        "biz" => "whois.neulevel.biz",
        "com" => "whois.internic.net",
        "us" => "whois.nic.us",
        "coop" => "whois.nic.coop",
        "info" => "whois.nic.info",
        "name" => "whois.nic.name",
        "net" => "whois.internic.net",
        "gov" => "whois.nic.gov",
        "edu" => "whois.internic.net",
        "mil" => "rs.internic.net",
        "int" => "whois.iana.org",
        "ac" => "whois.nic.ac",
        "ae" => "whois.uaenic.ae",
        "at" => "whois.ripe.net",
        "au" => "whois.aunic.net",
        "be" => "whois.dns.be",
        "bg" => "whois.ripe.net",
        "br" => "whois.registro.br",
        "bz" => "whois.belizenic.bz",
        "ca" => "whois.cira.ca",
        "cc" => "whois.nic.cc",
        "ch" => "whois.nic.ch",
        "cl" => "whois.nic.cl",
        "cn" => "whois.cnnic.net.cn",
        "cz" => "whois.nic.cz",
        "de" => "whois.nic.de",
        "fr" => "whois.nic.fr",
        "hu" => "whois.nic.hu",
        "ie" => "whois.domainregistry.ie",
        "il" => "whois.isoc.org.il",
        "in" => "whois.ncst.ernet.in",
        "ir" => "whois.nic.ir",
        "mc" => "whois.ripe.net",
        "to" => "whois.tonic.to",
        "tv" => "whois.tv",
        "ru" => "whois.ripn.net",
        "org" => "whois.pir.org",
        "aero" => "whois.information.aero",
        "nl" => "whois.domain-registry.nl"
    );
 
    if (!isset($servers[$ext])){
        die('Error: No matching nic server found!');
    }
 
    $nic_server = $servers[$ext];
 
    $output = '';
 
    // connect to whois server:
    if ($conn = fsockopen ($nic_server, 43)) {
        fputs($conn, $domain."rn");
        while(!feof($conn)) {
            $output .= fgets($conn,128);
        }
        fclose($conn);
    }
    else { die('Error: Could not connect to ' . $nic_server . '!'); }
 
    return $output;
}

 

 

  $this->k=1;
 elseif($unit=='mm')
  $this->k=72/25.4;
 elseif($unit=='cm')
  $this->k=72/2.54;
 elseif($unit=='in')
  $this->k=72;
 else
  $this->error('incorrect unit: '.$unit);
 //page format
 $this->pageformats=array('a3'=>array(841.89,1190.55), 'a4'=>array(595.28,841.89), 'a5'=>array(420.94,595.28),
  'letter'=>array(612,792), 'legal'=>array(612,1008));
 if(is_string($format))
  $format=$this->_getpageformat($format);
 $this->defpageformat=$format;
 $this->curpageformat=$format;
 //page orientation
 $orientation=strtolower($orientation);
 if($orientation=='p' || $orientation=='portrait')
 {
  $this->deforientation='p';
  $this->w=$this->defpageformat[0];
  $this->h=$this->defpageformat[1];
 }
 elseif($orientation=='l' || $orientation=='landscape')
 {
  $this->deforientation='l';
  $this->w=$this->defpageformat[1];
  $this->h=$this->defpageformat[0];
 }
 else
  $this->error('incorrect orientation: '.$orientation);
 $this->curorientation=$this->deforientation;
 $this->wpt=$this->w*$this->k;
 $this->hpt=$this->h*$this->k;
 //page margins (1 cm)
 $margin=28.35/$this->k;
 $this->setmargins($margin,$margin);
 //interior cell margin (1 mm)
 $this->cmargin=$margin/10;
 //line width (0.2 mm)
 $this->linewidth=.567/$this->k;
 //automatic page break
 $this->setautopagebreak(true,2*$margin);
 //full width display mode
 $this->setdisplaymode('fullwidth');
 //enable compression
 $this->setcompression(true);
 //set default pdf version number
 $this->pdfversion='1.3';
}

2) Text messaging with PHP using the TextMagic API ——使用TextMagic API 获取PHP Test信息

function setmargins($left, $top, $right=null)
{
 //set left, top and right margins
 $this->lmargin=$left;
 $this->tmargin=$top;
 if($right===null)
  $right=$left;
 $this->rmargin=$right;
}

TextMagic引入强大的核心API,可轻松将SMS发送到手机。该API是需要付费。

function setleftmargin($margin)
{
 //set left margin
 $this->lmargin=$margin;
 if($this->page>0 && $this->x<$margin)
  $this->x=$margin;
}

 代码如下

function settopmargin($margin)
{
 //set top margin
 $this->tmargin=$margin;
}

the TextMagic PHP lib
require('textmagic-sms-api-php/TextMagicAPI.php');
 
// Set the username and passWord information
$username = 'myusername';
$password = 'mypassword';
 
// Create a new instance of TM
$router = new TextMagicAPI(array(
    'username' => $username,
    'password' => $password
));
 
// Send a text message to '999-123-4567'
$result = $router->send('Wake up!', array(9991234567), true);
 
// result:  Result is: Array ( [messages] => Array ( [19896128] => 9991234567 ) [sent_text] => Wake up! [parts_count] => 1 )

function setrightmargin($margin)
{
 //set right margin
 $this->rmargin=$margin;
}

 

function setautopagebreak($auto, $margin=0)
{
 //set auto page break mode and triggering margin
 $this->autopagebreak=$auto;
 $this->bmargin=$margin;
 $this->pagebreaktrigger=$this->h-$margin;
}

3) Get info about your memory usage——获取内存使用率

function setdisplaymode($zoom, $layout='continuous')
{
 //set display mode in viewer
 if($zoom=='fullpage' || $zoom=='fullwidth' || $zoom=='real' || $zoom=='default' || !is_string($zoom))
  $this->zoommode=$zoom;
 else
  $this->error('incorrect zoom display mode: '.$zoom);
 if($layout=='single' || $layout=='continuous' || $layout=='two' || $layout=='default')
  $this->layoutmode=$layout;
 else
  $this->error('incorrect layout display mode: '.$layout);
}

这段代码帮助你获取内存使用率。

function setcompression($compress)
{
 //set page compression
 if(function_exists('gzcompress'))
  $this->compress=$compress;
 else
  $this->compress=false;
}

 代码如下

function settitle($title, $isutf8=false)
{
 //title of document
 if($isutf8)
  $title=$this->_utf8toutf16($title);
 $this->title=$title;
}

echo "Initial: ".memory_get_usage()." bytes n";
/* prints
Initial: 361400 bytes
*/
 
// let's use up some memory
for ($i = 0; $i < 100000; $i++) {
    $array []= md5($i);
}
 
// let's remove half of the array
for ($i = 0; $i < 100000; $i++) {
    unset($array[$i]);
}
 
echo "Final: ".memory_get_usage()." bytes n";
/* prints
Final: 885912 bytes
*/
 
echo "Peak: ".memory_get_peak_usage()." bytes n";
/* prints
Peak: 13687072 bytes
*/

function setsubject($subject, $isutf8=false)
{
 //subject of document
 if($isutf8)
  $subject=$this->_utf8toutf16($subject);
 $this->subject=$subject;
}

 

function setauthor($author, $isutf8=false)
{
 //author of document
 if($isutf8)
  $author=$this->_utf8toutf16($author);
 $this->author=$author;
}

4) Display source code of any webpage——查看任意网页源代码

function setkeywords($keywords, $isutf8=false)
{
 //keywords of document
 if($isutf8)
  $keywords=$this->_utf8toutf16($keywords);
 $this->keywords=$keywords;
}

如果你想查看网页源代码,那么只需更改第二行的URL,源代码就会在网页上显示出。

function setcreator($creator, $isutf8=false)
{
 //creator of document
 if($isutf8)
  $creator=$this->_utf8toutf16($creator);
 $this->creator=$creator;
}

 

function aliasnbpages($alias='{nb}')
{
 //define an alias for total number of pages
 $this->aliasnbpages=$alias;
}

 代码如下

function error($msg)
{
 //fatal error
 die('<b>fpdf error:</b> '.$msg);
}

<?php // display source code $lines = file(''); foreach ($lines as $line_num => $line) {
    // loop thru each line and prepend line numbers
    echo "Line #{$line_num} : " . htmlspecialchars($line) . "
n";
}

function open()
{
 //begin document
 $this->state=1;
}

 

function close()
{
 //terminate document
 if($this->state==3)
  return;
 if($this->page==0)
  $this->addpage();
 //page footer
 $this->infooter=true;
 $this->footer();
 $this->infooter=false;
 //close page
 $this->_endpage();
 //close document
 $this->_enddoc();
}

5) Create data uri’s——创建数据uri

function addpage($orientation='', $format='')
{
 //start a new page
 if($this->state==0)
  $this->open();
 $family=$this->fontfamily;
 $style=$this->fontstyle.($this->underline ? 'u' : '');
 $size=$this->fontsizept;
 $lw=$this->linewidth;
 $dc=$this->drawcolor;
 $fc=$this->fillcolor;
 $tc=$this->textcolor;
 $cf=$this->colorflag;
 if($this->page>0)
 {
  //page footer
  $this->infooter=true;
  $this->footer();
  $this->infooter=false;
  //close page
  $this->_endpage();
 }
 //start new page
 $this->_beginpage($orientation,$format);
 //set line cap style to square
 $this->_out('2 j');
 //set line width
 $this->linewidth=$lw;
 $this->_out(sprintf('%.2f w',$lw*$this->k));
 //set font
 if($family)
  $this->setfont($family,$style,$size);
 //set colors
 $this->drawcolor=$dc;
 if($dc!='0 g')
  $this->_out($dc);
 $this->fillcolor=$fc;
 if($fc!='0 g')
  $this->_out($fc);
 $this->textcolor=$tc;
 $this->colorflag=$cf;
 //page header
 $this->inheader=true;
 $this->header();
 $this->inheader=false;
 //restore line width

通过使用此代码,你可以创建数据Uri,这对在HTML/CSS中嵌入图片非常有用,可帮助节省HTTP请求。

 

 

 if($this->linewidth!=$lw)
 {
  $this->linewidth=$lw;
  $this->_out(sprintf('%.2f w',$lw*$this->k));
 }
 //restore font
 if($family)
  $this->setfont($family,$style,$size);
 //restore colors
 if($this->drawcolor!=$dc)
 {
  $this->drawcolor=$dc;
  $this->_out($dc);
 }
 if($this->fillcolor!=$fc)
 {
  $this->fillcolor=$fc;
  $this->_out($fc);
 }
 $this->textcolor=$tc;
 $this->colorflag=$cf;
}

 代码如下

function header()
{
 //to be implemented in your own inherited class
}

function data_uri($file, $mime) {
  $contents=file_get_contents($file);
  $base64=base64_encode($contents);
  echo "data:$mime;base64,$base64";
}

function footer()
{
 //to be implemented in your own inherited class
}

 

function pageno()
{
 //get current page number
 return $this->page;
}

6) Detect location by IP——通过IP检索出地理位置

function setdrawcolor($r, $g=null, $b=null)
{
 //set color for all stroking operations
 if(($r==0 && $g==0 && $b==0) || $g===null)
  $this->drawcolor=sprintf('%.3f g',$r/255);
 else
  $this->drawcolor=sprintf('%.3f %.3f %.3f rg',$r/255,$g/255,$b/255);
 if($this->page>0)
  $this->_out($this->drawcolor);
}

这段代码帮助你查找特定的IP,只需在功能参数上输入IP,就可检测出位置。

function setfillcolor($r, $g=null, $b=null)
{
 //set color for all filling operations
 if(($r==0 && $g==0 && $b==0) || $g===null)
  $this->fillcolor=sprintf('%.3f g',$r/255);
 else
  $this->fillcolor=sprintf('%.3f %.3f %.3f rg',$r/255,$g/255,$b/255);
 $this->colorflag=($this->fillcolor!=$this->textcolor);
 if($this->page>0)
  $this->_out($this->fillcolor);
}

 

本文由澳门三合彩票发布于编程,转载请注明出处:并显示所有域名的相关信息

关键词: