Statistiques| Inscription| Espace privé
Développement Web
Accueil > AJAX > Un chat > Les fichiers PHP
Le plan Les galeries
Dernière mise à jour :
vendredi 15 mai 2009
Contact
Webmestre
olivier ramos
ParamSPIP
Agenda
<<   Avril 2024   >>
Lu Ma Me Je Ve Sa Di
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 1 2 3 4 5



install.php
 
 
 
 
<?php
session_start();

// On récupère les valeurs des champs du formulaire que l'on a envoyées par POST.
if ((isset($_POST['adbase']))and($_POST['adbase']!="")){
$champ1=true;
}
else $champ1=false;

if ((isset($_POST['log']))and($_POST['log']!="")){
$champ2=true;
}
else $champ2=false;

if ((isset($_POST['base']))and($_POST['base']!="")){
$champ3=true;
}
else $champ3=false;


$result= (($champ1) and ($champ2) and ($champ3));

if ($result==true) {

// Si on a obtenu le nécessaire, on crée le fichier de configuration "aristodefcondb.inc".
$monfichier=fopen('config/aristodefcondb.inc','w+');
fseek($monfichier,0);
$nouvfichier="<?php"."\n";
$nouvfichier.="define('ADBASE','".$_POST['adbase']."');"."\n";
$nouvfichier.="define('LOG','".$_POST['log']."');"."\n";
$nouvfichier.="define('BASE','".$_POST['base']."');"."\n";
$nouvfichier.="define('MDP','".$_POST['mdp']."');"."\n";
$nouvfichier.="define('NOMCHAT',\"".stripslashes($_POST['nomchat'])."\");"."\n";
$nouvfichier.="define('MDPCHAT','".$_POST['mdpchat']."');"."\n";
$nouvfichier.="?>";
fputs($monfichier,$nouvfichier);
fclose($monfichier);

// ensuite on crée la table
include "creertable.php";
// et enfin on lance le chat.
include "chat.php";
}
// Sinon on propose le formulaire d'installation.
else {
?>
<!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" lang="fr">

<head>
        <title>Installation</title>
        <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
        <link rel="stylesheet" href="aristojchatx.css" type="text/css" />
</head>

<body >
     
        <form id="formins" action="" method="post" >
       
        <div class="encadre">BASE DE DONNEES </div>

        <table class="tableauinstall" border="0" cellpadding="0" cellspacing="0" >
        <tr>
     <td  class="entgaucheins">L'adresse de la base de donn&eacute;es</td>
     <td class="entdroiteins" ><input type="text" name="adbase" /></td>
   </tr>
   <tr>
     <td  class="entgaucheins">Le login de connexion</td>
     <td class="entdroiteins" ><input type="text" name="log"   /></td>

   </tr>
        <tr>
     <td  class="entgaucheins">Le mot de passe de connexion</td>
     <td class="entdroiteins" ><input type="text" name="mdp"   /></td>
   </tr>
   <tr>
     <td  class="entgaucheins">Le nom de la base</td>
     <td class="entdroiteins" ><input type="text" name="base"  /></td>
    </tr>
        </table>


        <div class="encadre">LE CHAT </div>
                <table class="tableauinstall" border="0" cellpadding="0" cellspacing="0" >
                <tr>
     <td  class="entgaucheins">Le nom</td>
     <td class="entdroiteins" ><input type="text" name="nomchat"  /></td>

   </tr>
   <tr>
     <td  class="entgaucheins">Le mot de passe</td>
     <td class="entdroiteins" ><input type="text" name="mdpchat"  /></td>
   </tr>
  </table>
          <input type="submit" id="envoi1" value="Valider" />

               
        </form>
</body>

</html>

<?php
}
?>