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.

postwwwacct Add user to MySQL Database

Discussion in 'cPanel Developers' started by cfidecaro, Mar 29, 2009.

  1. cfidecaro

    cfidecaro Registered

    Joined:
    Mar 29, 2009
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    I need to automatically add the username to a MySQL whenever an account is created, but I'm not having any luck. I know to use postwwwacct, but I can't get anything to work. Here is the code I have so far, any advice would be greatly appreciated.

    PHP:
    #!/usr/bin/php -q

    <?php
    require_once('/home/diy/public_html/assets/config.php');
    require_once(
    '/home/diy/public_html/assets/dbclass.php');
    require_once(
    '/home/diy/public_html/assets/formFunctionsV2.0.php');

    $a = new makeForm($dbConArray);

    $opts = array();
    $argv0 array_shift($argv);

    while(
    count($argv)) {
        
    $key array_shift($argv);
        
    $value array_shift($argv);
        
    $opts[$key] = $value;
    }

    //Get username, store in a variable
    $diyUsername $opts['user'];

    //Create password from username, store in a variable
    $diyPassword $opts['user'].'77';

    //Insert account ($opts['user']), username and password into clients database
    $q "INSERT INTO tbl_accounts (username,password,account) VALUES ('".$diyUsername."','".$diyPassword."','".$diyUsername."')";
    $a->query($q);
    ?>
     
  2. WebScHoLaR

    WebScHoLaR Well-Known Member

    Joined:
    Dec 14, 2005
    Messages:
    511
    Likes Received:
    2
    Trophy Points:
    18
    Location:
    Planet Earth
    I can write a script for you that will do it what you need. Let me know if you still need it.
     
  3. cfidecaro

    cfidecaro Registered

    Joined:
    Mar 29, 2009
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    That would be great, PM me with details?
     
Loading...

Share This Page