本文整理汇总了PHP中encode_password函数的典型用法代码示例。如果您正苦于以下问题:PHP encode_password函数的具体用法?PHP encode_password怎么用?PHP encode_password使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了encode_password函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: verify_webuser
function verify_webuser($username, $pass)
{
$hash = encode_password($pass);
$data = array("username" => $username, "password" => $hash);
// send to backend
$response = rest_post(API_BASE_URL . "verifyWebUser.token=" . DEVICE_CODE, json_encode($data));
/*if (!response_status($response))
echo "failed";
else
echo "success";*/
return response_status($response);
}
示例2: user_auth
function user_auth($user_name, $user_password)
{
global $_CLASS;
$sql = 'SELECT user_id, username, user_password, user_password_encoding, user_status
FROM ' . USERS_TABLE . " WHERE username = '" . $_CLASS['core_db']->escape($user_name) . "'";
$result = $_CLASS['core_db']->query($sql);
$status = false;
if ($row = $_CLASS['core_db']->fetch_row_assoc($result)) {
if (encode_password($user_password, $row['user_password_encoding']) == $row['user_password']) {
if ($row['user_status'] != STATUS_ACTIVE) {
$status = $row['user_status'] == STATUS_DISABLED ? 'ACTIVE_ERROR' : 'UNACTIVATED_ERROR';
}
return (int) $row['user_id'];
}
}
$_CLASS['core_db']->free_result($result);
return $status;
}
示例3: random_code
$loginKey = random_code(30);
setcookie('kimai_key', $loginKey);
setcookie('kimai_user', $userData['name']);
$database->user_loginSetKey($userId, $loginKey);
header('Location: core/kimai.php');
}
// =================================================================
// = processing login and displaying either login screen or errors =
// =================================================================
switch ($_REQUEST['a']) {
case 'checklogin':
$is_customer = $database->is_customer_name($name);
Kimai_Logger::logfile('login: ' . $name . ($is_customer ? ' as customer' : ' as user'));
if ($is_customer) {
// perform login of customer
$passCrypt = encode_password($password);
$customerId = $database->customer_nameToID($name);
$data = $database->customer_get_data($customerId);
// TODO: add BAN support
if ($data['password'] == $passCrypt && $name != '' && $passCrypt != '') {
$loginKey = random_code(30);
setcookie('kimai_key', $loginKey);
setcookie('kimai_user', 'customer_' . $name);
$database->customer_loginSetKey($customerId, $loginKey);
header('Location: core/kimai.php');
} else {
setcookie('kimai_key', '0');
setcookie('kimai_user', '0');
$view->assign('headline', $kga['lang']['accessDenied']);
$view->assign('message', $kga['lang']['wrongPass']);
$view->assign('refresh', '<meta http-equiv="refresh" content="5;URL=index.php">');
示例4: load_class
if (empty($error)) {
require_once SITE_FILE_ROOT . 'includes/tables.php';
require_once SITE_FILE_ROOT . 'includes/cache/cache.php';
require_once SITE_FILE_ROOT . 'includes/cache/cache_' . $acm_type . '.php';
load_class(false, 'core_cache', 'cache_' . $acm_type);
set_core_config('global', 'site_name', $site_name, false);
set_core_config('server', 'site_domain', $site_domain, false);
set_core_config('server', 'site_path', $site_path, false);
set_core_config('server', 'site_port', $site_port, false);
set_core_config('email', 'site_email', $email, false);
set_core_config('server', 'cookie_domain', $cookie_domain, false);
set_core_config('server', 'cookie_path', $cookie_path, false);
set_core_config('server', 'cookie_name', $cookie_name, false);
set_core_config('server', 'site_secure', 0, false);
set_core_config('user', 'newest_username', $username, true);
$user_update = array('username' => $username, 'user_password' => encode_password($password, 'md5'), 'user_password_encoding' => 'md5', 'user_email' => $email);
$_CLASS['core_db']->query('UPDATE ' . USERS_TABLE . ' SET ' . $_CLASS['core_db']->sql_build_array('UPDATE', $user_update) . ' WHERE user_id = 2');
$_CLASS['core_template']->assign_array(array('admin_link' => generate_link(false, array('full' => true, 'sid' => false, 'admin' => true)), 'username' => $username));
$_CLASS['core_template']->display('installer/complete.html');
script_close();
}
$_CLASS['core_template']->assign_array(array('site_name' => $site_name, 'site_domain' => $site_domain, 'site_path' => $site_path, 'site_port' => $site_port, 'cookie_domain' => $cookie_domain, 'cookie_path' => $cookie_path, 'cookie_name' => $cookie_name, 'username' => $username, 'password' => $password, 'password_confirm' => $password_confirm, 'email' => $email, 'email_confirm' => $email_confirm, 'error' => empty($error) ? false : implode('<br/>', $error), 'config_content' => $config_content));
$_CLASS['core_template']->display('installer/stage3.html');
script_close();
}
if ($stage === 3) {
if ($db_layer && in_array($db_layer, array_keys($database_array))) {
load_class(SITE_FILE_ROOT . 'includes/db/' . $db_layer . '.php', 'core_db', 'db_' . $db_layer);
$site_db = array();
$site_db['type'] = $db_layer;
$site_db['persistent'] = false;
示例5: print_logon_form
break;
case "notyet":
print_logon_form();
break;
default:
http_response_code(400);
exit;
}
} else {
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$uamip = $_POST['uamip'];
$uamport = $_POST['uamport'];
$username = $_POST['username'];
$password = $_POST['password'];
$challenge = $_POST['challenge'];
$encoded_password = encode_password($password, $challenge, $uam_secret);
$redirect_url = "http://{$uamip}:{$uamport}/logon" . "?username=" . urlencode($username) . "&password=" . urlencode($encoded_password);
// If you want to redirect the user to a specific location, you may set it here
// $redirect_url .= "&redir=" . urlencode("http://myportal.example.com");
session_start();
if (isset($_POST["userurl"])) {
$_SESSION["userurl"] = $_POST["userurl"];
} else {
unset($_SESSION["userurl"]);
}
session_write_close();
header("Location: {$redirect_url}", TRUE, 302);
exit;
} else {
http_response_code(400);
exit;
示例6: dekripsi
function dekripsi($text)
{
@session_start();
$session_name = "Kh41r4";
$a = substr($text, 0, 2);
$b = substr($text, 2);
$c = encode_password($a, 1);
$d = $c . $b;
$dekripsi = base64_decode($d);
$result = str_replace(@$_SESSION['kunci_' . $session_name], "", $dekripsi);
#$result = $text;
return $result;
}
示例7: ucp_register
function ucp_register($id, $mode)
{
global $site_file_root, $config, $_CLASS, $_CORE_CONFIG;
$coppa = isset($_REQUEST['coppa']) ? (int) $_REQUEST['coppa'] : null;
$submit = isset($_POST['submit']);
if ($_CORE_CONFIG['user']['activation'] == USER_ACTIVATION_DISABLE || ($coppa || $_CORE_CONFIG['user']['activation'] == USER_ACTIVATION_SELF || $_CORE_CONFIG['user']['activation'] == USER_ACTIVATION_ADMIN) && !$_CORE_CONFIG['email']['email_enable']) {
trigger_error('UCP_REGISTER_DISABLE');
}
$_CLASS['core_template']->assign('S_UCP_ACTION', generate_link('Control_Panel&mode=register'));
$error = $data = array();
$s_hidden_fields = '';
if (!isset($_POST['agreed'])) {
if ($_CORE_CONFIG['user']['coppa_enable'] && is_null($coppa)) {
$now = explode(':', gmdate('m:j:Y'));
$coppa_birthday = $_CLASS['core_user']->format_date(mktime(12, 0, 0, $now[0], $now[1], $now[2] - 13), 'D M d, Y');
$_CLASS['core_template']->assign_array(array('L_COPPA_NO' => sprintf($_CLASS['core_user']->lang['UCP_COPPA_BEFORE'], $coppa_birthday), 'L_COPPA_YES' => sprintf($_CLASS['core_user']->lang['UCP_COPPA_ON_AFTER'], $coppa_birthday), 'U_COPPA_NO' => generate_link('Control_Panel&mode=register&coppa=0'), 'U_COPPA_YES' => generate_link('Control_Panel&mode=register&coppa=1'), 'S_SHOW_COPPA' => true, 'S_HIDDEN_FIELDS' => $s_hidden_fields, 'S_REGISTER_ACTION' => generate_link('Control_Panel&mode=register')));
} else {
$s_hidden_fields .= '<input type="hidden" name="coppa" value="' . $coppa . '" />';
$_CLASS['core_template']->assign_array(array('S_SHOW_COPPA' => false, 'S_HIDDEN_FIELDS' => $s_hidden_fields, 'S_REGISTER_ACTION' => generate_link('Control_Panel&mode=register')));
}
$this->display($_CLASS['core_user']->lang['REGISTER'], 'ucp_agreement.html');
script_close();
}
if ($submit) {
require_once $site_file_root . 'includes/functions_user.php';
$error = array();
$username = get_variable('username', 'POST', false);
$password = get_variable('password', 'POST', false);
$email = get_variable('email', 'POST', false);
$email_confirm = get_variable('email_confirm', 'POST', '');
//when we add this make sure to confirm that it's one of the installed langs
$lang = $_CORE_CONFIG['global']['default_lang'];
$tz = get_variable('tz', 'POST', false);
if (strpos($username, "\n")) {
die;
}
$username_validate = validate_username($username);
if ($username_validate !== true) {
$error[] = $_CLASS['core_user']->get_lang($username_validate);
}
if (!$password || $password !== get_variable('password_confirm', 'POST', '')) {
$error[] = $_CLASS['core_user']->get_lang('PASSWORD_ERROR');
}
if (!$email || $email !== $email_confirm) {
$error[] = $_CLASS['core_user']->get_lang('EMAIL_ERROR');
} elseif (!check_email($email)) {
$error[] = $_CLASS['core_user']->get_lang('EMAIL_INVALID');
}
if (!$tz || !in_array($tz, tz_array())) {
$tz = null;
}
if ($_CORE_CONFIG['user']['enable_confirm']) {
$confirmation_code = $_CLASS['core_user']->session_data_get('confirmation_code');
$confirm_code = trim(get_variable('confirm_code', 'POST', false));
if (!$confirm_code || !$confirmation_code || $confirm_code != $confirmation_code) {
$error[] = $_CLASS['core_user']->get_lang('CONFIRM_CODE_WRONG');
}
// we don't need this any more
$_CLASS['core_user']->user_data_kill('confirmation_code');
}
if (empty($error)) {
$password = encode_password($password, $_CORE_CONFIG['user']['password_encoding']);
if (!$password) {
//do some admin contact thing here
die('Activation disabled: Passwaord encoding problem');
}
if ($coppa || $_CORE_CONFIG['user']['activation'] == USER_ACTIVATION_SELF || $_CORE_CONFIG['user']['activation'] == USER_ACTIVATION_ADMIN) {
if (!$_CORE_CONFIG['email']['email_enable']) {
//do some admin contact thing here
die('Activation disabled: Email Disabled');
}
$user_status = STATUS_PENDING;
$user_act_key = generate_string(10);
if ($coppa) {
$message = $_CLASS['core_user']->lang['ACCOUNT_COPPA'];
$email_template = 'coppa_welcome_inactive';
} elseif ($_CORE_CONFIG['user']['activation'] == USER_ACTIVATION_SELF) {
$message = $_CLASS['core_user']->lang['ACCOUNT_INACTIVE'];
$email_template = 'user_welcome_inactive';
} elseif ($_CORE_CONFIG['user']['activation'] == USER_ACTIVATION_ADMIN) {
$message = $_CLASS['core_user']->lang['ACCOUNT_INACTIVE_ADMIN'];
$email_template = 'admin_welcome_inactive';
}
} else {
$user_status = STATUS_ACTIVE;
$user_act_key = null;
$email_template = 'user_welcome';
$message = $_CLASS['core_user']->lang['ACCOUNT_ADDED'];
}
$data = array('username' => (string) $username, 'user_email' => (string) $email, 'user_group' => $coppa ? 3 : 2, 'user_reg_date' => (int) $_CLASS['core_user']->time, 'user_timezone' => (string) $tz, 'user_password' => (string) $password, 'user_password_encoding' => (string) $_CORE_CONFIG['user']['password_encoding'], 'user_lang' => $lang ? (string) $lang : null, 'user_type' => USER_NORMAL, 'user_status' => (int) $user_status, 'user_act_key' => (string) $user_act_key, 'user_ip' => (string) $_CLASS['core_user']->ip);
user_add($data);
if ($data['user_status'] === STATUS_ACTIVE) {
set_core_config('user', 'newest_user_id', $data['user_id'], false);
set_core_config('user', 'newest_username', $data['username'], false);
set_core_config('user', 'total_users', $_CORE_CONFIG['user']['total_users'] + 1, false);
}
require_once $site_file_root . 'includes/mailer.php';
$mailer = new core_mailer();
$mailer->to($email, $username);
$mailer->subject($subject);
//.........这里部分代码省略.........
示例8: isset
/* RECEIVE VALUE */
$user_name = isset($_REQUEST['user_name']) ? $_REQUEST['user_name'] : '';
$user_password = isset($_REQUEST['user_password']) ? $_REQUEST['user_password'] : '';
$api_client = isset($_REQUEST['api_client']) ? $_REQUEST['api_client'] : '';
$location_url = isset($_REQUEST['location_url']) ? $_REQUEST['location_url'] : '';
$return = array('errcode' => 'e_1001', 'errmsg' => lang('error', 'e_1001'), 'data' => '');
if ($user_name && $user_password) {
//校验用户或者编号是否存在
$check_user_info = array();
$check_user_info = DB::fetch_first("SELECT user_id,user_password FROM " . DB::table('users') . " WHERE user_name ='" . $user_name . "' AND isdelete = 0 LIMIT 1");
if (empty($check_user_info)) {
$check_user_info = DB::fetch_first("SELECT user_id,user_password FROM " . DB::table('users') . " WHERE user_id ='" . $user_name . "' AND isdelete = 0 LIMIT 1");
}
//校验密码
if ($check_user_info['user_id']) {
$user_encode_password = encode_password($user_password);
if ($user_encode_password == $check_user_info['user_password']) {
if ($api_client) {
allow_crossdomain();
$userinfo = DB::fetch_first("SELECT * FROM " . DB::table('users') . " WHERE user_id ='" . $check_user_info['user_id'] . "' LIMIT 1");
//并返回用户信息
$return = array('errcode' => 'e_1000', 'errmsg' => lang('error', 'e_1000'), 'data' => $userinfo);
} elseif ($location_url) {
$user['user_id'] = $check_user_info['user_id'];
ext::synlogin($user, $user);
header('location:' . $location_url . '');
die;
} else {
$user['user_id'] = $check_user_info['user_id'];
ext::synlogin($user, $user);
$return = array('errcode' => 'e_1000', 'errmsg' => lang('error', 'e_1000'), 'data' => '');
示例9: mysql_real_escape_string
}
$form_username = mysql_real_escape_string(stripslashes($username), $c);
$raw_password = stripslashes($password);
$uq = mysql_query("SELECT `userid`, `userpass`, `pass_salt`\n FROM `users`\n WHERE `login_name` = '{$form_username}'", $c);
if (mysql_num_rows($uq) == 0) {
die("<h3>{GAME_NAME} Error</h3>\n\tInvalid username or password!<br />\n\t<a href='login.php'>> Back</a>");
} else {
$mem = mysql_fetch_assoc($uq);
$login_failed = false;
// Pass Salt generation: autofix
if (empty($mem['pass_salt'])) {
if (md5($raw_password) != $mem['userpass']) {
$login_failed = true;
}
$salt = generate_pass_salt();
$enc_psw = encode_password($mem['userpass'], $salt, true);
$e_salt = mysql_real_escape_string($salt, $c);
// in case of changed salt function
$e_encpsw = mysql_real_escape_string($enc_psw, $c);
// ditto for password encoder
mysql_query("UPDATE `users`\n \t\t SET `pass_salt` = '{$e_salt}', `userpass` = '{$e_encpsw}'\n \t\t WHERE `userid` = {$mem['userid']}", $c);
} else {
$login_failed = !verify_user_password($raw_password, $mem['pass_salt'], $mem['userpass']);
}
if ($login_failed) {
die("<h3>{GAME_NAME} Error</h3>\n\t\tInvalid username or password!<br />\n\t\t<a href='login.php'>> Back</a>");
}
if ($mem['userid'] == 1 && file_exists('./installer.php')) {
die("<h3>{GAME_NAME} Error</h3>\n The installer still exists! You need to delete installer.php immediately.<br />\n <a href='login.php'>> Back</a>");
}
session_regenerate_id();
示例10: authenticate
/**
* @param string $username
* @param string $password
* @param int $userId
* @return bool
*/
public function authenticate($username, $password, &$userId)
{
$userId = $this->database->user_name2id($username);
if ($userId === false) {
return true;
}
$userData = $this->database->user_get_data($userId);
$pass = $userData['password'];
$userId = $userData['userID'];
$passCrypt = encode_password($password);
return $pass == $passCrypt && $username != '';
}
示例11: addslashes
} else {
$tip2 = '你上传的不是图片文件,只支持jpg/gif/png三种格式';
}
} else {
$tip2 = '图片尚未上传或太大了';
}
} else {
if ($action == 'chpw') {
$password_current = addslashes(trim($_POST['password_current']));
$password_new = addslashes(trim($_POST['password_new']));
$password_again = addslashes(trim($_POST['password_again']));
if ($password_current && $password_new && $password_again) {
if ($password_new == $password_again) {
if (encode_password($password_current, $cur_user['regtime']) == $cur_user['password']) {
if ($password_current != $password_new) {
$new_md5pw = encode_password($password_new, $cur_user['regtime']);
if ($DBS->unbuffered_query("UPDATE yunbbs_users SET password='{$new_md5pw}' WHERE id='{$cur_uid}'")) {
//更新缓存和cookie
$cur_user['password'] = $new_md5pw;
$new_ucode = md5($cur_uid . $new_md5pw . $cur_user['regtime'] . $cur_user['lastposttime'] . $cur_user['lastreplytime']);
setcookie("cur_uid", $cur_uid, time() + 86400 * 365, '/');
setcookie("cur_uname", $cur_uname, time() + 86400 * 365, '/');
setcookie("cur_ucode", $new_ucode, time() + 86400 * 365, '/');
$tip3 = '密码已成功更改,请记住新密码';
} else {
$tip3 = '数据保存失败,请稍后再试';
}
} else {
$tip3 = '输入的新密码和原来的密码相同,没修改!';
}
} else {
示例12: createPassword
$kga['password_salt'] = createPassword(20);
if (write_config_file($kga['server_database'], $kga['server_hostname'], $kga['server_username'], $kga['server_password'], '', $kga['server_prefix'], $kga['language'], $kga['password_salt'], 'Europe/Berlin')) {
echo '<tr><td>' . $kga['lang']['updater'][140] . '</td><td class="green"> </td></tr>';
} else {
die($kga['lang']['updater'][130]);
}
// Reset all passwords
$new_passwords = array();
$users = $database->queryAll("SELECT * FROM {$p}usr");
foreach ($users as $user) {
if ($user['usr_name'] == 'admin') {
$new_password = 'changeme';
} else {
$new_password = createPassword(8);
}
exec_query("UPDATE `{$p}usr` SET pw = '" . encode_password($new_password) . "' WHERE usr_ID = {$user['usr_ID']}");
if ($result) {
$new_passwords[$user['usr_name']] = $new_password;
}
}
}
if ((int) $revisionDB < 1068) {
Kimai_Logger::logfile("-- update to r1068");
exec_query("ALTER TABLE `{$p}usr` CHANGE `autoselection` `autoselection` TINYINT( 1 ) NOT NULL default '0';");
}
if ((int) $revisionDB < 1077) {
Kimai_Logger::logfile("-- update to r1076");
exec_query("ALTER TABLE `{$p}usr` CHANGE `usr_mail` `usr_mail` varchar(160) DEFAULT ''");
exec_query("ALTER TABLE `{$p}usr` CHANGE `pw` `pw` varchar(254) NULL DEFAULT NULL");
exec_query("ALTER TABLE `{$p}usr` CHANGE `lang` `lang` varchar(6) DEFAULT ''");
exec_query("ALTER TABLE `{$p}zef` CHANGE `zef_comment` `zef_comment` TEXT NULL DEFAULT NULL");
示例13: resetPassword
/**
* @param string $username
* @param string $password
* @param string $key
* @return array
*/
public function resetPassword($username, $password, $key)
{
$kga = $this->getKga();
$database = $this->getDatabase();
$is_customer = $database->is_customer_name($username);
if ($is_customer) {
$customerId = $database->customer_nameToID($username);
$customer = $database->customer_get_data($customerId);
if ($key != $customer['passwordResetHash']) {
return array('message' => $kga['lang']['passwordReset']['invalidKey']);
}
$data = array('password' => encode_password($password), 'passwordResetHash' => null);
$database->customer_edit($customerId, $data);
} else {
$userId = $database->user_name2id($username);
$user = $database->user_get_data($userId);
if ($key != $user['passwordResetHash']) {
return array('message' => $kga['lang']['passwordReset']['invalidKey']);
}
$data = array('password' => encode_password($password), 'passwordResetHash' => null);
$database->user_edit($userId, $data);
}
return array('message' => $kga['lang']['passwordReset']['success'], 'showLoginLink' => true);
}
示例14: install
//.........这里部分代码省略.........
// Done, move on
echo '... Successful.<br />';
echo 'Writing game config file...<br />';
echo 'Write DB Connector...<br />';
$code = md5(rand(1, 100000000000));
if (file_exists("mysql.php")) {
unlink("mysql.php");
}
$e_db_hostname = addslashes($db_hostname);
$e_db_username = addslashes($db_username);
$e_db_password = addslashes($db_password);
$e_db_database = addslashes($db_database);
$config_file = <<<EOF
<?php
\$c = mysql_connect('{$e_db_hostname}', '{$e_db_username}', '{$e_db_password}') or die(mysql_error());
mysql_select_db('{$e_db_database}', \$c);
EOF;
$f = fopen('mysql.php', 'w');
fwrite($f, $config_file);
fclose($f);
echo '... file written.<br />';
echo 'Writing base database schema...<br />';
$fo = fopen("dbdata.sql", "r");
$query = '';
$lines = explode("\n", fread($fo, 1024768));
fclose($fo);
foreach ($lines as $line) {
if (!(strpos($line, "--") === 0) && trim($line) != '') {
$query .= $line;
if (!(strpos($line, ";") === FALSE)) {
mysql_query($query);
$query = '';
}
}
}
echo '... done.<br />';
echo 'Writing game configuration...<br />';
$ins_username = mysql_real_escape_string(htmlentities($adm_username, ENT_QUOTES, 'ISO-8859-1'), $c);
$salt = generate_pass_salt();
$e_salt = mysql_real_escape_string($salt, $c);
$encpsw = encode_password($adm_pswd, $salt);
$e_encpsw = mysql_real_escape_string($encpsw, $c);
$ins_email = mysql_real_escape_string($adm_email, $c);
$IP = mysql_real_escape_string($_SERVER['REMOTE_ADDR'], $c);
$ins_game_name = htmlentities($game_name, ENT_QUOTES, 'ISO-8859-1');
$ins_game_desc = nl2br(htmlentities($description, ENT_QUOTES, 'ISO-8859-1'));
$ins_game_owner = htmlentities($owner, ENT_QUOTES, 'ISO-8859-1');
$ins_game_id1name = htmlentities($adm_username, ENT_QUOTES, 'ISO-8859-1');
mysql_query("INSERT INTO `users`\n (`username`, `login_name`, `userpass`, `level`, `money`,\n `crystals`, `donatordays`, `user_level`, `energy`, `maxenergy`,\n `will`, `maxwill`, `brave`, `maxbrave`, `hp`, `maxhp`, `location`,\n `gender`, `signedup`, `email`, `bankmoney`, `lastip`,\n `pass_salt`)\n VALUES ('{$ins_username}', '{$ins_username}', '{$e_encpsw}', 1,\n 100, 0, 0, 2, 12, 12, 100, 100, 5, 5, 100, 100, 1,\n '{$adm_gender}', " . time() . ", '{$ins_email}', -1, '{$IP}',\n '{$e_salt}')", $c) or die(mysql_error());
$i = mysql_insert_id($c);
mysql_query("INSERT INTO `userstats`\n \t\t VALUES({$i}, 10, 10, 10, 10, 10)", $c);
$gamename_files = array('authenticate.php', 'donator.php', 'explore.php', 'gamerules.php', 'header.php', 'helptutorial.php', 'loggedin.php', 'login.php', 'new_staff.php', 'register.php', 'voting.php');
$gameowner_files = array('header.php', 'login.php');
$paypal_files = array('donator.php', 'willpotion.php');
$gamedesc_files = array('login.php');
$id1_files = array('gamerules.php');
$cron_files = array('crons/cron_day.php', 'crons/cron_fivemins.php', 'crons/cron_hour.php', 'crons/cron_minute.php');
foreach ($gamename_files as $file) {
file_update($file, '{GAME_NAME}', $ins_game_name);
}
foreach ($gameowner_files as $file) {
file_update($file, '{GAME_OWNER}', $ins_game_owner);
}
foreach ($paypal_files as $file) {
file_update($file, '{PAYPAL}', $paypal);
}
foreach ($gamedesc_files as $file) {
file_update($file, '{GAME_DESCRIPTION}', $ins_game_desc);
}
foreach ($id1_files as $file) {
file_update($file, '{ID1_NAME}', $ins_game_id1name);
}
foreach ($cron_files as $file) {
file_update($file, '{CRON_CODE}', $code);
}
echo '... Done.<br />';
$path = dirname($_SERVER['SCRIPT_FILENAME']);
echo "\n <h2>Installation Complete!</h2>\n <hr />\n <h3>Cron Info</h3>\n <br />\n This is the cron info you need for section <b>1.2 Cronjobs</b> of the installation instructions.<br />\n <pre>\n */5 * * * * php {$path}/crons/cron_fivemins.php {$code}\n * * * * * php {$path}/crons/cron_minute.php {$code}\n 0 * * * * php {$path}/crons/cron_hour.php {$code}\n 0 0 * * * php {$path}/crons/cron_day.php {$code}\n </pre>\n ";
echo "<h3>Installer Security</h3>\n Attempting to remove installer... ";
@unlink('./installer.php');
$success = !file_exists('./installer.php');
echo "<span style='color: " . ($success ? "green;'>Succeeded" : "red;'>Failed") . "</span><br />";
if (!$success) {
echo "Attempting to lock installer... ";
@touch('./installer.lock');
$success2 = file_exists('installer.lock');
echo "<span style='color: " . ($success2 ? "green;'>Succeeded" : "red;'>Failed") . "</span><br />";
if ($success2) {
echo "<span style='font-weight: bold;'>" . "You should now remove dbdata.sql, installer.php, installer_foot.php and installer_home.php from your server." . "</span>";
} else {
echo "<span style='font-weight: bold; font-size: 20pt;'>" . "YOU MUST REMOVE dbdata.sql, installer.php, " . "installer_foot.php and installer_home.php from your server.<br />" . "Failing to do so will allow other people " . "to run the installer again and potentially " . "mess up your game entirely." . "</span>";
}
} else {
require_once 'installer_foot.php';
@unlink('./installer_head.php');
@unlink('./installer_foot.php');
@unlink('./dbdata.sql');
exit;
}
}
示例15: ucp_profile
function ucp_profile($id, $mode)
{
global $config, $_CLASS, $site_file_root, $_CORE_CONFIG;
$preview = isset($_POST['preview']);
$submit = isset($_POST['submit']);
$module_link = generate_link("Control_Panel&i={$id}&mode={$mode}");
$error = $data = array();
$s_hidden_fields = '';
switch ($mode) {
case 'reg_details':
if ($submit) {
$var_ary = array('username' => $_CLASS['core_user']->data['username'], 'email' => $_CLASS['core_user']->data['user_email'], 'email_confirm' => (string) '', 'new_password' => (string) '', 'cur_password' => (string) '', 'password_confirm' => (string) '');
foreach ($var_ary as $var => $default) {
$data[$var] = request_var($var, $default);
}
$var_ary = array('username' => array(array('string', false, $_CORE_CONFIG['user']['min_name_chars'], $_CORE_CONFIG['user']['max_name_chars']), array('username', $data['username'])), 'password_confirm' => array('string', true, $_CORE_CONFIG['user']['min_pass_chars'], $_CORE_CONFIG['user']['max_pass_chars']), 'new_password' => array('string', true, $_CORE_CONFIG['user']['min_pass_chars'], $_CORE_CONFIG['user']['max_pass_chars']), 'email' => array(array('string', false, 6, 60), array('email', $data['email'])), 'email_confirm' => array('string', true, 6, 60));
$error = validate_data($data, $var_ary);
extract($data);
unset($data);
if ($new_password && $password_confirm != $new_password) {
$error[] = 'NEW_PASSWORD_ERROR';
}
if (($new_password || $_CLASS['auth']->acl_get('u_chgemail') && $email != $_CLASS['core_user']->data['user_email'] || $username != $_CLASS['core_user']->data['username'] && $_CLASS['auth']->acl_get('u_chgname') && $_CORE_CONFIG['user']['allow_namechange']) && encode_password($cur_password, $_CLASS['core_user']->data['user_password_encoding']) != $_CLASS['core_user']->data['user_password']) {
$error[] = 'CUR_PASSWORD_ERROR';
}
if ($_CLASS['auth']->acl_get('u_chgemail') && $email != $_CLASS['core_user']->data['user_email'] && $email_confirm != $email) {
$error[] = 'NEW_EMAIL_ERROR';
}
if (!sizeof($error)) {
$sql_ary = array('user_email' => $_CLASS['auth']->acl_get('u_chgemail') ? $email : $_CLASS['core_user']->data['user_email']);
if ($_CORE_CONFIG['email']['email_enable'] && $email != $_CLASS['core_user']->data['user_email'] && ($_CORE_CONFIG['user']['require_activation'] == USER_ACTIVATION_SELF || $_CORE_CONFIG['user']['require_activation'] == USER_ACTIVATION_ADMIN)) {
$template_file = $config['require_activation'] == USER_ACTIVATION_ADMIN ? 'user_activate_inactive.html' : 'user_activate.html';
$mailer = new core_mailer();
$messenger->template($template_file, $_CLASS['core_user']->data['user_lang']);
$mailer->subject($subject);
$messenger->to($email, $username);
$messenger->headers('X-AntiAbuse: Board servername - ' . $config['server_name']);
$messenger->headers('X-AntiAbuse: User_id - ' . $_CLASS['core_user']->data['user_id']);
$messenger->headers('X-AntiAbuse: Username - ' . $_CLASS['core_user']->data['username']);
$messenger->headers('X-AntiAbuse: User IP - ' . $_CLASS['core_user']->ip);
$messenger->assign_vars(array('SITENAME' => $_CORE_CONFIG['global']['sitename'], 'USERNAME' => $username, 'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $config['board_email_sig']), 'U_ACTIVATE' => generate_link("Control_Panel&mode=activate&u={$_CLASS['core_user']->data['user_id']}&k={$user_actkey}", array('full' => true))));
$body = trim($_CLASS['core_template']->display('modules/Contact/email/index.html', true));
$messenger->send(NOTIFY_EMAIL);
if ($_CORE_CONFIG['user']['require_activation'] == USER_ACTIVATION_ADMIN) {
// Grab an array of user_id's with a_user permissions
$admin_ary = $_CLASS['auth']->acl_get_list(false, 'a_user', false);
$sql = 'SELECT user_id, username, user_email, user_lang, user_jabber, user_notify_type
FROM ' . USERS_TABLE . '
WHERE user_id IN (' . implode(', ', $admin_ary[0]['a_user']) . ')';
$result = $_CLASS['core_db']->sql_query($sql);
while ($row = $_CLASS['core_db']->sql_fetchrow($result)) {
$messenger->template('admin_activate', $row['user_lang']);
$messenger->replyto($config['board_contact']);
$messenger->to($row['user_email'], $row['username']);
$messenger->im($row['user_jabber'], $row['username']);
$messenger->assign_vars(array('USERNAME' => $username, 'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $config['board_email_sig']), 'U_ACTIVATE' => generate_link("Control_Panel&mode=activate&u={$_CLASS['core_user']->data['user_id']}&k={$user_actkey}", array('full' => true))));
$messenger->send($row['user_notify_type']);
}
$_CLASS['core_db']->sql_freeresult($result);
}
$messenger->save_queue();
$sql_ary += array('user_type' => USER_INACTIVE, 'user_actkey' => $user_actkey);
}
$sql = 'UPDATE ' . USERS_TABLE . '
SET ' . $_CLASS['core_db']->sql_build_array('UPDATE', $sql_ary) . '
WHERE user_id = ' . $_CLASS['core_user']->data['user_id'];
$_CLASS['core_db']->sql_query($sql);
// Need to update config, forum, topic, posting, messages, etc.
if ($username != $_CLASS['core_user']->data['username'] && $_CLASS['auth']->acl_get('u_chgname') && $_CORE_CONFIG['user']['allow_namechange']) {
user_update_name($_CLASS['core_user']->data['username'], $username);
}
$_CLASS['core_display']->meta_refresh(3, $module_link);
$message = $_CLASS['core_user']->lang['PROFILE_UPDATED'] . '<br /><br />' . sprintf($_CLASS['core_user']->lang['RETURN_UCP'], '<a href="' . $module_link . '">', '</a>');
trigger_error($message);
}
// Replace "error" strings with their real, localised form
$error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$_CLASS['core_user']->lang['\\1'])) ? \$_CLASS['core_user']->lang['\\1'] : '\\1'", $error);
}
$user_char_ary = array('.*' => 'USERNAME_CHARS_ANY', '[\\w]+' => 'USERNAME_ALPHA_ONLY', '[\\w_\\+\\. \\-\\[\\]]+' => 'USERNAME_ALPHA_SPACERS');
$_CLASS['core_template']->assign(array('ERROR' => sizeof($error) ? implode('<br />', $error) : '', 'USERNAME' => isset($username) ? $username : $_CLASS['core_user']->data['username'], 'EMAIL' => isset($email) ? $email : $_CLASS['core_user']->data['user_email'], 'CONFIRM_EMAIL' => '', 'PASSWORD_CONFIRM' => isset($password_confirm) ? $password_confirm : '', 'NEW_PASSWORD' => isset($new_password) ? $new_password : '', 'CUR_PASSWORD' => '', 'L_USERNAME_EXPLAIN' => sprintf($_CLASS['core_user']->lang[$user_char_ary[str_replace('\\\\', '\\', $_CORE_CONFIG['user']['allow_name_chars'])] . '_EXPLAIN'], $_CORE_CONFIG['user']['min_name_chars'], $_CORE_CONFIG['user']['max_name_chars']), 'L_CHANGE_PASSWORD_EXPLAIN' => sprintf($_CLASS['core_user']->lang['CHANGE_PASSWORD_EXPLAIN'], $_CORE_CONFIG['user']['min_pass_chars'], $_CORE_CONFIG['user']['max_pass_chars']), 'S_FORCE_PASSWORD' => $_CORE_CONFIG['user']['chg_passforce'] && $this->data['user_passchg'] < time() - $_CORE_CONFIG['user']['chg_passforce'] ? true : false, 'S_CHANGE_USERNAME' => $_CORE_CONFIG['user']['allow_namechange'] && $_CLASS['auth']->acl_get('u_chgname') ? true : false, 'S_CHANGE_EMAIL' => $_CLASS['auth']->acl_get('u_chgemail') ? true : false, 'S_CHANGE_PASSWORD' => true));
break;
case 'profile_info':
$error = array();
$this_year = gmdate('Y', time());
if ($submit) {
$icq = get_variable('icq', 'POST', null);
$aim = get_variable('aim', 'POST', null);
$msn = get_variable('msn', 'POST', null);
$yim = get_variable('yim', 'POST', null);
$jabber = get_variable('jabber', 'POST', null);
//$google = get_variable('google', 'POST', null);
$website = get_variable('website', 'POST', null);
$location = get_variable('location', 'POST', null);
$occupation = get_variable('occupation', 'POST', null);
$interests = get_variable('interests', 'POST', null);
$bday_day = get_variable('bday_day', 'POST', false);
$bday_month = get_variable('bday_month', 'POST', false);
$bday_year = get_variable('bday_year', 'POST', false);
if ($bday_day || $bday_month || $bday_year) {
if ($bday_day < 1 || $bday_day > 31 || $bday_month < 1 || $bday_month > 12 || $bday_year < $this_year - 100 || $bday_month > $this_year) {
//.........这里部分代码省略.........