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.

Help

Discussion in 'General Discussion' started by demian, Jun 25, 2004.

  1. demian

    demian Member

    Joined:
    Aug 25, 2003
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    1
    HEllo everyone,

    I'm writing a script, I'm using the cpanel API, so when I connect it works fine, but if the password is wrong, or the hashkey is wrong, there is no way to know that, I mean, if the login failes, it returns weird things, what's necessary to know when a login connection failled ??


    I'm doing like this:

    <?php
    $host = "test.com";
    $user = "test";
    $accesshash='';
    $usessl = 0;

    $packs = array();
    $packs = $form->listaccts_($host,$user,$accesshash,$usessl);

    echo '<pre>';
    print_r($packs);
    echo '</pre>';
    ?>


    Tks a lot



    Demian Escobar
     
  2. christi1

    christi1 Well-Known Member

    Joined:
    Oct 20, 2003
    Messages:
    65
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Texas, USA
    In most any built-in function in PHP, such as file(), you can use a @ symbol directly before it to suppress any errors your receive so you can create your own error messages.

    Example:
    $data = @file("/path/to/myfile.txt");

    if($data == "") {
    echo "Sorry, I couldn't open that file or it is empty.";
    }
    else {
    // parse your $data here
    }

    Hope this helps.
     
Loading...

Share This Page