PHP Classes

File: langs/en-us/scripts/ticketsquerys/searchticketheader.php

Recommend this page to a friend!
  Classes of VITOR GABRIEL M. DANTAS   Pleiades   langs/en-us/scripts/ticketsquerys/searchticketheader.php   Download  
File: langs/en-us/scripts/ticketsquerys/searchticketheader.php
Role: Auxiliary script
Content type: text/plain
Description: Auxiliary script
Class: Pleiades
Application to implement an issue-tracking system
Author: By
Last change:
Date: 6 months ago
Size: 4,300 bytes
 

Contents

Class file image Download
<?php
session_start
();
require
__DIR__.'/../../config.php';
include
__DIR__.'/../../scripts/status.php';
include
__DIR__.'/../../scripts/verifyauth.php';
include
__DIR__.'/../../scripts/verifyticketselect.php';

$SearchStringData = filter_var($_POST['searchbar'], FILTER_SANITIZE_STRING);
$SearchTypeData = filter_var($_POST['searchtype'], FILTER_SANITIZE_NUMBER_INT);

if(
strlen($SearchStringData)>=3 and strlen($SearchStringData)<100){

    switch(
$SearchTypeData){
        case
0:
           
$QuerySearch = "SELECT protocolo,designacao,nometicket,ticketstatus,datapedido,datafinalizado FROM tickets WHERE solicitante='".$_SESSION['DataAccount']['id']."' AND protocolo LIKE '%".$SearchStringData."%'";
           
$QuerySearchExec = mysqli_query($CONNECTION_DB, $QuerySearch);

            unset(
$_SESSION['DataMyTickets']);
            for(
$l=0; $l<mysqli_num_rows($QuerySearchExec); $l++){
               
$DataTicket = mysqli_fetch_assoc($QuerySearchExec);
               
$_SESSION['DataMyTickets'][$l][] = $DataTicket['protocolo'];
               
$_SESSION['DataMyTickets'][$l][] = $DataTicket['designacao'];
               
$_SESSION['DataMyTickets'][$l][] = $DataTicket['nometicket'];
               
$_SESSION['DataMyTickets'][$l][] = $DataTicket['ticketstatus'];
               
$_SESSION['DataMyTickets'][$l][] = $DataTicket['datapedido'];
               
$_SESSION['DataMyTickets'][$l][] = $DataTicket['datafinalizado'];
            }
           
$_SESSION['DataMyTickets']['count'] = mysqli_num_rows($QuerySearchExec);
            break;
        case
1:
           
$QuerySearch = "SELECT protocolo,designacao,nometicket,ticketstatus,datapedido,datafinalizado FROM tickets WHERE solicitante='".$_SESSION['DataAccount']['id']."' AND tickethash LIKE '%".$SearchStringData."%'";
           
$QuerySearchExec = mysqli_query($CONNECTION_DB, $QuerySearch);

            unset(
$_SESSION['DataMyTickets']);
            for(
$l=0; $l<mysqli_num_rows($QuerySearchExec); $l++){
               
$DataTicket = mysqli_fetch_assoc($QuerySearchExec);
               
$_SESSION['DataMyTickets'][$l][] = $DataTicket['protocolo'];
               
$_SESSION['DataMyTickets'][$l][] = $DataTicket['designacao'];
               
$_SESSION['DataMyTickets'][$l][] = $DataTicket['nometicket'];
               
$_SESSION['DataMyTickets'][$l][] = $DataTicket['ticketstatus'];
               
$_SESSION['DataMyTickets'][$l][] = $DataTicket['datapedido'];
               
$_SESSION['DataMyTickets'][$l][] = $DataTicket['datafinalizado'];
            }
           
$_SESSION['DataMyTickets']['count'] = mysqli_num_rows($QuerySearchExec);
            break;
        case
2:
           
$QuerySearch = "SELECT protocolo,designacao,nometicket,ticketstatus,datapedido,datafinalizado FROM tickets WHERE solicitante='".$_SESSION['DataAccount']['id']."' AND designacao LIKE '%".$SearchStringData."%'";
           
$QuerySearchExec = mysqli_query($CONNECTION_DB, $QuerySearch);

            unset(
$_SESSION['DataMyTickets']);
            for(
$l=0; $l<mysqli_num_rows($QuerySearchExec); $l++){
               
$DataTicket = mysqli_fetch_assoc($QuerySearchExec);
               
$_SESSION['DataMyTickets'][$l][] = $DataTicket['protocolo'];
               
$_SESSION['DataMyTickets'][$l][] = $DataTicket['designacao'];
               
$_SESSION['DataMyTickets'][$l][] = $DataTicket['nometicket'];
               
$_SESSION['DataMyTickets'][$l][] = $DataTicket['ticketstatus'];
               
$_SESSION['DataMyTickets'][$l][] = $DataTicket['datapedido'];
               
$_SESSION['DataMyTickets'][$l][] = $DataTicket['datafinalizado'];
            }
           
$_SESSION['DataMyTickets']['count'] = mysqli_num_rows($QuerySearchExec);
            break;
        default:
           
$_SESSION['Msg'] = '<div class="alert alert-danger" role="alert"><i class="fa-solid fa-triangle-exclamation fa-beat"></i> You have not selected a valid filter!</div>';
            break;
    }
   
header("Location: ../../pages/MyTickets.php");
    exit();

}else{
   
$_SESSION['Msg'] = '<div class="alert alert-danger" role="alert"><i class="fa-solid fa-triangle-exclamation fa-beat"></i> The survey did not meet the minimum requirements!</div>';
   
header("Location: ../../pages/MyTickets.php");
    exit();
}
mysqli_close($CONNECTION_DB);