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.

account creation

Discussion in 'General Discussion' started by Frostbite, May 6, 2004.

  1. Frostbite

    Frostbite Member

    Joined:
    Jan 17, 2004
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    hello, i am looking for php or cgi script which a user can insert a domain name, username, and password, and it will create an account for them, the plan they use is specified in the script.

    so far i have got:

    PHP:
    <?php 
    require '/usr/local/cpanel/Cpanel/Accounting.php.inc'
    $host "localhost"
    $user "<WHM USERNAME HERE>"
    $accesshash "<ACCESSHASH HERE>''; 
    $usessl = "0"; 
    //this section takes the info from the form, putting it into variables for the below section
    $acctdomain = $_POST['domain'];
    $acctuser = $_POST['username'];
    $acctpass = $_POST['password'];
    $acctplan = "plan_name";
    createacct(
    $host,$user,$accesshash,$usessl,$acctdomain,$acctuser,$acctpass,$acctplan);
    ?>
    note the $acctdomain isnt meant to be split like that, it is just vbulletin :)

    but this fails to create the account

    does anyone know why? there is no errors or anything, or does anyone have a tried and working script? thank you :)
     
  2. Frostbite

    Frostbite Member

    Joined:
    Jan 17, 2004
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
  3. netnameus

    netnameus Well-Known Member

    Joined:
    Mar 7, 2004
    Messages:
    131
    Likes Received:
    0
    Trophy Points:
    16
    Change to $result = createacct($host,$user,$accesshash,$usessl,$acctdo
    main,$acctuser,$acctpass,$acctplan);

    then echo $result;
     
  4. Frostbite

    Frostbite Member

    Joined:
    Jan 17, 2004
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    thank you, worked perfectly, now what i wanted to do is create a database called theirusername_forums

    so i added this variable

    PHP:
    $dbname $acctuser."_forums";
    and then this code

    PHP:
    $link mysql_connect('localhost'"$acctuser""$acctpass");
    if (!
    $link) {
       die(
    'Could not connect: ' mysql_error());
    }
    echo 
    'Connected successfully';
    mysql_query("CREATE DATABASE $dbname");
    unfortunatly cpanel does not add it to the account (cant see it in cpanel list of databases or in phpmyadmin)

    is there anyway to add a database to an account externally, i desperatly need a way to do this, thanks
     
  5. Frostbite

    Frostbite Member

    Joined:
    Jan 17, 2004
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    can someone help me please? thanks
     
  6. r3n3gad3

    r3n3gad3 Member

    Joined:
    Apr 5, 2004
    Messages:
    15
    Likes Received:
    0
    Trophy Points:
    1
    search at google please for php or go to php.net and read th manual, if you want to have a good working system you sould look at https and a 128 bits encryption of your data, if I want to hack you now I would do it with eas, just do and Sqlinjection and I will have an account, make sure that you will use https and and encryption for a secure system :), just a tip :)
     
  7. r3n3gad3

    r3n3gad3 Member

    Joined:
    Apr 5, 2004
    Messages:
    15
    Likes Received:
    0
    Trophy Points:
    1
    PHP:
    $link mysql_connect('localhost'"$acctuser""$acctpass"); 
    if (!
    $link) { 
       die(
    'Could not connect: ' mysql_error()); 

    echo 
    'Connected successfully'
    mysql_query("CREATE DATABASE $dbname");
    and why are you using a If :S

    use this please:

    PHP:
    mysql_connect('localhost'"$acctuser""$acctpass") or die(mysql_error('could not connect to the db'));
    ok if you want some help there, you sould work with this:

    create a database with the usernames and passwords stored in it with a field called done, get the username and password and connect to there db (http://www.php.net/) then do an dsql dump and close the connection, after all that you must place yes in the field done because then your system can easially see witch domain already has it and witch domain doesn't ;)
     
    #7 r3n3gad3, May 8, 2004
    Last edited: May 8, 2004
  8. Frostbite

    Frostbite Member

    Joined:
    Jan 17, 2004
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    but the problem is not with connecting, it is with the fact that it is not added to a cpanel account, so i tried :

    PHP:
    <?php
    $ok 
    TRUE;
    $file fopen ("http://<their username>:<their password>@<domain name>:2082/frontend/x2/sql/adddb.html?db=<database name>""r");
    if (!
    $file) {
    $ok FALSE;
    }
    while (!
    feof ($file)) {
    $line fgets ($file1024);
    if (
    ereg ("already exists!"$line$out)) {
    $ok FALSE;
    }
    }
    fclose($file);
    ?>
    unfortunaly this doesnt work :(

    btw, the accounts are free, so it doesnt really matter about security too much :)
     
    #8 Frostbite, May 9, 2004
    Last edited: May 9, 2004
  9. Frostbite

    Frostbite Member

    Joined:
    Jan 17, 2004
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    can anyone help? thanks
     
  10. Almighty

    Almighty Member

    Joined:
    Apr 20, 2003
    Messages:
    20
    Likes Received:
    0
    Trophy Points:
    1
    wouldnt u need to add a mySQL database to their account under WHM?
    Or is this automatically incremented when you add a database.
     
Loading...

Share This Page