|
|
@@ -14,23 +14,16 @@ if (!file_exists($dataStorage)){
|
|
|
}');
|
|
|
include_once("functions/createUserDirectories.php");
|
|
|
}
|
|
|
-$message = $_POST['message'];
|
|
|
date_default_timezone_set("Asia/Hong_Kong");
|
|
|
$time = date("Y-m-d H:m:s");
|
|
|
?>
|
|
|
<html>
|
|
|
<head>
|
|
|
+
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
|
|
<title>TeaBag.tw</title>
|
|
|
<link rel="stylesheet" href="script/tocas/tocas.css">
|
|
|
<script src="script/tocas/tocas.js"></script>
|
|
|
-<script type="text/javascript">
|
|
|
-function check()
|
|
|
-{
|
|
|
- return true;
|
|
|
-}
|
|
|
-
|
|
|
-</script>
|
|
|
<script src="script/jquery.min.js"></script>
|
|
|
<style>
|
|
|
.extrapadding{
|
|
|
@@ -148,7 +141,7 @@ function check()
|
|
|
<div class="ts text container">
|
|
|
<div class="ts segment">
|
|
|
<div class="ts form">
|
|
|
- <form name="message" action="index.php" method="post" onsubmit="return check()">
|
|
|
+ <form name="message" action="updateSql.php" method="post">
|
|
|
<div class="field">
|
|
|
<label>分享帖子</label>
|
|
|
<textarea rows="4" placeholder="要說點甚麼嗎?" name="message" cols="40"></textarea>
|
|
|
@@ -174,22 +167,32 @@ function check()
|
|
|
</div>
|
|
|
-->
|
|
|
<?php
|
|
|
- if(isset($message) && $message !="")
|
|
|
+ $conn = mysqli_connect("localhost","root","","message");
|
|
|
+ if($conn->connect_error)
|
|
|
+ {
|
|
|
+ echo "Unable to connect to database";
|
|
|
+ exit;
|
|
|
+ }
|
|
|
+ $result = $conn->query("select * from message");
|
|
|
+ if(!$result) die("No message");
|
|
|
+ $result->data_seek(0);
|
|
|
+ while($row=$result->fetch_assoc())
|
|
|
{
|
|
|
echo '
|
|
|
<div class="ts card">
|
|
|
<div class="content">
|
|
|
<div class="header"><img class="ts circular image postAvator" src="img/dummy.png"></div>
|
|
|
<div class="meta">
|
|
|
- <a>'.$_SESSION['login'].'</a>
|
|
|
- <a>'.$time.'</a>
|
|
|
+ <a>'.$row["user"].'</a>
|
|
|
+ <a>'.$row["datetime"].'</a>
|
|
|
</div>
|
|
|
- <div class="description" >'.$message.'
|
|
|
+ <div class="linebreak" >'.$row["messgae"].'
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
';
|
|
|
}
|
|
|
+ $conn->close();
|
|
|
?>
|
|
|
</div>
|
|
|
</div>
|