Location: PHPKode > projects > phpMyPrepaid > phpmyprepaid/www/include/users/usermanagement.php
<?
/*
phpRADmin is developped with GPL Licence 2.0 :
http://www.gnu.org/licenses/gpl.txt
Developped by : Toni de la Fuente (blyx)

For information : hide@address.com
*/if (!isset($oreon))
		exit();
	
	if (!isset($oreon->users))
		$oreon->loadUsers();	
	
	if ($buttonID=="delUser")	{
		$user = & $_POST["user"];
		if (!isset($_POST['deleteuser']))
	        {
		 echo "<p class=\"information\"> You haven't choose any user for deletion !!</p>";
		}else {
		$user=$oreon->database->getUser($_POST['deleteuser']);
		$oreon->deleteUsers($oreon->users[$user['user_id']]);
		unset($user);

		 echo "<p class=\"information\"> Successfull deleted user ".$user['user_alias']." !!</p>";
		}
	} else if ($buttonID=="ChangePasswd")	{
		$user = & $_POST["user"];
		$user_id = $user["user_id"];
		if (strcmp($user["user_passwd"], "") && !strcmp($user["user_passwd"], $user["user_passwd1"])){
			$oreon->users[$user_id]->set_passwd($user["user_passwd"]);
			$oreon->saveUserPasswd($oreon->users[$user_id]);
		}
		else 
			$msg = $lang['errCode'][-7];
	} else if ($buttonID=="ChangeUsers")	{
		$user = & $_POST["user"];
		$user["user_version"] = $oreon->user->get_version();
		$id = $user["user_id"];
		$user_object = new User($user);

		$query = "UPDATE user_location SET locationid='".$user["user_location"]."',statusid='".$user["user_status"]."' WHERE userid='$id' AND locationid='".$user["user_location_old"]."'";
		if ($debug) echo $query;
		$oreon->database->database->query ($query) or die("Query database error !");

		if ((($user["user_alias"]!=$user['user_alias_old']) && ($user_object->is_complete() && $user_object->twiceTest($oreon->users))) or (($user["user_alias"]==$user['user_alias_old']) and ($user_object->is_complete())))	{
			$oreon->users[$id] = $user_object;
			$oreon->users[$id]->set_passwd($oreon->users[$id]->get_passwd());
			$oreon->saveUser($oreon->users[$id]);
			echo "<p class=\"information\"> Successfull modify user ".$user['user_alias']." !!</p>";

		}	else
			$msg = $lang['errCode'][$user_object->get_errCode()];
		unset($user_object);
	} else if ($buttonID=="AddUser")	{
		$user = & $_POST["user"];
		$user["user_version"] = $oreon->user->get_version();
		$user["user_id"] = -1;
		$user_object = new User($user);
		$user_object->set_passwd($user["user_passwd"]);
		$user_object->set_ppasswd($user["user_ppasswd"]);	
		if ($user_object->is_complete() && $user_object->twiceTest($oreon->users))	{
			$oreon->saveUser($user_object);
			$user_id = $oreon->database->database->get_last_id();
			$oreon->users[$user_id] = $user_object;
			$oreon->users[$user_id]->set_id($user_id);
			$oreon->saveUser($oreon->users[$user_id]);
			$query = "insert into user_location (locationid, userid,statusid) values ('".$user['user_location']."', '$user_id','".$user['user_status']."')";
			$oreon->database->database->query ($query) or die("Query database error !");
			echo "<p class=\"information\"> Successfull add user ".$user['user_alias']." !!</p>";
		}	else
				$msg = $lang['errCode'][$user_object->get_errCode()];
		unset($user_object);
	}
	
 ?>	
Return current item: phpMyPrepaid