Exemple #1
0
include 'functions.php';
include 'connect.php';
/*
@ini_set('display_errors', 'on');
  $jsn = '{ 
    "codepin"               : "VXGU6B3",
    "email_proprio"         : "*****@*****.**"
     }' ;
  $param = $jsn;
*/
$param = file_get_contents("php://input");
$p = json_decode($param);
$v0 = $DB->quote($p->codepin);
$v1 = $DB->quote($p->email_proprio);
$sql = 'update em_animal set email_proprio = ' . $v1 . ' where codepin = ' . $v0;
$res = $DB->exec($sql);
$info = "";
$sql = 'select id_animal from em_animal where codepin = ' . $v0;
$res = $DB->query($sql);
if ($res) {
    $arr = $res->fetch(PDO::FETCH_ASSOC);
    if ($arr) {
        sendInscriptionMail($DB, $HTTP_ADR, $arr['id_animal'], $info);
    }
}
$ret = '{"ret": "ok"}';
echo $ret;
?>


Exemple #2
0
    echo $ret;
    return;
}
//myTrace($DB, 'avant insert')    ;
$sql = 'insert into em_animal (codepin,     nuserie, email_proprio, nom_proprio, prenom_proprio, password_proprio, tel_proprio, nom_animal ,    uid  , code_postal, espece, date_naissance, race ) 
                        values ( ' . $v0 . ',' . $v1 . ',' . $v2 . ',' . $v3 . ',' . $v4 . ',' . $v5 . ',' . $v6 . ',' . $v7 . ' , UUID() , ' . $v8 . ' ,' . $v9 . ',' . $v10 . ',' . $v11 . ' )';
$res = $DB->exec($sql);
if (!$res) {
    // Insert inpossible...
    $ret = '{"ret" : "Erreur"}';
    echo $ret;
    return;
}
$w_id = $DB->lastInsertId();
//myTrace($DB, 'id animal : '.$w_id)    ;
$b = isLoterie($DB, $v0);
if ($b) {
    //myTrace($DB, 'loterie')    ;
    // on change l'état et le n° d'image ET on envoie pas le mail de confirmation
    $sql = 'update em_animal set etat = 1, cpt_modif_img=1 where codepin = ' . $v0;
    $res = $DB->exec($sql);
} else {
    //myTrace($DB, 'envoi mail')    ;
    sendInscriptionMail($DB, $HTTP_ADR, $w_id, $info);
}
$ret = '{"ret": "ok" , "id_animal" : "' . $w_id . '"}';
echo $ret;
?>