1 | <?php ob_start(); ?> |
||
2 | <?php require_once($_SERVER['DOCUMENT_ROOT'] . "/s/classes/config.inc.php"); ?> |
||
3 | <?php require_once($_SERVER['DOCUMENT_ROOT'] . "/s/classes/db_helper.php"); ?> |
||
4 | <?php require_once($_SERVER['DOCUMENT_ROOT'] . "/s/classes/time_manip.php"); ?> |
||
5 | <?php require_once($_SERVER['DOCUMENT_ROOT'] . "/s/classes/user_helper.php"); ?> |
||
6 | <?php require_once($_SERVER['DOCUMENT_ROOT'] . "/s/classes/video_helper.php"); ?> |
||
7 | <?php $__video_h = new video_helper($__db); ?> |
||
8 | <?php $__user_h = new user_helper($__db); ?> |
||
9 | <?php $__db_h = new db_helper(); ?> |
||
10 | <?php $__time_h = new time_helper(); ?> |
||
11 | <?php |
||
12 | $name = $_GET['user']; |
||
13 | $author = $_SESSION['siteusername']; |
||
14 | |||
15 | if(!isset($_SESSION['siteusername']) || !isset($_GET['user'])) { |
||
16 | header('Location: ' . $_SERVER['HTTP_REFERER']); |
||
17 | } |
||
18 | |||
19 | if($name == $_SESSION['siteusername']) { |
||
20 | header('Location: ' . $_SERVER['HTTP_REFERER']); |
||
21 | } |
||
22 | |||
23 | $stmt = $conn->prepare("SELECT * FROM block WHERE sender = ? AND reciever = ?"); |
||
24 | $stmt->bind_param("ss", $_SESSION['siteusername'], $name); |
||
25 | $stmt->execute(); |
||
26 | $result = $stmt->get_result(); |
||
27 | if($result->num_rows === 1) die('You already blocked this person!'); |
||
28 | $stmt->close(); |
||
29 | |||
30 | $stmt = $conn->prepare("INSERT INTO block (sender, reciever) VALUES (?, ?)"); |
||
31 | $stmt->bind_param("ss", $_SESSION['siteusername'], $name); |
||
32 | |||
33 | $stmt->execute(); |
||
34 | $stmt->close(); |
||
35 | $author = htmlspecialchars($_SESSION['siteusername']); |
||
36 | header('Location: ' . $_SERVER['HTTP_REFERER']); |
||
37 | ?> |
||
0 ignored issues
–
show
|
Using a closing tag in PHP files that only contain PHP code is not recommended as you might accidentally add whitespace after the closing tag which would then be output by PHP. This can cause severe problems, for example headers cannot be sent anymore.
A simple precaution is to leave off the closing tag as it is not required, and it also has no negative effects whatsoever.