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 Code:#!/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);
?>



LinkBack URL
About LinkBacks
Reply With Quote




