Probleme de regex

Probleme de regex - PHP - Programmation

Marsh Posté le 02-03-2011 à 18:27:23    

Salutation voici mon souci  
 
<code type="php">
<?php
 
if(!isset($_POST['txt'])) //Si la variable $_POST['membre'] n'existe pas
 {
 
  $ligne = file_get_contents("test1.1.php" );
   
  echo'<p>
    Je suis un gros Zéro, et pourtant j\'ai tout appris sur http://www.siteduzero.com<br>
    Je vous [color=green]recommande[/color] d\'aller sur ce site, vous pourrez apprendre à faire ça [color=purple]vous aussi[/color] !
   </p>
 
   
   <form method="post" action="test.php">
      <p>
       <label for="txt">Comment pensez-vous que je pourrais améliorer mon site ?</label><br />
       <textarea name="txt" id="txt" rows="40" cols="200" ></textarea>
       <input type="submit" />
      </p>
   </form>';
 }
 else //sinon
 {
  $monfichier1 = fopen("c://wamp//www//TEST//creertuto//test1.1.php", "w+" );
   
  $texte = implode("\n", array_map(create_function('$ligne', 'return "[HTML]".rtrim($ligne)."[/HTML]";'), explode("\n", $_POST['txt'])));
  $texte = htmlspecialchars($texte);
  $texte = nl2br($texte);
   
   
  // On fait passer notre texte à la moulinette des Regex
  $texte = preg_replace('#(\[HTML\].*)&lt;h1&gt;(.*?)&lt;/h1&gt;(.*\[/HTML\])#', '$1<SPAN CLASS="balisehtml">&lt;h1&gt;</SPAN><SPAN CLASS="balisehtmltexte">$2</SPAN><SPAN CLASS="balisehtml">&lt;/h1&gt;</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)&lt;h2&gt;(.*?)&lt;/h2&gt;(.*\[/HTML\])#', '$1<SPAN CLASS="balisehtml">&lt;h2&gt;</SPAN><SPAN CLASS="balisehtmltexte">$2</SPAN><SPAN CLASS="balisehtml">&lt;/h2&gt;</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)&lt;h3&gt;(.*?)&lt;/h3&gt;(.*\[/HTML\])#', '$1<SPAN CLASS="balisehtml">&lt;h3&gt;</SPAN><SPAN CLASS="balisehtmltexte">$2</SPAN><SPAN CLASS="balisehtml">&lt;/h3&gt;</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)&lt;h4&gt;(.*?)&lt;/h4&gt;(.*\[/HTML\])#', '$1<SPAN CLASS="balisehtml">&lt;h4&gt;</SPAN><SPAN CLASS="balisehtmltexte">$2</SPAN><SPAN CLASS="balisehtml">&lt;/h4&gt;</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)&lt;h5&gt;(.*?)&lt;/h5&gt;(.*\[/HTML\])#', '$1<SPAN CLASS="balisehtml">&lt;h5&gt;</SPAN><SPAN CLASS="balisehtmltexte">$2</SPAN><SPAN CLASS="balisehtml">&lt;/h5&gt;</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)&lt;h6&gt;(.*?)&lt;/h6&gt;(.*\[/HTML\])#', '$1<SPAN CLASS="balisehtml">&lt;h6&gt;</SPAN><SPAN CLASS="balisehtmltexte">$2</SPAN><SPAN CLASS="balisehtml">&lt;/h6&gt;</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)&lt;strong&gt;(.*?)&lt;/strong&gt;(.*\[/HTML\])#', '$1<SPAN CLASS="balisehtml">&lt;strong&gt;</SPAN><SPAN CLASS="balisehtmltexte">$2</SPAN><SPAN CLASS="balisehtml">&lt;/strong&gt;</SPAN>$3', $texte);
 
  $texte = preg_replace('#(\[HTML\].*)(.*?)&lt;br&gt;(.*\[/HTML\])#', '$1<SPAN CLASS="balisehtmltexte">$2</SPAN><SPAN CLASS="balisehtml">&lt;br&gt;</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)(.*?)&lt;br /&gt;(.*\[/HTML\])#', '$1<SPAN CLASS="balisehtmltexte">$2</SPAN><SPAN CLASS="balisehtml">&lt;br /&gt;</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)&lt;p&gt;(.*?)(.*\[/HTML\])#', '$1<SPAN CLASS="balisehtml">&lt;p&gt;</SPAN><SPAN CLASS="balisehtmltexte">$2</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)&lt;em&gt;(.*?)(.*\[/HTML\])#', '$1<SPAN CLASS="balisehtml">&lt;em&gt;</SPAN><SPAN CLASS="balisehtmltexte">$2</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)&lt;html&gt;(.*?)(.*\[/HTML\])#', '$1<SPAN CLASS="balisehtml">&lt;html&gt;</SPAN><SPAN CLASS="balisehtmltexte">$2</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)&lt;title&gt;(.*?)(.*\[/HTML\])#', '$1<SPAN CLASS="balisehtml">&lt;title&gt;</SPAN><SPAN CLASS="balisehtmltexte">$2</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)&lt;head&gt;(.*?)(.*\[/HTML\])#', '$1<SPAN CLASS="balisehtml">&lt;head&gt;</SPAN><SPAN CLASS="balisehtmltexte">$2</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)&lt;body&gt;(.*?)(.*\[/HTML\])#', '$1<SPAN CLASS="balisehtml">&lt;body&gt;</SPAN><SPAN CLASS="balisehtmltexte">$2</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)&lt;q&gt;(.*?)(.*\[/HTML\])#', '$1<SPAN CLASS="balisehtml">&lt;q&gt;</SPAN><SPAN CLASS="balisehtmltexte">$2</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)&lt;blockquote&gt;(.*?)(.*\[/HTML\])#', '$1<SPAN CLASS="balisehtml">&lt;blockquote&gt;</SPAN><SPAN CLASS="balisehtmltexte">$2</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)&lt;li&gt;(.*?)(.*\[/HTML\])#', '$1<SPAN CLASS="balisehtml">&lt;li&gt;</SPAN><SPAN CLASS="balisehtmltexte">$2</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)&lt;ul&gt;(.*?)(.*\[/HTML\])#', '$1<SPAN CLASS="balisehtml">&lt;ul&gt;</SPAN><SPAN CLASS="balisehtmltexte">$2</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)&lt;ol&gt;(.*?)(.*\[/HTML\])#', '$1<SPAN CLASS="balisehtml">&lt;ol&gt;</SPAN><SPAN CLASS="balisehtmltexte">$2</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)&lt;dl&gt;(.*?)(.*\[/HTML\])#', '$1<SPAN CLASS="balisehtml">&lt;dl&gt;</SPAN><SPAN CLASS="balisehtmltexte">$2</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)&lt;dt&gt;(.*?)(.*\[/HTML\])#', '$1<SPAN CLASS="balisehtml">&lt;dt&gt;</SPAN><SPAN CLASS="balisehtmltexte">$2</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)&lt;dd&gt;(.*?)(.*\[/HTML\])#', '$1<SPAN CLASS="balisehtml">&lt;dd&gt;</SPAN><SPAN CLASS="balisehtmltexte">$2</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)&lt;div&gt;(.*?)(.*\[/HTML\])#', '$1<SPAN CLASS="balisehtml">&lt;div&gt;</SPAN><SPAN CLASS="balisehtmltexte">$2</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)&lt;table&gt;(.*?)(.*\[/HTML\])#', '$1<SPAN CLASS="balisehtml">&lt;table&gt;</SPAN><SPAN CLASS="balisehtmltexte">$2</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)&lt;td&gt;(.*?)(.*\[/HTML\])#', '$1<SPAN CLASS="balisehtml">&lt;td&gt;</SPAN><SPAN CLASS="balisehtmltexte">$2</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)&lt;tr&gt;(.*?)(.*\[/HTML\])#', '$1<SPAN CLASS="balisehtml">&lt;tr&gt;</SPAN><SPAN CLASS="balisehtmltexte">$2</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)&lt;th&gt;(.*?)(.*\[/HTML\])#', '$1<SPAN CLASS="balisehtml">&lt;th&gt;</SPAN><SPAN CLASS="balisehtmltexte">$2</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)&lt;caption&gt;(.*?)(.*\[/HTML\])#', '$1<SPAN CLASS="balisehtml">&lt;caption&gt;</SPAN><SPAN CLASS="balisehtmltexte">$2</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)&lt;sup&gt;(.*?)(.*\[/HTML\])#', '$1<SPAN CLASS="balisehtml">&lt;sup&gt;</SPAN><SPAN CLASS="balisehtmltexte">$2</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)&lt;thead&gt;(.*?)(.*\[/HTML\])#', '$1<SPAN CLASS="balisehtml">&lt;thead&gt;</SPAN><SPAN CLASS="balisehtmltexte">$2</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)&lt;tbody&gt;(.*?)(.*\[/HTML\])#', '$1<SPAN CLASS="balisehtml">&lt;tbody&gt;</SPAN><SPAN CLASS="balisehtmltexte">$2</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)&lt;tfoot&gt;(.*?)(.*\[/HTML\])#', '$1<SPAN CLASS="balisehtml">&lt;tfoot&gt;</SPAN><SPAN CLASS="balisehtmltexte">$2</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)&lt;label&gt;(.*?)(.*\[/HTML\])#', '$1<SPAN CLASS="balisehtml">&lt;label&gt;</SPAN><SPAN CLASS="balisehtmltexte">$2</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)&lt;select&gt;(.*?)(.*\[/HTML\])#', '$1<SPAN CLASS="balisehtml">&lt;select&gt;</SPAN><SPAN CLASS="balisehtmltexte">$2</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)&lt;option&gt;(.*?)(.*\[/HTML\])#', '$1<SPAN CLASS="balisehtml">&lt;option&gt;</SPAN><SPAN CLASS="balisehtmltexte">$2</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)&lt;fieldset&gt;(.*?)(.*\[/HTML\])#', '$1<SPAN CLASS="balisehtml">&lt;fieldset&gt;</SPAN><SPAN CLASS="balisehtmltexte">$2</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)&lt;legend&gt;(.*?)(.*\[/HTML\])#', '$1<SPAN CLASS="balisehtml">&lt;legend&gt;</SPAN><SPAN CLASS="balisehtmltexte">$2</SPAN>$3', $texte);
   
  $texte = preg_replace('#(\[HTML\].*)(.*?)&lt;/p&gt;(.*\[/HTML\])#', '$1<SPAN CLASS="balisehtmltexte">$2</SPAN><SPAN CLASS="balisehtml">&lt;/p&gt;</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)(.*?)&lt;/em&gt;(.*\[/HTML\])#', '$1<SPAN CLASS="balisehtmltexte">$2</SPAN><SPAN CLASS="balisehtml">&lt;/em&gt;</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)(.*?)&lt;/html&gt;(.*\[/HTML\])#', '$1<SPAN CLASS="balisehtmltexte">$2</SPAN><SPAN CLASS="balisehtml">&lt;/html&gt;</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)(.*?)&lt;/title&gt;(.*\[/HTML\])#', '$1<SPAN CLASS="balisehtmltexte">$2</SPAN><SPAN CLASS="balisehtml">&lt;/title&gt;</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)(.*?)&lt;/head&gt;(.*\[/HTML\])#', '$1<SPAN CLASS="balisehtmltexte">$2</SPAN><SPAN CLASS="balisehtml">&lt;/head&gt;</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)(.*?)&lt;/body&gt;(.*\[/HTML\])#', '$1<SPAN CLASS="balisehtmltexte">$2</SPAN><SPAN CLASS="balisehtml">&lt;/body&gt;</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)(.*?)&lt;/q&gt;(.*\[/HTML\])#', '$1<SPAN CLASS="balisehtmltexte">$2</SPAN><SPAN CLASS="balisehtml">&lt;/q&gt;</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)(.*?)&lt;/blockquote&gt;(.*\[/HTML\])#', '$1<SPAN CLASS="balisehtmltexte">$2</SPAN><SPAN CLASS="balisehtml">&lt;/blockquote&gt;</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)(.*?)&lt;/li&gt;(.*\[/HTML\])#', '$1<SPAN CLASS="balisehtmltexte">$2</SPAN><SPAN CLASS="balisehtml">&lt;/li&gt;</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)(.*?)&lt;/ul&gt;(.*\[/HTML\])#', '$1<SPAN CLASS="balisehtmltexte">$2</SPAN><SPAN CLASS="balisehtml">&lt;/ul&gt;</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)(.*?)&lt;/ol&gt;(.*\[/HTML\])#', '$1<SPAN CLASS="balisehtmltexte">$2</SPAN><SPAN CLASS="balisehtml">&lt;/ol&gt;</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)(.*?)&lt;/dl&gt;(.*\[/HTML\])#', '$1<SPAN CLASS="balisehtmltexte">$2</SPAN><SPAN CLASS="balisehtml">&lt;/dl&gt;</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)(.*?)&lt;/dt&gt;(.*\[/HTML\])#', '$1<SPAN CLASS="balisehtmltexte">$2</SPAN><SPAN CLASS="balisehtml">&lt;/dt&gt;</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)(.*?)&lt;/dd&gt;(.*\[/HTML\])#', '$1<SPAN CLASS="balisehtmltexte">$2</SPAN><SPAN CLASS="balisehtml">&lt;/dd&gt;</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)(.*?)&lt;/div&gt;(.*\[/HTML\])#', '$1<SPAN CLASS="balisehtmltexte">$2</SPAN><SPAN CLASS="balisehtml">&lt;/div&gt;</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)(.*?)&lt;/table&gt;(.*\[/HTML\])#', '$1<SPAN CLASS="balisehtmltexte">$2</SPAN><SPAN CLASS="balisehtml">&lt;/table&gt;</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)(.*?)&lt;/td&gt;(.*\[/HTML\])#', '$1<SPAN CLASS="balisehtmltexte">$2</SPAN><SPAN CLASS="balisehtml">&lt;/td&gt;</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)(.*?)&lt;/tr&gt;(.*\[/HTML\])#', '$1<SPAN CLASS="balisehtmltexte">$2</SPAN><SPAN CLASS="balisehtml">&lt;/tr&gt;</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)(.*?)&lt;/th&gt;(.*\[/HTML\])#', '$1<SPAN CLASS="balisehtmltexte">$2</SPAN><SPAN CLASS="balisehtml">&lt;/th&gt;</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)(.*?)&lt;/caption&gt;(.*\[/HTML\])#', '$1<SPAN CLASS="balisehtmltexte">$2</SPAN><SPAN CLASS="balisehtml">&lt;/caption&gt;</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)(.*?)&lt;/sup&gt;(.*\[/HTML\])#', '$1<SPAN CLASS="balisehtmltexte">$2</SPAN><SPAN CLASS="balisehtml">&lt;/sup&gt;</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)(.*?)&lt;/thead&gt;(.*\[/HTML\])#', '$1<SPAN CLASS="balisehtmltexte">$2</SPAN><SPAN CLASS="balisehtml">&lt;/thead&gt;</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)(.*?)&lt;/tbody&gt;(.*\[/HTML\])#', '$1<SPAN CLASS="balisehtmltexte">$2</SPAN><SPAN CLASS="balisehtml">&lt;/tbody&gt;</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)(.*?)&lt;/tfoot&gt;(.*\[/HTML\])#', '$1<SPAN CLASS="balisehtmltexte">$2</SPAN><SPAN CLASS="balisehtml">&lt;/tfoot&gt;</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)(.*?)&lt;/label&gt;(.*\[/HTML\])#', '$1<SPAN CLASS="balisehtmltexte">$2</SPAN><SPAN CLASS="balisehtml">&lt;/label&gt;</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)(.*?)&lt;/fieldset&gt;(.*\[/HTML\])#', '$1<SPAN CLASS="balisehtmltexte">$2</SPAN><SPAN CLASS="balisehtml">&lt;/fieldset&gt;</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)(.*?)&lt;/legend&gt;(.*\[/HTML\])#', '$1<SPAN CLASS="balisehtmltexte">$2</SPAN><SPAN CLASS="balisehtml">&lt;/legend&gt;</SPAN>$3', $texte);
   
  $texte = preg_replace('#(\[HTML\].*)&lt;img(.*?)&gt;(.*\[/HTML\])#', '$1<SPAN CLASS="balisehtml">&lt;img</SPAN>&nbsp;$2<SPAN CLASS="balisehtml">&gt;</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)&lt;span(.*?)&gt;(.*\[/HTML\])#', '$1<SPAN CLASS="balisehtml">&lt;span</SPAN>&nbsp;$2<SPAN CLASS="balisehtml">&gt;</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)&lt;div(.*?)&gt;(.*\[/HTML\])#', '$1<SPAN CLASS="balisehtml">&lt;div</SPAN>&nbsp;$2<SPAN CLASS="balisehtml">&gt;</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)&lt;ul (.*?)&gt;(.*\[/HTML\])#', '$1<SPAN CLASS="balisehtml">&lt;ul</SPAN>&nbsp;$2<SPAN CLASS="balisehtml">&gt;</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)&lt;optgroup (.*?)&gt;(.*\[/HTML\])#', '$1<SPAN CLASS="balisehtml">&lt;optgroup</SPAN>&nbsp;$2<SPAN CLASS="balisehtml">&gt;</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)&lt;option (.*?)&gt;(.*\[/HTML\])#', '$1<SPAN CLASS="balisehtml">&lt;option</SPAN>&nbsp;$2<SPAN CLASS="balisehtml">&gt;</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)&lt;select (.*?)&gt;(.*\[/HTML\])#', '$1<SPAN CLASS="balisehtml">&lt;select</SPAN>&nbsp;$2<SPAN CLASS="balisehtml">&gt;</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)&lt;textarea (.*?)&gt;(.*\[/HTML\])#', '$1<SPAN CLASS="balisehtml">&lt;textarea</SPAN>&nbsp;$2<SPAN CLASS="balisehtml">&gt;</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)&lt;label (.*?)&gt;(.*\[/HTML\])#', '$1<SPAN CLASS="balisehtml">&lt;label</SPAN>&nbsp;$2<SPAN CLASS="balisehtml">&gt;</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)&lt;input (.*?)/&gt;(.*\[/HTML\])#', '$1<SPAN CLASS="balisehtml">&lt;input</SPAN>&nbsp;$2<SPAN CLASS="balisehtml">&gt;</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)&lt;form (.*?)&gt;(.*\[/HTML\])#', '$1<SPAN CLASS="balisehtml">&lt;form</SPAN>&nbsp;$2<SPAN CLASS="balisehtml">&gt;</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)&lt;td (.*?)&gt;(.*\[/HTML\])#', '$1<SPAN CLASS="balisehtml">&lt;td</SPAN>&nbsp;$2<SPAN CLASS="balisehtml">&gt;</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)&lt;p (.*?)&gt;(.*\[/HTML\])#', '$1<SPAN CLASS="balisehtml">&lt;p</SPAN>&nbsp;$2<SPAN CLASS="balisehtml">&gt;</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)&lt;ol (.*?)&gt;(.*\[/HTML\])#', '$1<SPAN CLASS="balisehtml">&lt;ol</SPAN>&nbsp;$2<SPAN CLASS="balisehtml">&gt;</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)&lt;a (.*?)&gt;(.*\[/HTML\])#', '$1<SPAN CLASS="balisehtml">&lt;a</SPAN>&nbsp;$2<SPAN CLASS="balisehtml">&gt;</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)&lt;acronym (.*?)&gt;(.*\[/HTML\])#', '$1<SPAN CLASS="balisehtml">&lt;acronym</SPAN>&nbsp;$2<SPAN CLASS="balisehtml">&gt;</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)&lt;html (.*?)&gt;(.*\[/HTML\])#', '$1<SPAN CLASS="balisehtml">&lt;html</SPAN>&nbsp;$2<SPAN CLASS="balisehtml">&gt;</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)&lt;body (.*?)&gt;(.*\[/HTML\])#', '$1<SPAN CLASS="balisehtml">&lt;body</SPAN>&nbsp;$2<SPAN CLASS="balisehtml">&gt;</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)&lt;link (.*?)&gt;(.*\[/HTML\])#', '$1<SPAN CLASS="balisehtml">&lt;link</SPAN>&nbsp;$2<SPAN CLASS="balisehtml">&gt;</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)&lt;meta (.*?)&gt;(.*\[/HTML\])#', '$1<SPAN CLASS="balisehtml">&lt;meta</SPAN>&nbsp;$2<SPAN CLASS="balisehtml">&gt;</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)&gt;(.*?)&lt;/a>(.*\[/HTML\])#', '$1<SPAN CLASS="balisehtmltexte">$2</SPAN><SPAN CLASS="balisehtml">&lt;/a&gt;</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)&gt;(.*?)&lt;/acronym>(.*\[/HTML\])#', '$1<SPAN CLASS="balisehtmltexte">$2</SPAN><SPAN CLASS="balisehtml">&lt;/acronym&gt;</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)(.*?)&lt;/form&gt;(.*\[/HTML\])#', '$1<SPAN CLASS="balisehtmltexte">$2</SPAN><SPAN CLASS="balisehtml">&lt;/form&gt;</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)(.*?)&lt;/textarea&gt;(.*\[/HTML\])#', '$1<SPAN CLASS="balisehtmltexte">$2</SPAN><SPAN CLASS="balisehtml">&lt;/textarea&gt;</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)(.*?)&lt;/select&gt;(.*\[/HTML\])#', '$1<SPAN CLASS="balisehtmltexte">$2</SPAN><SPAN CLASS="balisehtml">&lt;/select&gt;</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)(.*?)&lt;/option&gt;(.*\[/HTML\])#', '$1<SPAN CLASS="balisehtmltexte">$2</SPAN><SPAN CLASS="balisehtml">&lt;/option&gt;</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)(.*?)&lt;/optgroup&gt;(.*\[/HTML\])#', '$1<SPAN CLASS="balisehtmltexte">$2</SPAN><SPAN CLASS="balisehtml">&lt;/optgroup&gt;</SPAN>$3', $texte);
 
   
 
  $texte = preg_replace('#(\[HTML\].*)class=&quot;(.*?)&quot;(.*\[/HTML\])#', '$1 <SPAN CLASS="balisehtmltype">class</SPAN>=<SPAN CLASS="balisehtmlname">&quot;$2&quot;</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)accesskey=&quot;(.*?)&quot;(.*\[/HTML\])#', '$1 <SPAN CLASS="balisehtmltype">accesskey</SPAN>=<SPAN CLASS="balisehtmlname">&quot;$2&quot;</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)tabindex=&quot;(.*?)&quot;(.*\[/HTML\])#', '$1 <SPAN CLASS="balisehtmltype">tabindex</SPAN>=<SPAN CLASS="balisehtmlname">&quot;$2&quot;</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)selected=&quot;(.*?)&quot;(.*\[/HTML\])#', '$1 <SPAN CLASS="balisehtmltype">selected</SPAN>=<SPAN CLASS="balisehtmlname">&quot;$2&quot;</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)rows=&quot;(.*?)&quot;(.*\[/HTML\])#', '$1 <SPAN CLASS="balisehtmltype">rows</SPAN>=<SPAN CLASS="balisehtmlname">&quot;$2&quot;</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)cols=&quot;(.*?)&quot;(.*\[/HTML\])#', '$1 <SPAN CLASS="balisehtmltype">cols</SPAN>=<SPAN CLASS="balisehtmlname">&quot;$2&quot;</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)for=&quot;(.*?)&quot;(.*\[/HTML\])#', '$1 <SPAN CLASS="balisehtmltype">for</SPAN>=<SPAN CLASS="balisehtmlname">&quot;$2&quot;</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)size=&quot;(.*?)&quot;(.*\[/HTML\])#', '$1 <SPAN CLASS="balisehtmltype">size</SPAN>=<SPAN CLASS="balisehtmlname">&quot;$2&quot;</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)maxlength=&quot;(.*?)&quot;(.*\[/HTML\])#', '$1 <SPAN CLASS="balisehtmltype">maxlength</SPAN>=<SPAN CLASS="balisehtmlname">&quot;$2&quot;</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)value=&quot;(.*?)&quot;(.*\[/HTML\])#', '$1 <SPAN CLASS="balisehtmltype">value</SPAN>=<SPAN CLASS="balisehtmlname">&quot;$2&quot;</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)name=&quot;(.*?)&quot;(.*\[/HTML\])#', '$1 <SPAN CLASS="balisehtmltype">name</SPAN>=<SPAN CLASS="balisehtmlname">&quot;$2&quot;</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)method=&quot;(.*?)&quot;(.*\[/HTML\])#', '$1 <SPAN CLASS="balisehtmltype">method</SPAN>=<SPAN CLASS="balisehtmlname">&quot;$2&quot;</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)action=&quot;(.*?)&quot;(.*\[/HTML\])#', '$1 <SPAN CLASS="balisehtmltype">action</SPAN>=<SPAN CLASS="balisehtmlname">&quot;$2&quot;</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)colspan=&quot;(.*?)&quot;(.*\[/HTML\])#', '$1 <SPAN CLASS="balisehtmltype">colspan</SPAN>=<SPAN CLASS="balisehtmlname">&quot;$2&quot;</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)rowspan=&quot;(.*?)&quot;(.*\[/HTML\])#', '$1 <SPAN CLASS="balisehtmltype">rowspan</SPAN>=<SPAN CLASS="balisehtmlname">&quot;$2&quot;</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)id=&quot;(.*?)&quot;(.*\[/HTML\])#', '$1 <SPAN CLASS="balisehtmltype">id</SPAN>=<SPAN CLASS="balisehtmlname">&quot;$2&quot;</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)http-equiv=&quot;(.*?)&quot;(.*\[/HTML\])#', '$1 <SPAN CLASS="balisehtmltype">http-equiv</SPAN>=<SPAN CLASS="balisehtmlname">&quot;$2&quot;</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)xmlns=&quot;(.*?)&quot;(.*\[/HTML\])#', '$1 <SPAN CLASS="balisehtmltype">xmlns</SPAN>=<SPAN CLASS="balisehtmlname">&quot;$2&quot;</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)content=&quot;(.*?)&quot;(.*\[/HTML\])#', '$1 <SPAN CLASS="balisehtmltype">content</SPAN>=<SPAN CLASS="balisehtmlname">&quot;$2&quot;</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)rel=&quot;(.*?)&quot;(.*\[/HTML\])#', '$1 <SPAN CLASS="balisehtmltype">rel</SPAN>=<SPAN CLASS="balisehtmlname">&quot;$2&quot;</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)media=&quot;(.*?)&quot;(.*\[/HTML\])#', '$1 <SPAN CLASS="balisehtmltype">media</SPAN>=<SPAN CLASS="balisehtmlname">&quot;$2&quot;</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)type=&quot;(.*?)&quot;(.*\[/HTML\])#', '$1 <SPAN CLASS="balisehtmltype">type</SPAN>=<SPAN CLASS="balisehtmlname">&quot;$2&quot;</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)href=&quot;(.*?)&quot;(.*\[/HTML\])#', '$1 <SPAN CLASS="balisehtmltype">href</SPAN>=<SPAN CLASS="balisehtmlname">&quot;$2&quot;</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)title=&quot;(.*?)&quot;(.*\[/HTML\])#', '$1 <SPAN CLASS="balisehtmltype">title</SPAN>=<SPAN CLASS="balisehtmlname">&quot;$2&quot;</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)alt=&quot;(.*?)&quot;(.*\[/HTML\])#', '$1 <SPAN CLASS="balisehtmltype">alt</SPAN>=<SPAN CLASS="balisehtmlname">&quot;$2&quot;</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)src=&quot;(.*?)&quot;(.*\[/HTML\])#', '$1 <SPAN CLASS="balisehtmltype">src</SPAN>=<SPAN CLASS="balisehtmlname">&quot;$2&quot;</SPAN>$3', $texte);
  $texte = preg_replace('#(\[HTML\].*)target=(.*?)&nbsp(.*\[/HTML\])#', '$1 <SPAN CLASS="balisehtmltype">target</SPAN>=<SPAN CLASS="balisehtmlnameautre">$2</SPAN>$3', $texte);
   
  $texte = preg_replace('#(\[HTML\].*)&lt;!--(.*?)--&gt;(.*\[/HTML\])#', '$1 <span class="balisehtmlcom">&lt;!-- $2 --&gt;</span>$3', $texte);
 
  // je supprime les balises HTML
  $texte = preg_replace('#\[HTML\](.*)\[/HTML\]#','$1', $texte);
   
  fputs($monfichier1, $texte);
 
  fclose($monfichier1);
   
  $txt = $_POST['txt'];
   
  $monfichier2 = fopen("c://wamp//www//TEST//creertuto//test1.2.php", "w+" );
 
  fputs($monfichier2, $txt);
 
  fclose($monfichier2);
   
  header('Location: ./TEST/creertuto/');
 }
?>
</code>
 
et quand je rentre le texte suivant sa marche :
<code type="html">
<form method="post" action="traitement.php">
 
   <fieldset>
       <legend>Vos coordonnées</legend> <!-- Titre du fieldset -->
 
       <label for="nom">Quel est votre nom ?</label><br />
       <input type="text" name="nom" id="nom" tabindex="10" /><br />
 
       <label for="prenom">Quel est votre prénom ?</label><br />
       <input type="text" name="prenom" id="prenom" tabindex="20" /><br />
 
       <label for="email">Quel est votre e-mail ?</label><br />
       <input type="text" name="email" id="email" tabindex="30" /><br />
   </fieldset>
 
   <fieldset>
       <legend>Votre souhait</legend> <!-- Titre du fieldset -->
 
       <p>
           Faites un souhait que vous voudriez voir exaucé :<br />
       </p>
 
       <p>
           <label for="precisions">Si "Autre", veuillez préciser :</label><br />
           <textarea name="precisions" id="precisions" cols="40" rows="4" tabindex="80"></textarea>
       </p>
   </fieldset>
</form>
</code>
Et quand je rentre ce texte la ca ne marche pas :
<code type="html">
<form method="post" action="traitement.php">
 
   <fieldset>
       <legend>Vos coordonnées</legend> <!-- Titre du fieldset -->
 
       <label for="nom">Quel est votre nom ?</label><br />
       <input type="text" name="nom" id="nom" tabindex="10" /><br />
 
       <label for="prenom">Quel est votre prénom ?</label><br />
       <input type="text" name="prenom" id="prenom" tabindex="20" /><br />
 
       <label for="email">Quel est votre e-mail ?</label><br />
       <input type="text" name="email" id="email" tabindex="30" /><br />
   </fieldset>
 
   <fieldset>
       <legend>Votre souhait</legend> <!-- Titre du fieldset -->
 
       <p>
           Faites un souhait que vous voudriez voir exaucé :<br />
           <input type="radio" name="souhait" value="riche" id="riche" tabindex="40" /> <label for="riche">Etre riche</label><br />
           <input type="radio" name="souhait" value="celebre" id="celebre" tabindex="50" /> <label for="celebre">Etre célèbre</label><br />
           <input type="radio" name="souhait" value="intelligent" id="intelligent" tabindex="60" /> <label for="intelligent">Etre <strong>encore</strong> plus intelligent</label><br />
           <input type="radio" name="souhait" value="autre" id="autre" tabindex="70" /> <label for="autre">Autre...</label><br />
       </p>
 
       <p>
           <label for="precisions">Si "Autre", veuillez préciser :</label><br />
           <textarea name="precisions" id="precisions" cols="40" rows="4" tabindex="80"></textarea>
       </p>
   </fieldset>
</form>
</code>
 
POURQUOIIIIIIIIIIIIIIIII ???????????


---------------
sourcil power is back !!!
Reply

Marsh Posté le 02-03-2011 à 18:27:23   

Reply

Marsh Posté le 03-03-2011 à 11:17:23    

parce qu'on comprends pas ce que tu cherches a faire.


---------------
[VDS] rail vesa, bras ecran, support TV / [ACH] des machins
Reply

Sujets relatifs:

Leave a Replay

Make sure you enter the(*)required information where indicate.HTML code is not allowed