Beispiel #1
0
function getACRate($userID)
{
    $query = "select \r\n(select count(distinct p.pojProblemID) from problems as p where p.stat=0 ) as allPcount,\r\n(select count(distinct p.pojProblemID) from problems as p, score as s ,user as u where p.stat=0 and s.stat=0 and u.stat=0 and p.id=s.probID and s.AC=1 and s.userID={$userID}) as allAC,\r\n(select count(distinct p.pojProblemID) from problems as p where p.stat=0 and p.level=1) as teamPcount,\r\n(select count(distinct p.pojProblemID) from problems as p, score as s ,user as u where p.stat=0 and s.stat=0 and u.stat=0 and p.id=s.probID and s.AC=1 and p.level=u.team and s.userID=u.id and u.id={$userID}) as teamAC,\r\n(select count(distinct p.pojProblemID) from problems as p where p.userID={$userID}) as userPCount,\r\n(select count(distinct p.pojProblemID) from problems as p ,score as s,user as u where p.stat=0 and s.stat=0 and u.stat=0 and p.userID={$userID} and s.probID=p.id and s.AC=1) as ACed";
    return mydb_query_return_first_item($query);
}
Beispiel #2
0
<?php

require_once 'include/db_operator_class.php';
include 'permission.php';
if (isset($_GET['userID'])) {
    $userId = $_GET['userID'];
    $query = "SELECT u.photoPath,u.photoType FROM user AS u where id={$userId}";
    $result = mydb_query_return_first_item($query);
    $data = $result['photoPath'];
    // 	$type = $result['photoType'];
    // 	header( "Content-type: $type");
    echo $data;
    // 	echo urldecode(json_encode(urlencode($data)));
}