Issues (393)

web/public/get/unsubscribe.php (1 issue)

1
<?php require_once($_SERVER['DOCUMENT_ROOT'] . "/s/classes/config.inc.php"); ?>
2
<?php require_once($_SERVER['DOCUMENT_ROOT'] . "/s/classes/db_helper.php"); ?>
3
<?php require_once($_SERVER['DOCUMENT_ROOT'] . "/s/classes/time_manip.php"); ?>
4
<?php require_once($_SERVER['DOCUMENT_ROOT'] . "/s/classes/user_helper.php"); ?>
5
<?php require_once($_SERVER['DOCUMENT_ROOT'] . "/s/classes/video_helper.php"); ?>
6
<?php require_once($_SERVER['DOCUMENT_ROOT'] . "/s/classes/user_update.php"); ?><?php $__video_h = new video_helper($__db); ?>
7
<?php $__user_h = new user_helper($__db); ?>
8
<?php $__user_u = new user_update($__db); ?>
9
<?php $__db_h = new db_helper(); ?>
10
<?php $__time_h = new time_helper(); ?>
11
<?php
12
$request = (object) [
13
    "name" => $_GET['n'],
14
    "sender" => $_SESSION['siteusername'],
15
16
    "error" => (object) [
17
        "message" => "",
18
        "status" => "OK"
19
    ]
20
];
21
22
if(!$__user_h->if_subscribed(@$_SESSION['siteusername'], $request->name)) 
23
    { $request->error->message = "You aren't subscribed to this person!"; $request->error->status = ""; }
24
25
if($request->error->status == "OK") { 
26
    $stmt = $__db->prepare("DELETE FROM subscribers WHERE sender=:sender AND reciever=:reciever");
27
    $stmt->execute(array(
28
      ':sender' => $request->sender,
29
      ':reciever' => $request->name,
30
    ));
31
32
    header('Location: ' . $_SERVER['HTTP_REFERER']);
33
} else {
34
    echo json_encode($request->error);
35
}
36
37
?>
0 ignored issues
show
It is not recommended to use PHP's closing tag ?> in files other than templates.

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.

Loading history...