Skip to content

Commit

Permalink
Explicitly cast id to int & escape in header
Browse files Browse the repository at this point in the history
  • Loading branch information
DamianZaremba committed Aug 23, 2021
1 parent 397a2fc commit 5d7cd9e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pages/View.page.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class ViewPage extends Page
public function __construct()
{
global $mysql;
$this->id = $_REQUEST['id'];
$this->id = (int)$_REQUEST['id'];
$result = mysqli_query($mysql, 'SELECT * FROM `vandalism` WHERE `id` = \'' . mysqli_real_escape_string($mysql, $this->id) . '\'');
$this->row = mysqli_fetch_assoc($result);
$this->data = getReport($this->id);
Expand Down Expand Up @@ -52,7 +52,7 @@ public function __construct()

public function writeHeader()
{
echo 'Viewing ' . $this->id;
echo 'Viewing ' . htmlspecialchars($this->id);
}

public function writeContent()
Expand Down

0 comments on commit 5d7cd9e

Please sign in to comment.