-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
92 lines (80 loc) · 3.11 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<?php
//include llibreria
include("assets/lib.php");
include("assets/auth.php");
?>
<!DOCTYPE html>
<html>
<head>
<title>MY WORLD</title>
<link type="text/css" rel="stylesheet" href="assets/style.css" />
<script type="text/javascript" src="assets/basic.js"></script>
<script type="text/javascript" src="assets/jquery-1.9.1.min.js"></script>
</head>
<body>
<?php
if($isLogged == false){
if(isset($_GET["register"])){
include("views/registre.php");
}else{
include("views/login.php");
}
}else{
?>
<header id="header"><div id="logo"><a href="/">MY WORLD</a></div><div id="nom"><?php echo $_SESSION["data"]["name"]; ?></div></header>
<div id="main">
<p>
<?php
echo $_SESSION["data"]["bio"];
?>
<br>
Penja un arxiu:<br>
<form action="upload_file.php" method="post" enctype="multipart/form-data">
<label for="file">Arxiu:</label>
<input type="file" name="file" id="file"><br>
<input type="submit" name="submit" value="Submit">
</form>
<P>
Els meus arxius:<br>
<?php
$directorio=opendir("files/" . $_SESSION["data"]["username"] . "/");
while ($archivo = readdir($directorio))
if ($archivo == "." or $archivo == ".."){
continue;
}else{ ?>
<a class="file" title="Descarrega l'arxiu" href="files/<?php echo $_SESSION["data"]["username"] . "/" . $archivo; ?>"><?php echo $archivo; ?></a> <img src="assets/delete.png" title="Elimina l'arxiu" onclick="$.post('assets/delfile.php', {file: '<?php echo $archivo; ?>'}, function(responseTxt){ alert(responseTxt);window.location='index.php';} )" /><br>
<?php }
closedir($directorio);
?>
</P>
</p>
<p>
<form action="assets/publicacio.php" method="post">
<input type="text" name="message" id="post" />
<input type="submit" value="Publica!" id="bt-publicar" />
</form>
</p>
<div id="posts">
<h2>Últimes publicacions</h2>
<?php
$posts = mysql_query("SELECT content, user, time FROM posts ORDER BY time DESC");
while ($post = mysql_fetch_array($posts,MYSQLI_ASSOC)){
$post_user = $post['user'];
$post_content = $post['content'];
$post_date = $post['time'];
echo "<a class='unlink' href='profile.php?public=$post_user'><h4> $post_user </h4></a>";
echo "<div class='post'> $post_content </div>";
echo "<small class='datapost'> $post_date </small><br>";
}
mysql_free_result($posts);
?>
</div>
<p>
<a href="profile.php">Perfil</a> | <a href="sortir.php">Sortir</a>
</p>
</div>
<?php
}
?>
</body>
</html>