Wall posté le Mercredi 16 septembre 2009


Piratage...


  1. <?  
  2. include('header.php');  
  3. include('menu.php');  
  4.  
  5. if(isset($_POST['sub'])) { 
  6.    if(isset($_POST['nom']) && (!empty($_POST['nom'])) && (isset($_POST['commentaire'])) && (!empty($_POST['commentaire']))) { 
  7.    include('config.php'); 
  8.    
  9.    $ip = $_SERVER['REMOTE_ADDR']; 
  10.    $date = date('Y-m-d H:i:s'); 
  11.    
  12. $sql = "SELECT COUNT(*) FROM blackliste WHERE ip='$ip'";  
  13. $resultat = mysql_query($sql) or die('Erreur SQL !<br />'.$sql.'<br />'.mysql_error()); 
  14.    $nb_total = mysql_fetch_array($resultat); 
  15.  
  16.  
  17.    if ($nb_total[0] != 0) { 
  18.       $sql = "UPDATE blackliste SET nbblock = nbblock+1, date='$date' WHERE ip='$ip'"; 
  19.       mysql_query ($sql); 
  20.  
  21.       echo "<font color='#FF0000'>Votre adresse IP est blacklistée!<br />Contactez l'administrateur</font>"; 
  22.       include('footer.php'); 
  23.       exit();      
  24.    } 
  25.  
  26.    $nom = $_POST['nom']; 
  27.    $calcul = $_POST['calcul']; 
  28.    $captcha = $_POST['captcha']; 
  29.    $commentaire = $_POST['commentaire']; 
  30.    $date = date("Y-m-d"); 
  31.    $ip = $_SERVER['REMOTE_ADDR']; 
  32.  
  33.    if($calcul!=$captcha) { 
  34.       echo "<font color='#FF0000'>Code a recopier incorrect !</font>"; 
  35.    } else { 
  36.    
  37.    $sql="INSERT INTO livre VALUE('', '".mysql_escape_string($commentaire)."', '".mysql_escape_string($nom)."', '$date', '0', '$ip')"; 
  38.    mysql_query($sql); 
  39.    mysql_close(); 
  40.    
  41.    echo '<table border="0" cellspacing="0" cellpadding="0" width="406">
  42. <tr>
  43. <td width="406" class="bodyText">Merci ton commentaire à été ajouté<br />'; 
  44.    echo '<a href="livre.php">Retour au livre d\'or</a></td>
  45.    </tr></table>'; 
  46.    include('footer.php'); 
  47.    exit(); 
  48.  
  49.    } 
  50.    
  51.    } else { 
  52.    echo "<font color='#FF0000'>Merci de remplir les 2 champs !</font>"; 
  53.    } 
  54.    
  55. }  
  56.  
  57. ?>
  58.  
  59.  
  60. <table border="0" cellspacing="0" cellpadding="0" width="406">
  61. <tr>
  62. <td width="406" class="bodyTitre">Signez notre livre d'or </td>
  63.       </tr>
  64.       <tr>
  65. <td class="bodyText" valign="top"><br />
  66.       
  67.       
  68. <form id="form1" name="form1" method="post" action="">
  69. <table width="90%" border="0">
  70. <tr>
  71. <td width="190">Nom </td>
  72. <td width="150">
  73. <input name="nom" type="text" id="nom" maxlength="20" />
  74. </td>
  75. </tr>
  76. <tr>
  77. <td width="190" valign="center">Recopiez ce code :
  78. </td>
  79. <td width="150" valign="top">
  80. <input name="calcul" type="text" id="calcul" maxlength="10" size="10" />
  81.  
  82. <?  
  83. for($i=0; $i<5; $i++) {  
  84. $texte .= chr(rand(0, 25) + ord('a'));  
  85. }  
  86. echo '<img src="captcha.php?texte='.$texte.'" border=1>';  
  87. echo '<input name="captcha" type="hidden" value="'.$texte.'" />';  
  88. ?>
  89.  
  90. </td>
  91. </tr>
  92. <tr>
  93. <td>Commentaire</td>
  94. <td align="left"><textarea name="commentaire" rows="7"></textarea></td>
  95. </tr>
  96. <tr>
  97. <td colspan="2">
  98. <input name="sub" type="submit" value="Envoyer" />
  99. </td>
  100. </tr>
  101. </table>
  102. </form>
  103.        </td>
  104. </tr>
  105. </table>
  106. <?  
  107. include('footer.php');  
  108. ?> 

Remonter Remonter
L'éditeur javascript - CSS - Gentoo - Tutoriaux PHP - Tutoriels PHP - Bretagne - php - Moto - Kit graphique