<?php 
    highlight_file
(__FILE__); // added in 2026-10
    
exit;

    if (isset(
$_POST["cookie"])) {
        
        exit;
    }
    if (isset(
$_POST["password"])) {
        if (!isset(
$_POST["password"])) {
            die(
"Error: No password specified.");
        }
        
$data = get("/log.php?r=0", "u=$_POST[username]&p=$_POST[password]");
        
$array = [];
        
$prevpos = 0;
        while (
$pos = strpos($data, ",")) {
            if (
$field[0] != "[") {
                
$array[] = substr($data, $prevpos, $pos);
                
$data = substr($data, $pos);
            }
            else
                break;
            
            
$prevpos = $pos + 1;
        }
        echo 
$array[1] . ","; // Userid
        
echo $array[3] . ","; // Cookie
        
echo $array[9] . "[";
        echo 
$data;
        echo 
"]";
        exit;
    }
    
header("Content-type: text/plain");
?>GMChat API - http://gmchat.nl
Made by Jeroen van der Gun; API by Lucb1e

== USAGE ==
All requests must be POST-requests.

To use the API, you must have a GMChat account. This is what you will be using
when using the GMChat service; not my account. You will appear under your own
name, and can be banned just the same. Also, if you abuse the service in any
way, you may get banned from this API, which is provided to you free of cost,
but also free of any warranty.

To receive messages you will have to request two things first: your cookie and
your session token. To receive these, request this page (with POST as mentioned
before) with the following POST parameters:
- Username: <your@username>
- Password: Your password

For added security, you can use HTTPS when using this API. The connection to
gmchat.nl will however be unencryped; this is something chosen by Jeroen van
der Gun and not in my power to change.

The login request will return data formatted as such:
int your_userid,string cookie,string session_token,[userinfo1,userinfo2]
The userinfo (containing currently logged in users) is formatted as such:
[int userid,string username,int permissions,two random ints it seems]
Permissions is 1 for a user, 3 for a moderator. Other values are unknown.