The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

http://www.cplicensing.net/extras/scripts/chkcpaccts

Discussion in 'General Discussion' started by vishal, Sep 3, 2003.

  1. vishal

    vishal Well-Known Member

    Joined:
    Jan 28, 2003
    Messages:
    340
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    India
    Hello All,

    I am doing a Cleanup job on my servers and want a list of accounts who are owned by root and does not resolve or point to a different IP other that mine.
    I have checked the script
    http://www.cplicensing.net/extras/scripts/chkcpaccts

    but it does not find all the domains just few of them i have around 600+ accounts and manually when i checked some of them i found domains that do not point or resolve which were not given by the above script.

    Anybody can suggest me a script that will do the Job for me.

    Thank you,

    cPanel.net Support Ticket Number:
     
  2. vishal

    vishal Well-Known Member

    Joined:
    Jan 28, 2003
    Messages:
    340
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    India
    Hello All,

    I have written a script in php which returns the IP address of a domain if its resolving but the problem is that it returns the IP Address of the Last domain only here is the code :

    <?
    $filename="sites.txt";
    $arrnames=file($filename);
    $cnt=count($arrnames);

    for($i=0;$i<=($cnt-1);$i++)
    {
    echo $arrnames[$i]."<br>";
    echo "<br>";
    echo gethostbyname($arrnames[$i]);
    }

    ?>

    Here is the sites.txt
    domain1.com
    domain2.com
    domain3.com
    domain4.com

    The Output is :
    domain1.com
    domain2.com
    domain3.com
    10.20.30.40

    I have checked the domains in the file are resolving but why does it shows me the last IP address only. If i put 3 different line it works perfectly :
    echo gethostbyname('domain1.com');
    echo gethostbyname('domain2.com');
    echo gethostbyname('domain3.com');
    echo gethostbyname('domain4.com');
    The above statements works perfect.

    Any comments will be appreciated.

    cPanel.net Support Ticket Number:
     
  3. vishal

    vishal Well-Known Member

    Joined:
    Jan 28, 2003
    Messages:
    340
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    India
    Resolved ! :)
    The white space in the file sites.txt was the problem i used trim and it was working fine.

    gethostbyname(trim($arrnames[$i]));


    cPanel.net Support Ticket Number:
     
Loading...

Share This Page