SitePoint Sponsor

User Tag List

Results 1 to 9 of 9
  1. #1
    Non-Member toniya's Avatar
    Join Date
    Oct 2005
    Posts
    480
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Help - a typical problem

    Hello,

    Could you please test following URLs and tell me possible cause why second form is producing results at one URL and not displaying anything on second?:

    http://www.5starastrology.com/test.php
    http://www.1websiteshostingpromotions.com/test.php

    Both URLs have same file but on different servers.

    Thanks and reagrds,
    Toniya

  2. #2
    derrrp
    Join Date
    Aug 2006
    Location
    earth
    Posts
    923
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm getting results on both pages... wait, the second form doesn't.

    it's hard to tell without seeing any code.
    No, I REALLY dislike having to use Joomla.

  3. #3
    Dinah-Moe Humm mudshark's Avatar
    Join Date
    Dec 2003
    Posts
    1,072
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    A matter of register_globals on/off, perhaps?

  4. #4
    SitePoint Addict
    Join Date
    May 2005
    Location
    London, ON
    Posts
    360
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    We'd need to see the PHP code to help with this.
    Ryan Price
    Subscribe to my blog for regular tips and tricks

  5. #5
    Non-Member toniya's Avatar
    Join Date
    Oct 2005
    Posts
    480
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Both have same codes - evrything same - infact it is same file

  6. #6
    Dinah-Moe Humm mudshark's Avatar
    Join Date
    Dec 2003
    Posts
    1,072
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    register_globals is a server setting which may affect your code if the setting is different from one server to the other.
    Given a url like this:
    example.com/?variable=foo
    If your code accesses the "foo" value directly as $variable, and register_globals is off, then $variable will not get assigned. You should instead access it via $_GET['variable'].

  7. #7
    Non-Member toniya's Avatar
    Join Date
    Oct 2005
    Posts
    480
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Here is the code:
    ----------------

    <form name="form1" method="get" action="?sec=<?=$sec;?>&page=<?=$page;?>&sub=domaincheck">
    <p>Domain: www.<input type="text" name="domain"><select name="endung">
    <option value=".biz">.biz</option>
    <option value=".com">.com</option>
    <option value=".net">.net</option>
    <option value=".org">.org</option>
    <option value=".cc">.cc</option>
    <option value=".eu">.eu</option>
    <option value=".in">.in</option>
    <option value=".tv">.tv</option>
    <option value=".us">.us</option>
    <option value=".info">.info</option>
    <option value=".mobi">.mobi</option>
    <option value=".name">.name</option>
    </select><input type="submit" name="Submit" value="Check"></p>
    </form>

    <?
    if ($domain) {
    $domain = $domain.$endung;
    $whoisresult = lookup($domain);
    print "".$whoisresult."";
    }

    function get_whois_server($domain){
    $whoisservers = array(
    array("biz","whois.biz"),
    array("com","rs.internic.net"),
    array("net","rs.internic.net"),
    array("org","whois.publicinterestregistry.net"),
    array("cc","whois.enicregistrar.com"),
    array("eu","whois.eu"),
    array("in","whois.inregistry.in"),
    array("tv","whois.www.tv"),
    array("us","whois.nic.us"),
    array("info","whois.afilias.net"),
    array("mobi","whois.dotmobiregistry.net"),
    array("name","whois.nic.name")
    );
    $whocnt = count($whoisservers);
    for ($x = 0; $x < $whocnt; $x++){
    $artld = $whoisservers[$x][0];
    $tldlen = intval(0 - strlen($artld));
    if (substr($domain, $tldlen) == $artld) {
    $whosrv = $whoisservers[$x][1];
    }
    }
    return $whosrv;
    }

    function lookup($domain){
    $lusrv = get_whois_server($domain);
    if (!$lusrv) return "";
    $fp = fsockopen($lusrv, 43);
    if($lusrv == "whois.denic.de") {
    fputs($fp, "-C ISO-8859-1 -T ace,dn $domain\r\n");
    }
    else {
    fputs($fp, "$domain\r\n");
    }
    $string = "";
    while(!feof($fp)) {
    $string .= fgets($fp, 128);
    }
    fclose($fp);
    $reg = "/Whois Server: (.*?)\n/i";
    preg_match_all($reg, $string, $matches);
    $secondtry = $matches[1][0];
    if ($secondtry) {
    $fp = fsockopen($secondtry, 43);
    fputs($fp, "$domain\r\n");
    $string="";
    while(!feof($fp)) {
    $string .= fgets($fp, 128);
    }
    fclose($fp);
    }
    if(eregi("(no match|no entries found|not found| free|nothing found|not have an entry|not available|We do not have an entry in our database matching your query)",$string)) {
    echo "<p class=\"center\"><b>CONGRATULATIONS!<br>The Domain Name ".$domain." is available!!</b></p><br />";
    $whois = "<pre>".$string."</pre>";
    return $whois;
    }
    else {
    echo "<p class=\"center\"><b>SORRY!<br>The Domain Name ".$domain." is not available!!<br>Please TRY another name or another extension!</b></p><br />";
    $whois = "<pre>".$string."</pre>";
    return $whois;
    }
    }
    ?>

  8. #8
    Non-Member toniya's Avatar
    Join Date
    Oct 2005
    Posts
    480
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I uploaded a php.ini file and it worked:

    [php.ini]
    register_globals = on

  9. #9
    Non-Member toniya's Avatar
    Join Date
    Oct 2005
    Posts
    480
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I tried to add .mn and .bz in my above script but getting following error:

    Warning: fsockopen() [function.fsockopen]: unable to connect to bz.whois-servers.net:43 in /home/.../public_html/domain.php on line 466

    Warning: fsockopen() [function.fsockopen]: unable to connect to whois.nic.mn:43 in /home/..../public_html/domain.php on line 466

    How to fix it?

    I am using whois.belizenic.bz and whois.nic.mn as servers.

    Thanks and regards,
    Toniya


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •