jokerfool Posted January 29, 2009 Share Posted January 29, 2009 I have this code for looking up a domain and I was wondering if someone could check it and tell me why it doesn't allow the information to be submitted when I insert a domain and press go? <?php $desc = "<b>Domain lookup</b><br>"; $title = "Domain-lookup-tool"; include("header.php"); ?> <div style="padding:10px;"><b>Domain</b> <input type="text" name="url" value="<?php echo htmlspecialchars(@$_REQUEST['url'])?>" /> <input type="submit" value="Go!" /></div> <p>Shows you the age, website speed, pagerank, Alexa ranking, and the # of indexed pages on Google, MSN, and Yahoo for a domain that you enter.</p> <?php if(@$_REQUEST['url'] && checkImage()) { $url = trim($_REQUEST['url']); $url = trim($_REQUEST['url']); $url=str_replace ('http://', '', $_REQUEST['url']); $url=str_replace ('https://', '', $url); //$dom = dns_get_record($url); $dom = gethostbyname($url); if(!$dom) { echo "<br/><br/>Domain <b>$url</b> not found"; } else { $domain = array(); //$wh = whois::getInstance(); $wh = new whois(); $dominfo = $wh->getdomaininfo($url); preg_match("#Crea[^:]+: ([0-9a-z \-\:]+)#i",$dominfo,$creationdate); $domain['creationdate'] = @$creationdate[1] ? strtotime($creationdate[1]) : false; $start = microtime(true); file_get_contents("http://$url"); $domain['speed'] = microtime(true) - $start; $domain['pr'] = getpr("http://$url"); $domain['ar'] = getAlexa("http://$url"); $url2 = urlencode($url); $google = fetch("http://www.google.com/search?q=site:$url2&hl=en&sa=N"); $msn = fetch("http://search.msn.co.uk/results.aspx?q=site%3A$url2"); $yahoo = fetch("http://search.yahooapis.com/WebSearchService/V1/webSearch?appid=$yahooID&query=$url2&results=1"); preg_match("#of[^<]*? <b>([\\d,]+)</b>#",$google,$google); $google = preg_replace("#\\D#","",$google[1]); $domain['_google'] = number_format($google); preg_match("#1-10 of ([\\d,]+) results</span>#",$msn,$msn); $msn = preg_replace("#\\D#","",$msn[1]); $domain['_msn'] = number_format($msn); preg_match("#<ResultSet .*?totalResultsAvailable=\"(\\d+)\"#",$yahoo,$yahoo); $yahoo = preg_replace("#\\D#","",$yahoo[1]); $domain['_yahoo'] = number_format($yahoo); if($domain['creationdate']) { $d = getdate(time()-$domain['creationdate']); $domain['old'] = ($d['year']-1970) . " year(s), " . $d['mon'] . " month(s), " . $d['wday'] . " day(s)"; $domain['since'] = date("d-M-Y",$domain['creationdate']); } else { $domain['old'] = "(Not available)"; $domain['since'] = "(Not available)"; } ?> <fieldset style="border: 1px solid rgb(16, 80, 158); padding: 2px;"><legend><font color="#c40000" size="4">About your domain</font></legend> <table style="border-collapse: collapse;" border="0" cellpadding="4" cellspacing="4" width="100%"> <tbody> <tr> <td class="lines" height="30"><font size="2">Age of domain</font></td> <td class="lines" align="right"><font size="2"><b><?php echo $domain['old']?></b> - Online since: <?php echo $domain['since']?></font></td> </tr> <tr> <td class="lines" height="30"><font size="2">Website Speed</font></td> <td class="lines" align="right"><font size="2"><b><?php echo round($domain['speed'],5)?> seconds</b></font></td> </tr> </tbody> </table> </fieldset> <fieldset style="border: 1px solid rgb(159, 0, 0); padding: 2px;"><legend><font color="#c40000" size="4">About your ranking</font></legend> <table style="border-collapse: collapse;" border="0" cellpadding="4" cellspacing="4" width="100%"> <tbody> <tr> <td class="lines" height="30" width="110"><font size="2">Current Pagerank</font></td> <td class="lines" align="right"><span style="font-size: 9pt;"><b> <?php echo $domain['pr']?> / 10</b></span></td> </tr> <tr> <td height="30" width="110"><font size="2">Alexa Ranking</font></td> <td align="right"><span style="font-size: 9pt;"><b><?php echo $domain['ar']?></b> (<a target="_blank" href="http://info.alexa.com/data/details?url=http://<?php echo $url2?>">Click here</a>)</span></td> </tr> </tbody> </table> </fieldset> <fieldset style="border: 1px solid rgb(0, 119, 0); padding: 2px;"><legend><font color="#c40000" size="4">About your links</font></legend> <table style="border-collapse: collapse;" border="0" cellpadding="4" cellspacing="4" width="100%"> <tbody> <tr> <td class="lines" height="30"><font size="2">Listings on Google Search</font></td> <td class="lines" align="right"><font size="2"> <b><?php echo $domain['_google']?></b> (<a href="http://www.google.com/search?q=site%3A<?php echo $url2?>" target="_blank"><u>Click here</u></a>) </font></td> </tr> <tr> <td class="lines" height="30"><font size="2">Listings on MSN Search</font></td> <td class="lines" align="right"><font size="2"> <b><?php echo $domain['_msn']?></b> (<a href="http://search.msn.com/results.aspx?q=site%3A<?php echo $url2?>" target="_blank"><u>Click here</u></a>) </font></td> </tr> <tr> <td height="30"><font size="2">Listings on Yahoo Search</font></td> <td align="right"><font size="2"> <b><?php echo $domain['_yahoo']?></b> (<a href="http://siteexplorer.search.yahoo.com/search?p=<?php echo $url2?>" target="_blank"><u>Click here</u></a>) </font></td> </tr> </tbody> </table> </fieldset> <?php } } ?> <?php include("footer.php");?> Must be something really simple. Thank you. Link to comment https://forums.phpfreaks.com/topic/142966-looking-a-domains-information-help-please/ Share on other sites More sharing options...
soak Posted January 29, 2009 Share Posted January 29, 2009 Looking over your code there are a few places where things could be going wrong. Does it give you any sort of error message? If not pop these two lines at the very top of your file and try again: ini_set('display_errors', 'On'); error_reporting(E_ALL); Link to comment https://forums.phpfreaks.com/topic/142966-looking-a-domains-information-help-please/#findComment-749640 Share on other sites More sharing options...
jokerfool Posted January 30, 2009 Author Share Posted January 30, 2009 There is no error, just that my Go button isn't functioning properly, I press it and nothing happens. Link to comment https://forums.phpfreaks.com/topic/142966-looking-a-domains-information-help-please/#findComment-750520 Share on other sites More sharing options...
printf Posted January 30, 2009 Share Posted January 30, 2009 where is the FORM container... <form action='' method=''> // your form inputs go here </form> Link to comment https://forums.phpfreaks.com/topic/142966-looking-a-domains-information-help-please/#findComment-750522 Share on other sites More sharing options...
jokerfool Posted January 30, 2009 Author Share Posted January 30, 2009 hmmm where am I to be placing the form? Link to comment https://forums.phpfreaks.com/topic/142966-looking-a-domains-information-help-please/#findComment-750525 Share on other sites More sharing options...
printf Posted January 30, 2009 Share Posted January 30, 2009 change this line... <div style="padding:10px;"><b>Domain</b> <input type="text" name="url" value="<?php echo htmlspecialchars(@$_REQUEST['url'])?>" /> <input type="submit" value="Go!" /></div> to this... <div style="padding:10px;"><form action='<?php echo $_SERVER['PHP_SELF']; ?>' method='post' ><b>Domain</b> <input type="text" name="url" value="<?php echo htmlspecialchars(@$_REQUEST['url'])?>" /> <input type="submit" value="Go!" /></form></div> Link to comment https://forums.phpfreaks.com/topic/142966-looking-a-domains-information-help-please/#findComment-750529 Share on other sites More sharing options...
jokerfool Posted January 30, 2009 Author Share Posted January 30, 2009 Come up with an error msg Fatal error: Call to undefined function checkimage() on this line if(@$_REQUEST['url'] && checkImage()) Link to comment https://forums.phpfreaks.com/topic/142966-looking-a-domains-information-help-please/#findComment-750651 Share on other sites More sharing options...
jokerfool Posted January 30, 2009 Author Share Posted January 30, 2009 Can anyone assist me please? Link to comment https://forums.phpfreaks.com/topic/142966-looking-a-domains-information-help-please/#findComment-750898 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.