MyBB Community Forums

Full Version: What's this asking for?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
<?php
define("IN_MYBB", 1);
require_once "./global.php";

if(isset($_GET['action'])) {
    $action = $_GET['action'];

    switch($action) {
        case 'ping':
            $query = $db->simple_select("users", "username", "", array('limit' => 1));
            $result = $db->num_rows($query);

            echo json_encode(count($result) > 0);

            break;
        case 'get':
            if(isset($_GET['username'])) {
                $username = strtoupper($_GET['username']);

                if(strlen($username) <= 21) {
                    $query = $db->simple_select("users", "username, postnum AS posts", "UPPER(username)='".$db->escape_string(my_strtoupper($username))."'", array('limit' => 1));
                    $result = $db->fetch_array($query);

                    echo json_encode($result);

                } else {
                    echo json_encode(false);
                }
            } else {
                echo json_encode(false);
            }
            break;
    }
} else {
    echo json_encode(false);
}

?>

What is that code getting/grabbing?
Usernames and post counts.
Thanks, that's all I needed to know. Smile +rep.
May I ask why you needed to know Huh
It's for postloop.
(2010-12-20, 10:56 AM)Tom K. Wrote: [ -> ]May I ask why you needed to know Huh

Postloop, and why did you need to know why I wanted to know? Big Grin
From where you get this code ?
Was in a file Postloop give you.