本文整理汇总了PHP中UserData::add方法的典型用法代码示例。如果您正苦于以下问题:PHP UserData::add方法的具体用法?PHP UserData::add怎么用?PHP UserData::add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserData
的用法示例。
在下文中一共展示了UserData::add方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: UserData
<?php
$p = new UserData();
$p->name = $_POST['name'];
$p->email = $_POST['email'];
$p->password = sha1(md5($_POST['password']));
$p->usertype_id = 1;
$p->add();
print "<script>window.location='index.php?view=login';</script>";
示例2: strlen
if (!empty($_POST)) {
if ($_POST["name"] != "" && $_POST["lastname"] != "" && $_POST["email"] != "" && $_POST["password"] != "") {
$user = UserData::getByEmail($_POST["email"]);
if ($user == null) {
$str = "abcdefghijklmopqrstuvwxyz1234567890";
$code = "";
for ($i = 0; $i < 6; $i++) {
$code .= $str[rand(0, strlen($str) - 1)];
}
$user = new UserData();
$user->name = $_POST["name"];
$user->lastname = $_POST["lastname"];
$user->email = $_POST["email"];
$user->password = sha1(md5($_POST["password"]));
$user->code = $code;
$u = $user->add();
$p = new ProfileData();
$p->user_id = $u[1];
$p->add();
$msg = "<body><h1>Registro Exitoso</h1>\r\n\t\t\t\t\t<p>Ahora debes activar tu cuenta en el siguiente link:</p>\r\n\t\t\t\t\t<p><a href='http://youhost/app/index.php?r=index/processactivation&e=" . sha1(md5($_POST["email"])) . "&c=" . sha1(md5($code)) . "'>Activa tu cuenta:</a></p>\r\n\t\t\t\t\t<p>O tambien puedes usar el siguiente codigo de activacion: " . $code . "</p>\r\n\t\t\t\t\t</body>";
mail($_POST["email"], "Registro Exitoso", $msg);
/* $f = fopen (ROOT."/register.txt","w");
fwrite($f, $msg);
fclose($f);
*/
Core::alert("Registro Exitoso!, se ha enviado un correo electronico con los datos necesarios para activar su cuenta.");
Core::redir("./");
} else {
Core::alert("El email proporcionado ya esta registrado.");
Core::redir("./");
}
示例3: UserData
<?php
if (!empty($_POST)) {
$user = new UserData();
$user->name = $_POST["name"];
$user->lastname = $_POST["lastname"];
$user->username = $_POST["username"];
$user->password = sha1(md5($_POST["password"]));
$user->add();
Core::alert("Registro Exitoso!, ya puedes a iniciar sesion con tu nombre de usuario y password.");
Core::redir("./");
}
示例4: sregAction
/**
* 小店注册
*/
public function sregAction()
{
//注册时必填邮箱和手机
if (ComTool::isAjax()) {
if (isset($_POST['captcha'])) {
$captcha = trim($this->post('captcha'));
if (!ComTool::checkCaptcha($captcha)) {
ComTool::ajax(100001, '验证码错误');
}
}
$email = trim($this->post('email'));
ComTool::checkEmpty($email, '请填写常用邮箱');
ComTool::checkMaxLen($email, 32, '邮箱最多32位');
if (!ComTool::isEmail($email)) {
ComTool::ajax(100001, '请填写正确的邮箱');
}
//检查邮箱唯一性
$user = UserData::getByEmail($email);
if ($user) {
ComTool::ajax(100001, '邮箱已被注册');
}
$mobile = '';
$mobile = trim($this->post('mobile'));
ComTool::checkEmpty($mobile, '请填写常用手机号');
if (!ComTool::isMobile($mobile)) {
ComTool::ajax(100001, '请填写正确的手机号');
}
//检查手机唯一性
$user = UserData::getByMobile($mobile);
if ($user) {
ComTool::ajax(100001, '手机号已被注册');
}
$city = trim($this->post('city'));
ComTool::checkEmpty($city, '请选择城市');
$area = trim($this->post('area'));
ComTool::checkEmpty($area, '请选择区域');
$group = trim($this->post('group'));
ComTool::checkEmpty($group, '请选择圈子');
$addr_desc = trim($this->post('addr_desc'));
ComTool::checkEmpty($addr_desc, '请填写详细位置');
ComTool::checkMaxLen($addr_desc, 32, '详细位置最多32位');
$passwd = trim($this->post('passwd'));
ComTool::checkEmpty($passwd, '请输入密码');
ComTool::checkMinMaxLen($passwd, 6, 16, '密码6-16位');
$cpasswd = trim($this->post('cpasswd'));
ComTool::checkEqual($passwd, $cpasswd, '两次输入的密码不同');
$res = UserData::add(array('email' => $email, 'mobile' => $mobile, 'passwd' => md5($passwd), 'create_time' => time(), 'update_time' => time(), 'status' => 1));
/* if ($res === false) {
ComTool::ajax ( 100001, '服务器忙,请重试' );
}
$res = UserGroupData::add ( array (
'user_id' => $res,
'group_id' => $group,
'detail' => $addr_desc,
'status' => 1
) ); */
ComTool::result($res, '服务器忙,请重试', '注册成功,即将跳转');
}
$this->display();
}