vendredi 25 mai 2018

how I can protect id in the URL from end user? [on hold]

I have two page {php} the first page pass id to the second page and the second one get data from database depend on the id .. So i need to make sure the end user will not edit the url

the first page

echo "<td><a class='view-report' href='viewreport.php?id=".$row['reports_id']."'><i class='fa fa-eye'></i>  view </a> "."</td>";

the second page

   <h3 class="h4 text-center arabic-font ">   رقم البلاغ : <?=intval($_GET['id']);?> </h3> 
  <?php 
    $id = intval($_GET['id']);
    $query = $con->prepare("SELECT * FROM reports WHERE reports_id = ?");
    $query->execute(array($id));
    echo "<pre>";
    print_r($query->fetchAll());
    echo "</pre>";

  ?> 




Aucun commentaire:

Enregistrer un commentaire