b7191d98dab841292425368338f6cbaef2c951f2
2 /***************************************************************************
3 * Copyright (C) 2003-2006 Polytechnique.org *
4 * http://opensource.polytechnique.org/ *
6 * This program is free software; you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation; either version 2 of the License, or *
9 * (at your option) any later version. *
11 * This program is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. *
16 * You should have received a copy of the GNU General Public License *
17 * along with this program; if not, write to the Free Software *
19 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
20 ***************************************************************************/
22 require_once('xorg.inc.php');
23 new_skinned_page('marketing/public.tpl', AUTH_COOKIE
);
25 if (! Env
::has('num')) { exit; }
27 $uid = Env
::get('num');
29 $res = $globals->xdb
->query("SELECT nom, prenom, promo FROM auth_user_md5 WHERE user_id={?} AND perms='pending'", $uid);
31 if (list($nom, $prenom, $promo) = $res->fetchOneRow()) {
32 $page->assign('prenom', $prenom);
33 $page->assign('nom', $nom);
34 $page->assign('promo', $promo);
36 if (Env
::has('valide')) {
37 require_once('xorg.misc.inc.php');
39 $email = trim(Env
::get('mail'));
40 $res = $globals->xdb
->query('SELECT COUNT(*) FROM register_marketing WHERE uid={?} AND email={?}', $uid, $email);
42 if (!isvalid_email_redirection($email)) {
43 $page->trig("Email invalide !");
44 } elseif ($res->fetchOneCell()) {
45 $page->assign('already', true
);
47 $page->assign('ok', true
);
48 $globals->xdb
->execute(
49 "INSERT INTO register_marketing (uid,sender,email,date,last,nb,type,hash)
50 VALUES ({?}, {?}, {?}, NOW(), 0, 0, {?}, '')",
51 $uid, Session
::getInt('uid'), $email, Env
::get('origine'));
52 require_once('validations.inc.php');
53 $req = new MarkReq(Session
::getInt('uid'), $uid, $email, Env
::get('origine')=='user');