当前位置: 首页>>代码示例>>PHP>>正文


PHP select::byname方法代码示例

本文整理汇总了PHP中select::byname方法的典型用法代码示例。如果您正苦于以下问题:PHP select::byname方法的具体用法?PHP select::byname怎么用?PHP select::byname使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在select的用法示例。


在下文中一共展示了select::byname方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: command

 public static function command($msg, $user)
 {
     $returnmsg = "";
     $msg = substr($msg, 1);
     $command = explode(' ', $msg);
     commands::logm("command:" . $command[0] . "|rechte [" . $user->rights . "]\n");
     switch ($command[0]) {
         case "invite":
             break;
         case "join":
             break;
         case "leave":
             break;
         case "rights":
             break;
         case "group":
             break;
         case "eval":
             if ($user->rights >= 10000000) {
                 global $sockets, $users, $groups, $server;
                 ob_start();
                 eval($command[1] . ";");
                 $result = ob_get_clean();
                 $returnmsg = $result;
             } else {
                 $returnmsg = "Insufficient permissions!";
             }
             break;
         case "kick":
             break;
         case "ban":
             break;
         case "shout":
             if ($user->rights > 100) {
             } else {
                 $returnmsg = "Insufficient permissions!";
             }
             break;
         case "w":
             if (select::byname($command[1])) {
                 $returnmsg = "You whispert to:" . $command[1] . " " . $msg;
             } else {
                 $returnmsg = "User \"" . $command[1] . "\" not found";
             }
             break;
         default:
             $returnmsg = "Command not found";
             break;
     }
     return $returnmsg;
 }
开发者ID:Kawaeike,项目名称:LocalChat,代码行数:51,代码来源:commands.php

示例2: 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


注:本文中的select::byname方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。