Location: PHPKode > scripts > PHP Controller > php-controller/Pages/Administrator.class.php
<?php
/**
  * PHP Controller
  *
  * PHP versions 5
  *
  * LICENSE: This source file is subject to version 3.0 of the PHP license
  * that is available through the world-wide-web at the following URI:
  * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
  * the PHP License and are unable to obtain it through the web, please
  * send a note to hide@address.com so we can mail you a copy immediately.
  *
  *
  * @category   Example
  * @package    PHP-Controller
  * @author     Eddie Tejeda <hide@address.com>
  * @copyright  2005 Visudo LLC
  * @version    0.3
  */

class Administrator{

  var $database; 
  
  /**
    * Contructor does nothing here
    *
    */
  function Administrator(){
    $this->database = $_SESSION['database'];
  }
  
  /**
    * Web Method, user, takes $_GET[id], and we see information about this user	
    *
    * @return array associative array with user data
    */
  function User($url, $user){	
    $user = $this->database->query("SELECT * FROM Users WHERE user_id=".$user['id']);
    return $user[0];
  }
  
  /**
    * Web Method thats retrives all users from users database, takes not arguemnts
    *
    * @return bool  Auth was succesful
    */
  function Users(){
    
    $users = $this->database->query("SELECT * FROM Users");
    
    return $users;
  }
  
/**
    * Web Method thats retrives all users from users database, takes not arguemnts
    *
    * @return bool  Auth was succesful
    */
  function addUser($url, $get, $post, $cookie){
    return $get['firstname'].substr(uniqid(), 0, 5);
  }
  
  /**
    * Action Method that adds new user to user_table, gets information through POST[]	
    * forwards user back to Allusers
    *
    * @return bool  Auth was succesful
    */	
  function doAddUser($url, $get, $post, $cookie){

    $username = strip_tags($post['username']);
    $password = strip_tags($post['password']);
    $first_name = strip_tags($post['first_name']);
    $last_name = strip_tags($post['last_name']);
    $email = strip_tags($post['email']);
    $date_added = date("Y-m-d");
    $sql = 'INSERT INTO Users(username, password, first_name, last_name, email, date_added) VALUES("'.$username.'", "'.$password.'", "'.$first_name.'", "'.$last_name.'", "'.$email.'", "'.$date_added.'")';
    $this->database->query($sql);
  }
	
}
	
?>
Return current item: PHP Controller