Site PHP+MySQL Evénementiel

crabs_web_event-2.0 ©2005-2006 - Christophe CAZAJUS (crabs-mettre_le_signe_at-crabs-world.com)

~~ / LIB / class_mysql.php
Makefile util.php class_mysql.php entities.php
    1 <?php
    2 //
    3 // =============================================================================
    4 //  crabs_web_event-2.0 : Site PHP+MySQL Evénementiel
    5 //  Copyright (C) 2005-2006 : Christophe CAZAJUS (crabs-mettre_le_signe_at-crabs-world.com)
    6 //
    7 //  Ce source fait partie d'un projet logiciel libre. Vous pouvez le distribuer
    8 //  et/ou le modifier en respectant les termes de la GNU General Public License
    9 //  version 2 ou (suite a votre propre choix) une version ulterieure.
   10 //
   11 //  Ce programme est distribue dans l'espoir qu'il puisse etre utile, mais
   12 //  sans aucune garantie, meme si il est associe a un produit qui vous en
   13 //  propose une. Conformez-vous a la GNU General Public License pour avoir
   14 //  plus de precisions.
   15 //
   16 //  L'auteur ne peut etre tenu responsable de l'utilisation faite des
   17 //  composantes associees a ce projet (en partie ou dans leur totalite).
   18 //
   19 //  Une copie du fichier de la GNU GPL est fournie dans le repertoire DOC
   20 //  de ce projet sous le nom gnu_gpl.txt
   21 //
   22 // =============================================================================
   23 //
   24 class MYSQL
   25     {
   26     var         $_c     ;
   27     var         $_root  ;
   28 
   29     function MYSQL( $do_connect=false )
   30         {
   31         $this->_c = false ;
   32         if ( $do_connect ) $this->connect() ;
   33         }
   34     function connect()
   35         {
   36         $c = mysql_connect(DB_HOST,DB_USER,DB_PASSWD)
   37             or $this->err("mysql_connect");
   38         mysql_select_db( DB_BASE, $c ) or $this->err("mysql_select_db") ;
   39         $this->_c = $c ;
   40         }
   41     function close()
   42         {
   43         if ( !$this->_c ) return ;
   44         mysql_close($this->_c);
   45         $this->_c=false;
   46         }
   47     function id() { return mysql_insert_id( $this->_c ) ; }
   48     function query($sql)
   49         {
   50         if ( !$this->_c ) $this->connect() ;
   51         $r = mysql_query( $sql, $this->_c ) or $this->err($sql) ;
   52         return $r ;
   53         }
   54     function err( $call )
   55         {
   56         $URL_SITE = LOGOUT_URL ;
   57         if ( $this->_c )    $err = mysql_error( $this->_c ) ;
   58                     else    $err = mysql_error() ;
   59         echo <<<HTML
   60 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"
   61     "http://www.w3.org/TR/html4/strict.dtd">
   62 <html>
   63 <head>
   64     <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
   65     <meta http-equiv="CONTENT-LANGUAGE" content="fr">
   66     <meta name="LANGUAGE" content="fr">
   67     <title>Erreur Mysql</title>
   68 </head>
   69 <body>
   70     <h1>URI</h1>
   71     <pre>$_SERVER[REQUEST_URI]</pre>
   72     <h1>CONTEXTE</h1>
   73     <pre>$call</pre>
   74     <h1>RAISON</h1>
   75     <p>$err</p>
   76     <p><br><a href="$URL_SITE">Revenir au site</a></p>
   77 </body>
   78 </html>
   79 
   80 HTML;
   81         exit() ;
   82         }
   83     }
   84 ?>
Makefile util.php class_mysql.php entities.php
~~ / LIB / class_mysql.php

Haut de page

Contacter crabs

Date de génération : 22/09/2011 21:48