本文整理匯總了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;
}