コード例 #1
0
ファイル: index.php プロジェクト: Yanrs/PkmnChan
    <!--    <link href="style/bootstrap.min.css" rel="stylesheet" type="text/css" />
        <link href="style/bootstrap-theme.min.css" rel="stylesheet" type="text/css" />-->
    <link href="style/jquery-ui-1.10.4.custom.min.css" rel="stylesheet" type="text/css" />
    <!--    <link href="style/non-responsive.css" rel="stylesheet" type="text/css" />-->
    <link href="style/core.css" rel="stylesheet" type="text/css" />
  </head>
  <body>
    <div style="margin: 0px auto; width: 980px;">
    <!--      Main content area-->
    </div>
    <?php 
@session_start();
$_SESSION['user_id'] = isset($_GET['user_id']) ? (int) $_GET['user_id'] : 0;
// Load the messages initially
require_once __DIR__ . '/../core/FbChatMock.php';
$chat = new FbChatMock();
$messages = $chat->getMessages();
?>
    
    <div class="container" style="border: 1px solid lightgray;">
      <div class="msg-wgt-header">
        <a href="#">John</a>
      </div>
      <div class="msg-wgt-body">
        <table>
          <?php 
if (!empty($messages)) {
    foreach ($messages as $message) {
        $msg = htmlentities($message['message'], ENT_NOQUOTES);
        $user_name = ucfirst($message['username']);
        $sent = date('F j, Y, g:i a', $message['sent_on']);
コード例 #2
0
<?php

session_start();
if (isset($_POST['msg'])) {
    require_once __DIR__ . '/../../core/FbChatMock.php';
    $userId = (int) $_SESSION['user_id'];
    // Escape the message string
    $msg = htmlentities($_POST['msg'], ENT_NOQUOTES);
    $chat = new FbChatMock();
    $result = $chat->addMessage($userId, $msg);
}