eaglelegend Posted April 7, 2009 Share Posted April 7, 2009 Hi, On my PHP application I guess you might call it, that searches for available, and non available domain names, it works, but if I am to make a .co.uk tld so users can see if say www.phpfreaks.co.uk is available, when I upload it onto my server, it dont show the form, or the whole of the bottom of the page, I am just wondering whats going on here :s, if you can help, that would be great!, thanks in advance. here is the code that is causeing the issue <p> <div id="main"> <div id="caption"><b>Domain Lookup</b></div> <div id="icon"> </div> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" name="domain" id="domain"> Domain name: <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="com"/>.com <input type="checkbox" name="net"/>.net <input type="checkbox" name="org"/>.org <input type="checkbox" name="info"/>.info <input type="checkbox" name="edu"/>.edu <input type="checkbox" name="co.uk"/>.co.uk </td></tr> <tr><td align="center"><br/><input class="text" type="submit" name="submitBtn" value="Check domain"/></td></tr> </table> </form> <?php if (isset($_POST['submitBtn'])){ $domainbase = (isset($_POST['domainname'])) ? $_POST['domainname'] : ''; $d_all = (isset($_POST['all'])) ? 'all' : ''; $d_com = (isset($_POST['com'])) ? 'com' : ''; $d_net = (isset($_POST['net'])) ? 'net' : ''; $d_org = (isset($_POST['org'])) ? 'org' : ''; $d_info = (isset($_POST['info'])) ? 'info' : ''; $d_edu = (isset($_POST['edu'])) ? 'edu' : ''; $d_co.uk = (isset($_POST['co.uk'])) ? 'co.uk' : ''; // Check domains only if the base name is big enough if (strlen($domainbase)>2){ ?> <div id="caption">RESULT</div> <div id="icon2"> </div> <div id="result"> <table width="100%"> <?php 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'); if (($d_edu != '') || ($d_all != '') ) showDomainResult($domainbase.".edu",'whois.internic.net','No match for'); if (($d_co.uk != '') || ($d_all != '') ) showDomainResult($domainbase.".co.uk",'whois.nic.uk','No match'); ?> </table> </div> <?php } } ?> </div></p> <center> Link to comment https://forums.phpfreaks.com/topic/153041-whois/ Share on other sites More sharing options...
taquitosensei Posted April 7, 2009 Share Posted April 7, 2009 You can't use a period in a variable name. You need to change your variable name Link to comment https://forums.phpfreaks.com/topic/153041-whois/#findComment-803785 Share on other sites More sharing options...
eaglelegend Posted April 7, 2009 Author Share Posted April 7, 2009 if I change the varible - whichever one it is, wouldnt it change say what tld it is? so if I changed co.uk to couk wouldnt the tld it is looking for be couk instead? also period is . yes? Link to comment https://forums.phpfreaks.com/topic/153041-whois/#findComment-803822 Share on other sites More sharing options...
eaglelegend Posted April 7, 2009 Author Share Posted April 7, 2009 help? Link to comment https://forums.phpfreaks.com/topic/153041-whois/#findComment-803875 Share on other sites More sharing options...
revraz Posted April 7, 2009 Share Posted April 7, 2009 Yes, period is a hard stop. Link to comment https://forums.phpfreaks.com/topic/153041-whois/#findComment-803876 Share on other sites More sharing options...
eaglelegend Posted April 7, 2009 Author Share Posted April 7, 2009 so instead of .co.uk then, what can I do that it will still look for .co.uk as you say I cant have . in it? Link to comment https://forums.phpfreaks.com/topic/153041-whois/#findComment-803888 Share on other sites More sharing options...
revraz Posted April 7, 2009 Share Posted April 7, 2009 He is referring to the Variable Name, not the contents Change $_POST['co.uk'] to $_POST['couk'] and change your form to match. Link to comment https://forums.phpfreaks.com/topic/153041-whois/#findComment-803896 Share on other sites More sharing options...
eaglelegend Posted April 7, 2009 Author Share Posted April 7, 2009 OK, now it looks like so; <?php if (isset($_POST['submitBtn'])){ $domainbase = (isset($_POST['domainname'])) ? $_POST['domainname'] : ''; $d_all = (isset($_POST['all'])) ? 'all' : ''; $d_com = (isset($_POST['com'])) ? 'com' : ''; $d_net = (isset($_POST['net'])) ? 'net' : ''; $d_org = (isset($_POST['org'])) ? 'org' : ''; $d_info = (isset($_POST['info'])) ? 'info' : ''; $d_edu = (isset($_POST['edu'])) ? 'edu' : ''; $d_co.uk = (isset($_POST['couk'])) ? 'co.uk' : ''; // Check domains only if the base name is big enough if (strlen($domainbase)>2){ ?> however the form still dont show now, and the rest of the page oddly enough... any ideas? Link to comment https://forums.phpfreaks.com/topic/153041-whois/#findComment-803912 Share on other sites More sharing options...
taquitosensei Posted April 7, 2009 Share Posted April 7, 2009 you're still using a period in your variable name. If you had error reporting on you'd be getting this PHP Parse error: syntax error, unexpected '=' you need to change $d_co.uk to $d_couk or $d_co_uk anything other than $d_co.uk Link to comment https://forums.phpfreaks.com/topic/153041-whois/#findComment-803914 Share on other sites More sharing options...
trq Posted April 7, 2009 Share Posted April 7, 2009 This... $d_co.uk is not a valid variable name. Link to comment https://forums.phpfreaks.com/topic/153041-whois/#findComment-803917 Share on other sites More sharing options...
eaglelegend Posted April 7, 2009 Author Share Posted April 7, 2009 ah, thanks all, I think im getting the hang of this now LOL, thanks again Link to comment https://forums.phpfreaks.com/topic/153041-whois/#findComment-803919 Share on other sites More sharing options...
eaglelegend Posted April 7, 2009 Author Share Posted April 7, 2009 hey guys, while were on the subject, you wouldnt happen to know anyway I can make the results show the available domains (available) to show in green and taken in red do you? Link to comment https://forums.phpfreaks.com/topic/153041-whois/#findComment-803925 Share on other sites More sharing options...
eaglelegend Posted April 7, 2009 Author Share Posted April 7, 2009 Sorry to be a pain, but for some reason the results are always showing all the options after .co.uk even if I just want to check .com... here is the code in full <?php function checkDomain($domain,$server,$findText){ // Open a socket connection to the whois server $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; } } function showDomainResult($domain,$server,$findText){ if (checkDomain($domain,$server,$findText)){ echo "<tr><td>$domain</td><td>AVAILABLE</td></tr>"; } else echo "<tr><td>$domain</td><td>TAKEN</td></tr>"; } ?> <style type="text/css"><!-- .header {font-family:Tahoma, sans-serif; font-size: 12px; COLOR:#2FFFFF; padding-left:10; padding-right:5; font-weight:900 } .text {font-family:Tahoma,sans-serif; font-size: 11px; color:#626567; padding-left:20; padding-right:10 } .text2 {font-family:Verdana,sans-serif; font-size: 10px; color:#808087; padding-left:20; padding-right:10 } .news {font-family:Arial, sans-serif; font-size: 9px; color:#808087; padding-left:10; padding-right:5; font-weight:900; } a:link{text-decoration: none; color:#6699CC} a:visited{text-decoration: none; color: #6699CC} a:hover{text-decoration: underline; color: #6699CC} a:active{text-decoration: none; color: #6699CC} li { list-style-image:url('images/pic.jpg') } --></style> <tr> <td align="center"> <div align="center"> <table style="border-collapse: collapse;" id="table6" border="1" bordercolor="#c2e7ec" cellpadding="2" height="162" width="555"> <tbody><tr> <td valign="top" height="158"> <div align="center"> <table id="table7" border="0" cellpadding="2" cellspacing="0" width="100%"> <tbody><tr> <td> <div align="center"> <table id="table52" border="0" cellspacing="0" width="98%"> <tbody><tr> <td> <div align="center"> <table id="table3" border="0" cellpadding="2" cellspacing="0" width="100%"> <tbody><tr> <td> </td> </tr> <tr> <td> <table id="table4" border="0" cellpadding="0" cellspacing="0" width="528"> <tbody><tr> <td width="525"> <p align="justify"><font face="Arial"> <font color="#666666" style="font-size: 9pt; font-weight: 700"> Domain Names</font></font></p> <p align="justify">Sorry!, we do not currently offer domains. Why don't you try out our new domain lookup tool below to see if the domain name of your dreams is available! Please note we currently support limited TLDs (Top Level Domains - .com, .co.uk etc.) on the lookup, we will be adding more options soon!</p> <p> <div id="main"> <div id="caption"><b>Domain Lookup</b></div> <div id="icon"> </div> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" name="domain" id="domain"> Domain name: <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="com"/>.com <input type="checkbox" name="net"/>.net <input type="checkbox" name="org"/>.org <input type="checkbox" name="co.uk"/>.co.uk <input type="checkbox" name="org.uk"/>.org.uk <input type="checkbox" name="ltd.uk"/>.ltd.uk <input type="checkbox" name="plc.uk"/>.plc.uk <input type="checkbox" name="me.uk"/>.me.uk <input type="checkbox" name="info"/>.info <input type="checkbox" name="edu"/>.edu </td></tr> <tr><td align="center"><br/><input class="text" type="submit" name="submitBtn" value="Check domain"/></td></tr> </table> </form> <?php if (isset($_POST['submitBtn'])){ $domainbase = (isset($_POST['domainname'])) ? $_POST['domainname'] : ''; $d_all = (isset($_POST['all'])) ? 'all' : ''; $d_com = (isset($_POST['com'])) ? 'com' : ''; $d_net = (isset($_POST['net'])) ? 'net' : ''; $d_org = (isset($_POST['org'])) ? 'org' : ''; $d_couk = (isset($_POST['couk'])) ? 'co.uk' : ''; $d_orguk = (isset($_POST['orguk'])) ? 'org.uk' : ''; $d_ltduk = (isset($_POST['ltduk'])) ? 'ltd.uk' : ''; $d_plcuk = (isset($_POST['plcuk'])) ? 'plc.uk' : ''; $d_meuk = (isset($_POST['meuk'])) ? 'me.uk' : ''; $d_info = (isset($_POST['info'])) ? 'info' : ''; $d_edu = (isset($_POST['edu'])) ? 'edu' : ''; // Check domains only if the base name is big enough if (strlen($domainbase)>2){ ?> <div id="caption">RESULT</div> <div id="icon2"> </div> <div id="result"> <table width="100%"> <?php 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_co.uk != '') || ($d_all != '') ) showDomainResult($domainbase.".co.uk",'whois.nic.uk','No match'); if (($d_org.uk != '') || ($d_all != '') ) showDomainResult($domainbase.".org.uk",'whois.nic.uk','No match'); if (($d_ltd.uk != '') || ($d_all != '') ) showDomainResult($domainbase.".ltd.uk",'whois.nic.uk','No match'); if (($d_plc.uk != '') || ($d_all != '') ) showDomainResult($domainbase.".plc.uk",'whois.nic.uk','No match'); if (($d_me.uk != '') || ($d_all != '') ) showDomainResult($domainbase.".me.uk",'whois.nic.uk','No match'); if (($d_info != '') || ($d_all != '') ) showDomainResult($domainbase.".info",'whois.afilias.net','NOT FOUND'); if (($d_edu != '') || ($d_all != '') ) showDomainResult($domainbase.".edu",'whois.internic.net','No match for'); ?> </table> </div> <?php } } ?> </div></p> <center> <!--Advertise Here--> </td> <td width="3"> <p align="right"></p></td> </tr> </tbody></table> </td> </tr> </tbody></table></div> </td> </tr> </tbody></table> </div> </td> </tr> <tr> <td> <p style="text-align: center;" align="center"> <img src="images/logobot.jpg" border="0" height="70" width="535"></p></td> </tr> </tbody></table> </div> </td> </tr> </tbody></table> </div> </td> </tr> Link to comment https://forums.phpfreaks.com/topic/153041-whois/#findComment-803926 Share on other sites More sharing options...
eaglelegend Posted April 7, 2009 Author Share Posted April 7, 2009 anybody know? Link to comment https://forums.phpfreaks.com/topic/153041-whois/#findComment-803961 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.