**Can someone tell me what in the word is going on???
Fatal error**: Call to a member function add_user() on a non-object in /imedia/users/amfol/htdocs/finlit/users/includes/admin/clients.php on line **143
Here is Line 143…
$user is delcared as follows:
**
$user = new auth();
**if ($action == "Add") {
$situation = $user->add_user($username, $password, $team, $level, $status, $hours,$ssn,$employer,$address,$city,$state,$zip,$phoneday,$phoneeve,$phonecell, $program,$loanamt, $loanbal,$counselor,$clientstatus,$dateentered,$ficostart,$ficoend);
The corresponding function is…
**
function add_user($username, $password, $team, $level, $status, $hours,$ssn,$employer,$address,$city,$state,$zip,$phoneday,$phoneeve,$phonecell,$program,$loanamt,
$loanbal,$counselor,$clientstatus,$dateentered,$ficostart,$ficoend) {
if($team == 'Client')
{
do{
$idnum = rand(100000, 999999);
$idcheck = $this->id_check($idnum);
}while($idcheck == true);
$userExists = "SELECT * FROM authuser WHERE uname='$username'";
$query = "INSERT INTO authuser(clientid,uname,passwd,ssn,employer,address,city,state,zip,phoneday,phoneeve,phonecell,program,loanamt,loanbal,counselor,
clientstatus,team,level,status,dateentered,ficostart,ficoend,lastlogin,logincount) VALUES ('$idnum','$username',MD5('$password'),'$ssn','$employer',
'$address','$city','$state','$zip','$phoneday','$phoneeve','$phonecell','$program','$loanamt','$loanbal','$counselor','$clientstatus','$team',
'$level','$status','$dateentered','$ficostart','$ficoend','',0)";
$modquery = "INSERT INTO modules(first,last,mod1,mod2,mod3,mod4,mod5,mod6,mod7,mod8,mod9,
mod10,mod11,mod12,mod13,mod14,mod15,mod16,mod17,mod18,mod19,mod20,mod21,mod22)
VALUES ('$username',MD5('$password'), 'false', 'false', 'false', 'false', 'false',
'false', 'false', 'false', 'false', 'false', 'false', 'false', 'false', 'false',
'false', 'false', 'false', 'false', 'false', 'false', 'false', 'false',)";
$connection = mysql_connect($this->HOST, $this->USERNAME, $this->PASSWORD);
if (trim($username) == ""){
return "blank username";
}
else if (trim($password) == "")
{
return "blank password";
}
else if (trim($level) == "")
{
return "blank level";
}
$SelectedDB = mysql_select_db($this->DBNAME);
$user_exists = mysql_query($userExists);
if(mysql_num_rows($user_exists) > 0)
{
return "username exists";
}
else
{
$SelectedDB = mysql_select_db($this->DBNAME);
$setmods = mysql_query($modquery);
$result = mysql_query($query);
return mysql_affected_rows();
}
}
else
{
$qUserExists = "SELECT * FROM authuser WHERE uname='$username'";
$qInsertUser = "INSERT INTO authuser(uname, passwd, team, level, status,hourslogged, lastlogin, logincount)
VALUES ('$username', MD5('$password'), '$team', '$level', '$status', '$hours', '', 0)";
$qSetModuleDefaults = "INSERT INTO modules(first,last,mod1,mod2,mod3,mod4,mod5,mod6,mod7,mod8,mod9,
mod10,mod11,mod12,mod13,mod14,mod15,mod16,mod17,mod18,mod19,mod20,mod21,mod22)
VALUES ('$username',MD5('$password'), 'false', 'false', 'false', 'false', 'false',
'false', 'false', 'false', 'false', 'false', 'false', 'false', 'false', 'false',
'false', 'false', 'false', 'false', 'false', 'false', 'false', 'false',)";
$connection = mysql_connect($this->HOST, $this->USERNAME, $this->PASSWORD);
// Check if all fields are filled up
if (trim($username) == "") {
return "blank username";
}
// password check added 09-19-2003
elseif (trim($password) == "") {
return "blank password";
}
elseif (trim($level) == "") {
return "blank level";
}
// Check if user exists
$SelectedDB = mysql_select_db($this->DBNAME);
$user_exists = mysql_query($qUserExists);
if (mysql_num_rows($user_exists) > 0) {
return "username exists";
}
else {
// Add user to DB
// OLD CODE - DO NOT REMOVE
// $result = mysql_db_query($this->DBNAME, $qInsertUser);
// REVISED CODE
$SelectedDB = mysql_select_db($this->DBNAME);
$result = mysql_query($qInsertUser);
$setmods = mysql_query($qSetModuleDefaults);
return mysql_affected_rows();
}
}
} // End: function add_user