-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpost.php
More file actions
62 lines (62 loc) · 2.6 KB
/
Copy pathpost.php
File metadata and controls
62 lines (62 loc) · 2.6 KB
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
<?php
require('control/control_post.php');
session_start();
if (empty($_SESSION['id']))
header('Location: index.php');
else
{
try
{
if (isset($_GET["action"]) && (($_GET["action"] == "like") || ($_GET["action"] == "unlike")))
{
if (isset($_GET["post_id"]) && !is_array($_GET["post_id"]))
{
if ($_GET["action"] == "like")
like($_GET["post_id"], $_SESSION['id']);
else
unlike($_GET["post_id"], $_SESSION['id']);
}
else
throw new Exception("hhhhh That's not a beautiful way to give a like !!");
}
else if (isset($_GET["action"]) && ($_GET["action"]) == "cmnt")
{
if (isset($_POST['cmnt']) && !is_array($_POST['cmnt']) && (!empty($_POST['cmnt'])))
{
if (isset($_GET["post_id"]) && !is_array($_GET['post_id']) && is_numeric($_GET["post_id"]))
comment($_GET["post_id"], $_SESSION["id"], $_POST["cmnt"]);
else
throw new Exception("You trying to play with me or what !!");
}
else
throw new Exception("Thats not a beauty way to comment the post !!");
}
else if (isset($_GET["action"]) && ($_GET["action"]) == "del")
{
if (isset($_GET['cmnt_id']) && isset($_GET['user_id']) && isset($_GET['post_id']))
{
if (is_array($_GET['cmnt_id']) || is_array($_GET['user_id']) || is_array($_GET['post_id']))
throw new Exception("don't give me arrays !!");
else if (hash('whirlpool', $_SESSION['id']) == $_GET['user_id'])
uncomment($_GET['cmnt_id'], $_GET['post_id']);
else
throw new Exception("You dont have the right to delete this comment !!");
}
else
throw new Exception("Are you fucking crazy get your ass out of here !!");
}
else if (isset($_GET['post_id']) && !is_array($_GET['post_id']))
{
listPost($_GET["post_id"], $_SESSION["id"]);
}
else
{
throw new Exception("You trying to play with me or what !!");
}
}
catch (Exception $e)
{
$erreur = 'Erreur : ' . $e->getMessage();
require('view/error.php');
}
}