Issues (46)

lib/deletecomment.php (2 issues)

1
<?php require($_SERVER['DOCUMENT_ROOT'] . "/static/config.inc.php"); ?>
2
<?php require($_SERVER['DOCUMENT_ROOT'] . "/static/conn.php"); ?>
3
<?php require($_SERVER['DOCUMENT_ROOT'] . "/lib/profile.php"); ?>
4
<?php 
5
    $userID = getIDFromUser($_SESSION['siteusername'], $conn); 
6
    echo $userID;
7
8
    $stmt = $conn->prepare("SELECT * FROM comments WHERE toid = ? AND id = ?");
9
    $stmt->bind_param("ii", $userID, $_GET['id']);
10
    $stmt->execute();
11
    $result = $stmt->get_result();
12
    if($result->num_rows === 0) die('No coimment');
13
    while($row = $result->fetch_assoc()) {
14
        deleteComment($_GET['id'], $conn);
0 ignored issues
show
The function deleteComment was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

14
        /** @scrutinizer ignore-call */ 
15
        deleteComment($_GET['id'], $conn);
Loading history...
15
    }
16
    $stmt->close();
17
18
    header('Location: ' . $_SERVER['HTTP_REFERER']);
19
?>
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...