本文整理汇总了PHP中genRandomString函数的典型用法代码示例。如果您正苦于以下问题:PHP genRandomString函数的具体用法?PHP genRandomString怎么用?PHP genRandomString使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了genRandomString函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: activated
function activated($key, $hash_email)
{
$this->db->where("BINARY(activation_reset_key)", $key);
//"BINARY column_name = '$var'"
//$sql = "'BINARY user = '.$username.'";
/*$query = $this->db->get_compiled_select("tbl_users");
echo $query; exit;*/
$query = $this->db->get("tbl_users");
if ($query->num_rows() > 0) {
foreach ($query->result_array() as $row) {
if ($hash_email === sha1(md5($row['email']))) {
$this->db->set('activation_reset_key', genRandomString('42'));
$this->db->set('verification_status', 1);
$this->db->where('email', $row['email']);
if ($this->db->update('tbl_users')) {
return $row['email'];
} else {
return false;
}
}
}
return false;
} else {
//echo "can't find either the key or the email."; exit;
return false;
}
}
开发者ID:rajanpkr,项目名称:jobportal,代码行数:27,代码来源:registration_model.php
示例2: encryptUserInfo
function encryptUserInfo($user_id, $mobile)
{
$output = "";
// 2位随机字母
$output .= genRandomString(2);
// 用户id
$output .= encryptNumToAlphabet(strval($user_id));
// 分隔符
$output .= 'z';
// 用户手机号,以随机字母间隔
$encryptMobile = encryptNumToAlphabet($mobile);
for ($i = 0; $i < strlen($encryptMobile); $i++) {
$output .= genRandomString(1);
$output .= $encryptMobile[$i];
}
// 分隔符
$output .= 'z';
// 年月日时,以随机字母间隔
$time = date("YmdH", time());
$encryptTime = encryptNumToAlphabet($time);
for ($i = 0; $i < strlen($encryptTime); $i++) {
$output .= genRandomString(1);
$output .= $encryptTime[$i];
}
// 2位随机字母
$output .= genRandomString(2);
return $output;
}
开发者ID:NAMEs,项目名称:Utility,代码行数:28,代码来源:emailactivate.php
示例3: update_pw
public function update_pw($email, $password)
{
$data = array('pw_reset_key' => genRandomString("42"), 'password' => $password);
$this->db->where('email', $this->session->userdata('admin_email'));
if ($this->db->update('tbl_admin', $data)) {
return true;
} else {
return false;
}
}
开发者ID:rajanpkr,项目名称:jobportal,代码行数:10,代码来源:login_model.php
示例4: userRegisters
public function userRegisters($username, $password)
{
//检查用户名
$encrypt = genRandomString(6);
$password = md5($password);
$data = array('uname' => $username, "upassword" => $password, 'authkey' => $encrypt);
dump($data);
$userid = $this->add($data);
dump($userid);
if ($userid) {
return $userid;
}
$this->error = $this->getError() ?: '注册失败!';
return false;
}
开发者ID:gzwyufei,项目名称:hp,代码行数:15,代码来源:UserModel.class.php
示例5: ChangePassword
/**
* 根据标识修改对应用户密码
* @param type $identifier
* @param type $password
* @return type
*/
public function ChangePassword($identifier, $password)
{
if (empty($identifier) || empty($password)) {
return false;
}
$term = array();
if (is_int($identifier)) {
$term['id'] = $identifier;
} else {
$term['username'] = $identifier;
}
$verify = genRandomString();
$data['verify'] = $verify;
$data['password'] = $this->encryption($identifier, $password, $verify);
$up = $this->where($term)->save($data);
if ($up !== false) {
return true;
}
return false;
}
开发者ID:BGCX262,项目名称:ztoa-svn-to-git,代码行数:26,代码来源:UserModel.class.php
示例6: editUser
/**
* 修改会员信息
* @param $data
* @return boolean
*/
public function editUser($data)
{
if (empty($data) || !is_array($data) || !isset($data['userid'])) {
$this->error = '没有需要修改的数据!';
return false;
}
$info = $this->where(array('userid' => $data['userid']))->find();
if (empty($info)) {
$this->error = '该会员信息不存在!';
return false;
}
//密码为空,表示不修改密码
if (isset($data['upassword']) && empty($data['upassword'])) {
unset($data['upassword']);
}
if ($this->create($data)) {
if ($this->data['upassword']) {
$this->authkey = genRandomString(6);
$this->upassword = $this->hashPassword($this->upassword, $this->authkey);
}
if ($info['ifrz'] == false && $data['ifrz'] == true) {
$today = date('Y年m月d日', time());
insertSysmsg($info['userid'], '获嘉您升级为烘焙师', '恭喜您于' . $today . '申请认证烘焙师已审核通过,继续努力哦!');
}
$status = $this->save();
if (false !== $status) {
if ($data['uavatar']) {
service("Attachment")->api_update('', 'userid-ua' . $data['userid'], 1);
}
if ($data['ubackground']) {
service("Attachment")->api_update('', 'userid-ua' . $data['userid'], 1);
}
}
return $status !== false ? true : false;
}
return false;
}
开发者ID:gzwyufei,项目名称:hp,代码行数:42,代码来源:UserModel.class.php
示例7: processUserPwdResetForm
/**
* Process password reset user form.
*
* @since 1.0
* @package facileManager
*
* @param string $user_login Username to authenticate
* @return boolean
*/
function processUserPwdResetForm($user_login = null)
{
global $fmdb;
if (empty($user_login)) {
return;
}
$user_info = getUserInfo(sanitize($user_login), 'user_login');
/** If the user is not found, just return lest we give away valid user accounts */
if ($user_info == false) {
return true;
}
$fm_login = $user_info['user_id'];
$uniqhash = genRandomString(mt_rand(30, 50));
$query = "INSERT INTO fm_pwd_resets VALUES ('{$uniqhash}', '{$fm_login}', " . time() . ")";
$fmdb->query($query);
if (!$fmdb->rows_affected) {
return false;
}
/** Mail the reset link */
$mail_enable = getOption('mail_enable');
if ($mail_enable) {
$result = $this->mailPwdResetLink($fm_login, $uniqhash);
if ($result !== true) {
$query = "DELETE FROM fm_pwd_resets WHERE pwd_id='{$uniqhash}' AND pwd_login='{$fm_login}'";
$fmdb->query($query);
return $result;
}
}
return true;
}
开发者ID:Vringe,项目名称:facileManager,代码行数:39,代码来源:class_logins.php
示例8: userRegister
/**
* 注册会员
* @param type $username 用户名
* @param type $password 明文密码
* @param type $email 邮箱
* @return boolean
*/
public function userRegister($username, $password)
{
//检查用户名
$ckname = $this->userCheckUsername($username);
if ($ckname !== true) {
return false;
}
$Member = D("User/User");
$encrypt = genRandomString(6);
$password = $Member->encryption(0, $password, $encrypt);
$data = array("uname" => $username, "upassword" => $password, "authkey" => $encrypt);
$userid = $Member->add($data);
if ($userid) {
return $userid;
} else {
$this->error = $Member->getError() ?: '注册失败!';
return false;
}
}
开发者ID:gzwyufei,项目名称:hp,代码行数:26,代码来源:Passport.class.php
示例9: amendManager
/**
* 修改管理员信息
* @param type $data
*/
public function amendManager($data)
{
if (empty($data) || !is_array($data) || !isset($data['id'])) {
$this->error = '没有需要修改的数据!';
return false;
}
$info = $this->where(array('id' => $data['id']))->find();
if (empty($info)) {
$this->error = '该管理员不存在!';
return false;
}
//密码为空,表示不修改密码
if (isset($data['password']) && empty($data['password'])) {
unset($data['password']);
}
if ($this->create($data)) {
if ($this->data['password']) {
$verify = genRandomString(6);
$this->verify = $verify;
$this->password = $this->hashPassword($this->password, $verify);
}
$status = $this->save();
return $status !== false ? true : false;
}
return false;
}
开发者ID:sandom123,项目名称:king400,代码行数:30,代码来源:UserModel.class.php
示例10: db_connect
<?php
//TODO: unexistant user.
include_once "../../includes/general.php";
include_once "../../includes/db.include.php";
include_once "../../includes/mail.include.php";
db_connect();
$_SESSION['reset_email'] = mysql_real_escape_string($_POST['email']);
if (trim($_POST["email"]) == "") {
$_SESSION['ResetMessage'] = "You must input an email address.\n";
$_SESSION['ResetType'] = 3;
$_SESSION['ResetDetails'] = $_SESSION['ResetDetails'] . "Input your email address so we can send you your password.<br />";
go("../reset_pass.php");
}
$newpassdisplay = genRandomString();
$newpass = mysql_real_escape_string(md5($newpassdisplay));
//update
$query = "UPDATE Scientists SET password = '" . $newpass . "', loginstep = 1 WHERE email = '" . $_SESSION['reset_email'] . "';";
$result = mysql_query($query);
$mail = generatePassMail($_SESSION['reset_email'], "Password Reset", $newpassdisplay, "You will be prompted to change the password as soon as you log in.");
$_SESSION['LoginMessage'] = "Password reset successful.";
$_SESSION['LoginDetails'] = "An email was sent to " . $_SESSION['reset_email'] . " with a new password. You will be asked to change the password upon your first login.";
$_SESSION['LoginType'] = 1;
go("../login.php");
?>
开发者ID:purdue-epics-wise,项目名称:AMBI,代码行数:25,代码来源:reset_pass.post.php
示例11: keys
private function keys()
{
$path = APP_PATH . 'Conf/dataconfig.php';
if (is_writable($path) == false) {
exit(serialize(array('error' => -10007, 'status' => 'fail')));
}
//读取数据
$config = (include $path);
if (empty($config)) {
exit(serialize(array('error' => -10018, 'status' => 'fail')));
}
//开始更新
$config['AUTHCODE'] = genRandomString(30);
if (F('dataconfig', $config, APP_PATH . 'Conf/')) {
//删除缓存
$Dir = new Dir();
$Dir->del(RUNTIME_PATH);
exit(serialize(array('authcode' => $config['AUTHCODE'], 'status' => 'success')));
} else {
exit(serialize(array('error' => -10019, 'status' => 'fail')));
}
}
开发者ID:NeilFee,项目名称:vipxinbaigo,代码行数:22,代码来源:IndexAction.class.php
示例12: mysql_query
mysql_query("UPDATE `{$dbPrefix}config` SET `value` = '{$seo_description}' WHERE varname='siteinfo'");
mysql_query("UPDATE `{$dbPrefix}config` SET `value` = '{$seo_keywords}' WHERE varname='sitekeywords'");
//读取配置文件,并替换真实配置数据
$strConfig = file_get_contents(SITEDIR . 'install/' . $configFile);
$strConfig = str_replace('#DB_HOST#', $dbHost, $strConfig);
$strConfig = str_replace('#DB_NAME#', $dbName, $strConfig);
$strConfig = str_replace('#DB_USER#', $dbUser, $strConfig);
$strConfig = str_replace('#DB_PWD#', $dbPwd, $strConfig);
$strConfig = str_replace('#DB_PORT#', $dbPort, $strConfig);
$strConfig = str_replace('#DB_PREFIX#', $dbPrefix, $strConfig);
$strConfig = str_replace('#AUTHCODE#', genRandomString(18), $strConfig);
$strConfig = str_replace('#COOKIE_PREFIX#', genRandomString(6) . "_", $strConfig);
@file_put_contents(SITEDIR . '/shuipf/Conf/dataconfig.php', $strConfig);
//插入管理员
//生成随机认证码
$verify = genRandomString(6);
$time = time();
$ip = get_client_ip();
$password = md5($password . md5($verify));
$query = "INSERT INTO `{$dbPrefix}user` VALUES ('1', '{$username}', '未知', '{$password}', '', '{$time}', '0.0.0.0', '{$verify}', '[email protected]', '备注信息', '{$time}', '{$time}', '1', '1', '');";
mysql_query($query);
$message = '成功添加管理员<br />成功写入配置文件<br>安装完成.';
$arr = array('n' => 999999, 'msg' => $message);
echo json_encode($arr);
exit;
}
include_once "./templates/s4.php";
exit;
case '5':
include_once "./templates/s5.php";
@touch('./install.lock');
开发者ID:BGCX262,项目名称:ztoa-svn-to-git,代码行数:31,代码来源:index.php
示例13: forget
/**
* 忘记密码
*/
public function forget()
{
if ($_POST) {
if ($this->userid) {
$this->error("你已经登录了", '/');
}
$post = I('post.');
if (empty($post['uname'])) {
$this->error("请输入你的注册邮箱");
}
if (!is_email($post['uname'])) {
$this->error("请输入正确的邮箱格式");
}
$user = M('User')->where(array('uname' => $post['uname']))->field("uemail, userid")->find();
if (!$user['userid']) {
$this->error("你输入注册邮箱不存在");
}
$is_exist = M('UserRelog')->where(array('userid' => $user['userid']))->count();
if ($is_exist > 0) {
$info['vcode'] = genRandomString(6);
$info['create_time'] = time();
$id = M('UserRelog')->where(array('userid' => $user['userid']))->save($info);
} else {
$info['userid'] = $user['userid'];
$info['vcode'] = genRandomString(6);
$info['create_time'] = time();
$id = M('UserRelog')->add($info);
}
//SendMail($address, $title, $message);
if ($id) {
$address = $post['uname'];
$title = "修改密码";
$url = "http://" . $_SERVER['HTTP_HOST'] . "/user/login/repwd?userid=" . $user['userid'] . "&vcode=" . $info['vcode'];
$message = "欢迎使用烘焙圈,点击<a href='{$url}' target='_blank'>修改密码</a>,链接有效期为3天";
if (SendMail($address, $title, $message)) {
$this->success("邮件发送成功,请在3天内修改密码", "/");
} else {
$this->error("邮件发送失败");
}
} else {
$this->error("系统繁忙");
}
} else {
$this->display();
}
}
开发者ID:gzwyufei,项目名称:hp,代码行数:49,代码来源:LoginController.class.php
示例14: exec_ogp_module
function exec_ogp_module()
{
global $db;
global $view;
echo "<h2>" . get_lang('add_new_game_home') . "</h2>";
echo "<p><a href='?m=user_games'><< " . get_lang('back_to_game_servers') . "</a></p>";
$remote_servers = $db->getRemoteServers();
if ($remote_servers === FALSE) {
echo "<p class='note'>" . get_lang('no_remote_servers_configured') . "</p>\n\t\t\t <p><a href='?m=server'>" . get_lang('add_remote_server') . "</a></p>";
return;
}
$game_cfgs = $db->getGameCfgs();
$users = $db->getUserList();
if ($game_cfgs === FALSE) {
echo "<p class='note'>" . get_lang('no_game_configurations_found') . " <a href='?m=config_games'>" . get_lang('game_configurations') . "</a></p>";
return;
}
echo "<p> <span class='note'>" . get_lang('note') . ":</span> " . get_lang('add_mods_note') . "</p>";
$selections = array("allow_updates" => "u", "allow_file_management" => "f", "allow_parameter_usage" => "p", "allow_extra_params" => "e", "allow_ftp" => "t", "allow_custom_fields" => "c");
if (isset($_REQUEST['add_game_home'])) {
$rserver_id = $_POST['rserver_id'];
$home_cfg_id = $_POST['home_cfg_id'];
$web_user_id = trim($_POST['web_user_id']);
$control_password = genRandomString(8);
$access_rights = "";
$ftp = FALSE;
foreach ($selections as $selection => $flag) {
if (isset($_REQUEST[$selection])) {
$access_rights .= $flag;
if ($flag == "t") {
$ftp = TRUE;
}
}
}
if (empty($web_user_id)) {
print_failure(get_lang('game_path_empty'));
} else {
foreach ($game_cfgs as $row) {
if ($row['home_cfg_id'] == $home_cfg_id) {
$server_name = $row['game_name'];
}
}
foreach ($remote_servers as $server) {
if ($server['remote_server_id'] == $rserver_id) {
$ogp_user = $server['ogp_user'];
}
}
foreach ($users as $user) {
if ($user['user_id'] == $web_user_id) {
$web_user = $user['users_login'];
}
}
$ftppassword = genRandomString(8);
$game_path = "/home/" . $ogp_user . "/OGP_User_Files/";
if (($new_home_id = $db->addGameHome($rserver_id, $web_user_id, $home_cfg_id, clean_path($game_path), $server_name, $control_password, $ftppassword)) !== FALSE) {
$db->assignHomeTo("user", $web_user_id, $new_home_id, $access_rights);
if ($ftp) {
$home_info = $db->getGameHomeWithoutMods($new_home_id);
require_once 'includes/lib_remote.php';
$remote = new OGPRemoteLibrary($home_info['agent_ip'], $home_info['agent_port'], $home_info['encryption_key']);
$host_stat = $remote->status_chk();
if ($host_stat === 1) {
$remote->ftp_mgr("useradd", $home_info['home_id'], $home_info['ftp_password'], $home_info['home_path']);
}
$db->changeFtpStatus('enabled', $new_home_id);
}
print_success(get_lang('game_home_added'));
$db->logger(get_lang('game_home_added') . " ({$server_name})");
$view->refresh("?m=user_games&p=edit&home_id={$new_home_id}");
} else {
print_failure(get_lang_f("failed_to_add_home_to_db", $db->getError()));
}
}
}
// View form to add more servers.
if (!isset($_POST['rserver_id'])) {
echo "<form action='?m=user_games&p=add' method='post'>";
echo "<table class='center'>";
echo "<tr><td class='right'>" . get_lang('game_server') . "</td><td class='left'><select onchange=" . '"this.form.submit()"' . " name='rserver_id'>\n";
echo "<option>" . get_lang('select_remote_server') . "</option>\n";
foreach ($remote_servers as $server) {
echo "<option value='" . $server['remote_server_id'] . "'>" . $server['remote_server_name'] . " (" . $server['agent_ip'] . ")</option>\n";
}
echo "</select>\n";
echo "</form>";
echo "</td></tr></table>";
} else {
if (isset($_POST['rserver_id'])) {
$rhost_id = $_POST['rserver_id'];
}
$remote_server = $db->getRemoteServer($rhost_id);
require_once 'includes/lib_remote.php';
$remote = new OGPRemoteLibrary($remote_server['agent_ip'], $remote_server['agent_port'], $remote_server['encryption_key']);
$host_stat = $remote->status_chk();
if ($host_stat === 1) {
$os = $remote->what_os();
} else {
print_failure(get_lang_f("caution_agent_offline_can_not_get_os_and_arch_showing_servers_for_all_platforms"));
$os = "Unknown OS";
}
//.........这里部分代码省略.........
开发者ID:jamiebatch452,项目名称:Open-Game-Panel,代码行数:101,代码来源:add_home.php
示例15: preg_split
}
return $string;
}
if ($get != $null) {
echo "{\n";
if ($get != "/") {
$splitted = preg_split("/\\./", $get);
foreach ($splitted as $a) {
if ($a != "/") {
echo "\"" . $a . "\": {\n";
}
}
}
for ($i = 0; $i < rand(1, 7); $i++) {
$text = genRandomString();
echo "\n\"randomFromAjax_" . $text . "\":null,";
}
$text = genRandomString();
echo "\n\"" . $text . "\":null";
if ($get != "/") {
$splitted = preg_split("/\\./", $get);
foreach ($splitted as $a) {
if ($a != "/") {
echo "\n\n}";
}
}
}
echo "\n}";
} else {
echo "null";
}
开发者ID:NKjoep,项目名称:MooContentAssist,代码行数:31,代码来源:ajax-response.php
示例16: genRandomString
$values = null;
$statusmsg = 'updated';
switch($status){
// OPEN
case "0":
$values .= "serviceTypeID = '$serviceType',equipmentID = '$equipment',meter = '$meter'
,labor = '$labor',miscellaneous = '$misc',parts = '$parts',discount = '$disc',subTotal = '$subTotal',tax = '$tax',totalCost = '$totalCost'
,isWarranty = '$isWarranty',isBackJob = '$isBackJob',remarks = '$remarks' ";
$statusmsg = 'updated';
break;
// APPROVED
case "1":
if($isSent == 0){
$sesid = genRandomString(10);
$sesid = ",url = '$sesid'";
$values .= "serviceTypeID = '$serviceType',equipmentID = '$equipment',meter = '$meter'
,labor = '$labor',miscellaneous = '$misc',parts = '$parts',discount = '$disc',subTotal = '$subTotal',tax = '$tax',totalCost = '$totalCost'
,isWarranty = '$isWarranty',isBackJob = '$isBackJob',remarks = '$remarks'
$sesid ,status = '$status',remarks = '$remarks' ";
$statusmsg = 'updated and is waiting for approval';
}
break;
// FOR APPROVAL
case "2":
$values .= "labor = '$labor',miscellaneous = '$misc',parts = '$parts',discount = '$disc',tax = '$tax',totalCost = '$totalCost'
";
$statusmsg = 'updated and is waiting for repair';
break;
开发者ID:rogerapras,项目名称:fms,代码行数:30,代码来源:workorderController.php
示例17: sanitize_file_name
$generatephp = 'cp ' . $htmlpath . '/' . sanitize_file_name($archivo['filename']) . '-o.html ' . $htmlpath . '/' . sanitize_file_name($archivo['filename']) . '-o.php 2>&1';
exec($generatephp, $outphp);
$outphp = implode("\n", $outphp);
update_post_meta($post_ID, 'output_php', $outphp);
update_post_meta($post_ID, 'all2html_php', $uppath . '/' . sanitize_file_name($archivo['filename']) . '-o.php');
$html_plain = file_get_contents($htmlpath . '/' . sanitize_file_name($archivo['filename']) . '-o.php');
$content = preg_replace('/<img class=\\"(.*?)\\" alt=\\"\\" src=\\"(.*?)\\"\\/>/s', '<img class="$1" alt="" src="' . $uppath . '/$2"/>', $html_plain);
$filename = $htmlpath . '/' . sanitize_file_name($archivo['filename']) . '-i.php';
$handle = fopen($filename, 'x+');
fwrite($handle, $content);
fclose($handle);
update_post_meta($post_ID, 'all2html_htmlcontent', $uppath . '/' . sanitize_file_name($archivo['filename']) . '-i.php');
preg_match('/<div id=\\"pf3\\" class\\=\\"pf w0 h0\\" data\\-page\\-no\\=\\"3\\">(.*?)<\\/div>/s', $html_plain, $matches);
$excerpt = strip_tags($matches[1]);
update_post_meta($post_ID, 'all2html_excerpt', $excerpt);
update_post_meta($post_ID, 'all2html_hash', genRandomString($pdfoptpath));
// /<img class=\"(.*?)\" alt=\"\" src=\"(.*?)\"\/>/s
}
break;
case 'cinco':
//Se genera el HTML full
if (get_post_meta($post_ID, "all2html_ok", true) == 'ok') {
$pdfoptpath = get_post_meta($post_ID, "all2html_pdfoptpath", true);
$htmlpath = get_post_meta($post_ID, "all2html_path", true);
$uppath = str_replace($_SERVER['DOCUMENT_ROOT'], '', $htmlpath);
$archivo = get_post_meta($post_ID, "all2html_arch", true);
if (wp_mkdir_p($htmlpath . '/fullhtml')) {
$full_html = '/usr/local/bin/pdf2htmlEX --fit-width 1240 --embed cfijo --no-drm 1 --optimize-text 1 --dest-dir ' . $htmlpath . '/fullhtml --external-hint-tool=/usr/local/bin/ttfautohint ' . $pdfoptpath . ' 2>&1';
exec($full_html, $outfull);
$outfull = implode("\n", $outfull);
update_post_meta($post_ID, 'output_full', $outfull);
开发者ID:Gestiopolis,项目名称:GestiopolisExp1,代码行数:31,代码来源:processpdf.php
示例18: genRandomString
// if an action is set then lets do it.
if ($action == "newPad") {
$name = $_GET["name"];
if (!$name) {
function genRandomString()
{
// A funtion to generate a random name if something doesn't already exist
$length = 10;
$characters = '0123456789abcdefghijklmnopqrstuvwxyz';
$string = '';
for ($p = 0; $p < $length; $p++) {
$string .= $characters[mt_rand(0, strlen($characters))];
}
return $string;
}
$name = genRandomString();
}
$contents = $_GET["contents"];
try {
$newPad = $instance->createGroupPad($groupID, $name, $contents);
$padID = $newPad->padID;
$newlocation = "{$host}/p/{$padID}";
// redirect to the new padID location
header("Location: {$newlocation}");
} catch (Exception $e) {
echo "\n\ncreateGroupPad Failed with message " . $e->getMessage();
}
}
if ($action == "deletePad") {
$name = $_GET["name"];
try {
开发者ID:holtzermann17,项目名称:drupal_planetary,代码行数:31,代码来源:example_big.php
示例19: defined
/**
* @title JoomShaper registration module
* @website http://www.joomshaper.com
* @Copyright (C) 2010 - 2012 joomshaper.com. All rights reserved.
* @license GNU/GPL
**/
// no direct access
defined('_JEXEC') or die('Restricted access');
JHtml::_('behavior.keepalive');
JHtml::_('behavior.formvalidation');
$utilfile = JPATH_ROOT . '/media/media_chessvn/cvnphp/utils/cvnutils.php';
$configfile = JPATH_ROOT . '/media/media_chessvn/cvnphp/config/cvnconfig.php';
require_once $utilfile;
require_once $configfile;
$defaultname = $conf['default_email_prefix'] . genRandomString();
$defaultemail = $defaultname . $conf['default_email_domain'];
//$document = JFactory::getDocument();
//$mediaPath = JURI::base() . '/media/media_chessvn/';
//$document->addStyleSheet($mediaPath.'css/jquery-ui-1.10.3.custom.min.css');
?>
<script>
jQuery(document).ready(function(){
function checkuser(username){
var array = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','1','2','3','4','5','6','7','8','9','-','_'];
var check = 0;
username = username.toLowerCase();
for(i = 0; i<username.length; i++){
if(array.indexOf(username[i]) == -1){
check++;
}else{}
开发者ID:khangcodt,项目名称:nvssehcweb,代码行数:30,代码来源:default.php
示例20: loginLocal
/**
* 使用本地账号登陆 (密码为null时不参与验证)
* @param type $identifier 用户标识,用户uid或者用户名
* @param type $password 用户密码,未加密,如果为空,不参与验证
* @param type $is_remember_me cookie有效期
* return 返回状态,大于 0:返回用户 ID,表示用户登录成功
* -1:用户不存在,或者被删除
* -2:密码错
* -3会员注册登陆状态失败
*/
public function loginLocal($identifier, $password = null, $is_remember_me = 3600)
{
$db = D("Member");
if ($this->UCenter) {
$user = uc_user_login($identifier, $password);
if ($user[0] > 0) {
$userid = $user[0];
$username = $user[1];
$ucpassword = $user[2];
$ucemail = $user[3];
$map = array();
$map['userid'] = $userid;
$map['username'] = $username;
//取得本地相应用户
$userinfo = $db->where($map)->find();
//检查是否存在该用户信息
if (!$userinfo) {
//UC中有该用户,本地没有时,创建本地会员数据
$data = array();
$data['userid'] = $userid;
$data['username'] = $username;
$data['nickname'] = $username;
$data['encrypt'] = genRandomString(6);
//随机密码
$data['password'] = $db->encryption(0, $ucpassword, $data['encrypt']);
$data['email'] = $ucemail;
$data['regdate'] = time();
$data['regip'] = get_client_ip();
$data['modelid'] = $this->_config['defaultmodelid'];
$data['point'] = $this->_config['defualtpoint'];
$data['amount'] = $this->_config['defualtamount'];
$data['groupid'] = $db->get_usergroup_bypoint($this->_config['defualtpoint']);
$data['checked'] = 1;
$data['lastdate'] = time();
$data['loginnum'] = 1;
$data['lastip'] = get_client_ip();
$db->add($data);
$Model_Member = F("Model_Member");
$tablename = $Model_Member[$data['modelid']]['tablename'];
M(ucwords($tablename))->add(array("userid" => $userid));
$userinfo = $data;
} else {
//更新密码
$encrypt = genRandomString(6);
//随机密码
$pw = $db->encryption(0, $ucpassword, $encrypt);
$db->where(array("userid" => $userid))->save(array("encrypt" => $encrypt, "password" => $pw, "lastdate" => time(), "lastip" => get_client_ip(), 'loginnum' => $userinfo['loginnum'] + 1));
$userinfo['password'] = $pw;
$userinfo['encrypt'] = $encrypt;
}
if ($this->registerLogin($userinfo, $is_remember_me)) {
//登陆成功
return $userinfo['userid'];
} else {
//会员注册登陆状态失败
return -3;
}
} else {
//登陆失败
return $user[0];
}
} else {
$map = array();
if (is_int($identifier)) {
$map['userid'] = $identifier;
} else {
$map['username'] = $identifier;
}
$userinfo = $db->where($map)->find();
if (!$userinfo) {
//没有该用户
return -1;
}
$encrypt = $userinfo["encrypt"];
$password = $db->encryption($identifier, $password, $encrypt);
if ($password == $userinfo['password']) {
if ($this->registerLogin($userinfo, $is_remember_me)) {
//修改登陆时间,和登陆IP
$db->where($map)->save(array("lastdate" => time(), "lastip" => get_client_ip(), "loginnum" => $userinfo['loginnum'] + 1));
//登陆成功
return $userinfo['userid'];
} else {
//会员注册登陆状态失败
return -3;
}
} else {
//密码错误
return -2;
}
}
//.........这里部分代码省略.........
开发者ID:BGCX262,项目名称:ztoa-svn-to-git,代码行数:101,代码来源:PassportService.class.php
注:本文中的genRandomString函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论