Tfe

Ongi etorri tfe-ren webgunera...

Old stuff/old_sites/ids/data/compte/modif.php

(Deskargatu)
<?

if (   empty($_POST['mail']) or
    empty($_POST['societe'])
    )
{



    $contenu = $con->assocQuery("SELECT * FROM membres,societe WHERE mbr_pseudo='$nick' and mbr_societe_id = societe_id") or print $con->error;
    $societes = $con->assocQuery("SELECT societe_nom FROM societe");
    $contenu = $contenu[0];
    
    echo "
    <form action=\"".$burl."compte/modif\" method=\"post\" >
    <dl>
        <dt>Pseudo : </dt>
	<dd>$nick</dd>
	<dt>mail : </dt>
	<dd><input type=\"text\" name=\"mail\" value=\"$contenu[mbr_mail]\" /></dd>
	<dt>Soci&eacute;t&eacute; : </dt>
	<dd>
	<select name=\"societe\">
	";
	
	    foreach($societes as $key)
	    {
		if ($key[societe_nom] == $contenu[societe_nom])
		{
		    echo "<option value=\"$key[societe_nom]\" selected=\"selected\">$key[societe_nom]</option>";
		}
		else {
		    echo "<option value=\"$key[societe_nom]\">$key[societe_nom]</option>";
		}
	    
	    }
	echo "</select>
	</dd>
	<dt>Validation</dt>
	<dd><input type=\"submit\" value=\"Accepter\" /></dd>
    </dl>    
    </form>
    ";
}
else
{
    $mail =   $_POST['mail'];
    $societe = $_POST['societe'];
    
    
    $contenu = $con->assocQuery("SELECT societe_id FROM societe WHERE societe_nom='$societe'") or print $con->error;
    $contenu = $contenu[0];
    if (empty($contenu)) 
    {
    
        echo "Error : societe inexistante !";
    }
    else 
    {
    $societe_id = $contenu[societe_id];
    $query = "UPDATE membres SET mbr_mail='$mail',mbr_societe_id='$societe_id'";
    $con->execute($query) or print $con->error;
    
    echo "<h6>Modification du compte effectu&eacute;e</h6>
    <p><a href=\"$burl\">Retour</a></p>";        

    }

}

?>