本文整理汇总了PHP中Model_User::addUser方法的典型用法代码示例。如果您正苦于以下问题:PHP Model_User::addUser方法的具体用法?PHP Model_User::addUser怎么用?PHP Model_User::addUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Model_User
的用法示例。
在下文中一共展示了Model_User::addUser方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionRegister
public function actionRegister()
{
$email = $_POST['email'];
if (!$this->emailCheck($email)) {
echo json_decode(array('status' => 1, 'data' => '你输入的email不合法'));
exit;
}
$objUserModel = new Model_User();
if (!$objUserModel->checkEmail($email)) {
$userInfo = array('email' => $email, 'pwd' => '', 'user_status' => 2);
$objUserModel->addUser($userInfo);
echo json_decode(array('status' => 1, 'data' => '你的email申请通过,请等待审核'));
exit;
//todo::发送邮件功能还需要调整
require_once '../classes/lib/phpmailer/class.phpmailer.php';
try {
$mail = new PHPMailer(true);
$mail->IsSMTP();
$mail->CharSet = 'UTF-8';
//设置邮件的字符编码,这很重要,不然中文乱码
$mail->SMTPAuth = true;
//开启认证
$mail->Port = 25;
$mail->Host = "smtp.163.com";
$mail->Username = "18600440538@163.com";
$mail->Password = "qwe123";
//$mail->IsSendmail(); //如果没有sendmail组件就注释掉,否则出现“Could not execute: /var/qmail/bin/sendmail ”的错误提示
$mail->AddReplyTo("18600440538@163.com", "mckee");
//回复地址
$mail->From = "darwin001@yeah.net";
$mail->FromName = "darwin.cm";
$to = "649049479@qq.com";
$mail->AddAddress($to);
$mail->Subject = "darwin项目申请邮件";
$mail->Body = "<h1>dddd</h1>";
$mail->AltBody = "dddd";
//当邮件不支持html时备用显示,可以省略
$mail->WordWrap = 80;
// 设置每行字符串的长度
//$mail->AddAttachment("f:/test.png"); //可以添加附件
$mail->IsHTML(true);
$mail->Send();
echo json_decode(array('status' => 0, 'data' => '邮件已发送'));
} catch (phpmailerException $e) {
echo json_decode(array('status' => 0, 'data' => '邮件发送失败'));
}
} else {
echo json_decode(array('status' => 1, 'data' => '你的email已经申请过了'));
exit;
}
}
示例2: addOrder
public function addOrder($data)
{
//проверяем наличие пользователя
$email = Arr::get($data, "cb-email", "");
$phone = Arr::get($data, "cb-phone", "");
$name = Arr::get($data, "cb-name", "");
$users = new Model_User();
$user = $users->getUser($email);
if (!$user) {
//создаем нового пользователя
$adduserid = $users->addUser($email, $phone, 1, $name, $phone);
$user = $users->getUser($email);
}
//формируем новый заказ
$result = $this->newOrder($data, $user);
if ($result) {
return $result;
}
}
示例3: _addUser
private function _addUser($username, $password, $email)
{
//load model
$User = new Model_User();
// Check required fields
if (empty($username)) {
return array('error' => 'Please enter a username.');
} elseif (empty($password)) {
return array('error' => 'Please enter a password.');
} elseif (empty($email)) {
return array('error' => 'Please enter a email.');
}
// Add to DB
$User->addUser($username, $password, $email);
return TRUE;
}
示例4: action_finish
public function action_finish()
{
$email_config = Kohana::$config->load("email");
$owner_emails = array("lexa4ok@li.ru");
$owner_pushall_ids = array(8189);
$owner_icq_uins = array(673151743);
$model_base = new Model_Base();
$options = $model_base->getOptions();
$url = URL::base() . 'admin/orders/' . $_POST["order_id"];
// Ссылка на заказ
$sitename = $options['sitename'];
// Название сайта
$icon_url = URL::base() . '/img/pushall_icon.jpg';
$title = "Вам поступил заказ в интернет-магазине \"{$sitename}\"!";
$text = "Кликните для выяснения деталей.";
PC::debug($sitename);
$pushall_options = array("type" => 'unicast', "title" => $title, "text" => $text, "url" => $url, "icon" => $icon_url, "priority" => 1);
// --- Обновление БД -----------------------------------------------------------------------
// Регистрация пользователя
$model_user = new Model_User();
$email = Arr::get($_POST, 'email');
$user = $model_user->getUser($email);
// Пользователь не зарегистрирован
if (!$user) {
$user_data["username"] = $email;
$user_data["pass"] = $model_user->generate_pass();
$user_data["role"] = 4;
$user_data["name"] = Arr::get($_POST, 'name');
$user_data["phone"] = Arr::get($_POST, 'phone');
$add_user_id = $model_user->addUser($user_data);
$user = $model_user->getUser($email);
}
// Регистрация заказа
$order_params = array("name", "phone", "email", "order_id", "delivery_type", "street", "house", "apartment", "access", "floor", "date", "delivery_time", "delivery_point", "comment", "payment_type", "payment_comment", "user_id");
$order_data = array();
foreach ($order_params as $param) {
$order_data[$param] = Arr::get($_POST, $param);
}
$order_data["user_id"] = $user['id'];
$model_orders = new Model_Orders();
$model_orders->finishOrder($order_data);
$model_email = new Model_Email();
$model_email->addSubscriber($order_data["email"], $order_data["name"]);
// --- /Обновление БД ----------------------------------------------------------------------
// --- Отправка уведомлений ----------------------------------------------------------------
include APPPATH . '/classes/Pushes.class.php';
$pushes = new Pushes();
// Уведомление в браузер
foreach ($owner_pushall_ids as $owner_pushall_id) {
$pushes->pushall_send(array_merge($pushall_options, array("uid" => $owner_pushall_id)), 'get');
}
// Уведомление в аську
foreach ($owner_icq_uins as $owner_icq_uin) {
$pushes->icq_send($owner_icq_uin, "Вам поступил заказ в интернет-магазине!\n\tПодробнее: " . $url);
}
// Отправка почты
//$subject = 'Поступила заявка с сайта ' . $sitename . ' от ' .$order_data['name'];
$subject = 'Поступила заявка с сайта ' . '"' . $sitename . '"';
$from = $email_config['options']['username'];
$message = '<h2>Новая заявка</h2>';
$message .= 'Отправитель: <b>' . $order_data['name'] . ', </b><br>';
$message .= 'Тел: <b>' . $order_data['phone'] . ', </b><br>';
$message .= '<em>Отправлено: ' . date("d.m.Y H:i:s") . '</em>';
$message .= '<p><a href="' . $url . '">Подробнее</a></p>';
foreach ($owner_emails as $owner_email) {
$pushes->mail_send($owner_email, $from, $subject, $message);
}
$model = array("order_id" => $order_data["order_id"]);
// Подключение шаблона
$this->set_template('widgets/w_success_ordering.php')->render($model)->body();
// --- /Отправка уведомлений ---------------------------------------------------------------
}