Exemplo n.º 1
0
<?php

include "../config.php";
include "../functions.php";
include "../private_functions.php";
if (isset($_GET['uID'])) {
    $dbh = db_connect($MY_HOST, $MY_DB_PORT, $MY_DB, $DB_USER, $DB_PW);
    $resp = get_num_votes_of_user($dbh, $_GET['uID']);
    close_db_connection($dbh);
    echo json_encode($resp);
} else {
    echo json_encode(array("status" => -1));
}
Exemplo n.º 2
0
function html_user($dbh, $user, $me = "")
{
    $votes = get_num_votes_of_user($dbh, $user);
    $num_votes = $votes['count'];
    $posts = get_num_posts($dbh, $user);
    $num_posts = $posts['count'];
    $hashtags = get_num_tags_of_user($dbh, $user);
    $num_hashtags = $hashtags['count'];
    if (preg_match('/^[A-Za-z0-9]+$/', $user)) {
        echo '
			<div class="row user" id="user-' . $user . '">
			<div class="col-md-4">' . user_link($user) . '</div>
      
      <span style="font-size:12px; color: #888; padding:5px; padding-left: 10px;">voted for ' . $num_votes . ' posts.</span>
      <span style="font-size:12px; color: #888; padding:5px; padding-left: 10px;">has ' . $num_posts . ' posts.</span>
      <span style="font-size:12px; color: #888; padding:5px; padding-left: 10px;">used ' . $num_hashtags . ' hashtags.</span>
      ';
        echo '</div>';
    }
}