Rajouter Une Ligne Sur Un Include Php

Répondre


Cette question est un moyen d’empêcher des soumissions automatisées de formulaires par des robots.
Smileys
:D :) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :!: :?: :idea: :arrow: :| :mrgreen: =D> #-o =P~ :^o :non: :priere: 8-|
Voir plus de smileys
  Revue du sujet
 

  Étendre la vue Revue du sujet : Rajouter Une Ligne Sur Un Include Php

par blof » 26 janv. 2009, 23:23

par thehawk » 26 janv. 2009, 22:39

j'aurais tendance a t'orienter vers :
addslashes() et vers stripslashes()

par Pride » 26 janv. 2009, 22:15

MERCCIIIIIII Mai...Encore une nouvelle probleme!
$stringData3 = "<li><a href="products.php" onmouseover="doTooltip(event,$Prodnum)" onmouseout="hideTip()">$Prodname</a></li>\n";
Voici La ligne que je veux créer!
Mais...Il contient des ..."... Comment je peut faire?? :S

par blof » 26 janv. 2009, 22:07

Bonsoir,
je voudrai simplement en rajouter une nouvelle ligne...
Tout est expliqué dans le manuel : fopen()
Dans la rubrique "Liste des modes possibles", tu vas trouver ce que tu cherches :)

Rajouter Une Ligne Sur Un Include Php

par Pride » 26 janv. 2009, 21:47

Voici Ce que je veux faire Et ce que j'ai
J'ai Crée une Form...Pour pouvoir rajouter des nouveaux Produits en html...
<form action="secret2.php"  enctype="multipart/form-data" method="post">
Product Name: <input type="text" name="Prodname"><br>
Product Number: <input type="text" name="Prodnum"><br>
Product Description: <input type="text" name="Desc"><br>
<p>
Picture: <input type="file" name="fichier" size="30">
</p>
<input type="submit" name="Create" value="Create" /></strong>
</form>
Et Voici Secret2.php
<?php

// Session start
session_start();

// Checks password and username
if($Prodname != null AND $desc != null) {
    echo "Fill in Everything bbefore submitting!";
} else {


if( isset($_POST['Create']) ) // si formulaire soumis
{
    $content_dir = 'Photos/'; // dossier où sera déplacé le fichier

    $tmp_file = $_FILES['fichier']['tmp_name'];

    if( !is_uploaded_file($tmp_file) )
    {
        exit("Le fichier est introuvable");
    }

    // on vérifie maintenant l'extension
    $type_file = $_FILES['fichier']['type'];

    if( !strstr($type_file, 'jpg') && !strstr($type_file, 'jpeg') && !strstr($type_file, 'bmp') && !strstr($type_file, 'gif') )
    {
        exit("Le fichier n'est pas une image");
    }

    // on copie le fichier dans le dossier de destination
    $name_file = $_FILES['fichier']['name'];

    if( !move_uploaded_file($tmp_file, $content_dir . $name_file) )
    {
        exit("Impossible de copier le fichier dans $content_dir");
    }

    echo "File Uploaded Properly!";
	$myFile1 = "config/linkmnu.php";
$fh1 = fopen($myFile1, 'w') or die("can't open file");
$stringData = "links[$Prodnum]='http://www.vintage-grace.com/products/$Prodname.html';\n";
fwrite($fh1, $stringData);
fclose($fh1);
$myFile2 = "config/admnu.php";
$fh2 = fopen($myFile2, 'w') or die("can't open file");
$stringData2 = " ad[$Prodnum]='/Photos/$name_file';\n";
fwrite($fh2, $stringData2);
fclose($fh2);
echo "Le fichier a bien été édité";
}
        exit;
		echo "file not upladed";

}


?> 
C'est surtout a la fin que je veux m'interresser!
$myFile1 = "config/linkmnu.php";
$fh1 = fopen($myFile1, 'w') or die("can't open file");
$stringData = "links[$Prodnum]='http://www.vintage-grace.com/products/$Prodname.html';\n";
fwrite($fh1, $stringData);
fclose($fh1);
$myFile2 = "config/admnu.php";
$fh2 = fopen($myFile2, 'w') or die("can't open file");
$stringData2 = " ad[$Prodnum]='/Photos/$name_file';\n";
fwrite($fh2, $stringData2);
fclose($fh2);
echo "Le fichier a bien été édité";
Quand je l'utilise, Le Fichier est completement remplacé par cette ligne, alors Que moi je voudrai simplement en rajouter une nouvelle ligne...
Est-ce possible?? Mercii!!

~Tom