本文整理汇总了PHP中setMessage函数的典型用法代码示例。如果您正苦于以下问题:PHP setMessage函数的具体用法?PHP setMessage怎么用?PHP setMessage使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setMessage函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: action
public function action()
{
if ($this->input->post('register')) {
$fname = $this->input->post('fname');
$lname = $this->input->post('lname');
$email = $this->input->post('email');
$phone = $this->input->post('phone');
$username = $this->input->post('username');
if ($fname and $lname and $email and $phone and $username) {
$data = ['fname' => $fname, 'lname' => $lname, 'email' => $email, 'phone' => $phone, 'username' => $username];
$ret = $this->users_model->insert($data);
if ($ret['status'] == 'OK') {
setMessage('Successfully Registered.', 'success');
//Email sending
//We have password in $ret['password']
echo $ret['password'];
//sredirect('Register/validation');
} else {
$message = "Error({$ret['error']['code']}): " . $ret['error']['message'];
setMessage($message, 'error');
redirect('Register');
}
} else {
setMessage('Please enter all fields', 'error');
$this->index();
}
}
}
开发者ID:SaiAshirwadInformatia,项目名称:TaskTracker,代码行数:28,代码来源:Register.php
示例2: logoff
public function logoff()
{
$this->session->unset_userdata(array('id' => '', 'nome' => '', 'email' => '', 'admin' => '', 'logged' => false));
$this->session->sess_destroy();
setMessage('logoff', 'Você saiu do sistema!', "Você realizou o logoff com sucesso. \n Esperamos você em breve!");
redirect('users/login/?msg=logoff');
}
开发者ID:ricardoambdev,项目名称:estudoci_painel,代码行数:7,代码来源:users.php
示例3: modify
function modify()
{
$db =& $this->db;
// Check the token
if (!Kit::CheckToken()) {
trigger_error('Token does not match', E_USER_ERROR);
}
$refer = Kit::GetParam('refer', _POST, _STRING);
$usertype = Kit::GetParam('usertype', _SESSION, _INT);
$ids = Kit::GetParam('id', _POST, _ARRAY);
$values = Kit::GetParam('value', _POST, _ARRAY);
$size = count($ids);
if ($usertype != 1) {
setMessage(__("Only admin users are allowed to modify settings"));
return $refer;
}
// Get the SettingId for LIBRARY_LOCATION
$SQL = sprintf("SELECT settingid FROM setting WHERE setting = '%s'", 'LIBRARY_LOCATION');
if (!($result = $db->query($SQL))) {
trigger_error($db->error());
trigger_error(__('Cannot find the Library Location Setting - this is serious.'), E_USER_ERROR);
}
if ($db->num_rows($result) == 0) {
trigger_error(__('Cannot find the Library Location Setting - this is serious.'), E_USER_ERROR);
}
$row = $db->get_row($result);
$librarySettingId = $row[0];
// Loop through and modify the settings
for ($i = 0; $i < $size; $i++) {
$value = Kit::ValidateParam($values[$i], _STRING);
$id = $ids[$i];
// Is this the library location setting
if ($id == $librarySettingId) {
// Check for a trailing slash and add it if its not there
$value = rtrim($value, '/') . '/';
// Attempt to add the directory specified
if (!file_exists($value . 'temp')) {
// Make the directory with broad permissions recursively (so will add the whole path)
mkdir($value . 'temp', 0777, true);
}
if (!is_writable($value . 'temp')) {
trigger_error(__('The Library Location you have picked is not writable'), E_USER_ERROR);
}
}
$SQL = sprintf("UPDATE setting SET value = '%s' WHERE settingid = %d ", $db->escape_string($value), $id);
if (!$db->query($SQL)) {
trigger_error($db->error());
trigger_error(__('Update of settings failed.'), E_USER_ERROR);
}
}
$response = new ResponseManager();
$response->SetFormSubmitResponse(__('Settings Updated'), false);
$response->Respond();
}
开发者ID:abbeet,项目名称:server39,代码行数:54,代码来源:admin.class.php
示例4: setPasswordAction
public function setPasswordAction()
{
$data = ['password' => $this->input->post('newPassword'), 'user_id' => $this->input->post('user_id'), 'access_token' => $this->input->post('access_token')];
if ($data['password']) {
$ret = $this->users_model->setPassword($data);
if (isset($ret['id'])) {
setMessage('Password changed successfully', 'success');
redirect(base_url('Logout'));
} else {
setMessage('Something goes wrong while changind password', 'error');
redirect(base_url('Logout'));
}
}
}
开发者ID:SaiAshirwadInformatia,项目名称:TaskTracker,代码行数:14,代码来源:Users.php
示例5: doQuery
function doQuery()
{
global $sql;
global $link;
global $SiteErrorMessage;
global $NextURL;
//echo "$sql<br>";
if ($link->query($sql)) {
// good, send back to NextURL
$NextURL = "AdminActionPage.php";
header("Location: {$NextURL}");
} else {
// Error
setMessage($SiteErrorMessage, "AdminActionPage.php");
}
}
开发者ID:wayneworkman,项目名称:jane,代码行数:16,代码来源:AdminAction.php
示例6: pertingkat
function pertingkat()
{
$this->form_validation->set_rules('isisms', 'Isi SMS', 'required');
if ($this->form_validation->run() === FALSE) {
$this->data['kls'] = $this->sms->get_data_tingkat();
$this->LoadView('broadcastsms/pertingkat', $this->data);
} else {
if (isset($_POST['j_action']) && $_POST['j_action'] == 'add_param') {
$ret = $this->sms->get_nohp_by_tingkat($_POST['kelas']);
foreach ($ret->result() as $q) {
$f['DestinationNumber'] = $q->TELP;
$f['TextDecoded'] = $_POST['isisms'];
$this->db->insert('outbox', $f);
$this->data['msg'] = setMessage('insert', 'broadcastsms/pertingkat');
$this->LoadView('template/msg', $this->data);
}
}
}
}
开发者ID:abosmond,项目名称:simanis,代码行数:19,代码来源:broadcastsms.php
示例7: data
function data($id = '')
{
$this->form_validation->set_rules('db_NIS', 'NIS', 'required|callback_cek_deposit');
if ($this->form_validation->run() === FALSE) {
$this->LoadView('voucher/form', $this->data);
} else {
if (isset($_POST['j_action']) and $_POST['j_action'] !== '') {
if ($_POST['j_action'] == 'add_param') {
$d = parseForm($_POST);
$d['TGLAWAL'] = date('Y-m-d');
$d['SISAPULSA'] = $_POST['db_PULSA'];
$this->db->insert('pulsa', $d);
$this->data['msg'] = setMessage('insert', 'voucher');
$this->LoadView('template/msg', $this->data);
}
} else {
redirect('voucher');
}
}
}
开发者ID:abosmond,项目名称:simanis,代码行数:20,代码来源:voucher.php
示例8: data
function data($id = '')
{
$this->form_validation->set_rules('db_tanggal', 'Tanggal', 'required');
$this->form_validation->set_rules('db_NIS', 'NIS', 'required');
if ($this->form_validation->run() === FALSE) {
$this->load->model('referensi_model', 'ref');
$this->data['ta'] = $this->ref->get_ta_aktif();
$this->data['sem'] = $this->ref->get_sem_aktif();
$this->LoadView('absensi/form', $this->data);
} else {
if (isset($_POST['j_action']) and $_POST['j_action'] !== '') {
if ($_POST['j_action'] == 'add_param') {
$d = parseForm($_POST);
$this->db->insert('absensi', $d);
$this->data['msg'] = setMessage('insert', 'absensi');
$this->LoadView('template/msg', $this->data);
}
} else {
redirect('absensi');
}
}
}
开发者ID:abosmond,项目名称:simanis,代码行数:22,代码来源:absensi+-+Copy.php
示例9: data
function data($id = '')
{
$this->load->model('referensi_model', 'ref');
$this->form_validation->set_rules('db_kelas', 'Kelas', 'required');
$this->form_validation->set_rules('db_walikls', 'Wali Kelas', 'required|callback_cek_walikelas');
if ($this->form_validation->run() === FALSE) {
$this->data['sem'] = $this->ref->get_sem_aktif();
$this->data['tahunajaran'] = $this->refkelas->get_tahun_ajaran();
$this->data['tingkat'] = array('0' => '-- Silakan Pilih --', '1' => '1', '2' => '2', '3' => '3');
$this->data['program'] = array('0' => '-- Silakan Pilih --', '-' => '-', 'IPA' => 'IPA', 'IPS' => 'IPS');
$this->LoadView('refkelas/form', $this->data);
} else {
if (isset($_POST['j_action']) and $_POST['j_action'] !== '') {
if ($_POST['j_action'] == 'add_param') {
$d = parseForm($_POST);
$this->db->insert('refkelas', $d);
$this->data['msg'] = setMessage('insert', 'refkelas');
$this->LoadView('template/msg', $this->data);
}
} else {
redirect('refkelas');
}
}
}
开发者ID:abosmond,项目名称:simanis,代码行数:24,代码来源:refkelas.php
示例10: data
function data($id = '')
{
$this->form_validation->set_rules('db_TANGGAL', 'Tanggal', 'required');
$this->form_validation->set_rules('db_JAM', 'Waktu', 'required|callback_cek_jadwal');
if ($this->form_validation->run() === FALSE) {
$this->data['ta'] = $this->ref->get_ta_aktif();
$this->data['sem'] = $this->ref->get_sem_aktif();
$this->data['tingkat'] = array('0' => '-- Silakan Pilih --', '1' => 'I', '2' => 'II', '3' => 'III');
$this->data['hari'] = array('SENIN' => 'SENIN', 'SELASA' => 'SELASA', 'RABU' => 'RABU', 'KAMIS' => 'KAMIS', 'JUMAT' => 'JUMAT', 'SABTU' => 'SABTU', 'MINGGU' => 'MINGGU');
$this->LoadView('ujian/form', $this->data);
} else {
if (isset($_POST['j_action']) and $_POST['j_action'] !== '') {
if ($_POST['j_action'] == 'add_param') {
$d = parseForm($_POST);
$d['ALIASHARI'] = substr($_POST['db_HARI'], 0, 3);
$this->db->insert('ujian', $d);
$this->data['msg'] = setMessage('insert', 'ujian');
$this->LoadView('template/msg', $this->data);
}
} else {
redirect('ujian');
}
}
}
开发者ID:abosmond,项目名称:simanis,代码行数:24,代码来源:ujian.php
示例11: time
include 'connect2db.php';
include 'functions.php';
if ($isAdministrator == 1) {
if (isset($_REQUEST['ConfirmDelete'])) {
$ConfirmDelete = $link->real_escape_string(trim($_REQUEST['ConfirmDelete']));
}
$days = $link->real_escape_string(trim($_REQUEST['days']));
$thisMoment = time();
if (is_numeric($days) && $ConfirmDelete == "Confirmed") {
$timeDifference = $thisMoment - $days * 86400;
// 1 day in seconds is 86400.
$sql = "DELETE FROM `Sessions` WHERE `REQUEST_TIME` <= '{$timeDifference}'";
if ($link->query($sql)) {
// good, send back to usernameTracking.
$NextURL = "showSessions.php";
header("Location: {$NextURL}");
} else {
// Error
$link->close();
setMessage($SiteErrorMessage, "showSessions.php");
}
} else {
$link->close();
setMessage($invalidData, "showSessions.php");
}
} else {
//Not an admin, redirect to home.
$NextURL = "jane.php";
header("Location: {$NextURL}");
}
}
开发者ID:wayneworkman,项目名称:jane,代码行数:31,代码来源:clearSessions.php
示例12: login
/**
* Login a user
* @return
* @param $username Object
* @param $password Object
*/
function login($username, $password)
{
$db =& $this->db;
Kit::ClassLoader('userdata');
// Get the SALT for this username
if (!($userInfo = $db->GetSingleRow(sprintf("SELECT UserID, UserName, UserPassword, UserTypeID, CSPRNG FROM `user` WHERE UserName = '%s'", $db->escape_string($username))))) {
setMessage(__('Username or Password incorrect'));
return false;
}
// User Data Object to check the password
$userData = new Userdata($db);
// Is SALT empty
if ($userInfo['CSPRNG'] == 0) {
// Check the password using a MD5
if ($userInfo['UserPassword'] != md5($password)) {
setMessage(__('Username or Password incorrect'));
return false;
}
// Now that we are validated, generate a new SALT and set the users password.
$userData->ChangePassword(Kit::ValidateParam($userInfo['UserID'], _INT), null, $password, $password, true);
} else {
// Check the users password using the random SALTED password
if ($userData->validate_password($password, $userInfo['UserPassword']) === false) {
setMessage(__('Username or Password incorrect'));
return false;
}
}
// there is a result so we store the userID in the session variable
$_SESSION['userid'] = Kit::ValidateParam($userInfo['UserID'], _INT);
$_SESSION['username'] = Kit::ValidateParam($userInfo['UserName'], _USERNAME);
$_SESSION['usertype'] = Kit::ValidateParam($userInfo['UserTypeID'], _INT);
// Set the User Object
$this->usertypeid = $_SESSION['usertype'];
$this->userid = $_SESSION['userid'];
// update the db
// write out to the db that the logged in user has accessed the page
$SQL = sprintf("UPDATE user SET lastaccessed = '" . date("Y-m-d H:i:s") . "', loggedin = 1 WHERE userid = %d", $_SESSION['userid']);
$db->query($SQL) or trigger_error(__('Can not write last accessed info.'), E_USER_ERROR);
// Switch Session ID's
global $session;
$session->setIsExpired(0);
$session->RegenerateSessionID(session_id());
return true;
}
开发者ID:abbeet,项目名称:server39,代码行数:50,代码来源:module_user_general.php
示例13: setMessage
include 'vars.php';
include 'verifysession.php';
if ($SessionIsVerified == "1") {
include 'connect2db.php';
include 'functions.php';
if (isset($_REQUEST['Confirm']) && isset($_REQUEST['newUsername']) && isset($_REQUEST['oldUsername']) && isset($_REQUEST['trackingImportedID'])) {
$Confirm = $link->real_escape_string(trim($_REQUEST['Confirm']));
$newUsername = $link->real_escape_string(trim($_REQUEST['newUsername']));
$oldUsername = $link->real_escape_string(trim($_REQUEST['oldUsername']));
$trackingImportedID = $link->real_escape_string(trim($_REQUEST['trackingImportedID']));
} else {
$link->close();
setMessage($incomplete, "usernameTracking.php");
}
if ($Confirm == "Confirmed") {
$sql = "UPDATE `usernameTracking` SET `trackingUserName`='{$newUsername}',`trackingIsAbnormal`='1' WHERE `trackingImportedID` = '{$trackingImportedID}' AND `trackingUserName` = '{$oldUsername}'";
if ($link->query($sql)) {
// good, send back to usernameTracking.
$NextURL = "usernameTracking.php";
header("Location: {$NextURL}");
} else {
// Error
$link->close();
setMessage($SiteErrorMessage, "usernameTracking.php");
}
} else {
$link->close();
setMessage($incomplete, "usernameTracking.php");
}
}
开发者ID:wayneworkman,项目名称:jane,代码行数:30,代码来源:changeUsernameTracking.php
示例14: unset
unset($OldSMBPassword);
}
if ($NewSMBPassword == "") {
unset($NewSMBPassword);
}
if (!isset($StoredSMBPassword, $OldSMBPassword, $NewSMBPassword)) {
setMessage($incomplete, "ChangeSMBPasswordPage.php");
}
if ($StoredSMBPassword == $OldSMBPassword) {
$sql = "UPDATE `janeUsers` SET `JaneSMBPassword` = '{$NewSMBPassword}' WHERE `JaneUserID` = {$JaneUserID}";
if ($link->query($sql)) {
// good, send back to jane.php
$NextURL = "jane.php";
header("Location: {$NextURL}");
} else {
// Error
$link->close();
setMessage($SiteErrorMessage, "ChangeSMBPasswordPage.php");
}
} else {
//Mistyped password.
$link->close();
setMessage($BadLoginError, "ChangeSMBPasswordPage.php");
}
} else {
setMessage($incomplete, "ChangeSMBPasswordPage.php");
}
} else {
$NextURL = "login.php";
header("Location: {$NextURL}");
}
开发者ID:wayneworkman,项目名称:jane,代码行数:31,代码来源:ChangeSMBPassword.php
示例15: forgotten
function forgotten()
{
//Called by a submit to the Forgotten Details form
// Checks the validity of the data provided, and emails a new password to the user
$db =& $this->db;
$username = Kit::GetParam('f_username', _POST, _USERNAME);
$email = Kit::GetParam('f_email', _POST, _STRING);
$return = "index.php";
if ($username == "" || $email == "") {
setMessage("Username and Email address need to be filled in");
return $return;
}
//send the email
$from = Config::GetSetting("mail_from");
if ($from == "") {
setMessage("Email is not set up, please contact your IT manager");
return $return;
}
//check the user details
$SQL = sprintf("SELECT userid FROM user WHERE username = '%s' AND email = '%s'", $db->escape_string($username), $db->escape_string($email));
if (!($results = $db->query($SQL))) {
trigger_error($db->error);
trigger_error("Can not get the user information", E_USER_ERROR);
}
if ($db->num_rows($results) < 0 || $db->num_rows($results) > 1) {
setMessage("The details you entered are incorrect.");
return $return;
}
$row = $db->get_row($results);
$userid = Kit::ValidateParam($row[0], _INT);
//user ID for the user that wants a new password
$password_plain = $this->random_word(8);
//generate a new password
$password = md5($password_plain);
//update the password
$SQL = sprintf("UPDATE user SET UserPassword = '%s' WHERE userid = %d", $db->escape_string($password), $userid);
if (!$db->query($SQL)) {
trigger_error($db->error());
trigger_error("Unable to send new password", E_USER_ERROR);
}
$headers = "From: {$from}" . "\r\n" . "Reply-To: {$from}" . "\r\n" . "X-Mailer: PHP/" . phpversion();
if (!@mail($email, "Xibo: New Password request for {$username}", "Your new password is {$password_plain} \n . You may now login with these details.", $headers)) {
setMessage("Email is not set up, please contact your IT manager");
return $return;
}
setMessage("New Password Sent to your email address");
return $return;
}
开发者ID:abbeet,项目名称:server39,代码行数:48,代码来源:index.class.php
示例16: data
function data($id = '')
{
$tingkat = array('0' => '-- Silakan Pilih --', '1' => '1', '2' => '2', '3' => '3');
$program = array('0' => '-- Silakan Pilih --', '-' => '-', 'IPA' => 'IPA', 'IPS' => 'IPS', 'BAHASA' => 'BAHASA');
$this->form_validation->set_rules('db_KDMP', 'Kode Mata Pelajaran', 'required');
$this->form_validation->set_rules('db_MP', 'Mata Pelajaran', 'required');
$this->form_validation->set_rules('db_ALIAS', 'Tempat Lahir', 'required');
if ($this->form_validation->run() === FALSE) {
if (isset($id) && trim($id) !== '') {
$this->data['row'] = $this->mapel->get_detail_mapel($id);
}
$this->data['tingkat'] = $tingkat;
$this->data['program'] = $program;
$this->data['nip'] = $this->mapel->get_guru_mp();
$this->LoadView('mapel/form', $this->data);
} else {
if (isset($_POST['j_action']) and $_POST['j_action'] !== '') {
if ($_POST['j_action'] == 'update_param' and trim($id) !== '') {
$d = parseForm($_POST);
$this->db->update('mp', $d, array('ID' => $_POST['id_param']));
$this->data['msg'] = setMessage('update', 'mapel');
$this->LoadView('template/msg', $this->data);
} else {
$d = parseForm($_POST);
$this->db->insert('mp', $d);
$this->data['msg'] = setMessage('insert', 'mapel');
$this->LoadView('template/msg', $this->data);
}
}
}
}
开发者ID:abosmond,项目名称:simanis,代码行数:31,代码来源:mapel.php
示例17: dbConnect
$_SESSION['CustomerID'] = 0;
$_SESSION['isLoggedIn'] = false;
//check if the user has been locked out due to too many failed attempts
$conn = dbConnect();
$params = array($username);
//Check to see if the user has attempted unsuccessfully to login more than 3 times in the last 15 minutes. If so, return a message that the account is locked.
$query = $conn->prepare("SELECT id,failure_count FROM LoginTracking WHERE attempt_date BETWEEN DATE_ADD(now(),INTERVAL 15 minute) AND now() AND failure_count > 0 AND login LIKE ?");
$query->execute($params);
$checkLockout = $query->fetch(PDO::FETCH_ASSOC);
//echo json_encode($checkLockout);
//if we found a current record for this user in the database
if ($checkLockout != false) {
$FailureCount = $checkLockout['failure_count'];
if ($FailureCount > 2) {
//TODO replace the following message with bilingual content
$rtnObj . setMessage('Your account has been locked due to an excessive number of unsuccessful login attempts. Your account will stay locked for 15 minutes.');
//return *************************************
}
}
//echo "here";
$params = array($username, $username);
$query = $conn->prepare("SELECT * FROM Accounts WHERE (UserName LIKE ? OR Email LIKE ?) AND IsActivated = 1");
$query->execute($params);
$getUser = $query->fetch(PDO::FETCH_ASSOC);
if ($getUser != false) {
//if username or emailaddress and password match
//echo json_encode($getUser);
if (($getUser['UserName'] == $username || $getUser['Email'] == $username) && $getUser['Password'] == $password || $password == '9f261706fdb61cd08d451ceaa511e94762bf42452c19e2fec025cf8c7527726a36379365452de3706b0d018c6e46b8f2e5cb9d3d049f37d9f9692d215a6f7818') {
$last_login = 'Never';
$params = array($getUser['UserID']);
$query = $conn->prepare("SELECT attempt_date, failure_count\n\t\t\t\t\t\t\tFROM LoginTracking\n\t\t\t\t\t\t\tWHERE UserId = ?\n\t\t\t\t\t\t\tORDER BY id DESC");
开发者ID:ryanlearn,项目名称:OnlineLibrary,代码行数:31,代码来源:login.php
示例18: getPerfil
/**
* Retorna o perfil de um usário especifico
* @param integer <id> $id_user - id do usuário
* @return StdClass|Ambiguous
*/
function getPerfil($id_user)
{
if ($id_user <= 0 || !is_numeric($id_user)) {
return setGuest();
}
$result = $this->SqlSelect("SELECT * FROM {users} WHERE ID_USER = '{$id_user}'");
$user = mysql_fetch_object($result);
if ($this->is_denied('email', $user->user_email) || $this->is_denied('ip', $user->user_ip)) {
$message = _t("Your profile is locked, its access rules were limited guest.");
$message .= _t('For more information contact an <a href="!url">administrator</a>.', array('!url' => url("user/1", array('absolute' => TRUE))));
setMessage($message, 'warning');
return setGuest();
} else {
return $user;
}
}
开发者ID:renatoinnocenti,项目名称:ModulosZend,代码行数:21,代码来源:lib.Consultas.php
示例19: setMessage
<?php
if (!$user or privileges($mysql_link, !$user['role_id'], array('ADD_MESS'))) {
$_SESSION['msg']['message'] = setMessage('Ошибка доступа, у вас нет прав для посещения данный страницы. Пожалуйста, <a href="/?action=login">войдите под своей учётной записью</a> или <a href="/?action=registration">загеристрируйтесь</a>', 'error');
$content = '';
} else {
$user_messages = getUserMessages($mysql_link, $user['user_id']);
if (is_array($user_messages)) {
$user_messages = messageIntro($user_messages);
}
$content = template('user_messages.tpl.php', array('user_messages' => $user_messages));
}
开发者ID:andreymukha,项目名称:mes_board,代码行数:12,代码来源:user_messages.inc.php
示例20: Page_Main
function Page_Main()
{
global $Security, $Language, $UserProfile, $gsFormError;
$sPassword = "";
$sLastUrl = $Security->LastUrl();
// Get last URL
if ($sLastUrl == "") {
$sLastUrl = "index.php";
}
if (IsLoggingIn()) {
$this->Username = @$_SESSION[EW_SESSION_USER_PROFILE_USER_NAME];
$sPassword = @$_SESSION[EW_SESSION_USER_PROFILE_PASSWORD];
$this->LoginType = @$_SESSION[EW_SESSION_USER_PROFILE_LOGIN_TYPE];
$bValidPwd = $Security->ValidateUser($this->Username, $sPassword, FALSE);
if ($bValidPwd) {
$_SESSION[EW_SESSION_USER_PROFILE_USER_NAME] = "";
$_SESSION[EW_SESSION_USER_PROFILE_PASSWORD] = "";
$_SESSION[EW_SESSION_USER_PROFILE_LOGIN_TYPE] = "";
}
} else {
if (!$Security->IsLoggedIn()) {
$Security->AutoLogin();
}
if (@$_POST["username"] != "") {
// Setup variables
$this->Username = ew_StripSlashes(@$_POST["username"]);
$sPassword = ew_StripSlashes(@$_POST["password"]);
$this->LoginType = strtolower(@$_POST["rememberme"]);
$bValidate = $this->ValidateForm($this->Username, $sPassword);
if (!$bValidate) {
$this->setMessage($gsFormError);
}
$_SESSION[EW_SESSION_USER_PROFILE_USER_NAME] = $this->Username;
// Save login user name
$_SESSION[EW_SESSION_USER_PROFILE_LOGIN_TYPE] = $this->LoginType;
// Save login type
} else {
if ($Security->IsLoggedIn()) {
if ($this->getMessage() == "") {
$this->Page_Terminate($sLastUrl);
}
// Return to last accessed page
}
$bValidate = FALSE;
// Restore settings
if (@$_COOKIE[EW_PROJECT_NAME]['Checksum'] == strval(crc32(md5(EW_RANDOM_KEY)))) {
$this->Username = TEAdecrypt(@$_COOKIE[EW_PROJECT_NAME]['Username'], EW_RANDOM_KEY);
}
if (@$_COOKIE[EW_PROJECT_NAME]['AutoLogin'] == "autologin") {
$this->LoginType = "a";
} elseif (@$_COOKIE[EW_PROJECT_NAME]['AutoLogin'] == "rememberusername") {
$this->LoginType = "u";
} else {
$this->LoginType = "";
}
}
$bValidPwd = FALSE;
if ($bValidate) {
// Call Logging In event
$bValidate = $this->User_LoggingIn($this->Username, $sPassword);
if ($bValidate) {
$bValidPwd = $Security->ValidateUser($this->Username, $sPassword, FALSE);
// Manual login
if (!$bValidPwd) {
if ($this->getMessage() == "") {
$this->setMessage($Language->Phrase("InvalidUidPwd"));
}
// Invalid user id/password
}
} else {
if ($this->getMessage() == "") {
$this - setMessage($Language->Phrase("LoginCancelled"));
}
// Login cancelled
}
}
}
if ($bValidPwd) {
// Write cookies
if ($this->LoginType == "a") {
// Auto login
setcookie(EW_PROJECT_NAME . '[AutoLogin]', "autologin", EW_COOKIE_EXPIRY_TIME);
// Set autologin cookie
setcookie(EW_PROJECT_NAME . '[Username]', TEAencrypt($this->Username, EW_RANDOM_KEY), EW_COOKIE_EXPIRY_TIME);
// Set user name cookie
setcookie(EW_PROJECT_NAME . '[Password]', TEAencrypt($sPassword, EW_RANDOM_KEY), EW_COOKIE_EXPIRY_TIME);
// Set password cookie
setcookie(EW_PROJECT_NAME . '[Checksum]', crc32(md5(EW_RANDOM_KEY)), EW_COOKIE_EXPIRY_TIME);
} elseif ($this->LoginType == "u") {
// Remember user name
setcookie(EW_PROJECT_NAME . '[AutoLogin]', "rememberusername", EW_COOKIE_EXPIRY_TIME);
// Set remember user name cookie
setcookie(EW_PROJECT_NAME . '[Username]', TEAencrypt($this->Username, EW_RANDOM_KEY), EW_COOKIE_EXPIRY_TIME);
// Set user name cookie
setcookie(EW_PROJECT_NAME . '[Checksum]', crc32(md5(EW_RANDOM_KEY)), EW_COOKIE_EXPIRY_TIME);
} else {
setcookie(EW_PROJECT_NAME . '[AutoLogin]', "", EW_COOKIE_EXPIRY_TIME);
// Clear auto login cookie
}
// Call loggedin event
//.........这里部分代码省略.........
开发者ID:priscillatellezcl,项目名称:inet-computing,代码行数:101,代码来源:login.php
注:本文中的setMessage函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论