示例#1
0
文件: chat.php 项目: kelsh/classic
# Map
# Account
# Text
include 'mysql.php';
include 'functions.php';
session_start();
if ($_SESSION['Name']) {
    if ($_POST) {
        $Time = time();
        $Session = session_id();
        $Text = filter_var(trim(stripslashes($_POST['data'])), FILTER_SANITIZE_SPECIAL_CHARS);
        if ($Text) {
            $_SESSION['Active'] = $Time;
            mysql_query("Insert into `Chat`\r\t\t\t\t\t\t\tvalues('', '{$Time}', '{$_SESSION['Map']}', '{$_SESSION['AccountID']}', '{$Text}')");
            mysql_query("Update `Players` set `Active`='{$Time}' where `Account`='{$_SESSION['AccountID']}'");
        }
    }
} else {
    echo "You need to <a href='#signin'>sign in</a> or <a href='#register'>register</a> to use the chat.";
}
echo "<table>";
$Query = mysql_query("Select `Time`, `Account`, `Text`\r\t\t\t\t\t\tfrom `Chat`\r\t\t\t\t\t\twhere `Map`='{$_SESSION['Map']}'\r\t\t\t\t\t\torder by `ID` desc\r\t\t\t\t\t\tlimit 10");
while (list($Time, $AccountID, $Text) = mysql_fetch_array($Query)) {
    $AccountQuery = mysql_query("Select `Name`\r\t\t\t\t\t\t\t\t\tfrom `Accounts`\r\t\t\t\t\t\t\t\t\twhere `ID`='{$AccountID}'");
    list($Name) = mysql_fetch_array($AccountQuery);
    $Time = FormatTime($Time);
    $Text = FormatURL($Text);
    echo "<tr><td class='time'> {$Time} </td><td> <b>{$Name}</b> </td><td> {$Text} </td></tr>";
}
echo "</table>";
echo "<a href='#chat-history'>View Chat History</a>";
示例#2
0
 function About($username)
 {
     $this->__http->setUrl(FormatURL(\Urls\USER_ABOUT, array(':username' => $username)));
     return json_decode($this->__http->get());
 }