Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 10 of 10
  1. #1
    Member
    Join Date
    Jun 2002
    Location
    UK
    Posts
    152

    Default WHM - php error handling of remote access functions

    Hi,
    Im trying to make a PHP script to create user accounts as soon as their payment has been authorized with paypal,
    it works fine at the moment, but there is no way to check if there has been any errors creating the account, like if the username has been taken,
    is there anyway to echo an error if a problem occurs when creating accounts?
    thanks

  2. #2
    Member
    Join Date
    Jul 2002
    Location
    Atlanta, GA
    Posts
    646

    Default

    just echo out the variable you assigned to the createacct function. Here's an example.

    ------------
    $mycreateaccount = createacct($host,$user,$accesshash,$usessl,$acctdomain,$acctuser,$acctpass,$acctplan);

    echo $mycreateaccount;
    ------------

    If it errors out, the first four characters returned are 'Ouch', if it successful, the first four characters are 'WWWA' (without the quotes in both cases).

    I simply trap an error condition only and assume successful otherwise.

  3. #3
    Member
    Join Date
    Jun 2002
    Location
    UK
    Posts
    152

    Default

    thanks,
    ive managed to do full error checking now though with a few functions

  4. #4
    Member
    Join Date
    Jun 2002
    Location
    UK
    Posts
    152

    Default

    someone asked me on the forum how I do my error checking when creating accounts through PHP,
    this might not be the best way to do it, but it works fine for me:

    $length = strlen($acctuser);
    if ($length&8){ echo &your username is longer than 8 characters, please change it!&; die; }
    else {
    if (is_dir(&/home/$acctuser&amp){ echo &username taken, please try again&; die; }

    im not sure what other errors you can have when creating accounts, I have not yet come across any,
    im going to put all of my scripts for download sometime soon when I have added a few extra features, the only problem is that because I dont have 2checkout or authorize.net accounts i cannot test payment gateways with the script, except with paypal which works fine

  5. #5
    Member
    Join Date
    Feb 2002
    Posts
    105

    Default

    usernames with numbers arn't allowed anymore

  6. #6
    Member
    Join Date
    Jun 2002
    Location
    UK
    Posts
    152

    Default

    oh right, didnt know that one

    if (eregi(&[0-9]&, $acctuser)){
    echo &usernames with numbers arent allowed anymore!&;
    }

  7. #7
    Member
    Join Date
    Jul 2002
    Location
    Atlanta, GA
    Posts
    646

    Default

    I have a number of users with numbers in their username. No problems at all.

    Jaz

  8. #8
    Member
    Join Date
    Sep 2001
    Location
    Spain
    Posts
    779

    Default

    [quote:9d0fcf2de1][i:9d0fcf2de1]Originally posted by jimcarter[/i:9d0fcf2de1]
    if (is_dir(&/home/$acctuser&amp){ echo &username taken, please try again&; die; }
    [/quote:9d0fcf2de1]

    wwwacct checks against /etc/passwd to reject repeated usernames. Also rejects usernames greater than 8 characters long, and usernames beginning with a number or a dash.

  9. #9
    Member
    Join Date
    Jun 2002
    Location
    UK
    Posts
    152

    Default

    it doesnt return the errors though, and you could still end up charging someones credit card thinking that the account has been created when in fact it hasnt

  10. #10
    Member
    Join Date
    Sep 2001
    Location
    Spain
    Posts
    779

    Default

    Ok, I thougt you'd want to make the same checks wwwacct does

Similar Threads & Tags
Similar threads

  1. remote access, php error handling status?
    By adamint in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 04-15-2006, 02:34 PM
  2. Remote Access to DNS Functions
    By MohammadrezaH in forum cPanel and WHM Discussions
    Replies: 3
    Last Post: 03-19-2006, 01:04 PM
  3. PHP remote access functions question.
    By Shino in forum New User Questions
    Replies: 3
    Last Post: 02-17-2006, 03:45 AM
  4. Broken pipe error with php WHM remote access
    By tupolev in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 01-24-2006, 10:11 PM
  5. WHM Remote Access with PHP
    By adambrill in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 02-20-2005, 05:25 AM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube