Bonsoir à tous,

J'ai un souci avec ce bout de code.
Pas moyen d'enregistrer ce cookie !
Pouvez-vous m'aider ?
Qu'est-ce qui ne va pas ?
merci d'avance pour votre précieuse aide !!!

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
 
<?php
        $dateYYYYMMJJ="20131115";
	$newInscription="NO";
	if ($_COOKIE['inscription'] != "STOP") {
		if ($_COOKIE['inscription'] == "") {
			$newInscription="YES";
        	$dureecookie = time() + mktime(23, 59, 59) - time() + 10*365*24*3600;
        	setcookie("inscription", $dateYYYYMMJJ.$dateYYYYMMJJ, $dureecookie, "/", ".celinni.com", false, true);
    	} else {
        	$dateInscriptionPREM = substr($_COOKIE['inscription'],0,8);
            $dateInscriptionDERN = substr($_COOKIE['inscription'],8,8);
            if ($dateYYYYMMJJ > $dateInscriptionDERN) {
            	$dateInscriptionDERN = $dateYYYYMMJJ;
                $diffInscription = (strtotime($dateInscriptionDERN) - strtotime($dateInscriptionPREM))/86400;  
                if ($diffInscription > 7) {
                    $dureecookie = time() + mktime(23, 59, 59) - time() + 365*24*3600;
                    setcookie("inscription", "STOP", $dureecookie, "/", ".celinni.com", false, true);
                } else {
                	$newInscription="YES";
                    $dureecookie = time() + mktime(23, 59, 59) - time() + 365*24*3600;
                    setcookie("inscription", $dateInscriptionPREM.$dateInscriptionDERN, $dureecookie, "/", ".celinni.com", false, true);
                }
            }
        }
    }
?>