Traitement d’une structure stockée

Author:


Download

<?php
$bdh = dba_open('etudiant.db','c','gdbm') or die($php_errormsg);

if ($exists = dba_exists($_POST['nom_utilisateur'], $bdh))
{
    $serialized_data = dba_fetch($_POST['nom_utilisateur'], $bdh) or die($php_errormsg);
    $data = unserialize($serialized_data);
} else {
    $data = array();
}

if ($_POST['username'])
{
    $data['ancien_mot_de_passe'] = $_POST['nouveau_mot_de_passe'];
}
$data['dernier_acces'] = time();

if ($exists)
{
    dba_replace($_POST['nom_utilisateur'],serialize($data), $bdh);
} else
{
    dba_insert($_POST['nom_utilisateur'],serialize($data), $bdh);
}

dba_close($bdh);
?>

Leave a Reply

Your email address will not be published. Required fields are marked *


− 2 = three