<?php session_start(); if (!isset($_SESSION['me'])) { header("Location: /index.php"); } require $_SERVER['DOCUMENT_ROOT'] . "/apis/u.php"; $pings = getRecentPings($_SESSION["me"]); $ping = getPing($_SESSION["me"], $_GET['u'], isset($_GET['plus']) ? 'yes' : 'no'); ?> <!DOCTYPE html> <html> <head> <title>pingR</title> <meta name="viewport" content="initial-scale=1, maximum-scale=1" width=device-width height=device-height> <?php include $_SERVER['DOCUMENT_ROOT'] . "/design/design"; ?> <link rel="stylesheet" type="text/css" href="widedevice.css"> <link rel="stylesheet" type="text/css" href="longdevice.css"> <link rel="stylesheet" type="text/css" href="message.css"> <link rel="stylesheet" type="text/css" href="/cssoverride.css"> <script type="text/javascript" src="message.js.php?u=<?php echo $_GET['u']; ?> "></script> <style type="text/css"> footer > span{ margin: 0 auto; display: block; position: relative;
function getmessage($ping, $me) { $uid = $ping['userid']; if ($uid == $me['userid']) { return NULL; } $arr = array($me['userid'], $uid); sort($arr, SORT_NUMERIC); $n1 = str_pad($arr[0], 4, "0", STR_PAD_LEFT); $n2 = str_pad($arr[1], 4, "0", STR_PAD_LEFT); $tname = "ping" . $n1 . $n2; require $_SERVER['DOCUMENT_ROOT'] . "/key.php"; // Create connection $conn = new mysqli($dbservername, $dbusername, $dbpassword, $dbname); // Check connection if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } if (!($result = $conn->query("SELECT pingedat,status,message FROM {$tname} ORDER BY pingedat DESC LIMIT 10"))) { die("QUERY FAILED"); } $data = ""; $ping = getPing($_SESSION['me'], $uid, "no"); while ($row = $result->fetch_assoc()) { $date = new DateTime($row['pingedat']); $data = "<div class=\"message\"><span class=\"people\">" . (explode("+", $row['status'])[1] != $uid ? "You" : $ping['fname'] . " " . $ping['lname']) . "</span><p class=\"message\">" . $row['message'] . "</p><span class=\"time\">" . time2str($date->getTimestamp()) . "</span></div>" . $data; } if (!$conn->query("UPDATE userlist SET activity = '" . date('Y-m-d H:i:s') . "' WHERE userid = " . $me['userid'] . ";")) { die("+ONLINE STAT FAILED TO UPDATE" . $conn->error); } return $data; }