background preloader

PHP

Facebook Twitter

PHP 5 - Accès public, private et protected / Tutoriel PHP. Cet article est la reprise d'un article de mon ancien blog Introduction Avant l'arrivée des classes en PHP, les projets étaient généralement organisés en fonction, ces fonctions (très nombreuses généralement) étaient appelées à différents endroits dans les scripts et les manipulations de variables devenaient rapidement problématique. Avec l'apparition des classes, le PHP (version 4.jesaisplus) devenait un language orienté Objet et ainsi, permettait d'organiser les scripts de manière plus logique, et surtout plus pratique pour les développeurs, fini le procédural...

Les prémices de l'objet dans le PHP 4 soufrait de plusieurs problèmes pour les personnes acclimatées à la POO : Pas d'héritage, pas de gestion d'accès aux propriétés/métodes, avec PHP 5, tous ces outils sont réunis, et notamment la gestion de l'accès (L'objet de cet article) L'accès aux membres d'une classe Accès aux membres public Les membres public d'une classes sont accessibles partout : Accès aux membres private. $_GET and $_POST in PHP. Introduction Using the GET and POST methods, the browser client can send data to the web server. In PHP the GET and POST methods are used to retrieve information from forms, such as user input. Get and Post are methods used to send data to the server. These methods are used for data handling in forms. Where each method varies a little in the way they work. GET Method In the GET method, we can also send data to the server.

The main points about the GET method are as follows: The GET method is used to collect values in a form. Example First of all we create a PHP file which is called by the HTML page in later. <html><body bgcolor="pink">Welcome <? The above file is to be saved with the name "get.php", which is called by the HTML page later. <html><body bgcolor="pink"><table><form action="get.php" method="get"><tr><td>Name: <input type="text" name="Name" /></td></tr><tr><td>Class : <input type="text" name="Class" /></td></tr><input type="submit" " value="Submit"/></form> </body></html> Output. Convertir un site en UTF-8 - NeoBlog. Using PHP 5's XSL extension to perform XSL Transformations. By Tony Marston 22nd August 2004 Intended AudiencePrerequisitesA sample XML file- XML file contentsA sample XSL file- XSL file contentsXSL Include files- std.pagination.xsl- std.actionbar.xslPerforming the XSL Transformation- Creating an XSLT processor resource- Identifying and loading the XSL stylesheet- Identifying the XML document- Defining optional parameters- Invoking the XSLT process and displaying the resultSample outputReferences Intended Audience This tutorial is for developers who wish to know how to generate HTML documents using a combination of XML data and XSL stylesheets.

It also includes examples of how to use XSL parameters and included stylesheets. The process of combining the content of an XML file and the formatting instructions of an XSL file to produce another document is known as an XSL Transformation (XSLT for short). While XSL files are static in nature XML files can be created 'on the fly' to contain whatever data has just been selected from the database.

<? <? XSL : de PHP4 xslt à PHP5 xsl - Doc Alex. Tutorial | The Mole. In this tutorial, you will learn how to use The Mole to exploit SQL Injections, extracting data from the database and reading files from the vulnerable server. In order to read a complete reference of The Mole's commands and how to use them, please visit (btw, thanks to Sébastien Damaye for writing such a complete guide!). If you happen to encounter some problem when exploiting an SQL Injection, caused by some filter or IPS used by the target server, please visit our filters tutorial.

Before we start, you must know what is required in order to exploit a SQL Injection using The Mole. Once you have found a vulnerable script, you have to find a string which normally appears in the web page, but does not appear when you negate the query which is being executed on the database(by modifying the vulnerable parameter). Identifying the injection This example will be shown using this test site: Fine, we see the string "admin" has disappeared.

Exploiting the injection. Liste des fonctions PHP. Atelier PHP - apprendre le langage php, cours, exercices, ressources. Ce site est à votre disposition pour vous permettre d'apprendre facilement et gratuitement les bases du langage PHP.Il comprend actuellement 20 leçons resumant les principaux aspects du langage, et surtout pour chaque chapitre, entre 10 et 30 exercices de différents niveaux de difficulté (*: facile , **: moyen, ***: avancé) et un ensemble de QCM permettant d'apprécier le niveau acquis. Il vous est fortement conseillé : De vous enregistrer (gratuitement, et sans besoin de fournir votre adresse mél) comme "étudiant" en vous créant un identifiant associé à un mot de passe; ceci vous permettra de mémoriser vos résultats de QCM et ainsi de suivre votre progression dans l'apprentissage du langage. De vous inscrire sur la liste de distribution : ceci vous permettra d'être tenu au courant des évolutions du site (nouveaux chapitres de cours, nouveaux exemples, nouvelles applications...)

PHP IDE :: JetBrains PhpStorm. Major frameworks support PhpStorm is perfect for working with Symfony, Laravel, Drupal, WordPress, Zend Framework, Magento, Joomla! , CakePHP, Yii, and other frameworks. All the PHP tools The editor actually 'gets' your code and deeply understands its structure, supporting all the PHP language features for modern and legacy projects. It provides the best code completion, refactorings, on-the-fly error prevention, and more. Front-end technologies included Make the most of the cutting edge front-end technologies, such as HTML 5, CSS, Sass, Less, Stylus, CoffeeScript, TypeScript, Emmet, and JavaScript, with refactorings, debugging, and unit testing available.

Built-in developer tools Perform many routine tasks right from the IDE, thanks to the Version Control Systems integration, support for remote deployment, databases/SQL, command-line tools, Docker, Composer, REST Client, and many other tools. PhpStorm = WebStorm + PHP + DB/SQL Intelligent Coding Assistance Fast and Safe Refactoring.

SQLMap, outil d'injection SQL. SQLMap est un outil permettant d’effectuer des requêtes SQL de manières automatisées dans le but de trouver et d’exploiter une mauvaise configuration sur votre serveur Web. Ce dernier a été développé en Python par Bernardo Damele et Miroslav Stampar sous licence GPLv2. Le choix de ce langage de programmation est intéressant car il permet à l’outil d’être utilisable sur n’importe quel système d’exploitation. Pour rappel, les techniques d’injection SQL consistent à introduire du code additif dans une requête SQL de base. Cela va permettre à un utilisateur malveillant de récupérer certaines données telles le nom des tables, les logins, les mots de passe ou encore pire, de prendre le contrôle du système.

Voici quelques caractéristiques de l’outil : Support de MySQL, Oracle, PostgreSQL et Microsoft SQL Server. Pour en avoir la liste complète, veuillez vous rendre sur la documentation officielle : Téléchargement Utilisation Options utilisées Cas réel. Exploiter une injection SQL les doigts dans le nez. Exploiter une injection SQL les doigts dans le nez Si au petit-déj, vous aimez manger des injections SQL, voici un petit outil qui va vous permettre de tester votre site afin de voir si celui-ci est vulnérable. Cet outil, c'est The Mole. C'est tout en ligne de commande pour les barbus et ça permet simplement à partir d'une URL contenant une chaine de caractère valide, de voir s'il est possible d'y injecter du SQL. C'est pratique, car tout automatique et ça gère aussi bien MySQL, SQL Server, Postgres et Oracle. The Mole est téléchargeable ici et pour apprendre à vous en servir, il y a un très bon tuto ici. A utiliser sur votre propre machine, car sur les machines des autres, c'est illégal.

Vous avez aimé cet article ? Plus de 10 outils pour tester la sécurité de votre site web. Dans ce dossier je vais vous présenter un grand nombre d'outils pour sécuriser votre site ou votre application web. Les outils que je présente tournent sur différentes plateformes (parfois toutes) comme Windows, Linux, Mac ainsi que les navigateurs. Il en existe un paquet sur le net mais j'ai préféré vous présenter ceux qui sont récents et/ou maintenus et améliorés au fil du temps. La majorité de ces pentools sont des scripts écrits en perl, python ou ruby. Alors ce que je vous conseille avant d'aller plus loin c'est soit d'installer une distrib Linux (genre BackTrack) sur une machine virtuelle.

Mais si vous êtes trop feignant il y a quelques applications qui permettent d'exécuter ces scripts sur un environnement Windows. Vous pouvez par exemple commencer à installer Cygwin si vous voulez avoir un interpréteur de lignes de commande comme sur Linux. Sinon vous avez un tuto pour installer Ruby et Rails sur Windows ainsi que Python pour Windows et Perl pour Windows. Sqlsus The Mole Uniscan. Regular Expressions. Regular expressions are used with the RegExp methods test() and exec() and with the String methods match(), replace(), search(), and split(). When you want to know whether a pattern is found in a string, use the test() or search() methods; for more information (but slower execution) use the exec() or match() methods.

If you use exec() or match() and if the match succeeds, these methods return an array and update properties of the associated regular expression object and also of the predefined regular expression object, RegExp. If the match fails, the exec() method returns null (which coerces to false). In the following example, the script uses the exec() method to find a match in a string. const myRe = /d(b+)d/g;const myArray = myRe.exec("cdbbdbsbz"); If you do not need to access the properties of the regular expression, an alternative way of creating myArray is with this script: const myArray = /d(b+)d/g.exec("cdbbdbsbz"); However, if you have this script:

Générateurs et testeurs d'Expressions régulières (RegExp) RegExr. File Uploads with PHP. What do pictures in an online photo album, email attachments in a web-based mail client, and data files submitted to an online application for batch processing all have in common? They all rely on the ability to upload files across the Internet from the user’s web browser. Indeed, uploading files is an important feature of many of the sites and web-based applications we use on a daily basis. In this post, I show you how to add support for file uploads to your site using PHP. Requirements Handling file uploads isn’t difficult, but there are a handful of small details that must be correct or else the upload will fail. First, you need to ensure PHP is configured to allow uploads. Check your php.ini file and verify the file_uploads directive is set On. file_uploads = On Uploaded files are first stored in a temporary directory (don’t worry… your PHP script can move the files to a more permanent location afterward).

Scripting the Upload Process Security Considerations Summary.