PHP: Unterschied zwischen den Versionen

Aus robopagex.com
Zur Navigation springen Zur Suche springen
Zeile 16: Zeile 16:
 
=== '''$_GET[] | Query Navigation''' ===
 
=== '''$_GET[] | Query Navigation''' ===
 
'''Example 1'''
 
'''Example 1'''
<?php
+
<?php
 
     $PAGES          = array();
 
     $PAGES          = array();
 
     $PAGES = [
 
     $PAGES = [
Zeile 25: Zeile 25:
 
     @include(substr($PAGES[$_GET['p']] ?? ('home'), 0, 255));
 
     @include(substr($PAGES[$_GET['p']] ?? ('home'), 0, 255));
 
     exit;
 
     exit;
?>
+
?>
  
 
'''Example 2'''
 
'''Example 2'''
  
<?php
+
<?php
 
     $PAGES          = array();   
 
     $PAGES          = array();   
 
     $PAGES = [
 
     $PAGES = [
Zeile 38: Zeile 38:
 
     @include($PAGES[$_GET['p']] ?? ('home'));
 
     @include($PAGES[$_GET['p']] ?? ('home'));
 
     exit;
 
     exit;
?>
+
?>

Version vom 18. Dezember 2021, 16:51 Uhr

Secure "included php files"

index.php
<?php
     if((!defined('z'))){ define('z','0');  }
     include('file.php')
?>

file.php
<?php
     if((!defined("z"))){exit;}
?>
f611e2d0c2b292bce687e6c090956d63e396124abc17c2a2fa662c7ff6118ef2b43388c9d007cd2fadcad7d7952e6f855826028d58e5b1edd7264b2797996381
Secure php dynamic code build.

$_GET[] | Query Navigation

Example 1

<?php
   $PAGES          = array();
   $PAGES = [
      'home'       => 'home.html'
     ,'about'      => 'about.php'
     ,'contact'    => 'somedir/contact.php'
   ];
   @include(substr($PAGES[$_GET['p']] ?? ('home'), 0, 255));
   exit;
?>

Example 2

<?php
   $PAGES          = array();  
   $PAGES = [
      'home'       => 'home.html'
     ,'about'      => 'about.php'
     ,'contact'    => 'somedir/contact.php'
   ];
   @include($PAGES[$_GET['p']] ?? ('home'));
   exit;
?>