本文整理汇总了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');
}