Witam.
Mam skrypt, który działa i wyświetla wolne domeny. Wszystko działa tylko niezbędne jest przeładowanie strony www.
Jak to przerobić, żeby działało w AJAX'ie? - potrzebuję gotowego rozwiązania...
Poniżej daję kod php, który działa perfekcyjnie:
<HEAD>
<META NAME="konwerter" CONTENT="Ogonki97 1.3">
<META HTTP-EQUIV="content-type" CONTENT="text/html; CHARSET=iso-8859-2">
<script src="google_ga.js" type="text/javascript"></script>
</HEAD>
<div id="TRESC">
<?php
function checkDomain($domain,$server,$findText){
// Open a socket connection to the whois server
if (!$con) return false;
// Send the requested doman name
fputs($con, $domain."\r\n");
// Read and store the server response
$response = ' :';
$response .= fgets($con,128
); }
// Close the connection
// Check the response stream whether the domain is available
if (strpos($response, $findText)){ return true;
}
else {
return false;
}
}
function showDomainResult($domain,$server,$findText){
if (checkDomain($domain,$server,$findText)){
echo "<tr><td>$domain</td><td><B>DOSTĘPNA<B></td></tr>"; }
else echo "<tr><td>$domain</td><td>ZAJĘTA</td></tr>"; }
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>MicroWhois domain checker</title>
<link href="whois_style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="main">
<div id="caption">SPRAWDZENIE WOLNEJ DOMENY</div>
<div id="icon"> </div>
<form action="" method="post" name="domain" id="domain">
Nazwa domeny:
<table>
<tr><td><input class="text" name="domainname" type="text" size="36"/></td></tr>
<tr>
<td>
<input type="checkbox" name="all" checked />All
<input type="checkbox" name="pl"/>.pl
<input type="checkbox" name="eu"/>.eu
<input type="checkbox" name="com"/>.com
<input type="checkbox" name="net"/>.net
<input type="checkbox" name="org"/>.org
<input type="checkbox" name="info"/>.info
</td></tr>
<tr><td align="center"><br/><input class="text" type="submit" name="submitBtn" value="Sprawdź domenę"/></td></tr>
</table>
</form>
<?php
if (isset($_POST['submitBtn'])){ $domainbase = (isset($_POST['domainname'])) ?
$_POST['domainname'] : ''; $d_all = (isset($_POST['all'])) ?
'all' : ''; $d_pl = (isset($_POST['pl'])) ?
'pl' : ''; $d_eu = (isset($_POST['eu'])) ?
'eu' : ''; $d_com = (isset($_POST['com'])) ?
'com' : ''; $d_net = (isset($_POST['net'])) ?
'net' : ''; $d_org = (isset($_POST['org'])) ?
'org' : ''; $d_info = (isset($_POST['info'])) ?
'info' : '';
// Check domains only if the base name is big enough
?>
<div id="caption">WYNIK</div>
<div id="icon2"> </div>
<div id="result">
<table width="100%">
<?php
if ( ($d_all != '') ) showDomainResult($domainbase.".eu",'whois.eu','No match for');
if (($d_pl != '') || ($d_all != '') ) showDomainResult($domainbase.".pl",'whois.dns.pl','No information about');
if (($d_com != '') || ($d_all != '') ) showDomainResult($domainbase.".com",'whois.crsnic.net','No match for');
if (($d_net != '') || ($d_all != '') ) showDomainResult($domainbase.".net",'whois.crsnic.net','No match for');
if (($d_org != '') || ($d_all != '') ) showDomainResult($domainbase.".org",'whois.publicinterestregistry.net','NOT FOUND');
if (($d_info != '') || ($d_all != '') ) showDomainResult($domainbase.".info",'whois.afilias.net','NOT FOUND');
?>
</table>
</div>
<?php
}
}
?>
</div>
</div>
Ten post edytował thek 30.08.2010, 13:14:19
Powód edycji: [thek]: