<?php require_once 'config.inc.php'; require_once 'LiveUser/Admin/Admin.php'; //require_once 'LiveUser/LiveUser.php'; //require_once 'LiveUser/Admin/Perm/Container/DB_Medium.php'; //require_once 'LiveUser/Admin/Auth/Container/DB.php'; $admin = new LiveUser_Admin($conf, 'en'); $res = $admin->perm->setCurrentLanguage('en'); //$res = $admin->perm->addLanguage('en', 'english', 'English language'); $ts = time(); // ADD User //function addUser($handle, $password, $type = null, $active = true, $id = null, $owner_user_id = null, // $owner_group_id = null, $customFields = array()) $user_id = $admin->addUser('martin', 'dummypass', null, true, getUniqueId(), null, null, null); if (PEAR::isError($user_id)) { echo "<pre>"; print_r($user_id); echo "</pre>"; } else { echo 'Created User Id ' . $user_id . '<br />'; } /* // GET User $user = $admin->getUser($user_id); if(PEAR::isError($user)) { echo "<pre>"; print_r($user); echo "</pre>"; }
<?php // $Id: admin_example_mdb2.php,v 1.1 2004/07/16 13:59:08 mloitzl Exp $ require_once 'config_mdb2.inc.php'; require_once 'LiveUser/Admin.php'; $increment = time(); $admin = new LiveUser_Admin($conf, 'FR'); $custom = array('name' => 'asdfMDB22', 'email' => 'fleh@example.comMDB23'); $user_id = $admin->addUser('johndoe' . $increment, 'dummypass', null, true, null, null, null, $custom); echo 'Created Perm User Id ' . $user_id . '<br />'; if (MDB2::isError($user_id)) { var_dump($user_id); } if (!MDB2::isError($user_id) && $user_id > 2) { $echo_user_id = $user_id - 2; $admin->removeUser($echo_user_id); echo 'Removed Perm User Id ' . $echo_user_id . '<br />'; } if (!MDB2::isError($user_id) && $user_id > 1) { $custom = array('name' => 'asdfMDBUpdated22', 'email' => 'fleh@example.comMDBUpdated22'); $update_id = $user_id - 1; $admin->updateUser($update_id, 'johndoe' . $increment, 'dummypass', null, true, null, null, $custom); echo 'Updated Perm User Id ' . $update_id . '<br />'; } $foo = $admin->getUser($user_id); if (empty($foo)) { echo 'No user with that Perm ID was found ' . $user_id; } else { print_r($foo); } echo '<br />';
<?php require_once 'config.inc.php'; require_once 'LiveUser/Admin/Admin.php'; $admin = new LiveUser_Admin($conf, 'FR'); $custom = array(array('name' => 'name', 'value' => 'asdf', 'type' => 'text'), array('name' => 'email', 'value' => '*****@*****.**', 'type' => 'text')); $user_id = $admin->addUser('johndoe', 'dummypass', true, null, null, null, $custom); echo 'Created User Id ' . $user_id . '<br />'; if ($user_id > 2) { $admin->removeUser($user_id - 2); echo 'Removed User Id ' . ($user_id - 2) . '<br />'; } if ($user_id > 1) { $custom = array(array('name' => 'name', 'value' => 'asdfUpdated', 'type' => 'text'), array('name' => 'email', 'value' => '*****@*****.**', 'type' => 'text')); $admin->updateUser($user_id, 'johndoe', 'dummypass', true, null, null, $custom); echo 'Updated User Id ' . ($user_id - 1) . '<br />'; } $custom = array('name', 'email'); $foo = $admin->getUser($user_id, $custom); if (empty($foo)) { echo 'No user with that ID was found'; } else { print_r($foo); } echo '<br />'; $cols = array('name', 'email'); $filters = array('email' => array('op' => '=', 'value' => '*****@*****.**', 'cond' => 'AND'), 'name' => array('op' => '=', 'value' => 'asdfUpdated', 'cond' => '')); $foo1 = $admin->searchUsers($filters, $cols); echo 'These Users were found: <br />'; print_r($foo1);