Calling URI * */ public function __construct($url){ $this->pagename = $url['page']; } /* CALL * */ public function load(){ if( $_SESSION['WS'] || strlen($_SESSION['NAME']) == 0 ){ // ask with websocketInterop $wsi = new wsinterop('localhost', 9998); if( count($_SESSION['USER']) > 0 ){ // get/send name to web socket $wsi->send(['operation' => "Connect",'type' => 'user', 'name' => $_SESSION['USER']['username']]); $check = $wsi->receive(); if( $check['error'] == false ) $_SESSION['NAME'] = $check['name']; }elseif( count($_SESSION['ADMIN']) > 0 ){ // get/send name to web socket $wsi->send(['operation' => "Connect",'type' => 'admin', 'name' => $_SESSION['ADMIN']['username']]); $check = $wsi->receive(); if( $check['error'] == false ) $_SESSION['NAME'] = $check['name']; }else{ // get/send name to web socket $wsi->send(['operation' => "Connect",'type' => 'guest', 'name' => null]); $check = $wsi->receive(); if( $check['error'] == false ) $_SESSION['NAME'] = $check['name']; } $wsi->close(); $wsi = null; $_SESSION['WS'] = false; } if( file_exists(__ROOT__."/view/home.php") ) include __ROOT__."/view/home.php"; else echo "page not found"; } /* POST-CALL * */ public function __destruct(){ } }