Fix error in helpdesk.php (#516)

Error: Warning: Trying to access array offset on value of type bool in C:....\helpdesk.php on line 34
If I put a non-existent ID in the URL, it throws the error.
This commit is contained in:
Luan Luciano 2022-07-10 05:07:37 -03:00 committed by GitHub
parent 2c050dae1b
commit 5e67cf7450
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View File

@ -36,6 +36,11 @@ if ($view !== false){
} }
$ticketData = mysql_select_single("SELECT * FROM znote_tickets WHERE id='$view' LIMIT 1;"); $ticketData = mysql_select_single("SELECT * FROM znote_tickets WHERE id='$view' LIMIT 1;");
if(!$ticketData) {
echo 'You can not view this ticket!';
include 'layout/overall/footer.php';
die;
}
?> ?>
<h1>View Ticket #<?php echo $ticketData['id']; ?></h1> <h1>View Ticket #<?php echo $ticketData['id']; ?></h1>
<table class="znoteTable ThreadTable table table-striped"> <table class="znoteTable ThreadTable table table-striped">

View File

@ -21,7 +21,7 @@ if ($view !== false) {
} }
$ticketData = mysql_select_single("SELECT * FROM znote_tickets WHERE id='$view' LIMIT 1;"); $ticketData = mysql_select_single("SELECT * FROM znote_tickets WHERE id='$view' LIMIT 1;");
if($ticketData['owner'] != $session_user_id) { if(!$ticketData || $ticketData['owner'] != $session_user_id) {
echo 'You can not view this ticket!'; echo 'You can not view this ticket!';
include 'layout/overall/footer.php'; include 'layout/overall/footer.php';
die; die;