Example #1
0
 public function runners()
 {
     $active = $this->read('activeUsers');
     $runners = User::getUserList(Session::uid(), $active, 1, true);
     $ret = array();
     $default = isset($_REQUEST['runner']) ? $_REQUEST['runner'] : null;
     foreach ($runners as $runner) {
         $ret[] = array('id' => $runner->getId(), 'nickname' => $runner->getNickname(), 'selected' => $default === $runner->getId());
     }
     return $ret;
 }
Example #2
0
 public function index()
 {
     $this->view = null;
     $users = User::getUserList(Session::uid(), true);
     $ret = array();
     foreach ($users as $user) {
         $ret[] = array('id' => $user->getId(), 'nickname' => $user->getNickname(), 'current' => $user->getId() == Session::uid());
     }
     echo json_encode(array('users' => $ret));
     return;
 }
Example #3
0
 public static function setSearch()
 {
     $user_list = User::getUserList();
     if ($user_list) {
         try {
             $xs = self::getXS();
             $index = $xs->index;
             $index->clean();
             foreach ($user_list as $key => $value) {
                 $doc = new XSDocument();
                 $doc->id = $value['id'];
                 $doc->username = $value['username'];
                 $doc->email = $value['email'];
                 $index->add($doc);
             }
         } catch (Exception $e) {
             Log::write('Message: ' . $e->getMessage(), "ERR", 3, "xsd");
         }
     }
     echo 'done , asshole!';
 }
Example #4
0
 public function activeUsers()
 {
     $users = User::getUserList(Session::uid(), 1, 0, true);
     $ret = array();
     $ret[] = array('id' => 0, 'nickname' => 'None', 'selected' => true);
     foreach ($users as $user) {
         $ret[] = array('id' => $user->getId(), 'nickname' => $user->getNickname(), 'selected' => false);
     }
     return $ret;
 }
Example #5
0
<?php

session_start();
// 未登陆则重定向到登陆页面
if (!isset($_SESSION['username'])) {
    header("Location: http://" . $_SERVER['HTTP_HOST'] . "admin_site/login.php");
    exit;
}
require_once "../config/config.inc";
require_once "../lib/UserAction.class.php";
$whereSql = "";
if (isset($_POST["txtName"])) {
    $whereSql = $_POST["txtName"];
}
$userModal = new User();
$list = $userModal->getUserList($whereSql);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>运营后台管理</title>
    <link href="../css/styel_hy.css" rel="stylesheet" type="text/css" />
    <link href="../css/jquery-ui-1.10.4.custom.min.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="../js/jquery-1.10.2.js"></script>
    <script type="text/javascript" src="../js/jquery-ui-1.10.4.custom.min.js"></script>
    <script type="text/javascript" src="../js/usermanage.js"></script>

</head>
<body>
Example #6
0
<?php

session_start();
include "../../bossflex/Helpers/Reject.php";
Reject::permission($_SESSION['admin']);
$_SESSION['redir'] = $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];
if (isset($_GET["result"])) {
    echo '<h3>' . urldecode($_GET['result']) . '</h3>';
}
include "../../bossflex/DB/Models/User.php";
//Only a Boss Flex Admin can see all accounts
if ($_SESSION['admin']['CID'] == 1) {
    $Users = User::getUserList();
} else {
    $Users = User::getUserListByCID($_SESSION['admin']['CID']);
}
?>

<html>
<head>
    <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.10/css/jquery.dataTables.min.css">

    <script type="text/javascript" language="javascript" src="//code.jquery.com/jquery-1.12.0.min.js">
    </script>

    <script type="text/javascript" language="javascript" src="https://cdn.datatables.net/1.10.10/js/jquery.dataTables.min.js">
    </script>

    <script type="text/javascript" class="init">
        $(document).ready(function() {
            $('#usertable').DataTable( {
Example #7
0
			<table class="table table-bordered">
				<thead>
					<th>SL </th>
					<th>User Name</th>
					<th>Name </th>
					<th>Address</th>
					<th>Completed Searches</th>
					<th>Incomplete Searches</th>
					<th>Type of User</th>					
					<th>Status </th>
				</thead>
				<tbody>
					<?php
						$count = 1;
						$us = new User();
						$results = $us->getUserList();
						foreach($results as $res){
							$completed = $us->getNbCompletedSearches($res['UserID']);
							$incomplete = $us->getNbIncompleteSearches($res['UserID']);
							if($res['TypeOfUser']==1){ $usertype = 'Appraiser';} else if($res['TypeOfUser']==2){ $usertype="Loan Officer"; }else{continue;}
							if($res['Active']==1){ $status = "<span class='btn btn-info'>&nbsp;Active&nbsp;</span>";} else if($res['Active']==0) { $status = "<span class='btn btn-danger'>Inactive</span>"; } 
							echo '<tr><td>'.$count.'</td><td><a href="viewuser.php?id='.$res['UserID'].'">'.$res['UserName'].'</a></a></td><td>'.$res['Name'].'</td><td>'.$res['Address'].'</td>';
							if($completed>0){
								echo '<td><a href="viewcompleted.php?id='.$res['UserID'].'" style="text-decoration:underline;">'.$completed.'</a></td>';
							}else{
								echo '<td>'.$completed.'</td>';
							}
							echo '<td>'.$incomplete.'</td><td>'.$usertype.'</td><td>'.$status.'</td></tr>';
							$count++;
						}
					?>
Example #8
0
        echo "<script language=\"javascript\">alert('删除成功!');history.back(-1);</script>";
        die;
    }
    if ($_GET['action'] == "up") {
        $user->userRenew($_GET['user'], $user->getPass($_GET['user']), "", 0);
        echo "<script language=\"javascript\">alert('提权成功!');history.back(-1);</script>";
        die;
    }
    if ($_GET['action'] == "down") {
        $user->userRenew($_GET['user'], $user->getPass($_GET['user']), "", 1);
        echo "<script language=\"javascript\">alert('降权成功!');history.back(-1);</script>";
        die;
    }
}
$limit = isset($_GET['page']) ? (intval($_GET['page']) - 1) * 20 : "0";
$list = $user->getUserList(20, $limit);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>用户管理</title>
        <link rel="stylesheet" href="css/frame.css" type="text/css" />
    </head>
    <body>
    	<center>
        	<br />
            <table border="0" cellpadding="0" cellspacing="0">
                <tr>
                    <td width="200">
                        账号
    /**
     * 车险20免一, 分享
     */
    public function insuranceShareAction()
    {
        $user_agent = $this->request->getUserAgent();
        $is_in_car_mate = strpos($user_agent, 'YN122') !== false;
        $location_url = $this->request->get('location_url', null, null);
        //不在车优惠环境并且存在跳转参数,则跳转
        if (!$is_in_car_mate and $location_url) {
            $location_url = base64_decode($location_url);
            return $this->response->redirect($location_url);
        }
        $this->view->setVar('is_in_car_mate', $is_in_car_mate);
        $p_user_phone = $this->dispatcher->getParam('p_user_phone', null, '0');
        $user_phone = $this->request->get('user_phone', null, null);
        $this->view->setVar('p_user_phone', $p_user_phone);
        $this->view->setVar('is_user', true);
        $p_user_id = null;
        if ($p_user_phone !== '0') {
            $p_user = User::getUserByPhone($p_user_phone);
            $p_user_id = $p_user['user_id'];
        }
        $wx_state = $this->request->get('state', null, false);
        $user_agent = $this->request->getUserAgent();
        $is_wx = strpos($user_agent, 'MicroMessenger') !== false;
        $this->view->setVar('is_wx', $is_wx);
        $wx_userinfo_json = $this->cookies->get('wx_userinfo_json')->getValue('trim');
        $wx_userinfo = json_decode($wx_userinfo_json, true);
        file_put_contents('wx_userinfo.log', '[' . microtime(true) . ']' . var_export($wx_userinfo_json, 1) . "\r\n", FILE_APPEND);
        //使用微信客户端访问,并且不是从授权页面跳转过来的(跳转过来都带state),重定向到授权页面
        if ($is_wx and !$wx_state and !$wx_userinfo) {
            $auth_url = 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=' . $this->_app_id . '&redirect_uri=' . urlencode('http://ip.yn122.net:8092/insurance_share/' . $p_user_phone . '?lock_time=' . floor(microtime(true) * 100)) . '&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect';
            return $this->response->redirect($auth_url);
        }
        $this->view->setVar('wx_state', $wx_state);
        $wx_code = $this->request->get('code', null, null);
        $wx_openid = $this->request->get('wx_openid', null, null);
        $wx_unionid = $this->request->get('wx_unionid', null, null);
        $wx_token = null;
        $db = $this->db;
        if ($is_wx and $wx_state and !$user_phone) {
            if ($wx_code) {
                if (!$wx_userinfo) {
                    $wx_token_json = file_get_contents('https://api.weixin.qq.com/sns/oauth2/access_token?appid=' . $this->_app_id . '&secret=' . $this->_app_secret . '&code=' . $wx_code . '&grant_type=authorization_code');
                    $wx_token = json_decode($wx_token_json, true);
                    $wx_userinfo_json = file_get_contents('https://api.weixin.qq.com/sns/userinfo?access_token=' . $wx_token['access_token'] . '&openid=' . $wx_token['openid'] . '&lang=zh_CN');
                    $wx_userinfo = json_decode($wx_userinfo_json, true);
                    file_put_contents('wx_userinfo.log', '[pull_userinfo]' . var_export($wx_userinfo, 1) . "\r\n", FILE_APPEND);
                    //如果获取用户信息失败,则重新获取code授权
                    if (empty($wx_userinfo) or !isset($wx_userinfo['openid'])) {
                        file_put_contents('wx_userinfo.log', "[re_auth]\r\n", FILE_APPEND);
                        $auth_url = 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=' . $this->_app_id . '&redirect_uri=' . urlencode('http://ip.yn122.net:8092/insurance_share/' . $p_user_phone . '?lock_time=' . floor(microtime(true) * 100)) . '&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect';
                        return $this->response->redirect($auth_url);
                    }
                    $this->cookies->set('wx_userinfo_json', $wx_userinfo_json);
                }
                //保存微信用户信息
                $get_wx_user_sql = 'select top 1 id from WX_USER where openid = :openid';
                $get_wx_user_bind = array('openid' => $wx_userinfo['openid']);
                $wx_user_result = $db->query($get_wx_user_sql, $get_wx_user_bind);
                $wx_user_result->setFetchMode(Db::FETCH_ASSOC);
                $wx_user = $wx_user_result->fetch();
                $wx_user_id = !empty($wx_user) ? $wx_user['id'] : null;
                //没有此微信用户记录则添加
                if (!$wx_user_id) {
                    $insert_wx_user_sql = 'insert into WX_USER (openid, nickname, sex, province, city, country, headimgurl,privilege, unionid) values (:openid, :nickname, :sex, :province, :city, :country, :headimgurl, :privilege, :unionid)';
                    $insert_wx_user_bind = array('openid' => $wx_userinfo['openid'], 'nickname' => base64_encode($wx_userinfo['nickname']), 'sex' => $wx_userinfo['sex'], 'province' => $wx_userinfo['province'], 'city' => $wx_userinfo['city'], 'country' => $wx_userinfo['country'], 'headimgurl' => $wx_userinfo['headimgurl'], 'privilege' => json_encode($wx_userinfo['privilege']), 'unionid' => isset($wx_userinfo['unionid']) ? $wx_userinfo['unionid'] : null);
                    $db->execute($insert_wx_user_sql, $insert_wx_user_bind);
                    $wx_user_id = $db->lastInsertId();
                }
                $get_view_sql = 'select top 1 id from Hui_ActivityShareView where wx_user_id = :wx_user_id and p_user_id = :p_user_id and aid = :aid';
                $get_view_bind = array('wx_user_id' => $wx_user_id, 'p_user_id' => $p_user_id, 'aid' => 228);
                $view_result = $db->query($get_view_sql, $get_view_bind);
                $view_result->setFetchMode(Db::FETCH_ASSOC);
                $view_record = $view_result->fetch();
                if ($wx_user_id and empty($view_record)) {
                    //添加微信用户访问记录(本次活动)
                    $insert_view_sql = 'insert into Hui_ActivityShareView (p_user_id, wx_user_id, aid) values (:p_user_id, :wx_user_id, :aid)';
                    $insert_view_bind = array('p_user_id' => $p_user_id, 'wx_user_id' => $wx_user_id, 'aid' => 228);
                    $insert_view_success = $db->execute($insert_view_sql, $insert_view_bind);
                }
            }
            $this->view->setVar('wx_openid', $wx_token['openid']);
        }
        $bind_user = null;
        if ($wx_userinfo) {
            $bind_user_list = User::getUserList(array('wx_openid' => isset($wx_userinfo['openid']) ? $wx_userinfo['openid'] : 'cyh'));
            if (!empty($bind_user_list)) {
                $bind_user = $bind_user_list[0];
            }
        }
        if (!$user_phone and !$bind_user) {
            //查找上家分享码
            $query_sql = 'select invitation_code from ActivityUser where userid = :user_id and aid = :aid';
            $query_bind = array('user_id' => $p_user_id, 'aid' => 228);
            $query_result = $db->query($query_sql, $query_bind);
            $query_result->setFetchMode(Db::FETCH_ASSOC);
            $involved_p_user = $query_result->fetch();
            $this->view->setVar('invitation_code', !empty($involved_p_user) ? $involved_p_user['invitation_code'] : '');
            return;
        }
        $user = !empty($bind_user) ? $bind_user : User::getUserByPhone($user_phone);
        //未注册的用户
        if (empty($user)) {
            $this->view->setVar('is_user', false);
            $client_type = null;
            if (strpos($user_agent, 'iPhone') !== false) {
                $client_type = 'iPhone';
            } elseif (strpos($user_agent, 'iPod') !== false) {
                $client_type = 'iPod';
            } elseif (strpos($user_agent, 'iPad') !== false) {
                $client_type = 'iPad';
            } elseif (strpos($user_agent, 'Android') !== false) {
                $client_type = 'Android';
            }
            $register_result = file_get_contents('http://192.168.3.31/vehIllegalQuery/index.php?mod=Member&act=RegisterSave&PWD=' . $user_phone . '&PHONE=' . $user_phone . '&clientType=' . $client_type);
            $user = User::getUserByPhone($user_phone);
            $this->view->setVar('car_mate_user_phone', $user_phone);
            $this->view->setVar('car_mate_pwd', $user_phone);
        }
        $this->view->setVar('user_id', $user['user_id']);
        //如果用户没绑定,则绑定(微信客户端访问页面时)
        if ($is_wx and !$bind_user) {
            $bind_user_sql = 'update IAM_USER set weixintoken = :wx_openid, wx_openid = :wx_openid where userid = :user_id';
            $bind_user_bind = array('wx_openid' => $wx_userinfo['openid'], 'user_id' => $user['user_id']);
            $bind_user_success = $db->execute($bind_user_sql, $bind_user_bind);
        }
        $query_sql = 'select invitation_code from ActivityUser where userid = :user_id and aid = :aid';
        $query_bind = array('user_id' => $user['user_id'], 'aid' => 228);
        $query_result = $db->query($query_sql, $query_bind);
        $query_result->setFetchMode(Db::FETCH_ASSOC);
        $involved_user = $query_result->fetch();
        $is_already = !empty($involved_user);
        $this->view->setVar('is_already', $is_already);
        if ($is_already) {
            //在微信客户端访问则进入过此页面的微信用户信息
            if ($is_wx) {
                $get_view_sql = <<<SQL
\t\t\t\tselect u.nickname, u.headimgurl, convert(varchar(20), v.create_date, 20) as create_date from Hui_ActivityShareView v
\t\t\t\tleft join WX_USER u on u.id = v.wx_user_id
\t\t\t\twhere v.wx_user_id is not null and v.p_user_id = :p_user_id and v.aid = :aid
SQL;
                $get_view_bind = array('p_user_id' => $user['user_id'], 'aid' => 228);
                $record_result = $db->query($get_view_sql, $get_view_bind);
                $record_result->setFetchMode(Db::FETCH_ASSOC);
                $record_list = $record_result->fetchAll();
                $this->view->setVar('view_record_list', $record_list);
            }
            if ($p_user_id) {
                $this->flashSession->success('您也获得了邀请码哦!<br/>可以点击右上角分享给您的好友,也可以将邀请码告知您的好友,在保险精算时填写邀请码!如有疑问请<a href="tel:400-009-0047">拨打服务热线</a>或<a href="http://wpa.qq.com/msgrd?v=3&uin=1011973383&site=qq&menu=yes">加客服QQ</a>联系我们');
            } else {
                $this->flashSession->success('您已成功参加活动<br/>可以点击右上角分享给您的好友,也可以将邀请码告知您的好友,在保险精算时填写邀请码!<br/>成功邀请<b style="color:orange">20</b>个好友购买保险,您的车险就可以免单啦!如有疑问请<a href="tel:400-009-0047">拨打服务热线</a>或<a href="http://wpa.qq.com/msgrd?v=3&uin=1011973383&site=qq&menu=yes">加客服QQ</a>联系我们');
            }
            $this->view->setVar('invitation_code', $involved_user['invitation_code']);
            $this->view->setVar('p_user_phone', $user['phone']);
            return;
        }
        $invitation_code = strtoupper(str_pad(dechex($user['id']), 5, '0', STR_PAD_LEFT));
        $insert_au_sql = 'insert into ActivityUser(userid, aid, p_user_id, invitation_code) values (:user_id, :aid, :p_user_id, :invitation_code)';
        $insert_au_bind = array('user_id' => $user['user_id'], 'aid' => 228, 'p_user_id' => $p_user_id, 'invitation_code' => $invitation_code);
        $insert_au_success = $db->execute($insert_au_sql, $insert_au_bind);
        if ($p_user_id) {
            $this->flashSession->success('您也获得了邀请码哦!<br/> 可以点击右上角分享给您的好友,也可以将邀请码告知您的好友,在保险精算时填写邀请码!如有疑问请<a href="tel:400-009-0047">拨打服务热线</a>或<a href="http://wpa.qq.com/msgrd?v=3&uin=1011973383&site=qq&menu=yes">加客服QQ</a>联系我们');
        } else {
            $this->flashSession->success('您已成功参加活动<br/>可以点击右上角分享给您的好友,也可以将邀请码告知您的好友,在保险精算时填写邀请码!<br/>成功邀请<b style="color:orange">20</b>个好友购买保险,您的车险就可以免单啦!如有疑问请<a href="tel:400-009-0047">拨打服务热线</a>或<a href="http://wpa.qq.com/msgrd?v=3&uin=1011973383&site=qq&menu=yes">加客服QQ</a>联系我们');
        }
        $this->view->setVar('invitation_code', $invitation_code);
        $this->view->setVar('p_user_phone', $user['phone']);
        $this->view->setVar('is_success', true);
    }
Example #10
0
<?php

include "include/header.php";
$results['users'] = User::getUserList($_SESSION['userId']);
?>


   <div>
		<form name="form" action="/backend/main.php?action=viewProfile" method="POST">
		<table>
					
				
					<tr>
						<td>
						  Select user
						</td>
                        <td>
		                  <input type="text" id="demo1" name="personId" />
						  
		               </td>
		            </tr>
					
					<tr>
						<td colspan="2">
							<input type="submit" name="groupForm" value="see profile" />
							</td>
					</tr>	
      
		</table>
        <script type="text/javascript">
        $(document).ready(function() {
 * @version    $Id: UserController.php 867 2015-01-03 22:52:05Z julian $
 */
/**
 * User Controller
 * @author     DotKernel Team <*****@*****.**>
 */
// instantiate classes related to User module: model & view
$userModel = new User();
$userView = new User_View($tpl);
// all actions MUST set  the variable  $pageTitle
$pageTitle = $option->pageTitle->action->{$registry->requestAction};
switch ($registry->requestAction) {
    case 'list':
        // list users
        $page = isset($registry->request['page']) && $registry->request['page'] > 0 ? $registry->request['page'] : 1;
        $users = $userModel->getUserList($page);
        $userView->listUser('list', $users, $page);
        break;
    case 'add':
        // display form and add new user
        $data = $_POST;
        if ($_SERVER['REQUEST_METHOD'] === "POST") {
            // changes were made to checkUserToken
            // see: Dot_Auth::checkUserToken($userToken, $userType='admin')
            // see: IndexController.php : $userToken
            if (!Dot_Auth::checkUserToken($userToken)) {
                // remove the identity
                $dotAuth = Dot_Auth::getInstance();
                $dotAuth->clearIdentity('admin');
                // warn the user
                $session->message['txt'] = $option->warningMessage->tokenExpired;
 public function actionDelete($id)
 {
     $user = User::model()->find(array('condition' => 'id = :id', 'params' => array(':id' => $id)));
     if (isset($user)) {
         if (!Yii::app()->user->checkAccess('admin') && (Yii::app()->getUser()->getProfile()->modules->head != UserModules::DIRECTOR_COMPANY || Yii::app()->user->getProfile()->company_id != $user->company_id || Yii::app()->user->id == $id)) {
             throw new CHttpException(403);
         }
         $users = User::getUserList($id);
         $model = new ModuleAccess();
         if (isset($_POST['ModuleAccess'])) {
             $userId = $_POST['ModuleAccess']['user'];
             Transport::model()->updateAll(array('user_id' => $userId), 'user_id=' . $id);
             Product::model()->updateAll(array('user_id' => $userId), 'user_id=' . $id);
             Cargo::model()->updateAll(array('user_id' => $userId), 'user_id=' . $id);
             Reis::model()->updateAll(array('user_id' => $userId), 'user_id=' . $id);
             Sklad::model()->updateAll(array('user_id' => $userId), 'user_id=' . $id);
             Custom::model()->updateAll(array('user_id' => $userId), 'user_id=' . $id);
             Insurance::model()->updateAll(array('user_id' => $userId), 'user_id=' . $id);
             SpecialTechnique::model()->updateAll(array('user_id' => $userId), 'user_id=' . $id);
             if ($user->delete()) {
                 $this->redirect('/cabinet/staff/list');
             }
         }
         $this->render('delete', array('model' => $model, 'user' => $user, 'users' => $users));
     }
 }
Example #13
0
 function user()
 {
     $model = new User();
     View::render('user/listuser', array('list' => $model->getUserList()));
 }