Issues (393)

web/public/get/star.php (6 issues)

1
<?php ob_start(); ?>
2
<?php require_once($_SERVER['DOCUMENT_ROOT'] . "/static/important/config.inc.php"); ?>
3
<?php require_once($_SERVER['DOCUMENT_ROOT'] . "/static/lib/new/base.php"); ?>
4
<?php require_once($_SERVER['DOCUMENT_ROOT'] . "/static/lib/new/fetch.php"); ?>
5
<?php require_once($_SERVER['DOCUMENT_ROOT'] . "/static/lib/new/insert.php"); ?>
6
<?php
7
  $_user_fetch_utils = new user_fetch_utils();
0 ignored issues
show
The type user_fetch_utils was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
8
  $_user_insert_utils = new user_insert_utils();
0 ignored issues
show
The type user_insert_utils was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
9
  $_video_fetch_utils = new video_fetch_utils();
0 ignored issues
show
The type video_fetch_utils was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
10
  $_base_utils = new config_setup();
0 ignored issues
show
The type config_setup was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
11
 
12
  $_base_utils->initialize_db_var($conn);
13
  $_video_fetch_utils->initialize_db_var($conn);
14
  $_user_insert_utils->initialize_db_var($conn);
15
  $_user_fetch_utils->initialize_db_var($conn);
16
?>
17
<?php
18
session_start();
19
$name = $_GET['v'];
20
21
if(!isset($_SESSION['siteusername']) || !isset($_GET['v'])) {
22
    die("You are not logged in or you did not put in an argument");
23
}
24
25
if(!is_int((int)$_GET['rating'])) {
0 ignored issues
show
The condition is_int((int)$_GET['rating']) is always true.
Loading history...
26
    //header('Location: ' . $_SERVER['HTTP_REFERER']);
27
}
28
29
if((1 <= (int)$_GET['rating']) && ((int)$_GET['rating']) <= 5) {
30
    $stmt = $conn->prepare("SELECT * FROM stars WHERE sender = ? AND reciever = ?");
31
    $stmt->bind_param("ss", $_SESSION['siteusername'], $name);
32
        $stmt->execute();
33
        $result = $stmt->get_result();
34
        if($result->num_rows === 1) {
35
            $_user_insert_utils->remove_star_video($_SESSION['siteusername'], $name);
36
            goto skip;
37
        }
38
39
    $stmt = $conn->prepare("INSERT INTO stars (sender, reciever, type) VALUES (?, ?, ?)");
40
    $stmt->bind_param("ssi", $_SESSION['siteusername'], $name, $_GET['rating']);
41
42
    $stmt->execute();
43
    $stmt->close();
44
}
45
46
47
// sendIt($_SESSION['siteusername'], "New like", 'You have recieved a new like on ' . $name, "System Message", $conn);
48
skip:
49
header('Location: ' . $_SERVER['HTTP_REFERER']);
50
?>
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...