<?php
session_start();
ob_start();
function processText($text) {
$text = strip_tags($text);
$text = trim($text);
$text = htmlspecialchars($text);
return $text;
}
?>
<html>
<head>
<style>
body{
overflow:scroll;
}
#post{
border:3px outset #898C8A;
width:500px;
}
#barra{
width:100%;
height:25;
background-color:#92CEE0;
}
#from{
float:left;
position:relative;
}
#oradata{
float:right;
margin:5px;
position:relative;
}
#testo{
color:green;
position:center;
margin:10px;
}
#titolo{
float:left;
position:fixed;
left:30%;
}
#new_post{
float:right;
}
#tutti_post{
position:fixed;
margin-top:10%;
margin-left:20%;
}
</style>
<link rel="stylesheet" href="stili/index.style.css" type="text/css">
</head>
<body>
<center><div id="titolo"><font color="green" size="7"><strong>Ultimi post</strong></font></div>
<div id="new_post"><form action=new_post.php method=POST><input type=submit value='Nuovo post' ></form></div>
<div id="tutti_post">
<?php
include('db_conn.php');
$user = $_SESSION['login_effettuato'];
$query = "SELECT * FROM `post` WHERE `from` = '" . $user . "'";
$result = mysql_query($query);
if (mysql_num_rows($result) == '0'){
echo "<font color=green size=5><strong>Nessun post pubblicato.<br>Premi il pulsante "Nuovo post" per pubblicare nuovi post</strong></font><br><br><br><br>";
}else{
while ($row = mysql_fetch_array($result)){
echo "<div id=post><div id=barra><div id=from>Post inviato da: <font color=red>" . $row['from'] . "</font></div><div id=oradata><font size=1 color=gray>" . $row['ora'] . ", " . $row['data'] . "</font></div></div><div id=testo>" . $row['contenuto'] . "</div></div><br>";
}
}
?></div><br><br>
</center>
</body>
</html>