Пример #1
0
 function dept()
 {
     $widget['date'] = true;
     $this->assign("widget", $widget);
     $model = M("Dept");
     $list = $model->where('is_del=0')->order('sort asc')->getField('id,name');
     $this->assign('dept_list', $list);
     $where = $this->_search("User");
     if (method_exists($this, '_search_filter')) {
         $this->_search_filter($where);
         if ($where['is_del'] == "") {
             $where['is_del'] = 0;
         }
     }
     $where['id'] = array('gt', '1');
     $model = D("user");
     $userId = get_user_id();
     $userInfo = get_user_info($userId, 'id,name,emp_no,dept_id,phone');
     $where['dept_id'] = array("eq", $userInfo[$userId]['dept_id']);
     //        if (!empty($model)) {
     //            $this -> _list($model, $where,"emp_no",true);
     //        }
     $info = $model->where($where)->order("emp_no desc")->select();
     for ($i = 0; $info[$i]; $i++) {
         $info[$i]['dept'] = D("dept")->where("id=" . $info[$i]['dept_id'])->getField("name");
         $info[$i]['position'] = D("position")->where("id=" . $info[$i]['position_id'])->getField("name");
     }
     $this->assign("list", $info);
     $this->display();
 }
Пример #2
0
 function get_pde_department_info($id = '', $param = '')
 {
     if ($id == '') {
         return NULL;
     } else {
         $query = $this->db->select()->from($this->_tablename)->where($this->_primary_key, $id)->get();
     }
     if ($query->result_array()) {
         foreach ($query->result_array() as $row) {
             switch ($param) {
                 case 'title':
                     $result = $row['title'];
                     break;
                 case 'author_id':
                     $result = $row['author'];
                     break;
                 case 'author':
                     $result = get_user_info($row['author'], 'fullname');
                     break;
                 case 'isactive':
                     $result = $row['active'];
                     break;
                 case 'dateadded':
                     $result = $row['dateadded'];
                     break;
                 default:
                     $result = $query->result_array();
             }
         }
         return $result;
     } else {
         return NULL;
     }
 }
Пример #3
0
 /**
  * Send a mail to confirm that a user have been validated
  * by an admin to the creator of this user. 
  * 
  * @param mixed $user 
  * @access protected
  * @return void
  */
 protected function validateConfirmation($id) {
   $obm_q = run_query_user_detail($id);
   $admin = get_user_info();
   $this->from = $this->getSender();
   $this->subject = __('%displayname% validation confirmation', array('%displayname%' => $obm_q->f('userobm_firstname').' '.$obm_q->f('userobm_lastname')));
   $this->recipients = $this->getRecipients(array($obm_q->f('userobm_usercreate')));    
   $this->body = array('user_label' => $obm_q->f('userobm_firstname').' '.$obm_q->f('userobm_lastname'),
                       'admin_label' => $admin['firstname'].' '.$admin['lastname']);
 }
Пример #4
0
function get_openid()
{
    global $db, $tpf, $settings, $timestamp, $onlineip, $user_tpl_dir;
    $graph_url = "https://graph.qq.com/oauth2.0/me?access_token=" . $_SESSION['access_token'];
    $str = get_url_contents($graph_url);
    if (strpos($str, "callback") !== false) {
        $lpos = strpos($str, "(");
        $rpos = strrpos($str, ")");
        $str = substr($str, $lpos + 1, $rpos - $lpos - 1);
    }
    $user = json_decode($str);
    if (isset($user->error)) {
        echo "<h3>error:</h3>" . $user->error;
        echo "<h3>msg  :</h3>" . $user->error_description;
        exit;
    }
    //debug
    //echo("Hello " . $user->openid);
    //set openid to session
    $_SESSION["openid"] = $user->openid;
    if ($_SESSION["openid"]) {
        $arr = get_user_info();
        $nickname = $arr["nickname"];
        $abs_path = '../../../';
        $flid = @$db->result_first("select flid from {$tpf}fastlogin where auth_type='qq' and auth_name='{$_SESSION["openid"]}'");
        if ($flid) {
            $userid = @$db->result_first("select userid from {$tpf}fastlogin where flid='{$flid}'");
            if ($userid) {
                $rs = $db->fetch_one_array("select userid,gid,username,password,email from {$tpf}users where userid='{$userid}'");
                if ($rs) {
                    pd_setcookie('phpdisk_zcore_info', pd_encode("{$rs[userid]}\t{$rs[gid]}\t{$rs[username]}\t{$rs[password]}\t{$rs[email]}"));
                    //login
                    $ins = array('last_login_time' => $timestamp, 'last_login_ip' => $onlineip);
                    $db->query_unbuffered("update {$tpf}users set " . $db->sql_array($ins) . " where userid='{$userid}'");
                    $db->query_unbuffered("update {$tpf}fastlogin set " . $db->sql_array($ins) . " where flid='{$flid}'");
                    //echo 'Login Success';
                    redirect($settings[phpdisk_url] . urr("mydisk", ""), '', 0);
                }
                unset($rs);
            } else {
                // to bind username
                $title = __('bind_disk_name');
                require_once template_echo('pd_fastlogin', $user_tpl_dir);
            }
        } else {
            $ins = array('nickname' => $nickname, 'auth_type' => 'qq', 'auth_name' => $_SESSION["openid"], 'last_login_time' => $timestamp, 'last_login_ip' => $onlineip);
            $db->query_unbuffered("insert into {$tpf}fastlogin set " . $db->sql_array($ins) . "");
            $flid = $db->insert_id();
            //echo 'Login Success';
            $title = __('bind_disk_name');
            require_once template_echo('pd_fastlogin', $user_tpl_dir);
        }
    } else {
        exit('QQ Login Error');
    }
}
Пример #5
0
 /**
  * Send a mail to confirm that a user have been validated
  * by an admin to the creator of this user. 
  * 
  * @param mixed $user 
  * @access protected
  * @return void
  */
 protected function creationNotice($id) {
   $user = get_user_info($id);
   $creator = get_user_info();
   $this->from = $this->getSender();
   $this->subject = __('%displayname% is to be validated', array('%displayname%' => $user['firstname'].' '.$user['lastname']));
   $this->recipients = $this->getRecipients(run_query_people_get_admin($user['delegation']));    
   $this->body = array('user_label' => $user['firstname'].' '.$user['lastname'],
                       'creator_label' => $creator['firstname'].' '.$creator['lastname'],
                        'delegation' => $user['delegation']);
 }
Пример #6
0
 public function __construct() {
   parent::__construct();
   $this->locale = $_SESSION['set_lang'];
   $this->host = $GLOBALS['cgp_host'];
   $this->userId = $GLOBALS['obm']['uid'];
   // to move somewhere else...
   mb_internal_encoding("UTF-8");
   SI18n::set_locale($this->locale);
   self::set_template_root(dirname(__FILE__).'/../../views/mail');
   $this->userInfo = get_user_info();
 }
 public function qq()
 {
     $loginconfig = FS("Webconfig/loginconfig");
     require C("APP_ROOT") . "Lib/Oauth/qq2.0/oauth/qq_callback.php";
     qq_callback();
     //获取用户标示id
     get_openid();
     //获取用户信息
     $userInfo = (array) get_user_info();
     $map['openid'] = text($_SESSION['openid']);
     //唯一ID
     $map['site'] = 'qq';
     $field = array('is_bind' => 1, 'site' => 'qq', 'openid' => $_SESSION['openid'], 'nickname' => $userInfo['nickname'], 'avatar' => $userInfo['figureurl_2'], 'logintimes' => 1, 'bind_uid' => $this->uid, 'logintime' => time(), 'addtime' => time());
     $this->OauthSave($map, $field);
 }
Пример #8
0
function do_wefact_auth($u, $p)
{
    $wefact = new WeFactApi();
    $r = $wefact->sendRequest('debtor', 'show', array('DebtorCode' => $u));
    if (isset($r['status']) && $r['status'] == 'success') {
        $r = $wefact->sendRequest('debtor', 'checklogin', array('Username' => $u, 'Password' => $p));
        if (isset($r['status']) && $r['status'] == 'success') {
            if (get_user_info($u) == FALSE) {
                add_user($u);
            }
            return TRUE;
        }
        return FALSE;
    } else {
        return -1;
    }
}
Пример #9
0
function get_user()
{
    global $html;
    $html = "<table><tr><th>Nom de l'utilisateur</th><th>Supprimer le compte</th><th>Promouvoir administrateur</th></tr>";
    $array_result = get_user_info();
    foreach ($array_result as $value) {
        //Pour chaque utilisateurs
        $html .= "<tr>";
        $html .= "<td>" . $value['pseudo'] . "</td>";
        $html .= '<td><button class="btn btn-danger" name="SupressionUser" Onclick="window.location.href=\'administration.php?delete=' . $value['idUser'] . '\'">Supression</button>';
        if ($value['isAdmin'] == 0) {
            $html .= '<td><button class="btn btn-warning" name="Promouvoir" Onclick="window.location.href=\'administration.php?promote=' . $value['idUser'] . '\'">Promouvoir</button></td>';
        } else {
            $html .= "<td>Déjà administrateur</td>";
        }
        $html .= "<tr>";
    }
    $html .= "</table>";
}
/**
 * 调用会员信息
 */
function smarty_function_member_info($params, $template)
{
    $need_cache = $template->caching;
    $template->caching = false;
    if ($_SESSION['user_id'] > 0) {
        $template->assign('user_info', get_user_info());
    } else {
        if (!empty($_COOKIE['ECS']['username'])) {
            $template->assign('ecs_username', stripslashes($_COOKIE['ECS']['username']));
        }
        $captcha = intval($GLOBALS['_CFG']['captcha']);
        if ($captcha & CAPTCHA_LOGIN && (!($captcha & CAPTCHA_LOGIN_FAIL) || $captcha & CAPTCHA_LOGIN_FAIL && $_SESSION['login_fail'] > 2) && gd_version() > 0) {
            $template->assign('enabled_captcha', 1);
            $template->assign('rand', mt_rand());
        }
    }
    $output = $template->fetch('member_info.html');
    $template->caching = $need_cache;
    return $output;
}
Пример #11
0
 public function qqlogin()
 {
     $loginconfig = FS("Webconfig/loginconfig");
     require C("APP_ROOT") . "Lib/Oauth/qq2.0/oauth/qq_callback.php";
     //QQ登录成功后的回调地址,主要保存access token
     $res = qq_callback();
     if ($res !== true) {
         $this->assign('waitSecond', "5");
         $this->error($res, __ROOT__ . "/");
     }
     //获取用户标示id
     get_openid();
     //获取用户信息
     $userInfo = get_user_info();
     // 		$userInfo->nickname = date("YmdHis");
     $map['openid'] = text($_SESSION['openid']);
     //唯一ID
     $map['site'] = 'qq';
     $this->appCk($map, $userInfo->nickname);
 }
Пример #12
0
function draw_team_panel()
{
    global $points_brackets;
    $teams = get_team_leaders();
    $teampoints = array();
    while ($team = $teams->fetch_array()) {
        $teampoints[$team['user_id']] = get_team_point_total($team['user_id']);
    }
    $highest = max($teampoints);
    $bracket = 100;
    while ($bracket < $highest) {
        $bracket = current($points_brackets);
        next($points_brackets);
    }
    foreach ($teampoints as $team => $teampoint) {
        $tlinfo = get_user_info($team);
        echo 'Team ' . $tlinfo['lname'];
        draw_progress_bar($teampoint, $bracket);
    }
}
Пример #13
0
 /**
  * Share the binding Qzone
  */
 public function share_qqzoneOp()
 {
     //判断系统是否开启站外分享功能
     if (C('share_qqzone_isuse') != 1) {
         showMessage(Language::get('sharebind_unused'), 'index.php?act=member_sharemanage', 'html', 'error');
     }
     include_once 'api/snsapi/qqzone/oauth/qq_callback.php';
     if (!$_SESSION['qqzone']) {
         echo "<script>alert('" . Language::get('sharebind_bind_fail') . "');</script>";
         echo "<script>window.close();</script>";
         exit;
     }
     $update_arr = array();
     $update_arr['snsbind_memberid'] = $_SESSION['member_id'];
     $update_arr['snsbind_membername'] = $_SESSION['member_name'];
     $update_arr['snsbind_appsign'] = 'qqzone';
     $update_arr['snsbind_updatetime'] = time();
     $update_arr['snsbind_accesstoken'] = $_SESSION['qqzone']['access_token'];
     $update_arr['snsbind_expiresin'] = $_SESSION['qqzone']['expires_in'];
     $update_arr['snsbind_openid'] = $_SESSION['qqzone']['openid'];
     //获取qq账号信息
     require_once BASE_PATH . DS . 'api' . DS . 'snsapi' . DS . 'qqzone' . DS . 'user' . DS . 'get_user_info.php';
     $qquser_info = get_user_info();
     $update_arr['snsbind_openinfo'] = $qquser_info['nickname'];
     $model = Model();
     $where_arr = array();
     $where_arr['snsbind_memberid'] = $_SESSION['member_id'];
     $where_arr['snsbind_appsign'] = 'qqzone';
     //查询该用户是否已经绑定qqzone
     $bind_info = $model->table('sns_binding')->where($where_arr)->find();
     if (empty($bind_info)) {
         $result = $model->table('sns_binding')->insert($update_arr);
     } else {
         $result = $model->table('sns_binding')->where($where_arr)->update($update_arr);
     }
     if (!$result) {
         echo "<script>alert('" . Language::get('sharebind_bind_fail') . "');</script>";
     }
     echo "<script>window.close();</script>";
     exit;
 }
Пример #14
0
 private function checkLoginstatus()
 {
     if ($this->csloginid && (int) $this->csloginid > 0) {
         if ($this->csloginusersessionid) {
             $login_info = get_login_info((int) $this->csloginid);
             if ($login_info && $login_info->getStatus()) {
                 $user_info = get_user_info($login_info->getUserid());
                 if ($user_info) {
                     if ($this->csloginusersessionid == sha1($login_info->getLoginid() . $login_info->getUserid())) {
                         $this->islogin = true;
                         $this->login_info = $login_info;
                         $this->user_info = $user_info;
                         $this->usertype = $user_info->getType();
                         $this->userlevel = $user_info->getLevel();
                     }
                 }
             }
         }
     }
     return $this->islogin;
 }
Пример #15
0
function check_login($username, $password, $remember = true)
{
    $db = get_db_read();
    # Get the salt and check if the user exists at the same time
    $result = try_mysql_query("SELECT salt FROM users WHERE username = '******'", $db);
    if (mysql_num_rows($result) != 1) {
        return null;
    }
    $row = mysql_fetch_assoc($result);
    $salt = $row['salt'];
    mysql_free_result($result);
    $hashed_password = hash_password($password, $salt);
    $ret = get_user_info($db, $username, $hashed_password);
    if ($ret == null) {
        return null;
    }
    if ($remember == true) {
        setcookie("username", $username, time() + 60 * 60 * 24 * 3000);
        setcookie("password", $hashed_password, time() + 60 * 60 * 24 * 3000);
    }
    $_SESSION["username"] = $username;
    return $ret;
}
Пример #16
0
    $smarty->assign('verify_userlogin', $captcha['verify_userlogin']);
    $smarty->display('plus/ajax_login.htm');
    exit;
}
if ($_SESSION['utype'] != '2') {
    exit('<table width="100%" border="0" cellspacing="0" cellpadding="0" class="tableall">
	    <tr>
			<td width="20" align="right"></td>
			<td class="ajax_app">
				必须是个人会员才可以收藏职位!
			</td>
	    </tr>
	</table>');
}
require_once QISHI_ROOT_PATH . 'include/fun_personal.php';
$user = get_user_info($_SESSION['uid']);
if ($user['status'] == "2") {
    exit('<table width="100%" border="0" cellspacing="0" cellpadding="0" class="tableall">
	    <tr>
			<td width="20" align="right"></td>
			<td class="ajax_app">
				您的账号处于暂停状态,请联系管理员设为正常后进行操作!
			</td>
	    </tr>
	</table>');
}
if ($act == "add") {
    $id = isset($_GET['id']) ? trim($_GET['id']) : exit("出错了");
    if (add_favorites($id, $_SESSION['uid']) == 0) {
        exit('<table width="100%" border="0" cellspacing="0" cellpadding="0" class="tableall">
	    <tr>
Пример #17
0
function action_signin()
{
    // 获取全局变量
    $user = $GLOBALS['user'];
    $_CFG = $GLOBALS['_CFG'];
    $_LANG = $GLOBALS['_LANG'];
    $smarty = $GLOBALS['smarty'];
    $db = $GLOBALS['db'];
    $ecs = $GLOBALS['ecs'];
    $user_id = $_SESSION['user_id'];
    include_once 'includes/cls_json.php';
    $json = new JSON();
    $username = !empty($_POST['username']) ? json_str_iconv(trim($_POST['username'])) : '';
    $password = !empty($_POST['password']) ? trim($_POST['password']) : '';
    $captcha = !empty($_POST['captcha']) ? json_str_iconv(trim($_POST['captcha'])) : '';
    $result = array('error' => 0, 'content' => '');
    $captcha = intval($_CFG['captcha']);
    if ($captcha & CAPTCHA_LOGIN && (!($captcha & CAPTCHA_LOGIN_FAIL) || $captcha & CAPTCHA_LOGIN_FAIL && $_SESSION['login_fail'] > 2) && gd_version() > 0) {
        if (empty($captcha)) {
            $result['error'] = 1;
            $result['content'] = $_LANG['invalid_captcha'];
            die($json->encode($result));
        }
        /* 检查验证码 */
        include_once 'includes/cls_captcha.php';
        $validator = new captcha();
        $validator->session_word = 'captcha_login';
        if (!$validator->check_word($_POST['captcha'])) {
            $result['error'] = 1;
            $result['content'] = $_LANG['invalid_captcha'];
            die($json->encode($result));
        }
    }
    if ($user->login($username, $password)) {
        update_user_info();
        // 更新用户信息
        recalculate_price();
        // 重新计算购物车中的商品价格
        $smarty->assign('user_info', get_user_info());
        $ucdata = empty($user->ucdata) ? "" : $user->ucdata;
        $result['ucdata'] = $ucdata;
        $result['content'] = $smarty->fetch('library/member_info.lbi');
    } else {
        $_SESSION['login_fail']++;
        if ($_SESSION['login_fail'] > 2) {
            $smarty->assign('enabled_captcha', 1);
            $result['html'] = $smarty->fetch('library/member_info.lbi');
        }
        $result['error'] = 1;
        $result['content'] = $_LANG['login_failure'];
    }
    die($json->encode($result));
}
Пример #18
0
			<div style="border-top:1px #CCCCCC solid; line-height:180%; margin-top:10px; padding-top:10px; height:50px;margin-left:20px"  class="dialog_closed">
			<?php 
        echo $downresumeurl;
        ?>
<br />
			<?php 
    }
    ?>
			<a href="javascript:void(0)"  class="DialogClose underline" style="color:#0180cf;text-decoration:none;">下载完成</a>
			</div>
		</td>
    </tr>
</table>
<?php 
} elseif ($act == "download_save") {
    $ruser = get_user_info($resumeshow['uid']);
    $pms_notice = intval($_GET['pms_notice']);
    if ($_CFG['operation_mode'] == "2") {
        if ($resumeshow['talent'] == '2') {
            if ($setmeal['download_resume_senior'] > 0 && add_down_resume($id, $_SESSION['uid'], $resumeshow['uid'], $resumeshow['resume_name'])) {
                action_user_setmeal($_SESSION['uid'], "download_resume_senior");
                $setmeal = get_user_setmeal($_SESSION['uid']);
                write_memberslog($_SESSION['uid'], 1, 9002, $_SESSION['username'], "下载了 {$ruser['username']} 发布的高级简历,还可以下载 {$setmeal['download_resume_senior']} 份高级简历", 2, 1005, "下载高级简历", "1", "{$setmeal['download_resume_senior']}");
                write_memberslog($_SESSION['uid'], 1, 4001, $_SESSION['username'], "下载了 {$ruser['username']} 发布的简历");
                //站内信
                if ($pms_notice == '1') {
                    $company = $db->getone("select id,companyname  from " . table('company_profile') . " where uid ={$_SESSION['uid']} limit 1");
                    // $user=$db->getone("select username from ".table('members')." where uid ={$resumeshow['uid']} limit 1");
                    $resume_url = url_rewrite('QS_resumeshow', array('id' => $id));
                    $company_url = url_rewrite('QS_companyshow', array('id' => $company['id']));
                    $message = $_SESSION['username'] . "下载了您发布的简历:<a href=\"{$resume_url}\" target=\"_blank\">{$resumeshow['resume_name']}</a>,<a href=\"{$company_url}\" target=\"_blank\">点击查看公司详情</a>";
 public function index()
 {
     $widget['date'] = true;
     $this->assign("widget", $widget);
     $this->assign('user_id', get_user_id());
     $auth = $this->config['auth'];
     $this->assign('auth', $auth);
     if ($auth['admin']) {
         $node = D("Dept");
         $dept_id = get_dept_id();
         $dept_name = get_dept_name();
         $menu = array();
         $dept_menu = $node->field('id,pid,name')->where("is_del=0")->order('sort asc')->select();
         $dept_tree = list_to_tree($dept_menu, $dept_id);
         $count = count($dept_tree);
         if (empty($count)) {
             /*获取部门列表*/
             $html = '';
             $html = $html . "<option value='{$dept_id}'>{$dept_name}</option>";
             $this->assign('dept_list', $html);
             //*获取人员列表*/
             $rank_id = get_user_info(get_user_id(), 'rank_id');
             $where['rank_id'] = array('gt', $rank_id);
             $where['dept_id'] = array('eq', $dept_id);
             $emp_list = D("User")->where($where)->getField('id,name');
             $this->assign('emp_list', $emp_list);
         } else {
             /*获取部门列表*/
             $this->assign('dept_list', select_tree_menu($dept_tree));
             $dept_list = tree_to_list($dept_tree);
             $dept_list = rotate($dept_list);
             $dept_list = $dept_list['id'];
             /*获取人员列表*/
             $rank_id = get_user_info(get_user_id(), 'rank_id');
             $where['rank_id'] = array('gt', $rank_id);
             $where['dept_id'] = array('in', $dept_list);
             $where['is_submit'] = array('eq', 1);
             $where['_logic'] = 'or';
             $map['_complex'] = $where;
             $map['user_id'] = get_user_id();
             $emp_list = D("User")->where($map)->getField('id,name');
             $this->assign('emp_list', $emp_list);
         }
     }
     $map = $this->_search();
     if ($auth['admin']) {
         if (empty($map['dept_id'])) {
             if (!empty($dept_list)) {
                 $map['dept_id'] = array('in', array_merge($dept_list, array($dept_id)));
             } else {
                 $map['dept_id'] = array('eq', $dept_id);
             }
         }
     } else {
         $map['user_id'] = get_user_id();
     }
     if (D("Role")->check_duty('SHOW_LOG')) {
         $map = array();
         $map['is_del'] = array('eq', '0');
     }
     if (method_exists($this, '_search_filter')) {
         $this->_search_filter($map);
     }
     $model = D("MonthlyReport");
     if (!empty($model)) {
         $this->_list($model, $map);
     }
     $this->display();
 }
Пример #20
0
$openid = '01B30933D45BC52A869A1C5AD2E2FBED';
$openkey = '38AB0FB09FE3476ECF7D88586A012F65';
// 应用基本信息
//$appid = 100657839;
//$appkey = 'b96b85196a04ff2ef08707f43979db15';
// OpenAPI的服务器IP
// 最新的API服务器地址请参考wiki文档: http://wiki.open.qq.com/wiki/API3.0%E6%96%87%E6%A1%A3
$server_name = '119.147.19.43';
// 用户的OpenID/OpenKey
//$openid = 'E098C1E975A2459E534B48FB3224CFB6';
//$openkey = '05219DB6D7C04CA0B3F01A51D32635E3';
// 所要访问的平台, pf的其他取值参考wiki文档: http://wiki.open.qq.com/wiki/API3.0%E6%96%87%E6%A1%A3
$pf = 'qzone';
$sdk = new OpenApiV3($appid, $appkey);
$sdk->setServerName($server_name);
$ret = get_user_info($sdk, $openid, $openkey, $pf);
print_r("===========================\n");
print_r($ret);
/**
 * 获取好友资料
 *
 * @param object $sdk OpenApiV3 Object
 * @param string $openid openid
 * @param string $openkey openkey
 * @param string $pf 平台
 * @return array 好友资料数组
 */
function get_user_info($sdk, $openid, $openkey, $pf)
{
    $params = array('openid' => $openid, 'openkey' => $openkey, 'pf' => $pf);
    $script_name = '/v3/user/get_info';
Пример #21
0
<?php

define('FPDF_FONTPATH', 'fpdf_fonts/');
require 'fpdf.php';
include '_includeSessionConfig.php';
include "newProgressReports.php";
$loginError = check_auth($_SESSION[$_CONF['sess_name'] . '_username'], $_SESSION[$_CONF['sess_name'] . '_password']);
if (!$loginError['error_value']) {
    $tid = $_SESSION[$_CONF['sess_name'] . '_selected_teacher'];
    $result = get_user_info($tid);
    $user = $result->fetch_assoc();
    $tfName = $user['first_name'];
    $tlName = $user['last_name'];
    $teacherName = $tfName . " " . $tlName;
    $term_id = $_POST['term_id'];
    $termName = $_POST['term_name'];
    $loc = array();
    $year = date("y");
    $download = false;
    if (isset($_POST['all'])) {
        $sql = "SELECT classes.class_id,courses.teacher_id,courses.course_name\n                FROM classes,courses\n                WHERE courses.teacher_id=" . $tid . "\n                    AND courses.school_year_id=" . $_SESSION[$_CONF['sess_name'] . '_current_school_year'] . " \n                    AND classes.term_id=" . $term_id . "\n                    AND courses.course_id=classes.course_id\n                ORDER by courses.course_name";
        $result = $db->query($sql);
        while ($row = $result->fetch_assoc()) {
            $loc[$row['class_id']] = $row['course_name'];
        }
        $filename = $year . "_" . $termName . "_" . $teacherName . "_ClassSummaries.pdf";
        $download = true;
    } else {
        $cid = $_SESSION[$_CONF['sess_name'] . '_selected_class'];
        $result = get_class_info($cid);
        $row = $result->fetch_assoc();
Пример #22
0
function coupon_validation($valid, $coupon)
{
    global $woocommerce;
    $level = strtolower(get_user_info('loyalty_status'));
    $order = get_last_order();
    $code = $coupon->code;
    if (preg_match("/^[a-zA-Z]{2}[0-9]{2}\$/", $code) && $order > 0) {
        $valid = false;
    } elseif (strstr(" silver, gold, platinum ", $code) && $level != $code) {
        $valid = false;
    } else {
        $valid = true;
    }
    return $valid;
}
Пример #23
0
 /**
  * qq绑定新用户
  */
 public function registerOp()
 {
     //实例化模型
     $model_member = Model('member');
     if (chksubmit()) {
         $update_info = array();
         $update_info['member_passwd'] = md5(trim($_POST["password"]));
         if (!empty($_POST["email"])) {
             $update_info['member_email'] = $_POST["email"];
             $_SESSION['member_email'] = $_POST["email"];
         }
         $model_member->updateMember($update_info, $_SESSION['member_id']);
         showMessage(Language::get('nc_common_save_succ'), SHOP_SITE_URL);
     } else {
         //检查登录状态
         $model_member->checkloginMember();
         //获取qq账号信息
         require_once BASE_PATH . '/api/qq/user/get_user_info.php';
         $qquser_info = get_user_info($_SESSION["appid"], $_SESSION["appkey"], $_SESSION["token"], $_SESSION["secret"], $_SESSION["openid"]);
         Tpl::output('qquser_info', $qquser_info);
         //处理qq账号信息
         $qquser_info['nickname'] = trim($qquser_info['nickname']);
         $user_passwd = rand(100000, 999999);
         /**
          * 会员添加
          */
         $user_array = array();
         $user_array['member_name'] = $qquser_info['nickname'];
         $user_array['member_passwd'] = $user_passwd;
         $user_array['member_email'] = '';
         $user_array['member_qqopenid'] = $_SESSION['openid'];
         //qq openid
         $user_array['member_qqinfo'] = serialize($qquser_info);
         //qq 信息
         $rand = rand(100, 899);
         if (strlen($user_array['member_name']) < 3) {
             $user_array['member_name'] = $qquser_info['nickname'] . $rand;
         }
         $check_member_name = $model_member->infoMember(array('member_name' => trim($user_array['member_name'])));
         $result = 0;
         if (empty($check_member_name)) {
             $result = $model_member->addMember($user_array);
         } else {
             $user_array['member_name'] = trim($qquser_info['nickname']) . $rand;
             $check_member_name = $model_member->infoMember(array('member_name' => trim($user_array['member_name'])));
             if (empty($check_member_name)) {
                 $result = $model_member->addMember($user_array);
             } else {
                 for ($i = 1; $i < 999999; $i++) {
                     $rand = $rand + $i;
                     $user_array['member_name'] = trim($qquser_info['nickname']) . $rand;
                     $check_member_name = $model_member->infoMember(array('member_name' => trim($user_array['member_name'])));
                     if (empty($check_member_name)) {
                         $result = $model_member->addMember($user_array);
                         break;
                     }
                 }
             }
         }
         if ($result) {
             Tpl::output('user_passwd', $user_passwd);
             $avatar = @copy($qquser_info['figureurl_qq_2'], BASE_UPLOAD_PATH . '/' . ATTACH_AVATAR . "/avatar_{$result}.jpg");
             $update_info = array();
             if ($avatar) {
                 $update_info['member_avatar'] = "avatar_{$result}.jpg";
                 $model_member->updateMember($update_info, $result);
                 $user_array['member_avatar'] = "avatar_{$result}.jpg";
             }
             $user_array['member_id'] = $result;
             $model_member->createSession($user_array);
             Tpl::showpage('connect_register');
         } else {
             showMessage(Language::get('login_usersave_regist_fail'), SHOP_SITE_URL . '/index.php?act=login&op=register', 'html', 'error');
             //"会员注册失败"
         }
     }
 }
Пример #24
0
        /* Obsolete Code                                     */
        /* $DOC_TITLE = "Password Change Successfull";       */
        /* include("$CFG->templatedir/header.php");          */
        /* include("templates/change_password_success.inc"); */
        /* include("$CFG->templatedir/footer.php");          */
        $session['notice'] = "Passwort erfolgreich ge&auml;ndert!";
        $goto = empty($session["wantsurl"]) ? "{$CFG->wwwroot}/user/user_data.php" : $session["wantsurl"];
        header("Location: {$goto}");
        die;
    } else {
        $session['notice'] = $errormsg;
    }
}
/* Check that user is logged in is missing! */
$DOC_TITLE = "Change Password";
$tmp = get_user_info($session['username']);
include "{$CFG->templatedir}/header.php";
include "templates/changepassword.inc";
include "{$CFG->templatedir}/footer.php";
/******************************************************************************
 * FUNCTIONS
 *****************************************************************************/
function validate_form(&$frm, &$errors, $session)
{
    /* validate the signup form, and return the error messages in a string.  if
     * the string is empty, then there are no errors */
    $errors = new Object();
    $msg = "";
    $tmp = verify_login($session['username'], $frm["oldpassword"]);
    if (empty($frm["oldpassword"])) {
        $errors->oldpassword = true;
Пример #25
0
 }
 /* 查询:取得兑换商品信息 */
 $goods = get_exchange_goods_info($goods_id);
 if (empty($goods)) {
     ecs_header("Location: ./\n");
     exit;
 }
 /* 查询:检查兑换商品是否有库存 */
 if ($goods['goods_number'] == 0 && $_CFG['use_storage'] == 1) {
     show_message($_LANG['eg_error_number'], array($_LANG['back_up_page']), array($back_act), 'error');
 }
 /* 查询:检查兑换商品是否是取消 */
 if ($goods['is_exchange'] == 0) {
     show_message($_LANG['eg_error_status'], array($_LANG['back_up_page']), array($back_act), 'error');
 }
 $user_info = get_user_info($_SESSION['user_id']);
 $user_points = $user_info['pay_points'];
 // 用户的积分总数
 if ($goods['exchange_integral'] > $user_points) {
     show_message($_LANG['eg_error_integral'], array($_LANG['back_up_page']), array($back_act), 'error');
 }
 /* 查询:取得规格 */
 $specs = '';
 foreach ($_POST as $key => $value) {
     if (strpos($key, 'spec_') !== false) {
         $specs .= ',' . intval($value);
     }
 }
 $specs = trim($specs, ',');
 /* 查询:如果商品有规格则取规格商品信息 配件除外 */
 if (!empty($specs)) {
Пример #26
0
function insert_nickname()
{
    $need_cache = $GLOBALS['smarty']->caching;
    $GLOBALS['smarty']->caching = false;
    $output = '游客';
    if ($_SESSION['user_id'] > 0) {
        $user_info = get_user_info();
        $output = $user_info['nickname'];
    }
    $GLOBALS['smarty']->caching = $need_cache;
    return $output;
}
Пример #27
0
<?php

if ($_SESSION[$_CONF['sess_name'] . '_isOffice'] || $_SESSION[$_CONF['sess_name'] . '_isTeacher']) {
    if (isset($_POST['hoursByStudent'])) {
        $result = get_user_info($sid);
        $row = $result->fetch_assoc();
        $name = $row['first_name'] . " " . $row['last_name'];
        $colcount = 0;
        $t = "Student Hours Report";
        $b = "\n                <center>\n                <table>\n                <tr><th colspan=1>" . $name . "</th></tr>";
        $loc = get_student_classes_for_attendance($sid, $tid);
        foreach ($loc as $cname => $info) {
            $minutes = 0;
            $att = array();
            foreach ($info as $cid => $name_term) {
                if (isset($_POST['year'])) {
                    //$att = array_merge($att,getSMSStudentAttendance($sid,$cid, $_POST['year'],$_SESSION[$_CONF['sess_name'].'_myCenter']));
                    $att = array_merge($att, get_student_attendance($sid, $cid, $_POST['year'], $_SESSION[$_CONF['sess_name'] . '_myCenter']));
                } else {
                    //$att = array_merge($att,getSMSStudentAttendance($sid,$cid, $_SESSION[$_CONF['sess_name'].'_current_school_year'],$_SESSION[$_CONF['sess_name'].'_myCenter']));
                    $att = array_merge($att, get_student_attendance($sid, $cid, $_SESSION[$_CONF['sess_name'] . '_current_school_year'], $_SESSION[$_CONF['sess_name'] . '_myCenter']));
                }
                foreach ($att as $a => $i) {
                    foreach ($i as $d => $info) {
                        $minutes += $info['minutes'];
                    }
                }
                $b .= "<td align=center>" . $cname . "&nbsp;&nbsp;" . (int) ($minutes / 60) . ":" . sprintf("%02d", $minutes % 60) . "</td></tr>";
            }
            //$b .= make_attendance_table($att);
        }
Пример #28
0
    header('Location: admin.php');
}
?>
    <div class="content">
        <div class="topContent">
            <?php 
if (isset($_SESSION['user_id'])) {
    if (get_published_batch_id()) {
        $user = $_SESSION['user_id'];
        $name = get_user_by_id($user);
        $batch = get_published_batch_id();
        echo "<h2>" . get_text('Information') . " " . strtolower(get_text('About')) . ": {$name['0']} {$name['1']}</h2>";
        ?>
                    <p>
                        <a href="pdf.php?id=<?php 
        echo $_SESSION['user_id'];
        ?>
"><?php 
        echo get_text('View') . ' ' . get_text('PDF');
        ?>
</a>
                    </p>
                    <?php 
        get_user_info($user, $batch);
    }
}
?>
        </div>
    </div>
<?php 
require 'includes/footer.php';
Пример #29
0
        /* 检查验证码 */
        include_once 'includes/cls_captcha.php';
        $validator = new captcha();
        $validator->session_word = 'captcha_login';
        if (!$validator->check_word($_POST['captcha'])) {
            $result['error'] = 1;
            $result['content'] = $_LANG['invalid_captcha'];
            die($json->encode($result));
        }
    }
    if ($user->login($username, $password)) {
        update_user_info();
        //更新用户信息
        recalculate_price();
        // 重新计算购物车中的商品价格
        $smarty->assign('user_info', get_user_info());
        $ucdata = empty($user->ucdata) ? "" : $user->ucdata;
        $result['ucdata'] = $ucdata;
        $result['content'] = $smarty->fetch('library/member_info.lbi');
    } else {
        $_SESSION['login_fail']++;
        if ($_SESSION['login_fail'] > 2) {
            $smarty->assign('enabled_captcha', 1);
            $result['html'] = $smarty->fetch('library/member_info.lbi');
        }
        $result['error'] = 1;
        $result['content'] = $_LANG['login_failure'];
    }
    die($json->encode($result));
} elseif ($action == 'logout') {
    if (!isset($back_act) && isset($GLOBALS['_SERVER']['HTTP_REFERER'])) {
Пример #30
0
/**
 * 调用会员信息
 *
 * @access  public
 * @return  string
 */
function insert_member_info()
{
    $need_cache = $GLOBALS['smarty']->caching;
    $GLOBALS['smarty']->caching = false;
    if ($_SESSION['user_id'] > 0) {
        $GLOBALS['smarty']->assign('user_info', get_user_info());
    } else {
        if (!empty($_COOKIE['ECS']['username'])) {
            $GLOBALS['smarty']->assign('ecs_username', stripslashes($_COOKIE['ECS']['username']));
        }
        $captcha = intval(C('captcha'));
        if ($captcha & CAPTCHA_LOGIN && (!($captcha & CAPTCHA_LOGIN_FAIL) || $captcha & CAPTCHA_LOGIN_FAIL && $_SESSION['login_fail'] > 2) && gd_version() > 0) {
            $GLOBALS['smarty']->assign('enabled_captcha', 1);
            $GLOBALS['smarty']->assign('rand', mt_rand());
        }
    }
    $output = $GLOBALS['smarty']->fetch('library/member_info.lbi');
    $GLOBALS['smarty']->caching = $need_cache;
    return $output;
}