|
|
|
ผมโหลดไฟล์สคริปท์ PHP มาแก้เพื่อทำระบบ Whois ไม่รู้ว่าติดตรงไนรบกวนท่านผู้รู้ช่วยดูหน่อยครับ |
|
|
|
|
|
|
|
ผมโหลดไฟล์สคริปท์ PHP มาแก้เพื่อทำระบบ Whois
แต่พอเพิ่มการตรวจสอบ .th เข้าไปปรากฎว่ามันไม่ตรวจครับ
ไม่รู้ว่าติดตรงไนรบกวนท่านผู้รู้ช่วยดูหน่อยครับ
Code (PHP)
<?php
/*************************************************
* Max's Whois
*
* Version: 1.0
* Date: 2007-11-28
*
****************************************************/
/*----------------------------------------------------------------------
#Youjoomla YJ Whois v1.0
# ----------------------------------------------------------------------
# Modified by: You Joomla
# License: GNU GPL
# Website: http://www.youjoomla.com
------------------------------------------------------------------------*/
defined( '_JEXEC' ) or die( 'Direct Access to this location is not allowed.');
echo "<!-- http://www.Youjoomla.com YJ Whois v1.0 for Joomla 1.5 starts here --> ";
class maxWhois{
var $serverList;
var $tr = 0;
function maxWhois(){
$this->serverList[0]['top'] = 'com';
$this->serverList[0]['server'] = 'whois.crsnic.net';
$this->serverList[0]['response'] = 'No match for';
$this->serverList[0]['check'] = false;
$this->serverList[1]['top'] = 'net';
$this->serverList[1]['server'] = 'whois.crsnic.net';
$this->serverList[1]['response'] = 'No match for';
$this->serverList[1]['check'] = false;
$this->serverList[2]['top'] = 'org';
$this->serverList[2]['server'] = 'whois.publicinterestregistry.net';
$this->serverList[2]['response'] = 'NOT FOUND';
$this->serverList[2]['check'] = false;
$this->serverList[3]['top'] = 'ac.th';
$this->serverList[3]['server'] = 'whois.thnic.co.th';
$this->serverList[3]['response'] = 'No match for';
$this->serverList[3]['check'] = false;
$this->serverList[4]['top'] = 'go.th';
$this->serverList[4]['server'] = 'whois.thnic.co.th';
$this->serverList[4]['response'] = 'No match for';
$this->serverList[4]['check'] = false;
$this->serverList[5]['top'] = 'co.th';
$this->serverList[5]['server'] = 'whois.thnic.co.th';
$this->serverList[5]['response'] = 'No match for';
$this->serverList[5]['check'] = false;
$this->serverList[6]['top'] = 'in.th';
$this->serverList[6]['server'] = 'whois.thnic.co.th';
$this->serverList[6]['response'] = 'No match for';
$this->serverList[6]['check'] = false;
$this->serverList[7]['top'] = 'or.th';
$this->serverList[7]['server'] = 'whois.thnic.co.th';
$this->serverList[7]['response'] = 'No match for';
$this->serverList[7]['check'] = false;
$this->serverList[8]['top'] = 'mi.th';
$this->serverList[8]['server'] = 'whois.thnic.co.th';
$this->serverList[8]['response'] = 'No match for';
$this->serverList[8]['check'] = false;
}
function showHeader(){
?>
<?php
// -- figure out what URL to use for prefix
// -- Loop through existing prefix to get all of the variables
function getCurrentURL_whois(){
$cururl_whois = JRequest::getURI();
if(($pos = strpos($cururl_whois, "index.php"))!== false){
$cururl_whois = substr($cururl_whois,$pos);
}
$cururl_whois = JRoute::_($cururl_whois);
return $cururl_whois;
}
?>
<?php
}
function showWhoisForm(){
?>
<form action="<?php echo getCurrentURL_whois(); ?>" method="post" >
<br>
<left><font color='#009900'><b> กรุณาทำการตรวจสอบชื่อโดเมนเนมที่ท่านต้องการจะจดทะเบียนก่อนครับ<b></font><br></left>
<left> <b>www.</b><input name="domain" type="text" size="35" />
<?php
$i = 0;
foreach ($this->serverList as $value) {
if ($value['check'] == true) $checked='checked="checked"';
else $checked = '';
echo '<input type="checkbox" name="top_'.$value['top'].'" '.$checked.'/>.'.$value['top'].'';
$i++;
if ($i > 4) {
$i = 0;
}
}
?>
<input type="submit" class="button" name="submitBtn" value="ตรวจสอบ" />
</left><br><br><br>
</form>
<?php
}
function showFooter(){
?>
<?php
}
function processWhois($params){
$this->showHeader();
if (!isset($_POST['submitBtn'])){
$this->showWhoisForm();
} else {
$domainName = (isset($_POST['domain'])) ? htmlspecialchars(strip_tags($_POST['domain'])) : '';
for ($i = 0; $i < sizeof($this->serverList); $i++) {
$actTop = "top_".$this->serverList[$i]['top'];
$this->serverList[$i]['check'] = isset($_POST[$actTop]) ? true : false;
}
// Check domains only if the base name is big enough
if (strlen($domainName)>2){
echo '<table class="dtable">';
echo '<tr><th colspan="2"></th></tr>';
for ($i = 0; $i < sizeof($this->serverList); $i++) {
if ($this->serverList[$i]['check']){
$this->showDomainResult($params,$domainName.".".$this->serverList[$i]['top'],
$this->serverList[$i]['server'],
$this->serverList[$i]['response']);
}
}
echo '</table>';
}
$this->showWhoisForm();
}
$this->showFooter();
}
function showDomainResult($params,$domain,$server,$findText){
$your_link=$params->get('your_link','icteasy.com');
if ($this->tr == 0){
$this->tr = 1;
$class = " class='tr2'";
} else {
$this->tr = 0;
$class = "";
}
if ($this->checkDomain($domain,$server,$findText)){
//$register = 'icteasy.com';
echo "<tr $class><td> <font color='#FF0000'>$domain</font></td><td class='ava'><font color='#009900'> <img src='modules/mod_yj_whois/images/available.png' width='16' height='16' align='top' alt='available' /> <b>ว่าง</b> สามารถนำชื่อนี้ไปจดโดเมนในแบบฟอร์มด้านล่างได้เลยครับ</font></td></tr>";
}
else echo "<tr $class><td> <font color='#FF0000'>$domain</font></td><td class='ava'><font color='#FF0000'> <img src='modules/mod_yj_whois/images/taken.png' width='16' height='16' alt='not available' align='top'/> มีผู้จดทะเบียนใช้งานแล้ว กรุณาเลือกชื่อใหม่ครับ: </font><a href ='http://www.$domain' target='blank'><b>ไปยังเว็บไซต์ $domain</b></a></td></tr>";}
function checkDomain($domain,$server,$findText){
$con = fsockopen($server, 43);
if (!$con) return false;
// Send the requested doman name
fputs($con, $domain."\r\n");
// Read and store the server response
$response = ' :';
while(!feof($con)) {
$response .= fgets($con,128);
}
// Close the connection
fclose($con);
// Check the response stream whether the domain is available
if (strpos($response, $findText)){
return true;
}
else {
return false;
}
}
}
?>
<?php
$whois = new maxWhois();
$whois->processWhois($params);
?>
Tag : PHP
|
|
|
|
|
|
Date :
2012-08-22 15:47:48 |
By :
borntobit |
View :
953 |
Reply :
1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 03
|