root/trunk/responses/6nergies.response.php

Revision 1, 2.7 KB (checked in by anonymous, 7 years ago)

initial import

Line 
1<?php
2/****************************************************** Open .node ***
3 * Description:   
4 * Status:        Stable.
5 * Author:        Alexandre Dath <alexandre@dotnode.com>
6 * $Id$
7 *
8 * Copyright (C) 2005 Alexandre Dath <alexandre@dotnode.com>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software Foundation,
22 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23 ******************** http://opensource.ikse.net/projects/dotnode ***/
24
25error_log($_SERVER['REMOTE_ADDR']);
26$id = md5($_POST['email']);
27
28if($db->getOne('SELECT COUNT(id) FROM user WHERE id=?', array($id)) == 0)
29{
30    $id_6nergies = '46dfafc70eb46e3bdd5a15279e2b5bcd';
31    $data = array (
32        'id' => $id,
33        'id_invit' => $id_6nergies,
34        'lname' => $_POST['lname'],
35        'fname' => $_POST['fname'],
36        'email' => $_POST['email'],
37        'lang' => 'fr_FR',
38        'type' => '6nergies',
39        'status' => 'doing',
40        'date_begin' => time(),
41        'ip' => $_SERVER['REMOTE_ADDR']
42    );
43    $db->autoExecute('invitation_email', $data);
44
45
46
47    $invitation = $db->getRow('SELECT id, id_invit, lname, fname, email, date_begin FROM invitation_email WHERE id=? AND status=?', array($id, 'doing'));
48    if(isset($invitation['id']))
49    {
50        session_destroy();
51
52        session_set_save_handler ('_sess_open', '_sess_close', '_sess_read', '_sess_write', '_sess_destroy', '_sess_gc');
53        session_start();
54
55        $_SESSION['my_id'] = $invitation['id'];
56        $_SESSION['my_id_invit'] = $invitation['id_invit'];
57        $_SESSION['invitation_date'] = $invitation['date_begin'];
58       
59        $_SESSION['my_fname'] = stripslashes($_POST['fname']);
60        $_SESSION['my_lname'] = stripslashes($_POST['lname']);
61        $_SESSION['my_email'] = $_POST['email'];
62        $_SESSION['status'] = 'guest';
63        $_SESSION['my_ip'] = $_SERVER['REMOTE_ADDR'];
64        srand(time());
65        $SecID = md5(rand(1,10000000));
66        setcookie('SecID', $SecID, time()+31536000, '/');
67        $_SESSION['SecID'] = $SecID;
68        $_SESSION['6nergies_url'] = $_POST['6nergies_url'];
69        list($_SESSION['6nergies_login']) = split('@', $_POST['login']);
70     
71        error_log(print_r($invitation, true));
72     
73        header('Location: /new');
74    }
75    else
76        header('Location: /error/bad_link');
77}
78else
79    header('Location: /error/bad_link');
80
81?>
Note: See TracBrowser for help on using the browser.