本文整理汇总了PHP中Agent::validated方法的典型用法代码示例。如果您正苦于以下问题:PHP Agent::validated方法的具体用法?PHP Agent::validated怎么用?PHP Agent::validated使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Agent
的用法示例。
在下文中一共展示了Agent::validated方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Create
function Create($email, $firstname, $lastname, $phone, $password, $repassword, $sendButton = null)
{
$repassword = $repassword == "null" ? null : $repassword;
$agent = new Agent();
$agent->set($firstname, $lastname, $email, $phone, $password);
$agentModel = new AgentModel($agent);
$list = $agentModel->GetUsers();
$this->agentModelView->agent = $agent;
$this->agentModelView->agentList = $list;
if ($agent->validated()) {
if ($password != $repassword) {
Session::set("warning", " Password mis-matched, re-enter passwords again!");
return $this->View($this->agentModelView, "Agent", "Create");
} else {
$this->agentModelView->agentDbModel = $agentModel;
if ($agentModel->Exists()) {
Session::set("warning", "The user with the given email address [{$email}] already exists!");
} else {
try {
//else create the user
if ($agentModel->Create()) {
$sessionID = Validator::UniqueKey(20);
$agentModel->SaveVerificationCode($email, $sessionID);
//create a barcode
$param = new ArrayIterator();
$param->offsetSet("username", $agent->email);
$param->offsetSet("verificationCode", $sessionID);
$url = ContextManager::CreateURL("Agent", "Login", $param);
$imgPath = ContextManager::CreateQRBarcode($url, $agent->agentId);
if ($this->_sendVerificationEmail($agent, $sessionID, $imgPath)) {
//navigate to comfirmation page
return $this->View($agent, "Agent", "Confirmation");
} else {
Session::set("warning", "could not send mail ");
$agentModel->DeleteAgent($email);
}
}
} catch (Exception $err) {
Session::set("warning", $err->getMessage());
}
}
}
// create a database record here
} else {
Session::set("warning", $agent->getError());
}
return $this->View($this->agentModelView, "Agent", "Create");
}