AdminSysNet

Aller au contenu | Aller au menu | Aller à la recherche

Développement › Docs_dev_en_cours

Fil des billets

PHP: sécurisation des données de formulaires

Articles intéressants:

http://www.siteduzero.com/tutoriel-3-64912-securite-php-securiser-les-flux-de-donnees.html

http://www.siteduzero.com/tutoriel-3-423618-les-filtres-en-php-pour-valider-les-donnees-utilisateur.html

http://www.benji1000.net/la-securite-des-formulaires-php/

http://site-waide.fr/2012/05/securiser-ses-formulaires-php/

forum sur site du zero:

http://www.siteduzero.com/forum-83-393262-p1-proteger-l-envoi-de-donnee-via-un-formulaire.html


Valider des donénes avec Symfony2: http://www.siteduzero.com/tutoriel-3-614250-validez-vos-donnees.html

MySQL: table column-count and rowsize limits

Page très intéressante concernant les limites de taille d'une table MySQL

http://dev.mysql.com/doc/refman/5.6/en/column-count-limit.html

E.7.4. Table Column-Count and Row-Size Limits

There is a hard limit of 4096 columns per table, but the effective maximum may be less for a given table. The exact limit depends on several interacting factors.

  • Every table (regardless of storage engine) has a maximum row size of 65,535 bytes. Storage engines may place additional constraints on this limit, reducing the effective maximum row size.

    The maximum row size constrains the number (and possibly size) of columns because the total length of all columns cannot exceed this size. For example, utf8 characters require up to three bytes per character, so for a CHAR(255) CHARACTER SET utf8 column, the server must allocate 255 × 3 = 765 bytes per value. Consequently, a table cannot contain more than 65,535 / 765 = 85 such columns.

    Storage for variable-length columns includes length bytes, which are assessed against the row size. For example, a VARCHAR(255) CHARACTER SET utf8 column takes two bytes to store the length of the value, so each value can take up to 767 bytes.

    BLOB and TEXT columns count from one to four plus eight bytes each toward the row-size limit because their contents are stored separately from the rest of the row.

    Declaring columns NULL can reduce the maximum number of columns permitted. For MyISAM tables, NULL columns require additional space in the row to record whether their values are NULL. Each NULL column takes one bit extra, rounded up to the nearest byte. The maximum row length in bytes can be calculated as follows:

    row length = 1
    + (sum of column lengths)
    + (number of NULL columns + delete_flag + 7)/8
    + (number of variable-length columns)
    

    delete_flag is 1 for tables with static row format. Static tables use a bit in the row record for a flag that indicates whether the row has been deleted. delete_flag is 0 for dynamic tables because the flag is stored in the dynamic row header. For information about MyISAM table formats, see Section 14.1.3, “MyISAM Table Storage Formats”.

    These calculations do not apply for InnoDB tables. Storage size is the same for NULL and NOT NULL columns.

    The following statement to create table t1 succeeds because the columns require 32,765 + 2 bytes and 32,766 + 2 bytes, which falls within the maximum row size of 65,535 bytes:

    mysql> CREATE TABLE t1
    -> (c1 VARCHAR(32765) NOT NULL, c2 VARCHAR(32766) NOT NULL)
    -> ENGINE = MyISAM CHARACTER SET latin1;
    Query OK, 0 rows affected (0.02 sec)
    

    The following statement to create table t2 fails because the columns are NULL and MyISAM requires additional space that causes the row size to exceed 65,535 bytes:

    mysql> CREATE TABLE t2
    -> (c1 VARCHAR(32765) NULL, c2 VARCHAR(32766) NULL)
    -> ENGINE = MyISAM CHARACTER SET latin1;
    ERROR 1118 (42000): Row size too large. The maximum row size for the
    used table type, not counting BLOBs, is 65535. You have to change some
    columns to TEXT or BLOBs
    

    The following statement to create table t3 fails because although the column length is within the maximum length of 65,535 bytes, two additional bytes are required to record the length, which causes the row size to exceed 65,535 bytes:

    mysql> CREATE TABLE t3
    -> (c1 VARCHAR(65535) NOT NULL)
    -> ENGINE = MyISAM CHARACTER SET latin1;
    ERROR 1118 (42000): Row size too large. The maximum row size for the
    used table type, not counting BLOBs, is 65535. You have to change some
    columns to TEXT or BLOBs
    

    Reducing the column length to 65,533 or less permits the statement to succeed.

  • Each table has an .frm file that contains the table definition. The server uses the following expression to check some of the table information stored in the file against an upper limit of 64KB:

    if (info_length+(ulong) create_fields.elements*FCOMP+288+
    n_length+int_length+com_length > 65535L || int_count > 255)

    The portion of the information stored in the .frm file that is checked against the expression cannot grow beyond the 64KB limit, so if the table definition reaches this size, no more columns can be added.

    The relevant factors in the expression are:

    • info_length is space needed for screens. This is related to MySQL's Unireg heritage.

    • create_fields.elements is the number of columns.

    • FCOMP is 17.

    • n_length is the total length of all column names, including one byte per name as a separator.

    • int_length is related to the list of values for ENUM and SET columns.

    • com_length is the total length of column and table comments.

    Thus, using long column names can reduce the maximum number of columns, as can the inclusion of ENUM or SET columns, or use of column or table comments.

  • Individual storage engines might impose additional restrictions that limit table column count. Examples:

    • InnoDB permits up to 1000 columns.

    • InnoDB restricts row size to something less than half a database page (approximately 8000 bytes), not including VARBINARY, VARCHAR, BLOB, or TEXT columns.

    • Different InnoDB storage formats (COMPRESSED, REDUNDANT) use different amounts of page header and trailer data, which affects the amount of storage available for rows.

MySQL: gestion des multibytes strings (=>chaines de caractères multi-octets)

http://php.net/manual/fr/intro.mbstring.php

Introduction

Même si la plupart des langues peuvent être représentées grâce à un jeu de 128 caractères, il y a d'autres langues qui requièrent des jeux de caractères bien plus grands. Des méthodes de caractères multi-octets ont été développées pour résoudre ce type de problème.

Lorsque vous manipulez des chaînes de caractères multi-octets, pour couper, rechercher ou nettoyer une chaîne, vous devez utiliser deux octets consécutifs, qui représentent un seul caractère. Si vous n'y prenez pas garde, vous allez obtenir une chaîne corrompue et invalide, avec une représentation totalement incompréhensible.

mbstring fournit les fonctions spécifiques de manipulations de chaînes qui vous permet de travailler avec les encodages multi-octets en PHP. En plus de cela, mbstring gère la traduction entre les jeux de caractères disponibles. mbstring est également connu pour gérer l'Unicode, comme UTF-8 et UCS-2 ainsi que de nombreux autres jeux mono-octets.



reject note add a note add a note User Contributed Notes Introduction
Ant P. 19-Feb-2009 05:12
As mentioned on the "Function Overloading" page, you can get the benefits of this module in existing code with almost zero effort on your part - just set "mbstring.func_overload" in php.ini.

Fonction mb-strlen():
http://php.net/manual/en/function.mb-strlen.php

Gestion des problèmes d'encodage de caractères (Unicode, UTF8, ANSI, ASCII...)

http://unicode.org/

http://www.unicode.org/charts/

http://stackoverflow.com/questions/700187/unicode-utf-ascii-ansi-format-differences?rq=1

what is the difference between Unicode, UTF8, UTF7,UTF16,UTF32,ASCII, ANSI code format of encoding in ASP.net In what these are helpful for programmers. unicode encoding utf-8 ascii ansi share|improve this question Joachim Sauer Going down your list: "Unicode encoding" is more properly known as UTF-16: 2 bytes per "code point". This is the native format of strings in .NET. Values outside the Basic Multilingual Plane (BMP) are encoded as surrogate pairs. (These are relatively rarely used - which is a good job, as very few developers get them right, I suspect. I very much doubt that I do.) "Unicode" is really the character set - it's unfortunate that the term is also used as a synonym for UTF-16 in .NET and various Windows applications.
UTF-8: Variable length encoding, 1-4 bytes covers every current character. ASCII values are encoded as ASCII.
UTF-7: Usually used for mail encoding. Chances are if you think you need it and you're not doing mail, you're wrong. (That's just my experience of people posting in newsgroups etc - outside mail, it's really not widely used at all.)
UTF-32: Fixed width encoding using 4 bytes per code point. This isn't very efficient, but makes life easier outside the BMP. I have a .NET Utf32String class as part of my MiscUtil library, should you ever want it. (It's not been very thoroughly tested, mind you.) ASCII: Single byte encoding only using the bottom 7 bits. (Unicode 0-127.) No accents etc.
ANSI: There's no one fixed ANSI encoding - there are lots of them. Usually when people say "ANSI" they mean "the default code page for my system" which is obtained via Encoding.Default, and is often Windows-1252.
There's more on my Unicode page and tips for debugging Unicode problems.
The other big resource of code is unicode.org which contains more information than you'll ever be able to work your way through - possibly the most useful bit is the code charts.


Unicode != UTF-16. Unicode is just the character set, representable as UTF7/8/16/32 – jalf Mar 31 '09 at 7:01

@jalf: Edited answer to clarify that though. – Jon Skeet Mar 31 '09 at 7:48
Some reading to get you started on character encodings: Joel on Software: The Absolute Minimum Every Software Developer Absolutely, Positively Must Know
About Unicode and Character Sets (No Excuses!)
By the way - ASP.NET has nothing to do with it. Encodings are universal.

Tomalak
The best site to refer would be : http://msdn.microsoft.com/en-us/library/dd374081(VS.85).aspx
share|improve this answer
answered Sep 27 '10 at 21:37

Serveurs Linux:administration+DNS+HA_etc

Sécuriser son serveur Linux:

http://www.siteduzero.com/tutoriel-3-165981-securiser-son-serveur-linux.html

Gérer son nom de domaine :

http://www.siteduzero.com/tutoriel-3-272111-gerer-son-nom-de-domaine.html

 Serveur multiutilisateurs sous Linux : création et suppression des comptes utilisateurs et toutes les étapes associées

http://www.siteduzero.com/tutoriel-3-36221-un-serveur-d-hebergement-multiutilisateur-sous-linux.html#ss_part_8

 Systèmes Linux Haute-Disponibilité :

http://www.linuxfocus.org/Francais/November2000/article179.shtml

MySQL avancé

http://www.mysql.fr/

Jointures MySQL : découper en plusieurs tables pour éviter la redondance de données :

http://www.siteduzero.com/tutoriel-3-214617-introduction-aux-jointures-sql.html

Foreign Keys sous MySql grâce à InnoDB:
Attention:les autres moteurs de MySql ne gèrent pas les contraintes (on update,on delete,...) des foreign keys.
http://dev.mysql.com/doc/refman/5.1/en/ansi-diff-foreign-keys.html

MySQL Index,clés primaires/étrangères et sous-requêtes:
http://www.siteduzero.com/tutoriel-3-482339-index.html
http://www.siteduzero.com/tutoriel-3-482330-cles-primaires-et-etrangeres.html
http://www.siteduzero.com/tutoriel-3-503554-sous-requetes.html

Autoriser seulement l'accès à MySQL depuis l'adresse locale 127.0.0.1:

http://korben.info/faille-dans-mysql-et-mariadb.html

Sauvegarde MySQL:

http://www.commentcamarche.net/forum/affich-24740749-sauvegarde-mysql
Exemple sauvegarde de glpi:
http://www.glpi-project.org/forum/viewtopic.php?id=18743
http://www.developpez.net/forums/d917304/php/php-sgbd/php-mysql/mysql-backup-sauvergarde-automatisee-sous-windows/
http://luca.lovalvo.net/1_luca_lo_valvo/archive/203_backup_mysql_windows_avec_un_batch_et_mysqldump_mysql_dump.html

HTML5+CSS3+Templates

Introduction à HTML5: http://www.html5-css3.fr/html5/introduction-html5

Cours HTML5+CSS3:
http://www.siteduzero.com/tutoriel-3-13666-apprenez-a-creer-votre-site-web-avec-html5-et-css3.html

CSS:
http://caniuse.com/
http://www.css3.info/
http://www.w3schools.com/css3/css3_2dtransforms.asp

Outils d'aide au dev:
http://code.google.com/p/zen-coding/
http://docs.emmet.io/ (le remplaçant de zen-coding)
http://net.tutsplus.com/articles/general/9-ways-to-instantly-code-faster/



Template:
http://shikiryu.com/html5/

Un template pour créer des pages de 960px de large découpée en 12 colonnes:
http://960.gs/ et une petite démo: http://net.tutsplus.com/articles/news/a-detailed-look-at-the-960-css-framework/

http://html5boilerplate.com/
http://www.initializr.com/


PHP+MySQL

Concevez votre site en PHP et MySQL:

http://www.siteduzero.com/tutoriel-3-14668-concevez-votre-site-web-avec-php-et-mysql.html

http://www.viaphp.net/cours/php/23-recuperer-les-informations-d-un-formulaire-en-php

Register_globals: http://www.journaldunet.com/developpeur/tutoriel/php/070703-php-register-global-off.shtml

Fonction Mail:

avec php de base: http://fr2.php.net/manual/fr/function.mail.php

avec PEAR: http://pear.php.net/package/Mail et http://pear.php.net/package/Mail_Queue

Orienté Objet:

http://www.siteduzero.com/tutoriel-3-147180-programmez-en-oriente-objet-en-php.html

http://www.siteduzero.com/tutoriel-3-147160-utiliser-la-classe.html

http://www.apprendre-php.com/tutoriels/tutoriel-29-les-classes-et-objets.html

http://php.net/manual/fr/language.oop5.php

Sites en anglais:

http://www.w3schools.com/php/

http://www.php.net/manual/en/tutorial.php

http://www.phpbuilder.com/getit/