Example #1
0
 function auth()
 {
     global $_G;
     $cookie = $_G['cookie']['auth'];
     if ($cookie) {
         @(list($password, $uid) = explode("\t", authcode($cookie, 'DECODE')));
         $uid = intval($uid);
         $password = addslashes($password);
         $member = DB::fetch_first('SELECT * FROM ' . tname('members') . ' WHERE uid=\'' . $uid . '\' AND password=\'' . $password . '\'');
         if ($member) {
             $_G['uid'] = $uid;
             $_G['username'] = addslashes($member['username']);
             $_G['email'] = addslashes($member['email']);
             $_G['myshopid'] = intval($member['myshopid']);
             $_G['member']['shopcount'] = 0;
             $_G['member'] = $member;
             if ($_G['myshopid'] > 0) {
                 require_once B_ROOT . "./source/class/shop.class.php";
                 $_G['myshopsarr'] = shop::ls_myshops();
                 $_G['member']['shopcount'] = count($_G['myshops']);
             }
         }
     }
     //if(!$_G['uid']) { sclearcookie(); return ;}
     if (IN_STORE === true) {
         if (pkperm('isadmin')) {
             showmessage('admin_no_perm_to_panel', 'index.php');
         } elseif ($_G['myshopid'] < 0) {
             showmessage('no_perm', 'index.php');
         } else {
             $shop_grade = $_G['myshopsarr'][$_G['myshopid']]['grade'];
             if ($shop_grade <= 1) {
                 $_G['myshopstatus'] = 'unverified';
             } elseif ($shop_grade > 1) {
                 $_G['myshopstatus'] = 'verified';
             }
         }
     }
 }