本文整理汇总了PHP中integrate::add_user方法的典型用法代码示例。如果您正苦于以下问题:PHP integrate::add_user方法的具体用法?PHP integrate::add_user怎么用?PHP integrate::add_user使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类integrate
的用法示例。
在下文中一共展示了integrate::add_user方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
/**
* 添加新用户的函数
*
* @access public
* @param string username 用户名
* @param string password 登录密码
* @param string email 邮件地址
* @param string bday 生日
* @param string gender 性别
* @return int 返回最新的ID
*/
function add_user($username, $password, $email, $gender = -1, $bday = 0, $reg_date = 0, $md5password = '')
{
$result = parent::add_user($username, $password, $email, $gender, $bday, $reg_date, $md5password);
if (!$result) {
return false;
}
/* 更新memberdata表 */
$sql = 'INSERT INTO ' . $this->table('memberdata') . ' (' . $this->field_id . ") " . " SELECT " . $this->field_id . " FROM " . $this->table($this->user_table) . " WHERE " . $this->field_name . "='{$username}'";
$this->db->query($sql);
return true;
}
示例2: time
/**
* 添加新用户的函数
*
* @access public
* @param string username 用户名
* @param string password 登录密码
* @param string email 邮件地址
* @param string bday 生日
* @param string gender 性别
* @return int 返回最新的ID
*/
function add_user($username, $password, $email, $gender = -1, $bday = 0, $reg_date = 0, $md5password = '')
{
$result = parent::add_user($username, $password, $email, $gender, $bday, $reg_date, $md5password);
if (!$result) {
return false;
}
/* 获得默认的用户组 */
$sql = 'SELECT groupid FROM ' . $this->table('usergroups') . ' WHERE creditshigher <= 0 AND creditslower > 0';
$grp = $this->db->getOne($sql);
if ($this->charset != 'UTF8') {
$username = ecs_iconv('UTF8', $this->charset, $username);
}
/* 更新组id */
$sql = "UPDATE " . $this->table($this->user_table) . " SET groupid= '{$grp}', " . " regip = '" . real_ip() . "'," . " regdate = '" . time() . "'" . " WHERE " . $this->field_name . "='{$username}'";
$this->db->query($sql);
/* 更新memberfields表 */
$sql = 'INSERT INTO ' . $this->table('memberfields') . ' (' . $this->field_id . ") " . " SELECT " . $this->field_id . " FROM " . $this->table($this->user_table) . " WHERE " . $this->field_name . "='{$username}'";
$this->db->query($sql);
return true;
}
示例3: addslashes
/**
* 添加新用户的函数
*
* @access public
* @param string username 用户名
* @param string password 登录密码
* @param string email 邮件地址
* @param string bday 生日
* @param string gender 性别
* @return int 返回最新的ID
*/
function add_user($username, $password, $email, $gender = -1, $bday = 0, $reg_date = 0, $md5password = '')
{
$result = parent::add_user($username, $password, $email, $gender, $bday, $reg_date, $md5password);
if (!$result) {
return false;
}
$user_title = $this->db->GetOne("SELECT title FROM " . $this->table('usertitle') . " ORDER BY minposts LIMIT 1");
if ($this->charset != 'UTF8') {
$username = ecs_iconv('UTF8', $this->charset, $username);
}
/* 编译密码 */
$salt = addslashes($this->fetch_user_salt());
/* 更新数据 */
$sql = "UPDATE " . $this->table($this->user_table) . " SET " . $this->field_pass . " = '" . $this->compile_password(array('type' => PWD_SUF_SALT, 'password' => $password, 'salt' => $salt)) . "', " . " salt = '{$salt}', " . " ipaddress = '" . real_ip() . "', " . " usergroupid = 2, " . " usertitle = '{$user_title}' " . " WHERE " . $this->field_name . "='{$username}'";
$this->db->query($sql);
$sql = 'INSERT INTO ' . $this->table('userfield') . ' (' . $this->field_id . ") " . " SELECT " . $this->field_id . " FROM " . $this->table($this->user_table) . " WHERE " . $this->field_name . "='{$username}'";
$this->db->query($sql);
$sql = 'INSERT INTO ' . $this->table('usertextfield') . ' (' . $this->field_id . ") " . " SELECT " . $this->field_id . " FROM " . $this->table($this->user_table) . " WHERE " . $this->field_name . "='{$username}'";
$this->db->query($sql);
return true;
}
示例4: VALUES
/**
*
*
* @access public
* @param
*
* @return void
*/
function add_user($username, $password, $email, $gender = -1, $bday = 0, $reg_date = 0, $md5password = '')
{
$result = parent::add_user($username, $password, $email, $gender, $bday, $reg_date, $md5password);
if (!$result) {
return false;
}
$user_id = $this->check_user($username);
if ($user_id > 0) {
$sql = "REPLACE INTO " . $this->table('memberdata') . " (" . $this->field_id . ") VALUES ('{$user_id}')";
$this->db->query($sql);
}
return true;
}