Issues (34)

view/weather/validationip.php (4 issues)

Labels
Severity
1
<?php
2
3
namespace Anax\View;
4
5
/**
6
 * Render content within an article.
7
 */
8
9
?>
10
<head>
11
    <meta charset="utf-8">
12
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
13
    <title>Vädret</title>
14
</head>
15
16
<h1>Vädret</h1>
17
<?php
18
if ($data["geoInfo"] == "Inget att visa") {
19
    echo "Domänen för adressen är " . $data["hostname"] ;
20
    echo "<br>Ingen tillgänglig plats";
21
} elseif ($data["hostname"] != "Ej korrekt ip") {
22
    echo "<br><br>Addressen befinner sig i " . $data["geoInfo"]["city"] . ", " .
23
         $data["geoInfo"]["country"];
24
    echo "<br>Koordinaterna är <br><b>latitude:</b> " .  round($data["geoInfo"]["latitude"], 2) .
25
         "<br><b>longitude</b>: " . round($data["geoInfo"]["longitude"], 2);
26
} else {
27
    echo "Ingen tillgänglig domän";
28
    echo "<br>Ingen tillgänglig plats";
29
}
30
?>
31
<h3>Vädret Just Nu</h3>
32
<div id="currweather">
33
    <?php
34
    if (is_array($data["forweather"])) {
35
        echo "<p>Vädret hos dig just nu är " . $data["forweather"]["current"]["weather"][0]["description"];
36
        echo "<br>Temperaturen är " . $data["forweather"]["current"]["temp"] .
37
            " grader och det känns som " . $data["forweather"]["current"]["feels_like"] . "</p>";
38
    } else {
39
        echo "<p>Tyvärr går det inte att visa vädret hos dig just nu.</p>";
40
    }?>
41
</div>
42
43
<h3>Kommande väder</h3>
44
<div id="forweather">
45
    <p>
46
    <?php
47
    if (is_array($data["forweather"])) {
48
        echo "Imorgon blir det ca " . $data["forweather"]["daily"][0]["temp"]["day"] .
49
            " grader och det blir " . $data["forweather"]["daily"][0]["weather"][0]["description"];
50
        echo "<br>I övermorgon blir det ca " . $data["forweather"]["daily"][1]["temp"]["day"] .
51
        " grader och det blir " . $data["forweather"]["daily"][1]["weather"][0]["description"];
52
        echo "<br>Om tre dagar blir det ca " . $data["forweather"]["daily"][2]["temp"]["day"] .
53
        " grader och det blir " . $data["forweather"]["daily"][2]["weather"][0]["description"];
54
        echo "<br>Om fyra dagar blir det ca " . $data["forweather"]["daily"][3]["temp"]["day"] .
55
        " grader och det blir " . $data["forweather"]["daily"][3]["weather"][0]["description"];
56
        echo "<br>Om fem dagar blir det ca " . $data["forweather"]["daily"][4]["temp"]["day"] .
57
        " grader och det blir " . $data["forweather"]["daily"][4]["weather"][0]["description"];
58
    } else {
59
        echo "Väderprognosen går ej att hämta.";
60
    }?>
61
    </p>
62
</div>
63
64
<h3>Historiskt väder</h3>
65
66
<div id="histweather">
67
    <p>
68
    <?php
69
    if (count($data["histweather"]) == 5) {
70
        echo "Igår var det " . $data["histweather"][0]["temp"] .
71
            " grader ute och det var " . $data["histweather"][0]["weather"][0]["description"];
72
        echo "<br>I förrgår var det " . $data["histweather"][1]["temp"] .
73
            " grader ute och det var " . $data["histweather"][1]["weather"][0]["description"];
74
        echo "<br>Dagen innan dess var det " . $data["histweather"][2]["temp"] .
75
            " grader ute och det var " . $data["histweather"][2]["weather"][0]["description"];
76
        echo "<br>För fyra dagar sen var det " . $data["histweather"][3]["temp"] .
77
            " grader ute och det var " . $data["histweather"][3]["weather"][0]["description"];
78
        echo "<br>För fem dagar sen var det " . $data["histweather"][4]["temp"] .
79
            " grader ute och det var " . $data["histweather"][4]["weather"][0]["description"];
80
    } else {
81
        echo "Historiskt väder kan inte visas för dig.";
82
    }?>
83
    </p>
84
</div>
85
86
87
<!-- <pre>
88
    <?= var_dump($data); ?>
0 ignored issues
show
Are you sure var_dump($data) of type void can be used in echo? ( Ignorable by Annotation )

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

88
    <?= /** @scrutinizer ignore-type */ var_dump($data); ?>
Loading history...
Are you sure the usage of var_dump($data) is correct as it seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
89
    <?= var_dump($_POST); ?> -->
0 ignored issues
show
Are you sure the usage of var_dump($_POST) is correct as it seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
Are you sure var_dump($_POST) of type void can be used in echo? ( Ignorable by Annotation )

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

89
    <?= /** @scrutinizer ignore-type */ var_dump($_POST); ?> -->
Loading history...
90