PHP Classes

File: Client.php

Recommend this page to a friend!
  Classes of Peter   Users   Client.php   Download  
File: Client.php
Role: Example script
Content type: text/plain
Description: Example class script
Class: Users
Manage user records stored in files
Author: By
Last change:
Date: 13 years ago
Size: 1,874 bytes
 

Contents

Class file image Download
<?php

require 'Users.php';

class
Client extends Users{
   
    protected
$workspaces;
    protected
$expired;
   
    public function
Initialization($data){
       
       
$this->workspaces = '/tmp/Users';
       
$this->expired = 5;
       
        switch(
$data['mode']):
            case
'checkUsers':
               
$users = explode(',', $data['users']);
                for(
$i = 0; $i < count($users); $i++):
                   
$online[$i] = $this->checkUser($users[$i]);
                endfor;
                if(
$data):
                   
$response['responseStatus'] = true;
                   
$response['responseText'] = array(
                       
'online' => $online,
                       
'users' => $users);
                    echo
json_encode($response);
                    return
true;
                else:
                   
$response['responseStatus'] = false;
                   
$response['responseText'] = $data;
                    echo
json_encode($response);
                    return
false;
                endif;
                break;
            case
'getAllUser':
               
$data = $this->getAllUser();
                if(
$data):
                   
$response['responseStatus'] = true;
                   
$response['responseText'] = array('users' => $data);
                    echo
json_encode($response);
                    return
true;
                else:
                   
$response['responseStatus'] = false;
                   
$response['responseText'] = $data;
                    echo
json_encode($response);
                    return
false;
                endif;
                break;
            default:
                break;
        endswitch;
    }
   
    public function
__construct(){
       
$data = $_REQUEST;
       
$this->Initialization($data);
    }
   
}

$Client = new Client();

?>