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


PHP Crypto::cust_encrypt方法代码示例

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


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

示例1: createHub

 private function createHub($hubName, $username)
 {
     if (isset($hubName, $username)) {
         // Replace spaces with underscores
         $hubName = str_replace(" ", "_", $hubName);
         if (!empty(CREATE_HUB_SCRIPT)) {
             exec(CREATE_HUB_SCRIPT . ' "' . $hubName . '"', $outputArray, $return_val);
             if ($return_val == 0) {
                 // Cycle through the output
                 foreach ($outputArray as $output) {
                     // If the array is at the password block
                     if (strpos($output, 'Password: ') !== false) {
                         $password = Crypto::cust_encrypt(str_replace('Password: ', '', $output));
                         $stmt = $this->db_connection->prepare('SELECT id FROM clients WHERE username = ?');
                         if ($stmt->execute(array($username))) {
                             if ($userid = $stmt->fetchColumn()) {
                                 $stmt = null;
                                 $stmt = $this->db_connection->prepare('SELECT null FROM hubs WHERE name = ? AND client_id_fk = ?');
                                 if ($stmt->execute(array($hubName, $userid))) {
                                     if ($stmt->rowCount() == 0) {
                                         $stmt = null;
                                         $stmt = $this->db_connection->prepare('INSERT INTO hubs (name, password, client_id_fk, created) VALUES (?, ?, ?, ?)');
                                         if ($stmt->execute(array($hubName, $password, $userid, date('Y-m-d H:i:s')))) {
                                             return true;
                                         } else {
                                             throw new Exception('The hub creation failed due to a database error');
                                         }
                                     } else {
                                         throw new Exception('The hub ' . $hubName . ' already exists');
                                     }
                                 } else {
                                     throw new Exception('The hub creation failed due to a database error');
                                 }
                             } else {
                                 throw new Exception('The hub creation failed due to a database error');
                             }
                         } else {
                             throw new Exception('The hub creation failed due to a database error');
                         }
                         return $password;
                     }
                 }
             } elseif ($return_val == 2) {
                 throw new Exception('The hub name is already in use');
             }
         }
     }
     throw new Exception('The hub ' . $hubName . ' failed to be created');
 }
开发者ID:carriercomm,项目名称:CloudEther,代码行数:49,代码来源:ManageHub.php


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