Esempio n. 1
0
function login($email, $pass)
{
    try {
        $id = WaUser::FindUserIdByEmail($email);
        $info = WaUser::GetUserInfo($id);
    } catch (Exception $e) {
        returnError($e->getMessage());
        return false;
    }
    if (!$id || !$info) {
        returnError('您还未注册。');
        return false;
    }
    $processedPass = sha1($pass);
    if ($info['user_pass'] != $processedPass) {
        returnError('密码好像不正确。');
        return false;
    }
    $timeStamp = microtime(true);
    $loginInfo = array($id, $timeStamp);
    $loginPass = sha1($timeStamp);
    $kvKey = 'loginpass_' . $loginPass;
    $result = setKv($kvKey, $loginInfo);
    $kvKey = 'userlogin_' . $id;
    $userLogins = getKv($kvKey);
    if ($userLogins === true || $userLogins === false) {
        $userLogins = array();
    }
    array_unshift($userLogins, array($loginPass, $timeStamp));
    $result = setKv($kvKey, $userLogins);
    setcookie('loginpass', $loginPass, strtotime('+1 year'), '/', 'wawall.sinaapp.com');
    returnSucc();
}
Esempio n. 2
0
            if ($userInfo) {
                $wall['wall_creatorname'] = $userInfo['user_name'];
            }
            $wall['wall_type'] = $info['wall_type'];
            $wall['wall_usercount'] = $info['wall_usercount'];
        }
        $wall['relationship'] = 'like';
        array_push($ret, $wall);
    }
}
$walls = WaWall::FindWallIdsByCreator($id);
if ($walls) {
    while (list($key, $value) = each($walls)) {
        $wall = array();
        $wall['wall_id'] = $value['wall_id'];
        if (isset($_GET['fulldata'])) {
            $info = WaWall::GetWallInfo($wall['wall_id']);
            $wall['wall_name'] = $info['wall_name'];
            $wall['wall_desc'] = $info['wall_desc'];
            $userInfo = WaUser::GetUserInfo($info['wall_creator']);
            if ($userInfo) {
                $wall['wall_creatorname'] = $userInfo['user_name'];
            }
            $wall['wall_type'] = $info['wall_type'];
            $wall['wall_usercount'] = $info['wall_usercount'];
        }
        $wall['relationship'] = 'own';
        array_push($ret, $wall);
    }
}
echo json_encode($ret);
Esempio n. 3
0
      <div class="wall-user">
        <h3>用户列表</h3>
        <h5>墙主:<?php 
            echo $creatorName;
            ?>
</h5>
      </div>
      <?php 
        }
        ?>
      </span>
      <?php 
        $users = WaWall::FindUserIdsByWall($wall);
        if ($users) {
            foreach ($users as $user) {
                $userInfo = WaUser::GetUserInfo($user['user_id']);
                if ($userInfo) {
                    ?>
      <span class="wall-user list-group-item">
      <h4 class="list-group-item-text"><?php 
                    echo $userInfo['user_name'];
                    ?>
</h4>
      </span>
      <?php 
                }
            }
        }
        ?>
    </div>
    <?php 
Esempio n. 4
0
	<div id="navbar-body" class="navbar-collapse collapse">
		<ul class="nav navbar-nav">
			<li class="divider"></li>
			<li><a href="#hall" title="大厅">大厅</a></li>
			<li><a href="#mywall" title="我的墙">我的墙</a></li>
			<li><a href="#inprogress" title="动态(建设中)" class="unimplemented">动态</a></li>
			<li><a href="#inprogress" title="消息(建设中)" class="unimplemented">消息</a></li>
		</ul>
		<ul class="nav navbar-nav navbar-right">
			<?php 
    global $loginUser;
    if ($loginUser) {
        ?>
			<li> <a href="#inprogress" title="我的资料(建设中)" class="unimplemented" style="text-decoration:none">
				<?php 
        $info = WaUser::GetUserInfo($loginUser);
        $data = WaUser::GetUserData($loginUser);
        if ($info) {
            echo '您好,' . $info['user_name'];
        }
        ?>
				</a></li>
			<?php 
        if (!signedIn($loginUser)) {
            ?>
			<li>
				<button id="sign-btn" class="btn btn-warning navbar-btn">点击签到</button>
			</li>
			<?php 
        } else {
            ?>
Esempio n. 5
0
}
for ($i = 0; $i < $offset; $i++) {
    next($posts);
}
while (list($key, $post) = each($posts)) {
    $post_id = $post['post_id'];
    try {
        $postInfo = WaPost::GetPostInfo($post_id);
        if (!$postInfo) {
            throw new Exception('');
        }
    } catch (Exception $e) {
        continue;
    }
    $post = array();
    $post['post_id'] = $postInfo['post_id'];
    $post['post_title'] = $postInfo['post_title'];
    $post['post_content'] = $postInfo['post_content'];
    $creator = $postInfo['post_creator'];
    try {
        $creator_info = WaUser::GetUserInfo($creator);
    } catch (Exception $e) {
        continue;
    }
    $post['post_creator'] = $creator_info['user_name'];
    array_unshift($ret, $post);
    if (--$limit <= 0) {
        break;
    }
}
echo json_encode(array('post' => $ret));