Beispiel #1
0
 function is_profile_complete()
 {
     $row = get_user_detail();
     //if ( ! $row || ! $row->email_address || ! $row->password || ! $row->level || ($row->first_name . $row->last_name == '') || ! $row->phone_number || ! $row->zip_code ):
     if (!$row || !$row->level || $row->first_name . $row->last_name == '') {
         return FALSE;
     }
     return TRUE;
 }
 public function test2()
 {
     $user_id = 50;
     session(md5("user_id" . $user_id), md5("user_id" . $user_id), 24 * 3600);
     ob_start();
     W('User/sendActiveEmail', [get_user_detail(50)]);
     $content = ob_get_contents();
     ob_end_clean();
     // dump(get_user_detail(50));
     echo $content;
 }
Beispiel #3
0
function check_permission($type, $user_id)
{
    global $user_right;
    $u_det = get_user_detail($user_id);
    if ($u_det['account_type'] == 1) {
        return true;
    }
    switch ($type) {
        case 'configuration':
            $key = 'configuration';
            break;
        case 'advertisers':
            $key = 'view_advertisers';
            break;
        case 'add_administrator':
            $key = 'configuration';
            break;
        case 'modify_advertisers':
            $key = 'modify_advertisers';
            break;
        case 'campaigns':
            $key = 'view_own_campaigns';
            $key2 = 'view_all_campaigns';
            break;
        case 'adnetworks':
            $key = 'ad_networks';
            break;
        case 'trafficrequests':
            $key = 'traffic_requests';
            break;
        case 'advertisers':
            $key = 'view_advertisers';
            break;
    }
    if (isset($key) && !isset($key2)) {
        if ($user_right[$key] != 1) {
            return false;
        }
    } else {
        if (isset($key) && isset($key2)) {
            if ($user_right[$key] != 1 && $user_right[$key2] != 1) {
                return false;
            }
        } else {
            return true;
        }
    }
    return true;
}
Beispiel #4
0
    exit;
}
global $current_action;
$current_action = 'edit';
if (isset($_POST['update'])) {
    if (do_edit('user', $_POST, $_GET['id'])) {
        global $edited;
        $edited = 1;
        MAD_Admin_Redirect::redirect('edit_user.php?edited=1&id=' . $_GET['id'] . '');
    } else {
        global $edited;
        $edited = 2;
    }
}
if ($edited != 2) {
    $editdata = get_user_detail($_GET['id']);
}
require_once MAD_PATH . '/www/cp/templates/header.tpl.php';
?>

<div id="content">		
		
		<div id="contentHeader">
			<h1>Edit User</h1>
		</div> <!-- #contentHeader -->	
		
		<div class="container">
			
				
			<div class="grid-24">
			
				<td width="5%"  class="filter-false"><strong>Requested&nbsp;</strong></td>
				<td width="7%" data-placeholder="Search"><strong>product&nbsp;</strong></td>
				<td width="5%" class="filter-false"><strong>Number&nbsp;</strong></td>
				<td width="5%" data-placeholder="Search"><strong>Reason&nbsp;</strong></td>
				<td width="5%" data-placeholder="Search"><strong>Purpose&nbsp;</strong></td>
				<td width="5%" class="filter-false"><strong>Amt Financed&nbsp;</strong></td>
				<td width="5%" class="filter-false"><strong>PAN&nbsp;</strong></td>
				<td width="5%" class="filter-false"><strong>Telephone&nbsp;</strong></td>
				<td width="6%" class="filter-false"><strong>Mobile&nbsp;</strong></td>
				<td width="8%" data-placeholder="Search"><strong>Non Credit CAPS&nbsp;</strong></td>
			</tr>        
		</thead>
	   <?php 
$j = 1;
while ($row = mysql_fetch_assoc($users)) {
    $userDetail = get_user_detail($row['user_id']);
    ?>
        <tr align="center" class="normal">
		<td><input name="chkid[<?php 
    echo $j;
    ?>
]" type="checkbox" id="chkid[<?php 
    echo $j;
    ?>
]" value="<?php 
    echo $row['id'];
    ?>
" /></td>
		  <td  height="30"><?php 
    echo $row['full_name'];
    ?>
 public function activeEmail()
 {
     if (I('get.user_id') && I('get.activeCode')) {
         $userDetail = get_user_detail(I('get.user_id'));
         if (I('get.activeCode') == $userDetail[0]['email_code']) {
             $update_time = substr($userDetail[0]['email_code'], 0, 10);
             if (time() - $update_time > 24 * 3600) {
                 echo "验证码过期!";
             } else {
                 M('User')->where("user_id=" . I('get.user_id'))->save(['email_code' => '', 'status' => 1]);
                 session('userDetail', get_user_detail(I('get.user_id')));
                 $this->success("激活成功", U('Index/index'));
                 $this->nickName();
             }
         } else {
             echo "验证码失效!";
         }
     } else {
         echo "非法访问!";
     }
 }
Beispiel #7
0
<?php

//error_reporting(E_ALL);
$document_root = '/home/home365/public_html';
require_once $document_root . '/dbconnect/dbconnect.php';
require_once $document_root . '/utilities/utilities.php';
if (mysql_select_db("home365_ios", $useradmin)) {
} else {
    echo "Error selecting database, exited.";
    exit;
}
$email = isset($_POST['email']) ? $_POST['email'] : $_GET['email'];
//echo $email;
if (!empty($email)) {
    $user = get_user_detail($email);
    if (empty($user)) {
        $return_code = 2;
        $error = "email not registered";
    } else {
        if ($user['status'] == 'D') {
            $return_code = 1;
            $error = "email not active";
        } else {
            if (send_mail($user)) {
                $return_code = 0;
                $error = "Email sent";
            } else {
                $return_code = 4;
                $error = "error sending email";
            }
        }
Beispiel #8
0
 public function index()
 {
     $title = 'Update Profile';
     $this->load->view(get_client() . '/header', array('title' => $title));
     $data = array();
     if ($this->input->post() && !$this->input->post('verify_password')) {
         //update profile
         $this->form_validation->set_rules('first_name', 'First Name', "trim|required");
         $this->form_validation->set_rules('last_name', 'Last Name', "trim|required");
         $this->form_validation->set_rules('email', 'Email', "trim|required|valid_email|callback__check_duplicate_email");
         if ($this->input->post('password') || !is_profile_complete()) {
             $this->form_validation->set_rules('password', 'Password', "trim|required|min_length[8]|max_length[16]");
         }
         $this->form_validation->set_rules('phone', 'Phone Number', "trim|required|callback__isValidPhone");
         $this->form_validation->set_rules('zipcode', 'Zip Code', "trim|required|callback__isValidZipCode");
         if ($this->form_validation->run() == TRUE) {
             $data['last_name'] = $this->input->post('last_name');
             $data['first_name'] = $this->input->post('first_name');
             $data['email_address'] = $this->input->post('email');
             $data['gender'] = $this->input->post('gender');
             $data['phone_number'] = $this->input->post('phone');
             $data['zip_code'] = $this->input->post('zipcode');
             if ($this->input->post('password')) {
                 $data['password'] = md5($this->input->post('password'));
             }
             $this->db->where('id', $this->session->userdata('id'));
             $this->db->update('users', $data);
             if ($this->db->affected_rows() > 0) {
                 $data['success_msg'] = 'Update profile success!';
                 if (is_profile_complete()) {
                     $this->session->set_userdata('password_verified', TRUE);
                 }
                 if ($this->session->userdata('url')) {
                     redirect($this->session->userdata('url'));
                 }
             }
         } else {
             $data['error_msg'] = 'Update profile failed. Please check field below!';
         }
     } elseif ($this->input->post('verify_password')) {
         $this->form_validation->set_rules('verify_password', 'Password', "trim|required");
         if ($this->form_validation->run() == TRUE) {
             $this->db->where('id', $this->session->userdata('id'));
             $this->db->where('password', md5($this->input->post('verify_password')));
             $query = $this->db->get('users', 1);
             if ($query->num_rows() > 0) {
                 $this->session->set_userdata('password_verified', TRUE);
             } else {
                 $data['error_msg'] = 'Wrong password, please try again!';
             }
         }
     }
     $data['user'] = get_user_detail();
     if (!is_profile_complete() || !$data['user']->password) {
         //profile not complete -> no need to verified the password
         $data['success_msg'] = 'Please complete data below!';
         $this->load->view(get_client() . '/update_profile', $data);
     } elseif (!$this->session->userdata('password_verified')) {
         $this->load->view(get_client() . '/verify_password', $data);
     } else {
         $this->load->view(get_client() . '/update_profile', $data);
     }
     $this->load->view(get_client() . '/footer', array('picture_upload' => TRUE));
 }
function delete_user($id, $origin)
{
    global $maindb;
    $u_det = get_user_detail($id);
    if (count_administrators() < 2 && $u_det['account_type'] == 1) {
        global $errormessage;
        $errormessage = 'You cannot delete the last Administrator in the system.';
        return false;
    }
    mysql_query("DELETE from md_uaccounts where user_id='{$id}'", $maindb);
    mysql_query("DELETE from md_user_rights where user_id='{$id}'", $maindb);
}
        global $edited;
        $edited = 2;
    }
}
if ($edited != 2) {
    $editdata = get_permissions($_GET['type'], $_GET['id']);
}
switch ($_GET['type']) {
    case 'group':
        $tt = 'Group';
        $group_detail = get_group_detail($_GET['id']);
        $tt_det = $group_detail['group_name'];
        break;
    case 'user':
        $tt = 'User';
        $usr_detail = get_user_detail($_GET['id']);
        $tt_det = $usr_detail['first_name'] . ' ' . $usr_detail['last_name'];
        break;
}
require_once MAD_PATH . '/www/cp/templates/header.tpl.php';
?>

<div id="content">		
		
		<div id="contentHeader">
			<h1>Manage Permissions</h1>
		</div> <!-- #contentHeader -->	
		
		<div class="container">
			
				
Beispiel #11
0
function is_logged_in()
{
    return get_user_detail('identity');
}