Example #1
0
 function getlogin($data)
 {
     $outp = array("ec" => 1, "data" => 0);
     if (User::islogin()) {
         $outp["data"] = gets("login");
     } else {
         $outp["ec"] = -22;
     }
     return $outp;
 }
Example #2
0
 function conv($data)
 {
     $need = array("aid");
     $ec = 1;
     $odata = 0;
     if (!Fun::isAllSet($need, $data)) {
         $ec = -9;
     } else {
         if (!User::islogin()) {
             $ec = -8;
         } else {
             $odata = 122;
         }
     }
     echo json_encode(array('ec' => $ec, 'data' => $odata)) . "\n";
     if ($ec < 0) {
         return;
     }
     Disps::disp_assign_conv($data["aid"]);
 }
Example #3
0
 public static function gotologin($typec = '', $force = false, $page = 'login')
 {
     if ($force || (!User::islogin() || $typec != '' && $typec != User::loginType())) {
         Fun::redirect(BASE . $page . "?url=" . rawurlencode(self::getcururl()));
     }
 }
Example #4
0
 public static function myprofile()
 {
     if (User::islogin()) {
         return self::userProfile(User::loginId());
     } else {
         return null;
     }
 }
Example #5
0
 public function insertXueshu($arr)
 {
     $user = new User($this->arr);
     if ($user->islogin()) {
         $user_id = $user->getUserId();
         $huida_id = isset($arr['huida_id']) ? (int) $arr['huida_id'] : 0;
         $kinds = C::safe($arr['kinds'], $this->dbc);
         $title = C::safe($arr['title'], $this->dbc);
         $content = Safe::removeXSS($arr['content']);
         $filename = sha1(uniqid() . $user_id) . '.txt';
         //			$table = $this->arr['xml']->xueshu['table'];
         $table = $this->table;
         $file_dir = $this->arr['xml']->xueshu['dir'];
         $root_dir = $this->arr['root_dir'];
         if (file_put_contents(dirname(dirname(__FILE__)) . '/' . $file_dir . $filename, $content)) {
             $query = sprintf("INSERT INTO %s (user_id,kinds,title,filename,huida_id)\n\t\t\t\t\t\tVALUES(%d,'%s','%s','%s', %d)", $table, $user_id, $kinds, $title, $filename, $huida_id);
             $result = C::query($query, $this->dbc);
             if ($result) {
                 $arr = array('isok' => '1', 'info' => 'Ok', 'content' => $content);
             } else {
                 $arr = array('isok' => '0', 'code' => 3, 'info' => mysql_error($this->dbc));
             }
             if ($huida_id !== 0) {
                 $query = sprintf("UPDATE %s SET huida = huida + 1 WHERE xueshu_id = %d", $table, $huida_id);
                 C::query($query, $this->dbc);
             }
         } else {
             $arr = array('isok' => '0', 'code' => 2, 'info' => 'can not write into file!');
         }
     } else {
         $arr = array('isok' => '0', 'code' => 1, 'info' => 'have not login!');
     }
     return $arr;
 }
Example #6
0
pit('active', g("curpage") === 'aboutus');
?>
"><a href="<?php 
echo BASE . "aboutus";
?>
">About Us</a></li>
		<li class="<?php 
pit('active', g("curpage") === 'contactus');
?>
"><a href="<?php 
echo BASE . "contactus";
?>
">Contact Us</a></li>

		<?php 
if (User::islogin()) {
    ?>
		<li class="<?php 
    pit('active', g("curpage") === 'profile');
    ?>
"><a href="<?php 
    echo BASE . "profile";
    ?>
">Profile</a></li>
		<li><a href="<?php 
    echo BASE . "?logout";
    ?>
">Logout</a></li>
		<?php 
} else {
    ?>