Beispiel #1
0
<?php

session_start();
include "utilities.php";
require_once "database/conversation_table.php";
require_once "database/message_table.php";
if (!isset($_SESSION["username"])) {
    header("Location: login.php");
    exit;
}
if (isset($_POST["status_to_read"])) {
    ConversationTable::update_conversation_status($_SESSION["username"], $_POST["conversation_id"], "read");
}
if (isset($_POST["reply"])) {
    if (MessageTable::create_message($_SESSION["username"], $_POST["receiver_name"], $_POST["message"], $_POST["conversation_id"], gmdate("Y-m-d H:i:s"))) {
        ConversationTable::update_conversation_status($_POST["receiver_name"], $_POST["conversation_id"], "unread");
        ConversationTable::set_destroy_date($_POST["receiver_name"], $_POST["conversation_id"], 'NULL');
    }
}
?>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <link href='https://fonts.googleapis.com/css?family=Roboto' rel='stylesheet' type='text/css'>
    <link rel="stylesheet" href="styles.css">
</head>
<body>
    <div class="main_iframe">
Beispiel #2
0
    header("Location: login.php");
    exit;
}
if (isset($_SESSION["last_activity"]) && $_SESSION["last_activity"] + $_SESSION["time_out"] * 60 < time()) {
    session_unset();
    session_destroy();
    ?>
    <script>
        window.parent.location.href = window.parent.location.href;
    </script>
<?php 
    exit;
}
$_SESSION["last_activity"] = time();
if (isset($_POST["conversation_id"])) {
    if (ConversationTable::update_conversation_status($_SESSION["username"], $_POST["conversation_id"], "deleted")) {
        $date = date_format(date_add(date_create(gmdate("Y-m-d")), date_interval_create_from_date_string("1 week")), "Y-m-d");
        ConversationTable::set_destroy_date($_SESSION["username"], $_POST["conversation_id"], "'{$date}'");
    }
}
if (isset($_POST["checkbox"])) {
    ConversationTable::update_multiple_conversation_status($_SESSION["username"], $_POST["checkbox"], "deleted");
    $date = date_format(date_add(date_create(gmdate("Y-m-d")), date_interval_create_from_date_string("1 week")), "Y-m-d");
    ConversationTable::set_multiple_destroy_date($_SESSION["username"], $_POST["checkbox"], "'{$date}'");
}
?>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">