Powered by Ajaxy
Digg StumbleUpon LinkedIn YouTube Flickr Facebook Twitter RSS Reset

Traitement d’une structure stockée


{filelink=12768}

<?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);
?>

No comments yet.

Leave a Comment