Example #1
0
 function userinfo($uid, $tel = null, $page = null)
 {
     if (-1 == $uid && !is_null($page)) {
         $limit = null;
         $arr = array(1 => 1);
         $limit = ($page - 1) * 10;
         $limit .= ',10';
         $re = UserInfo::userinfo_orderby_select('`uid`', $limit);
         $a = array();
         while ($selfinfo = mysql_fetch_array($re, MYSQL_ASSOC)) {
             $a[] = $selfinfo;
         }
         return $a;
     } else {
         $arr = isset($tel) ? array("tel" => $tel) : array("uid" => $uid);
         $limit = 1;
         $re = UserInfo::userinfo_select($arr, $limit);
         $selfinfo = mysql_fetch_array($re, MYSQL_ASSOC);
         $a = array('nickname', 'image', 'gender', 'provice');
         $count = 0;
         foreach ($selfinfo as $key => $value) {
             if (in_array($key, $a)) {
                 if (isset($value)) {
                     $count++;
                 }
             }
         }
         $selfinfo['percent'] = floor($count / 4 * 100);
         return $selfinfo;
     }
 }