Skip to content

Instantly share code, notes, and snippets.

@farfromunique
Created September 16, 2013 02:40
Show Gist options
  • Save farfromunique/6576182 to your computer and use it in GitHub Desktop.
Save farfromunique/6576182 to your computer and use it in GitHub Desktop.
<?php
$site_root = $_SERVER["SERVER_NAME"];
$serverRoot = $_SERVER["DOCUMENT_ROOT"] . '/';
spl_autoload_register(function ($class) {
global $serverRoot;
require_once $serverRoot . 'classes/' . $class . '.class.php';
});
if ( ! isset($_SESSION)) {
session_start();
}
require_once $serverRoot . 'include/time.php';
if ( ! isset($yours)) {
$yours = unserialize($_SESSION["Character"]);
}
$chat = new Conversation($yesterday->format('Y-m-d H:i:s'),1); // '1' needs to be replaced with the character's location'
$currentChar = $_SESSION["CharUID"];
if (isset($_POST["UD_type"])) {
if ($_POST["UD_type"]="Converse") {
$newComment = $_POST["Comm"];
$chat->Send($sendChat,$yours->UID,$newComment);
}
}
?>
<?php echo $chat ?>
<input type='text' name='Comm' class='TalkBox' id='message' onkeypress='return typeChat(event)'>
<input type='submit' value='Talk' class='TalkButton' onClick='chat()'>
<?php
if ( ! isset($_SESSION)) {
session_start();
}
$t=time(); // Current Time
$u=$t;
$tf = date('Y-m-d g:i A',$t); // Time, Formatted (in server TZ) (To be displayed)
$tu = date('Y-m-d G:i:s',$t); // Time, Formatted (in server TZ) (For the update process)
$tfOld = "'" . date('Y-m-d G:i:s',$t-86400) . "'"; // Time minus 1 day, formatted. For use in pulling conversations.
if (isset($_SESSION["TZ"])) // If the user has set a TimeZone
{
$tz=date_create(date('Y-m-d g:i:s',$t),timezone_open($_SESSION["TZ"])); // Timezone
$t=$t+date_offset_get($tz); // Time, modified to be accurate to Timezone
$tf = date('Y-m-d g:i A',$t); // Time, Formatted (in User TZ) (to be displayed)
}
$tzOffset=($u-$t); // Number of seconds difference from server (UTC) to user
$date = new DateTime();
$localTime = new DateTime('now',new DateTimeZone('America/Los_Angeles'));
/** @noinspection PhpVoidFunctionResultUsedInspection */
/** @noinspection PhpParamsInspection */
$yesterday = $date->sub(date_interval_create_from_date_string('1 day'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment