<?PHP
// ------------------------------------------------------------------------- //
// <G a n e s h a> - Free Web Based Training System                          //
// ------------------------------------------------------------------------- //
// <G a n e s h a> - Plate-forme de téléformation gratuite et en open source //
// ------------------------------------------------------------------------- //
// Copyright (C) 2001-2003  Anéma Formation  <http://www.anema.fr/>          //
// ------------------------------------------------------------------------- //
//            Developer : Georges CALDEIRA <gcaldeira@anemalab.org>          //
// ------------------------------------------------------------------------- //
//               Infos on project <http://anemalab.org/>                     //
// ------------------------------------------------------------------------- //
//  This program is free software; you can redistribute it and/or modify     //
//  it under the terms of the GNU General Public License as published by     //
//  the Free Software Foundation; either version 2 of the License, or        //
//  (at your option) any later version.                                      //
//                                                                           //
//  This program is distributed in the hope that it will be useful,          //
//  but WITHOUT ANY WARRANTY; without even the implied warranty of           //
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            //
//  GNU General Public License for more details.                             //
//                                                                           //
//  You should have received a copy of the GNU General Public License        //
//  along with this program; if not, write to the Free Software              //
//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA //
// ------------------------------------------------------------------------- //

/**
* Page fiche d'un membre
*
* @author	Georges Caldeira <gcaldeira@anemalab.org>
* @package	GaneshaCommun
*/
	/**
	* include des fichiers + verification de la cnx
	*/
	include_once("anema.inc.php");

	$texte = $st_titre["modifiche"] ;
	if ( isset($modification) && $modification==1 ) {
		$nom	= htmlentities($HTTP_POST_VARS['nom']);
		$prenom = htmlentities($HTTP_POST_VARS['prenom']);
		$login	= htmlentities($HTTP_POST_VARS['login']);
		$pwd	= htmlentities($HTTP_POST_VARS['pwd']);
		$adresse= htmlentities($HTTP_POST_VARS['adresse']);
		$ville	= htmlentities($HTTP_POST_VARS['ville']);
		$cp		= htmlentities($HTTP_POST_VARS['cp']);

		if ( $ClsMembre->VerifPwdLogin ($pwd,$login,$guserid) ) {
			if ( ! $ClsMembre->emailExist($guserid,$email) ) {
				if ( strlen(trim($email)) != 0 && !isEmail($email) ) {
					$texte = $st_texte['erroremail'];
				} else {
					$ClsMembre->ModifierFiche ($guserid,$nom,$prenom,$email,$login,$pwd,$adresse,$cp,$ville );
					$texte = $st_texte['fichemodif'];
				}
			}else {
				$texte = $st_texte['erroremail'];
			}
		} else {
			$texte = $st_texte['errorlogin'];
		}
	}

	$ret = $ClsMembre->GetFiche($guserid);
	$nom			= $ret['nom']			;
	$prenom			= $ret['prenom']		;
	$login			= $ret['login']			;
	//$pwd			= $ret['pwd']			;
	$date_creation	= $ret['date_creation']	;
	$email			= $ret['email']			;
	$adresse		= $ret['adresse']		;
	$cp				= $ret['cp']			;
	$ville			= $ret['ville']			;

	InitPageHtml( $st_titre['modifiche'],false );

	$url = HTTP_COMMUN.'p_fiche'.$ext.'?connexion='.$gconnexionid ;

?>
<table width="480" border="0" cellspacing="0" cellpadding="0" >
  <tr bgcolor="<?PHP echo $color2?>"><td align="middle"><p class="g_titre"><?PHP echo $texte ?></p></td></tr>
</table>
<table width="480" border="0" cellspacing="0" cellpadding="0">
  <tr> 
    <td width="50" valign="top" bgcolor="<?PHP echo $color1?>">&nbsp;</td>
    <td width="430" valign="top"> 
      <form name="form1" method="post" action="<?PHP echo $url?>">
        <input type="hidden" name="modification" value="1" >
        <table border="0" cellspacing="0" cellpadding="4">
          <tr> 
            <td width="150" align="right">&nbsp;</td>
            <td width="300">&nbsp;</td>
          </tr>
          <tr> 
            <td width="150" align="right"><?PHP echo $st_form['datecreat']?></td>
            <td width="300"> 
              <input class="bouton" type="text" DISABLED name="numero" size="30" value="<?PHP echo $date_creation ?>">
            </td>
          </tr>
          <tr> 
            <td width="150" align="right"><b><?PHP echo $st_form['nom']?> *</b></td>
            <td width="300"> 
              <input class="bouton" type="text" name="nom" size="30"  value="<?PHP echo $nom ?>">
            </td>
          </tr>
          <tr> 
            <td width="150" align="right"><b><?PHP echo $st_form['prenom']?> *</b></td>
            <td width="300"> 
              <input class="bouton" type="text" name="prenom" size="30" value="<?PHP echo $prenom ?>">
            </td>
          </tr>
          <tr> 
            <td width="150" align="right"><b><?PHP echo $st_form['email']?>&nbsp;&nbsp;&nbsp;</b></td>
            <td width="300"> 
              <input class="bouton" type="text" name="email" size="30" value="<?PHP echo $email ?>">
            </td>
          </tr>
          <tr> 
            <td width="150" align="right"><b><?PHP echo $st_form['adresse']?> *</b></td>
            <td width="300"> 
              <input class="bouton" type="text" name="adresse" size="30" value="<?PHP echo $adresse ?>">
            </td>
          </tr>
          <tr> 
            <td width="150" align="right"><b><?PHP echo $st_form['cp']?> *</b></td>
            <td width="300"> 
              <input class="bouton" type="text" name="cp" size="5" value="<?PHP echo $cp ?>">
            </td>
          </tr>
          <tr> 
            <td width="150" align="right"><b><?PHP echo $st_form['ville']?> *</b></td>
            <td width="300"> 
              <input class="bouton" type="text" name="ville" size="30" value="<?PHP echo $ville ?>">
            </td>
          </tr>
          <tr> 
            <td width="150" align="right"><b><?PHP echo $st_form['login']?> *</b></td>
            <td width="300"> 
              <input class="bouton" type="text" name="login" size="30" value="<?PHP echo $login ?>">
            </td>
          </tr>
          <tr> 
            <td width="150" align="right"><b><?PHP echo $st_form['mdp']?> *</b></td>
            <td width="300"> 
              <input class="bouton" type="password" name="pwd" size="30" value="">
            </td>
          </tr>
          <tr> 
            <td width="150" align="right"><b><?PHP echo $st_form['cmdp']?> *</b></td>
            <td width="300"> 
              <input class="bouton" type="password" name="pwd2" size="30" value="">
            </td>
          </tr>
          <tr> 
            <td width="150" align="right">&nbsp;</td>
            <td width="300" align="right"> 
              <div align="center"> 
                <input class="bouton" type="button" name="Submit" value="<?PHP echo $st_form['valider']?>" onClick="ValiderFormFiche(this.form);">
                <input class="bouton" type="reset" name="Submit2" value="<?PHP echo $st_menu['quit']?>" 
				onClick="self.close();">
              </div>
            </td>
          </tr>
         <tr> 
            <td width="150" align="right">&nbsp;</td>
            <td width="300" align="right"><b>(*)<i> <?PHP echo $st_texte['mobligatoire']?></b></i></td>
          </tr>
        </table>
      </form>
      </td>
  </tr>
</table>
<table width="480" border="0" cellspacing="0" cellpadding="0" >
  <tr bgcolor="<?PHP echo $color1?>"><td align="middle">&nbsp;</td></tr>
</table>
<?PHP
Footer()		;
ClosePageHtml()	;
?>