<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Sécurité : Astuces de programmation Le MEMO du Web Développeur</title>
	<atom:link href="https://memo-web.fr/tag/securite/feed/" rel="self" type="application/rss+xml" />
	<link>https://memo-web.fr</link>
	<description></description>
	<lastBuildDate>Fri, 10 Apr 2020 07:24:34 +0000</lastBuildDate>
	<language>fr-FR</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.8.2</generator>
	<item>
		<title>Fonction de sécurisation des données passées dans formulaire ou URL</title>
		<link>https://memo-web.fr/categorie-php-86/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=categorie-php-86</link>
					<comments>https://memo-web.fr/categorie-php-86/#respond</comments>
		
		<dc:creator><![CDATA[t@ra]]></dc:creator>
		<pubDate>Tue, 30 Jul 2013 15:08:45 +0000</pubDate>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Sécurité]]></category>
		<category><![CDATA[URL]]></category>
		<guid isPermaLink="false">http://memo-web.fr/?p=154</guid>

					<description><![CDATA[<p>La fonction suivante permet de sécuriser les données passées par des formulaires ou des URL avant de leur faire subir une requête en base de données.</p>
The post <a href="https://memo-web.fr/categorie-php-86/">Fonction de sécurisation des données passées dans formulaire ou URL</a> first appeared on <a href="https://memo-web.fr">Le MEMO du Web Développeur</a>.]]></description>
										<content:encoded><![CDATA[<p>La fonction suivante permet de sécuriser les données passées par des formulaires ou des URL avant de leur faire subir une requête en base de données.</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">function securite_bdd($string){   
// On regarde si le type de string est un nombre entier (int)  
  if(ctype_digit($string))   {   
    $string = intval($string);   }   // Pour tous les autres types  
  else {
    $string = mysql_real_escape_string($string);    
     $string = addcslashes($string, '%_');   }    
  return $string; 
}</pre>
<div style="margin-top: 0px; margin-bottom: 0px;" class="sharethis-inline-share-buttons" ></div>The post <a href="https://memo-web.fr/categorie-php-86/">Fonction de sécurisation des données passées dans formulaire ou URL</a> first appeared on <a href="https://memo-web.fr">Le MEMO du Web Développeur</a>.]]></content:encoded>
					
					<wfw:commentRss>https://memo-web.fr/categorie-php-86/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Protection contre les injections HTML XCSS</title>
		<link>https://memo-web.fr/protection-contre-les-injections-html-xcss/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=protection-contre-les-injections-html-xcss</link>
					<comments>https://memo-web.fr/protection-contre-les-injections-html-xcss/#respond</comments>
		
		<dc:creator><![CDATA[t@ra]]></dc:creator>
		<pubDate>Tue, 03 Jan 2012 16:06:07 +0000</pubDate>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Sécurité]]></category>
		<guid isPermaLink="false">http://memo-web.fr/?p=152</guid>

					<description><![CDATA[<p>La fonction&#160;htmlentities()&#160;permet de protéger l&#8217;affichage de données dont on n&#8217;est pas sûr de l&#8217;origine en rendant toutes les balises XHTML inopérentes. Exemple: http://www.monsite.com?monpseudo=&#60;strong&#62;Justine&#60;/strong&#62;&#60;script src= »http://hacker.com/injection.js » &#62; En gros, cette fonction va remplacer &#60; par &#38;lt; ou &#62; par &#38;gt; à l&#8217;affichage, rendant caduque toute tentative malveillante d&#8217;injection HTML (ou javascript). A l&#8217;affichage , dans l&#8217;exemple précédent, [&#8230;]</p>
The post <a href="https://memo-web.fr/protection-contre-les-injections-html-xcss/">Protection contre les injections HTML XCSS</a> first appeared on <a href="https://memo-web.fr">Le MEMO du Web Développeur</a>.]]></description>
										<content:encoded><![CDATA[<p>La fonction&nbsp;<strong>htmlentities()</strong>&nbsp;permet de protéger l&rsquo;affichage de données dont on n&rsquo;est pas sûr de l&rsquo;origine en rendant toutes les balises XHTML inopérentes.</p>



<p>Exemple:</p>



<p>http://www.monsite.com?monpseudo=&lt;strong&gt;Justine&lt;/strong&gt;&lt;script src= »http://hacker.com/injection.js » &gt;</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">&lt;?php echo "Salut ".htmlentities($_GET['monpseudo']); ?></pre>



<p>En gros, cette fonction va remplacer &lt; par &amp;lt; ou &gt; par &amp;gt; à l&rsquo;affichage, rendant caduque toute tentative malveillante d&rsquo;injection HTML (ou javascript).</p>



<p>A l&rsquo;affichage , dans l&rsquo;exemple précédent, on affichera :</p>



<p><strong><em>Salut &amp;lt;strong&amp;gt;Justine&amp;lt;strong&amp;gt;&amp;lt;script src=&amp;quot;http://hacker.com/injection.js&amp;quot; &amp;gt;</em></strong></p>



<p><strong>htmlspecialchars()</strong>&nbsp;est l&rsquo;équivalent de htmlentities() mais il est conseillé d&rsquo;utiliser cette dernière.</p>



<p>Si l&rsquo;on veut plutôt supprimer les balises HTML&nbsp;susceptibles d&rsquo;être ajoutées par l&rsquo;utilisateur on utilise la fonction&nbsp;<strong>strip_tags</strong></p>
<div style="margin-top: 0px; margin-bottom: 0px;" class="sharethis-inline-share-buttons" ></div>The post <a href="https://memo-web.fr/protection-contre-les-injections-html-xcss/">Protection contre les injections HTML XCSS</a> first appeared on <a href="https://memo-web.fr">Le MEMO du Web Développeur</a>.]]></content:encoded>
					
					<wfw:commentRss>https://memo-web.fr/protection-contre-les-injections-html-xcss/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
