本文整理汇总了PHP中CommonFunctions::getRandomNumberPassword方法的典型用法代码示例。如果您正苦于以下问题:PHP CommonFunctions::getRandomNumberPassword方法的具体用法?PHP CommonFunctions::getRandomNumberPassword怎么用?PHP CommonFunctions::getRandomNumberPassword使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CommonFunctions
的用法示例。
在下文中一共展示了CommonFunctions::getRandomNumberPassword方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addAction
public function addAction()
{
$this->view->messages = $this->_flashMessenger->getMessages();
$this->_helper->layout->disableLayout();
$formData = array();
$formErrors = array();
$formData = $this->getRequest()->getPost();
if ($this->getRequest()->isPost() && isset($formData['add_author']) && $formData['add_author'] == 'Add Author') {
$formData = $this->getRequest()->getPost();
if (!isset($formData['first_name']) || trim($formData['first_name']) == "") {
$formErrors['first_name'] = "Please enter first name";
}
if (!isset($formData['last_name']) || trim($formData['last_name']) == "") {
$formErrors['last_name'] = "Please enter last name";
}
if (isset($formData['emailid']) && trim($formData['emailid']) != "") {
if (!CommonFunctions::isValidEmail($formData['emailid'])) {
if (!array_key_exists('emailid', $formErrors)) {
$formErrors['emailid'] = "Please enter valid email";
}
}
}
if ($formData['emailid'] != '') {
if ($this->modelAuthor->isExist('emailid="' . $formData['emailid'] . '" and parent_id!="0"')) {
if (!array_key_exists('emailid', $formErrors)) {
$formErrors['emailid'] = "Email already exist";
}
}
}
if (count($formErrors) == 0) {
if ($this->getRequest()->isPost()) {
$activationCode = CommonFunctions::generateGUID();
$add_time = date('Y-m-d H:i:s');
$formData['password'] = CommonFunctions::getRandomNumberPassword(8);
$formData['parent_publisher_id'] = !empty($this->sessPublisherInfo->id) ? $this->sessPublisherInfo->id : 0;
$username_array = explode("@", $formData['emailid']);
$formData['username'] = $username_array[0];
$authorData = array('user_type' => 'author', 'parent_id' => $formData['parent_publisher_id'], 'username' => $formData['username'], 'emailid' => $formData['emailid'], 'password' => $formData['password'], 'first_name' => $formData['first_name'], 'last_name' => $formData['last_name'], 'phone' => $formData['phone'], 'profile_status' => '1', 'updated_date' => date("Y-m-d H:i:s"), 'add_time' => $add_time);
$lastId = $this->modelAuthor->insert($authorData);
if ($lastId > 0) {
$this->_flashMessenger->addMessage('<div class="div-success">Author Added successfully</div>');
$this->_redirect('publisher/author/index/tab_ajax/author/');
}
}
} else {
$this->view->errorMessage = '<div class="div-error">Please enter required fields to register.</div>';
}
} else {
$formData['user_type'] = "";
$formData['first_name'] = "";
$formData['last_name'] = "";
$formData['emailid'] = "";
$formData['password'] = "";
}
$this->view->formData = $formData;
$this->view->formErrors = $formErrors;
}
示例2: createAction
public function createAction()
{
$this->view->messages = $this->_flashMessenger->getMessages();
$this->_helper->layout->disableLayout();
$formData = array();
$formErrors = array();
$formData = $this->getRequest()->getPost();
//print_r($formData);exit;
if ($this->getRequest()->isPost() && isset($formData['create_group']) && $formData['create_group'] == 'Create') {
if (!isset($formData['user_type']) || trim($formData['user_type']) == "") {
$formErrors['user_type'] = "Please select user type ";
}
if (!isset($formData['first_name']) || trim($formData['first_name']) == "") {
$formErrors['first_name'] = "Please enter first name";
}
if (!isset($formData['last_name']) || trim($formData['last_name']) == "") {
$formErrors['last_name'] = "Please enter last name";
}
if (!isset($formData['emailid']) || trim($formData['emailid']) == "") {
$formErrors['emailid'] = "Please enter email";
}
/*if(!(isset($formData['password'])) || trim($formData['password'])=="")
{
$formErrors['password']="Please enter password";
}
*/
if (!CommonFunctions::isValidEmail($formData['emailid'])) {
if (!array_key_exists('emailid', $formErrors)) {
$formErrors['emailid'] = "Please enter valid email";
}
}
/*if($this->modelGroup->isExist('username="'.$formData['username'].'"'))
{
if(!(array_key_exists('username',$formErrors)))
{
$formErrors['username']="Username already exist";
}
}
*/
if ($this->modelPublisher->isExist('emailid="' . $formData['emailid'] . '"') || $this->modelCompany->isExist('user_email="' . $formData['emailid'] . '"')) {
if (!array_key_exists('emailid', $formErrors)) {
$formErrors['emailid'] = "Email already exist";
}
}
if (count($formErrors) == 0) {
if ($this->getRequest()->isPost()) {
$activationCode = CommonFunctions::generateGUID();
$add_time = date('Y-m-d H:i:s');
$formData['password'] = CommonFunctions::getRandomNumberPassword(8);
$formData['publisher_author_id'] = !empty($this->parentPublisherId) ? $this->parentPublisherId : 0;
$username_array = explode("@", $formData['emailid']);
$formData['username'] = $username_array[0];
$groupUserData = array('parent_id' => $formData['publisher_author_id'], 'user_type' => $formData['user_type'], 'username' => $formData['username'], 'emailid' => $formData['emailid'], 'password' => $formData['password'], 'first_name' => $formData['first_name'], 'last_name' => $formData['last_name'], 'phone' => $formData['phone'], 'profile_status' => '1', 'updated_date' => date("Y-m-d H:i:s"), 'add_time' => $add_time);
$lastId = $this->modelPublisher->insert($groupUserData);
//$lastId=$this->modelGroup->insert($groupUserData);
if ($lastId > 0) {
$mailhost = SMTP_SERVER;
$mailconfig = array('ssl' => SMTP_SSL, 'port' => SMTP_PORT, 'auth' => SMTP_AUTH, 'username' => SMTP_USERNAME, 'password' => SMTP_PASSWORD);
$transport = new Zend_Mail_Transport_Smtp($mailhost, $mailconfig);
Zend_Mail::setDefaultTransport($transport);
$message = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Electronic Vendor Ltd</title>
<style type="text/css">
body{
margin:0;
padding:0px;
}
#container{
width:700px;
margin:0 auto;
}
#header{
width:700px;
float:left;
padding:40px 0 10px 0;
font-family:Arial, Helvetica, sans-serif;
color:#3A3B3F;
text-align:center;
font-size:11px;
}
#header a{
color:#3A3B3F;
font-weight:bold;
text-decoration:none;
}
#header a:hover{
color:#40BBE3;
}
#logopart
{
border:0px solid red;
width:698px;
height:140px;
background-color:#1B75BB;
margin-left:0px;
}
//.........这里部分代码省略.........
示例3: createAction
public function createAction()
{
$this->view->messages = $this->_flashMessenger->getMessages();
$this->_helper->layout->disableLayout();
$formData = array();
$formErrors = array();
$formData = $this->getRequest()->getPost();
//print_r($formData);exit;
if ($this->getRequest()->isPost() && isset($formData['create_member']) && $formData['create_member'] == 'Create') {
if (!isset($formData['group_id']) || empty($formData['group_id'])) {
$formErrors['group_id'] = "Please select a group";
}
if (!isset($formData['first_name']) || trim($formData['first_name']) == "") {
$formErrors['first_name'] = "Please enter first name";
}
if (!isset($formData['last_name']) || trim($formData['last_name']) == "") {
$formErrors['last_name'] = "Please enter last name";
}
if (!isset($formData['user_email']) || trim($formData['user_email']) == "") {
$formErrors['user_email'] = "Please enter email";
}
if (!isset($formData['user_password']) || trim($formData['user_password']) == "") {
$formErrors['user_password'] = "Please enter password";
}
if (!CommonFunctions::isValidEmail($formData['user_email'])) {
if (!array_key_exists('user_email', $formErrors)) {
$formErrors['user_email'] = "Please enter valid email";
}
}
/*if($this->modelCompany->isExist('username="'.$formData['username'].'"'))
{
if(!(array_key_exists('username',$formErrors)))
{
$formErrors['username']="Username already exist";
}
}
*/
if ($this->modelCompany->isExistCompany('user_email="' . $formData['user_email'] . '" and (account_type="1" or account_type="3")') || $this->modelPublisher->isExist('emailid="' . $formData['user_email'] . '"')) {
if (!array_key_exists('user_email', $formErrors)) {
$formErrors['user_email'] = "Email already exist for company or member of company or publisher";
}
}
if ($this->modelCompany->isExist('user_email="' . $formData['user_email'] . '" and (parent_id!="0" or group_id!="0")')) {
if (!array_key_exists('user_email', $formErrors)) {
$formErrors['user_email'] = "Email already member of a group.";
}
}
if (count($formErrors) == 0) {
if ($this->getRequest()->isPost()) {
$groupName = $this->modelGroup->getInfoByGroupId($formData['group_id']);
########################## get user who are not publisher,company and member of other company ######################
$memberData = $this->modelCompany->getNonMemberUser($formData['user_email']);
if (count($memberData) > 0) {
//$groupName = $this->modelGroup->getInfoByGroupId($formData['group_id']);
$activationCode = CommonFunctions::generateGUID();
$add_time = date('Y-m-d H:i:s');
$formData['user_password'] = empty($formData['user_password']) ? CommonFunctions::getRandomNumberPassword(8) : $formData['user_password'];
$formData['company_id'] = !empty($this->sessCompanyInfo->id) ? $this->sessCompanyInfo->id : 0;
$MemberUserData = array('parent_id' => $formData['company_id'], 'group_varify_id' => $formData['group_id'], 'user_email' => $formData['user_email'], 'account_type' => 3, 'status' => '1', 'updated_date' => date("Y-m-d H:i:s"), 'activation_code' => $activationCode, 'added_date' => $add_time);
$group_id = $formData['group_id'];
$lastId = $this->modelCompany->update($MemberUserData, "id='" . $memberData[0]['id'] . "'");
if ($memberData[0]['id'] != '') {
$mailhost = SMTP_SERVER;
$mailconfig = array('ssl' => SMTP_SSL, 'port' => SMTP_PORT, 'auth' => SMTP_AUTH, 'username' => SMTP_USERNAME, 'password' => SMTP_PASSWORD);
$transport = new Zend_Mail_Transport_Smtp($mailhost, $mailconfig);
Zend_Mail::setDefaultTransport($transport);
$varification_url = $this->view->serverUrl() . $this->view->baseUrl() . '/user/register/groupverification/code/' . $activationCode . '/id/' . $group_id;
$message = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Electronic Vendor Ltd</title>
<style type="text/css">
body{
margin:0;
padding:0px;
}
#container{
width:700px;
margin:0 auto;
}
#header{
width:700px;
float:left;
padding:40px 0 10px 0;
font-family:Arial, Helvetica, sans-serif;
color:#3A3B3F;
text-align:center;
font-size:11px;
}
#header a{
color:#3A3B3F;
font-weight:bold;
text-decoration:none;
}
#header a:hover{
color:#40BBE3;
}
#logopart
//.........这里部分代码省略.........