當前位置: 首頁>>代碼示例>>PHP>>正文


PHP select::receivers方法代碼示例

本文整理匯總了PHP中select::receivers方法的典型用法代碼示例。如果您正苦於以下問題:PHP select::receivers方法的具體用法?PHP select::receivers怎麽用?PHP select::receivers使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在select的用法示例。


在下文中一共展示了select::receivers方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: login

 public static function login($client, $msg)
 {
     global $server, $groups, $users;
     if (DEBUG) {
         echo "login\n";
     }
     $temp = explode(" ", $msg);
     if ($temp[0] == "!login") {
         if ($client->ip == SERVER_IP) {
             $client->name = "Admin";
             $client->status = 3;
             $client->active_group = "Main";
             $client->rights = 10000000;
             $group = select::receivers($client->active_group);
             array_push($group->members, new member($client));
             array_push($client->groups, $client->active_group);
             array_push($users, $client);
             chat::send_msg($server, "Success", $client);
         } else {
             if (select::byname($temp[1]) === false) {
                 if (preg_match("/admin/i", $temp[1]) == 0 && preg_match("/server/i", $temp[1]) == 0) {
                     if (preg_match("/[-_a-z0-9]{4,20}/i", $temp[1])) {
                         $client->name = $temp[1];
                         $client->status = 3;
                         $client->active_group = "Main";
                         $group = select::receivers($client->active_group);
                         array_push($group->members, new member($client));
                         array_push($client->groups, $client->active_group);
                         array_push($users, $client);
                         chat::send_msg($server, "Success", $client);
                     } else {
                         chat::send_msg($server, "Invalid Username", $client);
                     }
                 } else {
                     chat::send_msg($server, "Username is reserved", $client);
                 }
             } else {
                 chat::send_msg($server, "Username already used! Chose a other!", $client);
             }
         }
     } else {
         chat::send_msg($server, "You must first login with !login <username>!", $client);
     }
 }
開發者ID:Kawaeike,項目名稱:LocalChat,代碼行數:44,代碼來源:connection.php

示例2: process

 public static function process($client, $msg)
 {
     if (DEBUG) {
         echo "process\n";
     }
     $msg = str_replace("&", "&", $msg);
     $msg = str_replace("<", "&lt;", $msg);
     $msg = str_replace(">", "&gt;", $msg);
     $receivers = select::receivers($client->active_group);
     if (substr($msg, 0, 1) == "!module") {
         $gamemode::run($msg, $client, $receivers);
     } else {
         if (substr($msg, 0, 1) == "!") {
             $msg = commands::command($msg, $client, $receivers);
             $receivers = array($client);
             chat::send_msg($client, $msg, $client);
         } else {
             chat::send($client, $msg, $receivers);
         }
     }
 }
開發者ID:Kawaeike,項目名稱:LocalChat,代碼行數:21,代碼來源:chat.php


注:本文中的select::receivers方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。