Results 1 to 18 of 18

Thread: Auto User Creation

  1. #1
    Join Date
    Jun 2003
    Location
    Alabama, USA
    Posts
    50

    Auto User Creation

    Ok, here is the situation. I use paypal for users to buy my services. I have an IPN script that directs the user to a certain page based on if the payment meets specific requirements (or will be as soon as I can get it up). Is there a way I can use PHP maybe to store values on the paypal form (before you get to the actual paypal page where you submit payment) and use them on the successpayment page to automatically create the user's account using API? I know I have asked a lot of questions here, but im new to a lot of these things and you guys all seem like experts.
    Last edited by Gadget; 10-02-2003 at 12:01 PM.
    B. Bryant
    Bryco PC Consulting and Internet Services
    P.O. Box 491, Mc Calla, AL 35111-0491
    http://www.BrycoPc.com/

  2. #2
    Join Date
    Jun 2003
    Posts
    1,471
    Yes, you can. Check out the new create account API function (which accepts data the same as the old create account method) and my PHP class for communicating with DA.
    Installatron Plugin is a native DirectAdmin plugin that provides you and your customers an intuitive interface to install, manage, upgrade, and backup/restore a premier collection of the best applications on the web, all instantly at the click of a button.

    Also: cPanel-to-DA converterBulk Domains and Sub-domain PluginDA User Tool

  3. #3
    Join Date
    Jun 2003
    Posts
    1,471
    Here.

    PHP Code:
    <?php

    $obj
    ->request("/CMD_ACCOUNT_USER?username=<username>&email=<email>&passwd=<password>"
        
    ."&passwd2=<password>&domain=<primary_domain>&bandwidth=<megs_bandwidth>"
        
    ."&quota=<megs_storage>&uvdomains=ON&unsubdomains=ON&unemails=ON&unemailf=ON"
        
    ."&unemailml=ON&unemailr=ON&umysql=ON&udomainptr=ON&uftp=ON&aftp=ON&cgi=ON&ssl=ON"
        
    ."&suspend_at_limit=ON&skin=<skin>&ip=<server_ip>&add=Submit&action=create");

    ?>
    That's what I use to create actual accounts right now. It works great, however, it does need coverted over to the new CMP_API_CREATE_ACCOUNT method.

    I think the below will work with the CMD_API (untested):

    PHP Code:
    <?php

    $obj
    ->request("/CMD_API_ACCOUNT_USER?username=<username>&email=<email>&passwd=<password>"
        
    ."&passwd2=<password>&domain=<primary_domain>&bandwidth=<megs_bandwidth>"
        
    ."&quota=<megs_storage>&uvdomains=ON&unsubdomains=ON&unemails=ON&unemailf=ON"
        
    ."&unemailml=ON&unemailr=ON&umysql=ON&udomainptr=ON&uftp=ON&aftp=ON&cgi=ON&ssl=ON"
        
    ."&suspend_at_limit=ON&skin=<skin>&ip=<server_ip>&add=Submit&action=create");

    $result $obj->array_last_parsed();

    if (
    $result[error]) {

        echo 
    "Woo. There was an error.<p>$result[details]";

        exit;
    }

    echo 
    $result[text];

    ?>
    Note: Rememer to replace my <blah> tags with actual values/variables. :P

    *Note: This example uses the version 1.xx of the communication class; you need the wrapper to continue in this fashion*
    Last edited by l0rdphi1; 04-15-2004 at 09:16 AM.
    Installatron Plugin is a native DirectAdmin plugin that provides you and your customers an intuitive interface to install, manage, upgrade, and backup/restore a premier collection of the best applications on the web, all instantly at the click of a button.

    Also: cPanel-to-DA converterBulk Domains and Sub-domain PluginDA User Tool

  4. #4
    Yes, the CMD_API_ACCOUNT_* commands are exact copies of the regular verions... the only difference is the output it generates, which is nicer to parse.

    John

  5. #5
    Join Date
    Aug 2003
    Posts
    3

    a php script to creat account that work pleas

    Is there anyone here that can give a real script with a minimum of explanation ??

    if yes don't be shy just help, the help on the api is not clear at all, and no exemple can be found, is there any documentation out there ?

    thanks
    william !

  6. #6
    Hello,

    Check out http://www.directadmin.com/forum/sho...hreadid=258... I'm not sure how much simpler it can get.

    John

  7. #7
    Join Date
    Aug 2003
    Posts
    3

    automatic member creation

    thanks but this doesn't seem to work for me, what a pitty.
    thanks anywhat.
    william !

  8. #8
    Join Date
    Jun 2003
    Posts
    1,471
    We are here to help if you want to tell us what is not working
    Installatron Plugin is a native DirectAdmin plugin that provides you and your customers an intuitive interface to install, manage, upgrade, and backup/restore a premier collection of the best applications on the web, all instantly at the click of a button.

    Also: cPanel-to-DA converterBulk Domains and Sub-domain PluginDA User Tool

  9. #9
    Join Date
    Aug 2003
    Posts
    3

    What doesn't work for me

    Hi,

    What Does not work for this URL creation.

    Whatever I do

    1-Using this URL in a browser to create a member shows me the login page

    http://login:password@esecuresite3.c...USER?username=$ndd&email=$alm_email&passwd=pass1234&passwd2=pass1234&domain=$primary_domain&package=aleapay&notify=yes&ip=66.98.138.15&add=Submit&action=create

    2-Using this URL in a fsock results in an error
    http://login:password@esecuresite3.c...USER?username=$ndd&email=$alm_email&passwd=pass1234&passwd2=pass1234&domain=$primary_domain&package=aleapay&notify=yes&ip=66.98.138.15&add=Submit&action=create

    The only possibility is to
    a ) connect to my admin account
    http://esecuresite3.com:2222
    login
    password

    b ) copy the URL in the same browser and the accounts are created, but doing this way means that it is not automatic at all.
    http://login:password@esecuresite3.c...USER?username=$ndd&email=$alm_email&passwd=pass1234&passwd2=pass1234&domain=$primary_domain&package=aleapay&notify=yes&ip=66.98.138.15&add=Submit&action=create

    So I don't understand why it works for everyone and not for me.


    thanks
    william !

  10. #10
    Join Date
    Jun 2003
    Posts
    1,471
    I don't think you can login like that anymore. The session system doesn't allow for it.

    Check out
    Installatron Plugin is a native DirectAdmin plugin that provides you and your customers an intuitive interface to install, manage, upgrade, and backup/restore a premier collection of the best applications on the web, all instantly at the click of a button.

    Also: cPanel-to-DA converterBulk Domains and Sub-domain PluginDA User Tool

  11. #11
    Join Date
    Dec 2003
    Posts
    1

    Doesn't work

    I tried that script for 2.0 for account creations, seems it doesn't work correctly. For result, I keep getting Array, and yes I'm using CMD_API_ACCOUNT_USER. I use $sock->query("/CMD_API_ACCOUNT_USER?bahblahblah");

    However, I've tried this remotely, to see if it blocks local connections, and it cannot even establish a connection remotely. I have no other idea on what to do.

  12. #12
    Hello,

    Does it connect at all? try:
    Code:
    telnet localhost 2222
    # or
    telnet 1.2.3.4 2222
    and then press enter 3 times if it connects..

    John

  13. #13
    Join Date
    Jun 2003
    Posts
    1,471

    Re: Doesn't work

    You'll also want to be using
    Code:
    $sock->query("/CMD_API_ACCOUNT_USER","bahblahblah");
    I do believe
    Installatron Plugin is a native DirectAdmin plugin that provides you and your customers an intuitive interface to install, manage, upgrade, and backup/restore a premier collection of the best applications on the web, all instantly at the click of a button.

    Also: cPanel-to-DA converterBulk Domains and Sub-domain PluginDA User Tool

  14. #14

    Automatic user creation

    Hello, I want to automate the user creation procces using the signup forms I use for new customers signing up for a hosting account.

    I have found the PHP classes with user_create forms in them.
    This seems very prommissing, but I keep getting the message that the password is not correct.

    Now, I know that the password is correct, because i checked it. Also all other settings in the config.php file are correct...
    But, for some reason all the forms from this php class have a problems with my admin password.

    "Failed to add new user: Cannot Create Account
    Invalid Password"

    Can anybody help me?

  15. #15
    The password is not syntactically allowed by DA, for whatever reason.
    Try a simpler password to give the user. (it's not your existing DA account password that DA is talking about)

    Or if you've enabled the difficult password checking, then you'd have to satisfy that.

    John

  16. #16
    Thanks for your reply. I tried a lot of different passwords, simple and hard, but none are accepted.

    I did not enable the difficult passoword thingy, I'm not realy in to the API yet.
    All I am able to do is copy and past php classes that do the job for me.
    This is why I need that class to work...

    Any other suggestions to what I could do?

  17. #17
    This is an example which works, perhaps you're simply not passing a required variable. Compare yours to this one:

    http://www.directadmin.com/sample_api.txt

    John

  18. #18
    I checked the sample with the code I got in the 'da-api php class' package and it's all there. It's just a little bit diffirent

    Code:
    <?php
    
    $username 	= $_POST[username];
    $email 		= $_POST[email];
    $passwd 	= $_POST[password1];
    $passwd2 	= $_POST[password2];
    $domain 	= $_POST[domain];
    $package 	= $_POST[package];
    $notify 	= $_POST[notify];
    
    include '../config/config.php';
    include '../protocol/httpsocket.php';
    $Socket = new HTTPSocket;
    
    $Socket->connect($siteurl,$siteport);
    $Socket->set_login($adminusername,$adminpassword);
    // {admin_username} and {admin_password} are not specifically your administrative DA user,
    // but rather the user that you want to own this new user.
    
    $Socket->query('/CMD_API_ACCOUNT_USER',
        array(
            'username' => $username, // The User's username. 4-8 characters, alphanumeric
            'email' => $email, // A valid email address
            'passwd' => $password1, // The User's password. 5+ characters, ascii
            'passwd2' => $password2, // Password double check. 5+ characters, ascii
            'domain' => $domain, // A valid domain name in the form: domain.com
            'package' => $package, // One of the User packages created by the Reseller
            'ip' => $ipaddress, // One of the ips which is available for user creation. Only free or shared ips are allowed.
            'notify' => $notify, // yes or no. If yes, an email will be sent to email
            'action' => 'create',
            'add' => 'Submit'
        ));
    $result = $Socket->fetch_parsed_body();
    
    if ( $Socket->get_status_code() != 200 || !empty($result['error']) )
    {
        // failure.
        echo "Failed to add new user: {$result['text']}<br />{$result['details']}";
    } else {
        // new user added.
        print_r('User '.$username.' created...');
    }
    
    
    ?>
    Then I pasted the code of your sample in a file on my server and tried if it actually is working... Unfortunatily, I got the following order trying:
    "Fatal error: Class 'HTTPSocket' not found in graphicscompany.net/public_html/php/forms/sample.php on line 21"
    Last edited by graphicscompany; 03-27-2009 at 03:01 PM.

Similar Threads

  1. NEW - iPanel 3.6 BETA - Auto Account Creation and Billing Script with Forced Ads
    By ihostdev in forum DirectAdmin-related Products and Services [Advertising Forum]
    Replies: 6
    Last Post: 12-12-2007, 10:42 AM
  2. Divorce database creation from database user creation
    By orangekay in forum Feedback & Feature Requests
    Replies: 5
    Last Post: 11-24-2007, 12:02 AM
  3. auto account creation
    By virtual in forum Scripting / API
    Replies: 1
    Last Post: 05-22-2006, 06:40 PM
  4. auto account creation
    By fergz in forum 3rd Party Software
    Replies: 2
    Last Post: 11-03-2004, 11:24 PM
  5. Auto-Subdomain creation
    By Francisco in forum DirectAdmin General Discussion
    Replies: 1
    Last Post: 05-03-2004, 11:53 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •