Exemple #1
0
</head>
<body>
<?php 
require "php/topbar.php";
?>

<div class="maindiv">
<?php 
session_start();
require_once "php/database.php";
require_once "php/storedprocedures.php";
require_once "php/error.php";
if (isset($_GET['messageid'])) {
    $db = connectToDatabase();
    if ($db) {
        $content = getMessageContent($db, $_GET['messageid'], $_SESSION['id'], $_SESSION['token']);
        switch ($content[SP::ERROR]) {
            case ERR::OK:
                echo "<p>" . $content[MESSAGE::CONTENT] . "</p>";
                break;
            case ERR::TOKEN_EXPIRED:
            case ERR::TOKEN_FAIL:
            case ERR::USER_NO_TOKEN:
                header("Location: logout.php?error=" . $content[SP::ERROR]);
                break;
        }
    } else {
        echo "<p>Could not coinnect to database. Please try again later.</p>";
    }
} else {
    echo "<p>No message selected. <a href='friendslist.php'>Back to friends list</a>.</p>";
Exemple #2
0
<?php 
// Get all messages sent to this player...
$mailQuery = $dbh->prepare("SELECT * FROM msgs WHERE uidt = ? GROUP BY uidf ORDER BY ts DESC");
$mailQuery->bindParam(1, $uuid);
$mailQuery->execute();
// And print them out in this anonymous div, which has a bunch of style information that should
// be in resources/fcn.css.  The basic logic here is to populate it with msgHead divs (click event handled
// above), which contain the sender's name, the time of the last message received, and a preview
// of the message content (first 60 bytes).
$mcount = 0;
echo "<div style=\"position:fixed;width:200px;left:30;height:100%;border-right:1px solid lightgray;clear:both;overflow:auto;\">\n";
// First, print the compose button
?>
	<div style="width:80%;margin-left:auto;margin-right:auto;text-align:center;clear:both;"><b><a href="mailCompose.php" rel="shadowbox;height=480;width=640;"><img src="resources/compose.png"/></a></b></div> <?php 
while ($row = $mailQuery->fetch()) {
    echo "<div class=\"msghead\" name=\"" . $row['uidf'] . "\" id=\"" . getUserName($row['uidf']) . "\"><img src=\"mail-icon.png\" style=\"width:20px;vertical-align:middle;padding-bottom:4px;\"/>&nbsp;<b>" . getUsername("" . $row['uidf'] . "") . "</b><br/><span style=\"font-size:small;\">" . $row['ts'] . "</span><br/>" . substr(getMessageContent($row['mid']), 0, 60) . "..." . "</div>";
    $mcount++;
}
if ($mcount == 0) {
    echo "<p style=\"margin-left:20px;\">You have no messages.</p>";
}
echo "</div>\n";
echo "<div id=\"conversation\" style=\"position:fixed;left:300;width:40%;height:80%;overflow:hidden;border-bottom:1px solid lightgray;padding:8px;overflow-y:scroll;\">No conversation selected.\n";
echo "</div>\n";
echo "<div id=\"respond\" style=\"position:fixed;left:300;bottom:10;width:40%;height:8%;\"></div>\n";
?>
</div>
</div>
<?php 
include 'jewel.php';
?>
Exemple #3
0
if (session_id() == '') {
    session_start();
}
$uname = $_SESSION['uname'];
$uuid = $_SESSION['uuid'];
$targetUser = $_GET['uidf'];
ob_start();
require 'db.php';
require 'functions.php';
ob_end_clean();
echo "<h2>Messages with " . getUsername($targetUser) . "</h2>";
// Get all messages from this person to uuid or from uuid to this person...
$query = $dbh->prepare("SELECT * FROM msgs WHERE (uidf = ? AND uidt = ?) OR ( uidf = ? AND uidt = ?) ORDER BY ts ASC");
$query->bindParam(1, $targetUser);
$query->bindParam(2, $uuid);
$query->bindParam(3, $uuid);
$query->bindParam(4, $targetUser);
$query->execute();
while ($row = $query->fetch()) {
    // .. and display them in rounded conversation bubbles with different background
    // colors, depending on who's speaking.
    if ($row['uidf'] != $uuid) {
        echo "<div style=\"float:left;background:#ededed;width:65%;padding:8px;margin:8px;-moz-border-radius:10px;border-radius:10px;\">\n";
    } else {
        echo "<div style=\"float:right;background:#ffffff;width:65%;padding:8px;border:1px solid lightgray;margin:8px;-moz-border-radius:10px;border-radius:10px;\">\n";
    }
    // Call the getMessageContent() convenience function to show the text; add a timestamp.
    echo getMessageContent($row['mid']);
    echo "<p/><span style=\"font-size:smaller;\">" . $row['ts'] . "</span>";
    echo "</div>\n";
}