Ceci est une ancienne révision du document !
Sécurisation des INCLUDE
Script lancé par modules.php (dans notre exemple : index.php )
Au début de chaque fichier PHP (après le cartouche de commentaires décrivant le module, licence, …) il est nécessaire de rajouter :
Versions actuelles
// For More security if (!stristr($_SERVER['PHP_SELF'],"modules.php")) die(); if (strstr($ModPath,'..') || strstr($ModStart,'..') || stristr($ModPath, 'script') || stristr($ModPath, 'cookie') || stristr($ModPath, 'iframe') || stristr($ModPath, 'applet') || stristr($ModPath, 'object') || stristr($ModPath, 'meta') || stristr($ModStart, 'script') || stristr($ModStart, 'cookie') || stristr($ModStart, 'iframe') || stristr($ModStart, 'applet') || stristr($ModStart, 'object') || stristr($ModStart, 'meta')) die(); // For More security
Versions anciennes
// For More security if (!eregi("modules.php", $PHP_SELF)) { die(); } if (strstr($ModPath,"..") || strstr($ModStart,"..") || stristr($ModPath, "script") || stristr($ModPath, "cookie") || stristr($ModPath, "iframe") || stristr($ModPath, "applet") || stristr($ModPath, "object") || stristr($ModPath, "meta") || stristr($ModStart, "script") || stristr($ModStart, "cookie") || stristr($ModStart, "iframe") || stristr($ModStart, "applet") || stristr($ModStart, "object") || stristr($ModStart, "meta")) { die(); } // For More security // Retro compatibilité SABLE if (!function_exists("sql_connect")) { include ("modules/$ModPath/retro-compat/mysql.php"); } // Retro compatibilité SABLE
Script lancé par admin.php (dans notre exemple : admin/adm.php )
Au début de chaque fichier PHP (après le cartouche de commentaires décrivant le module, licence, …) il est nécessaire de rajouter :
Versions actuelles
// For More security if (!function_exists('admindroits')) include($_SERVER['DOCUMENT_ROOT'].'/admin/die.php'); if (strstr($ModPath,'..') || strstr($ModStart,'..') || stristr($ModPath, 'script') || stristr($ModPath, 'cookie') || stristr($ModPath, 'iframe') || stristr($ModPath, 'applet') || stristr($ModPath, 'object') || stristr($ModPath, 'meta') || stristr($ModStart, 'script') || stristr($ModStart, 'cookie') || stristr($ModStart, 'iframe') || stristr($ModStart, 'applet') || stristr($ModStart, 'object') || stristr($ModStart, 'meta')) die(); // For More security
Versions anciennes
// For More security if (!eregi("admin.php", $PHP_SELF)) { die(); } if (strstr($ModPath,"..") || strstr($ModStart,"..") || stristr($ModPath, "script") || stristr($ModPath, "cookie") || stristr($ModPath, "iframe") || stristr($ModPath, "applet") || stristr($ModPath, "object") || stristr($ModPath, "meta") || stristr($ModStart, "script") || stristr($ModStart, "cookie") || stristr($ModStart, "iframe") || stristr($ModStart, "applet") || stristr($ModStart, "object") || stristr($ModStart, "meta")) { die(); } // For More security // Retro compatibilité SABLE if (!function_exists("sql_connect")) { include ("modules/$ModPath/retro-compat/mysql.php"); } // Retro compatibilité SABLE''
Script servant à la réalisation d’un BLOC NPDS
Au début de chaque fichier PHP (après le cartouche de commentaires décrivant le module, licence, …) il est nécessaire de rajouter :
// For More security if (!function_exists("Mysql_Connection")) { die(); } // For More security // Retro compatibilité SABLE if (!function_exists("sql_connect")) { include ("modules/$ModPath/retro-compat/mysql.php"); } // Retro compatibilité SABLE
:!:Plus généralement tous fichier PHP contenu dans un module (à l’exclusion d’un fichier de paramétrage,d’installation) contenant l’utilisation de variables global de NPDS (par exemple $ModStart, $ModPath, $language, …) doit être sécurisé !