Example #1
1
/**
 *前台自动登陆判断
 */
function auto_login()
{
    $uid = is_login();
    if (!$uid) {
        $uid = autologin();
    }
    return $uid;
}
        $random_salt = hash('sha512', uniqid(mt_rand(1, mt_getrandmax()), true));
        // Create salted password
        $password = hash('sha512', $password . $random_salt);
        //Update the password for the user in the database
        if ($insert_stmt = $mysql->prepare("UPDATE Users SET Password = ?, Salt = ? WHERE UserID = {$userid}")) {
            $insert_stmt->bind_param('ss', $password, $random_salt);
            if (!$insert_stmt->execute()) {
                header('Location: ./changepassword.php?err=Registration failure: INSERT1');
                exit;
            }
        } else {
            header('Location: ./changepassword.php?err=Registration failure: INSERT2');
            exit;
        }
        //Login user and then take them to their account
        $level = autologin($email, $password, $mysql);
        if ($level > 0) {
            header('Location: ./includes/portalredirect.php');
            exit;
        } else {
            if ($level == -1) {
                header('Location: ./securityquestions.php');
            } else {
                //Login failed
                header('Location: ./login.php?err=FAIL');
            }
        }
    } else {
        header('Location: ./changepassword.php?err=' . $error_msg);
    }
}
Example #3
0
<?php

session_start();
include "../include/config.inc.php";
require "../login/autologin.php";
require "../include/get.variable.inc.php";
if ($state == 1) {
    $username = it;
    $password = md5(1111111111);
} else {
    $username = $username;
    $password = md5($password);
}
$loginreturn = autologin($username, $password);
//下面是出错信息的数组
$arr_errmsg[2] = "密码错误!(请注意区分大小写)";
$arr_errmsg[3] = "由于密码错误多次,禁止使用该用户!";
$arr_errmsg[4] = "该用户被停用!";
$arr_errmsg[9] = "该用户不存在!";
if ($loginreturn == 1) {
    session_register("loginuser");
    // 登陆id,可用于授权用户
    session_register("loginname");
    // 登陆用户名,可用于授权用户
    session_register("logintrueuser");
    // 真实登陆id
    session_register("logintruename");
    // 真实登陆用户名
    session_register("loginbrowline");
    // 用户brow习惯
    session_register("loginruning");
Example #4
0
 public function signin($param = '', $param1 = '')
 {
     if ($this->dx_auth->is_logged_in() || autologin() == 1) {
         header("Cache-Control: no-cache, must-revalidate");
         header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
         redirect('home/dashboard');
     }
     $this->session->unset_userdata('image_url');
     if ($this->input->get('search')) {
         $this->session->set_userdata('redirect_to', 'search');
     }
     if ($this->input->get('home')) {
         $this->session->set_userdata('redirect_to', 'home');
     }
     if ($this->input->get('account')) {
         $this->session->set_userdata('redirect_to', 'account/wishlists/' . $this->input->get('id'));
     }
     if ($this->input->get('rooms')) {
         $this->session->set_userdata('redirect_to', 'rooms/' . $this->input->get('id'));
     }
     //Intialize values for library and helpers
     $this->form_validation->set_error_delimiters($this->config->item('field_error_start_tag'), $this->config->item('field_error_end_tag'));
     if ($this->input->post()) {
         if (!$this->dx_auth->is_logged_in()) {
             // Set form validation rules
             $this->form_validation->set_rules('username', 'Username or Email', 'required|trim|xss_clean');
             $this->form_validation->set_rules('password', 'password', 'required|trim|xss_clean');
             //$this->form_validation->set_rules('remember', 'Remember me', 'integer');
             if ($this->form_validation->run()) {
                 $username = $this->input->post("username");
                 $password = $this->input->post("password");
                 $remember_me = $this->input->post("remember_me");
                 if ($this->dx_auth->login($username, $password, $remember_me)) {
                     // Redirect to homepage
                     $newdata = array('user' => $this->dx_auth->get_user_id(), 'username' => $this->dx_auth->get_username(), 'logged_in' => TRUE);
                     $this->session->set_userdata($newdata);
                     $this->Common_model->updateTableData('login_history', 0, array('session_id' => $this->session->userdata('session_id')), array('user_id' => $this->dx_auth->get_user_id()));
                     if ($this->session->userdata('redirect_to')) {
                         $redirect_to = $this->session->userdata('redirect_to');
                         $this->session->unset_userdata('redirect_to');
                         redirect($redirect_to, 'refresh');
                     } else {
                         $this->session->set_flashdata('flash_message', $this->Common_model->flash_message('success', translate('Logged in successfully.')));
                         redirect('home/dashboard/', 'refresh');
                     }
                 } else {
                     $this->session->set_flashdata('flash_message', $this->Common_model->flash_message('error', translate('Either the username or password is wrong. Please try again!')));
                     redirect('users/signin');
                 }
             }
         } else {
             $this->session->set_flashdata('flash_message', $this->Common_model->flash_message('error', translate('You are already logged in. Logout to login again!')));
             redirect('home/index', 'refresh');
         }
     }
     if ($param == 'logout') {
         if ($param1 == 1) {
             $this->session->set_flashdata('flash_message', $this->Common_model->flash_message('error', translate('You are Banned by admin.')));
             redirect('users/signin');
         } else {
             $this->session->set_flashdata('flash_message', $this->Common_model->flash_message('success', translate('You are logged out successfully.')));
             redirect('users/signin');
         }
     }
     if ($param == 'cancel') {
         $this->session->set_flashdata('flash_message', $this->Common_model->flash_message('success', translate('Your account has been cancelled successfully.')));
         redirect('users/signin');
     }
     $data["title"] = get_meta_details('Sign_In / Sign_Up', 'title');
     $data["meta_keyword"] = get_meta_details('Sign_In / Sign_Up', 'meta_keyword');
     $data["meta_description"] = get_meta_details('Sign_In / Sign_Up', 'meta_description');
     $data['fb_app_id'] = $this->db->get_where('settings', array('code' => 'SITE_FB_API_ID'))->row()->string_value;
     $data['google_app_id'] = $this->db->get_where('settings', array('code' => 'SITE_GOOGLE_API_ID'))->row()->string_value;
     $data['message_element'] = "users/view_signIn";
     //from template
     $this->load->view('template', $data);
 }
Example #5
0
<?php

if ($_POST[userID] && $_POST[token]) {
    $user = autologin($_POST[userID] * 1, $_POST[token]);
    if ($user == 1) {
        echo "ok";
    }
}
Example #6
0
    ?>
	<link href="<?php 
    echo css_url();
    ?>
/rooms.css" media="screen" rel="stylesheet" type="text/css" />
	<?php 
}
if ($this->uri->segment(1) != 'search') {
    $this->carabiner->js('common.js');
    $this->carabiner->display('js');
}
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
$query5 = $this->db->get_where('settings', array('code' => 'GOOGLE_ANALYTICS_CODE'));
echo $query5->row()->text_value;
autologin();
$mainpath = dirname($_SERVER['SCRIPT_FILENAME']);
$user_id = $this->session->userdata('DX_user_id');
$is_banned = $this->db->where('id', $user_id)->where('banned', 1)->get('users')->num_rows();
if ($is_banned == 1) {
    $this->session->set_userdata('is_banned', 1);
    redirect('users/logout');
}
$fb_app_id = $this->db->get_where('settings', array('code' => 'SITE_FB_API_ID'))->row()->string_value;
?>
<script>

var NREUMQ=[];NREUMQ.push(["mark","firstbyte",new Date().getTime()]);(function(){var d=document;var e=d.createElement("script");e.type="text/javascript";e.async=true;e.src="<?php 
echo base_url();
?>
http://www.tehuuraanzee.net/html/js/rum.js";var s=d.getElementsByTagName("script")[0];s.parentNode.insertBefore(e,s);})()