[ Index ]
 

Code source de Dolibarr 2.0.1

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/htdocs/public/dons/ -> index.php (source)

   1  <?php
   2  /* Copyright (C) 2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
   3   *
   4   * This program is free software; you can redistribute it and/or modify
   5   * it under the terms of the GNU General Public License as published by
   6   * the Free Software Foundation; either version 2 of the License, or
   7   * (at your option) any later version.
   8   *
   9   * This program is distributed in the hope that it will be useful,
  10   * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12   * GNU General Public License for more details.
  13   *
  14   * You should have received a copy of the GNU General Public License
  15   * along with this program; if not, write to the Free Software
  16   * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  17   *
  18   * $Id: index.php,v 1.19 2005/07/02 12:33:06 eldy Exp $
  19   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/public/dons/index.php,v $
  20   *
  21   */
  22  
  23  require ("../../don.class.php");
  24  require ("../../conf/conf.class.php");
  25  
  26  $conf = new Conf();
  27  $conf->db->type = $dolibarr_main_db_type;
  28  $conf->db->host = $dolibarr_main_db_host;
  29  $conf->db->name = $dolibarr_main_db_name;
  30  $conf->db->user = $dolibarr_main_db_user;
  31  $conf->db->pass = $dolibarr_main_db_pass;
  32  
  33  // Si type non défini (pour compatibilité avec ancienne install), on
  34  // travail avec mysql
  35  if (! $conf->db->type) { $conf->db->type = 'mysql'; }
  36  
  37  require("../../lib/.$dolibarr_main_db_type.lib.php");
  38  
  39  if ($conf->don->enabled)
  40  {
  41  
  42    $db = new DoliDb($conf->db->type,$conf->db->host,$conf->db->user,$conf->db->pass,$conf->db->name);
  43  
  44    $don = new Don($db);
  45        
  46    $don->projetid    = $_POST["projetid"];
  47    $don->date        = time();
  48    $don->prenom      = $_POST["prenom"];
  49    $don->nom         = $_POST["nom"];
  50    $don->societe     = $_POST["societe"];
  51    $don->adresse     = $_POST["adresse"];
  52    $don->cp          = $_POST["cp"];
  53    $don->ville       = $_POST["ville"];
  54    $don->pays        = $_POST["pays"];
  55    $don->public      = 1;
  56    if ($_POST["public"] == "FALSE")
  57      {
  58        $don->public      = 0;
  59      }
  60    $don->email       = $_POST["email"];
  61    $don->amount      = $_POST["montant"];
  62    $don->commentaire = $_POST["commentaire"];
  63    
  64  
  65    if ($_POST["action"] == 'add')
  66      {
  67        
  68        if ($don->check($conf->don->minimum))
  69      {
  70        require("valid.php");
  71      }
  72        else
  73      {
  74        require("erreur.php");
  75      }     
  76      }
  77    elseif ($_POST["action"] == 'valid' && $_POST["valid"] == 'Valider')
  78      {
  79        
  80        if ($don->check($conf->don->minimum))
  81      {
  82        $ref_commande = $don->create(0);
  83        
  84        if ($ref_commande)
  85          {
  86            $date_limite = strftime("%A %d %B %Y",time() + (3 * 7 * 24 * 3600));
  87  
  88            include  ("mail.php");
  89  
  90            include  ("mail_moderator.php");
  91  
  92            mail($don->email, $subject, $body, "From: contact@eucd.info");
  93  
  94            mail($conf->don->email_moderator, $subject_moderator, $body_moderator);
  95  
  96            require("merci.php");
  97          }
  98        else
  99          {
 100            print "Erreur : can't insert value in db";
 101          }
 102      }
 103        else
 104      {
 105        require("erreur.php");
 106      }
 107      }
 108    else
 109      {
 110        require("don.php");
 111      }
 112  }
 113  else
 114  {
 115    print "Cette fonctionnalité n'est pas activé sur ce site";
 116  }
 117  
 118  
 119  ?>


Généré le : Mon Nov 26 12:29:37 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics