Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    Member vishal's Avatar
    Join Date
    Jan 2003
    Location
    India
    Posts
    343

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

    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:
    rh_linuxion

    It is very simple to be Happy but it is very difficult to be Simple.

  2. #2
    Member vishal's Avatar
    Join Date
    Jan 2003
    Location
    India
    Posts
    343

    Default

    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:
    rh_linuxion

    It is very simple to be Happy but it is very difficult to be Simple.

  3. #3
    Member vishal's Avatar
    Join Date
    Jan 2003
    Location
    India
    Posts
    343

    Default

    Resolved !
    The white space in the file sites.txt was the problem i used trim and it was working fine.

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


    Originally posted by vishal
    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:
    cPanel.net Support Ticket Number:
    rh_linuxion

    It is very simple to be Happy but it is very difficult to be Simple.

Similar Threads & Tags
Similar threads

  1. Worm? http://www.visualcoders.net/spy.gif?
    By yuga in forum cPanel and WHM Discussions
    Replies: 3
    Last Post: 12-28-2004, 07:36 AM
  2. Demos on http://www.cpanel.net/
    By supr in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 01-05-2004, 12:56 PM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube