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.

List stuff from a cPanel account with php

Discussion in 'General Discussion' started by snakex, Aug 3, 2005.

  1. snakex

    snakex Member

    Joined:
    Aug 21, 2003
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Portugal, Porto
    Hi.

    Is it possible to list stuff like subdomains, emails, etc... from a cPanel account?

    For example:
    Client 1 goes to his cPanel account and create 3 subdomains, and what i want is to, is in my administration area list the subdomains that client has created, and the same to emails and that stuff.


    Thanks in advance.
     
  2. snakex

    snakex Member

    Joined:
    Aug 21, 2003
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Portugal, Porto
    anyone? :\
     
  3. HH-Steven

    HH-Steven Well-Known Member

    Joined:
    Aug 29, 2004
    Messages:
    284
    Likes Received:
    0
    Trophy Points:
    16
    cPanel Access Level:
    Root Administrator
    Im also interested in this, more specifically displaying a users Webspace/Bandwidth Used and remaining into a php page.

    Not exactly the same i know but id assume the process to calling this information would be the same.
     
  4. gdi

    gdi Member

    Joined:
    Aug 7, 2005
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    Hello,

    I hope this is not thread hi-jacking, but I'm also interested. I have a custom support ticket system I created and was hoping to use my customer's cpanel username and passwords for them to log into the ticket system.

    Can we get cpanel user info with a PHP script?

    Thanks,
    gdi
     
  5. fwwebs

    fwwebs Well-Known Member

    Joined:
    Feb 16, 2004
    Messages:
    329
    Likes Received:
    0
    Trophy Points:
    16
    The below code will output diskusage for the /public_html/user folder. Just substitute the $request for the cPanel URL you'd like to display.



    PHP:
    $request="/frontend/x/diskusage/index.html?showtree=public_html/user";
    $result=func($host,$port,$cpusername,$cppass,$request);
    echo 
    $result;

    function 
    func($host,$port,$cpusername,$cppass,$request)  {
    $sock fsockopen($host,$port);
    if(!
    $sock)
    {
    print(
    'Socket error');
    exit();
    }
    $authstr "$cpusername:$cppass";
    $pass base64_encode($authstr);
    //$in  = "GET $request\r\n";
    $in  "GET $request\n";
    $in .= "HTTP/1.0\r\n";
    $in .= "Host:$domain\r\n";
    $in .= "Authorization: Basic $pass\r\n";
    $in .= "\r\n";

       
    fputs($sock$in);
       while (!
    feof($sock))  {
    // fgets ($sock,128);
    $result .= fgets ($sock,128);
    }
    fclose$sock );
    return 
    $result;
    }


    You would need to create a method to store the password in your own script. Password are one-way encrypted and cannot be retrieved.
     
  6. gdi

    gdi Member

    Joined:
    Aug 7, 2005
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    All right. I can't retrieve them. I'm assuming when I log into CPanel, somehow it checks to see if the pw matches whats in the database. Since they are one way encrypted I'm guessing there is a response for matching and a response if they don't match. Any way I could use that same type of coding in my login? I just need to know if they are using the proper cpanel username and password when they log into my ticket system.....Not so much that I need to know exactly what they are typing. Nor was a planning to do a mass table dump to create a separate table for my application. I guess I'm asking if I can take a login form and verify the username and password against the CPanel tables and then continue on with my script if they are authenticated?.?.

    Thanks for the help so far,
    gdi
     
  7. KingMotley

    KingMotley Member

    Joined:
    Apr 21, 2005
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    1
    Yes, use the above PHP code earlier in this thread.

    Just check the value of what is returned from the func call, and you'll know if the username/password are correct.
     
  8. snakex

    snakex Member

    Joined:
    Aug 21, 2003
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Portugal, Porto
  9. gdi

    gdi Member

    Joined:
    Aug 7, 2005
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    Hello,

    Per your instructions, I used the code you supplied as a building module. I now have a login script where my customers can use their same Cpanel username/password to log into my custom support ticket system. Thanks for the advice!

    gdi
     
  10. the_bobara

    the_bobara Well-Known Member
    PartnerNOC

    Joined:
    Sep 23, 2004
    Messages:
    92
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Bulgaria
    cPanel Access Level:
    Root Administrator
    gdi I have a question:
    if somebody change his cpanel`s password, what happens with your helpdesk system?
    how to synchronize cpanel`s password with the password in your system?
    i have user panel and i want if somebody change his password in cpanel the password in his userpanel to be synchronize with it?
    how?
     
  11. gdi

    gdi Member

    Joined:
    Aug 7, 2005
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    That's the issue I have solved...

    When a customer attempts to log into my support system, the username and password they entered is compared to their cpanel username and password on the server. I do not store any customer usernames or passwords in database tables. I figured, if Cpanel already stores that stuff somewhere, why should I. Also, the point you mentioned, what if they change their login username and password. How could I track that if I use my own personal "customer" database table. This has solved a large problem for me.

    Please let me know if you have any further questions.

    Thanks,
    gdi
     
Loading...

Share This Page