Titre: [résolue] aide installateur php
Posté par: andykimpe1 le le 11-07-2012 a 15:12:49
bonjour a tous depuis un moi j'ai développer un module pour communauté de zpanel (http://www.zpanelcp.com) le module porte de le nom de webmail advanced
cependant je bloque sur des variante dans le programme d’installation
je dois modifier un fichier a l'aide d'un formulaire
voici une partie du code que j'ai réaliser c'est cette partie qui me bloque
squirrelmail.php (page du formulaire)
Code:
ici j'ai enlever le code php car ce code fonctionne bien <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Instalation module webmail</title> ici j'ai retirer une icone <style type="text/css"> ici j'ai retirer le css pour raccourcir la page </style> </head> <body> ici aussi j'ai retirer quelque ligne de style <div class="content"> <center> <h1>Squirrelmail a étais installer avec succées </h1> <br /><br /> </p> <FORM METHOD=POST ACTION="Hastymail.php"> votre domaine zpanel <input type="text" name="zpanel-domain" > <input type="submit" > </div> <div class="poweredbox"> ici j'ai retirer le Powered qui ne nous intéresse pas </div> </body> </html> |
|
Hastymail.php (page de réception du formulaire)
Code:
<?php $file1 = 'Hastymail/hastymail2.conf'; $newfile1 = 'C:/zpanel/panel/modules/webmail/apps/Hastymail/hastymail2.conf'; if (!copy($file1, $newfile1)) { echo "La copie $file1 du fichier a échoué...\n"; } $file2 = 'Hastymail/index.php'; $newfile2 = 'C:/zpanel/panel/modules/webmail/apps/Hastymail/index.php'; if (!copy($file2, $newfile2)) { echo "La copie $file2 du fichier a échoué...\n"; } // 1: it opens the file $myfile = fopen ('C:/zpanel/panel/modules/webmail/apps/Hastymail/hastymail2.conf', 'r +'); // 2: reads the first line of file $ line = fgets ($myfile); fseek ($myfile, 0); fputs ($myfile, 'host_name = $ _POST [\'zpanel-domain\']'); // 2: we will here our operations on the file ...
// 3: when you have finished using it, it closes the file fclose ($myfile); ?> ici le html ne nous et d'aucune utilité puisse le problème vient du php
|
|
le problème au lieu d'écrie host_name =le résultat du formulaire sa écrie host_name =$ _POST ['zpanel-domain']
quelqu'un aurais une solution svp sa fait un moi que je bloque sur ce code
ps : mon serveur tourne sur window server web edition 2008 R2 SP1 avec apache 2.4 , php 5,cron,named, mysql 5 et hmailserver (pour le serveur de mail) |
Titre: Re:aide installateur php
Posté par: andykimpe1 le le 11-07-2012 a 15:51:55
résolue j'ai trouver la correction
Hastymail.php (page de réception du formulaire)
Code:
<?php if(isset($_POST['zpanel-domain'])){ $zpaneldomaine = $_POST['zpanel-domain']; // 1: it opens the file $myfile = fopen(realpath('C:/zpanel/panel/modules/webmail/apps/Hastymail/hastymail2.conf'), 'r+'); //'r+' Open for reading and writing; place the file pointer at the beginning of the file. // 2: reads the first line of file // Where is this used? Don't see it being used at all throughout the entire method //$line = fgets($myfile); //You already placed the pointer at the begining of the file this is redundant. //fseek($myfile, 0); //Modified slightly to add a newline at the end of a line you should always do this otherwise the inserted text ends up on all one line fputs($myfile, 'host_name = '.$zpaneldomaine.PHP_EOL); // 2: we will here our operations on the file ... // 3: when you have finished using it, it closes the file fclose($myfile); } ?> |
|
|
Forum-webmaster | Actionné par YaBB SE
© 2001-2003, YaBB SE Dev Team. Tous droits réservés.
|