root/trunk/wifidog-auth/wifidog/validate.php @ 568

Revision 568, 2.7 KB (checked in by fproulx, 8 years ago)

2005-04-25 Fran�ois Proulx <francois.proulx@…

  • More interface work
  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
Line 
1<?php
2  /********************************************************************\
3   * This program is free software; you can redistribute it and/or    *
4   * modify it under the terms of the GNU General Public License as   *
5   * published by the Free Software Foundation; either version 2 of   *
6   * the License, or (at your option) any later version.              *
7   *                                                                  *
8   * This program is distributed in the hope that it will be useful,  *
9   * but WITHOUT ANY WARRANTY; without even the implied warranty of   *
10   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the    *
11   * GNU General Public License for more details.                     *
12   *                                                                  *
13   * You should have received a copy of the GNU General Public License*
14   * along with this program; if not, contact:                        *
15   *                                                                  *
16   * Free Software Foundation           Voice:  +1-617-542-5942       *
17   * 59 Temple Place - Suite 330        Fax:    +1-617-542-2652       *
18   * Boston, MA  02111-1307,  USA       gnu@gnu.org                   *
19   *                                                                  *
20   \********************************************************************/
21  /**@file
22   * @author Copyright (C) 2004 Benoit Gr�goire, Philippe April.
23   */
24define('BASEPATH','./');
25require_once (BASEPATH.'/include/common.php');
26require_once (BASEPATH.'/include/common_interface.php');
27require_once (BASEPATH.'/classes/User.php');
28
29try {
30    if (!isset($_REQUEST["token"]))
31        throw new Exception(_('No token specified!'));
32       
33    if (!isset($_REQUEST["user_id"]))
34        throw new Exception(_('No user ID specified!'));
35
36    $user = User::getObject($_REQUEST['user_id']);
37
38    if ($db->EscapeString($_REQUEST['token']) != $user->getValidationToken())
39        throw new Exception(_('The validation token does not match the one in the database.'));
40
41    if ($user->getAccountStatus() == ACCOUNT_STATUS_ALLOWED)
42        throw new Exception(_('Your account has already been activated.'));
43
44    $user->SetAccountStatus(ACCOUNT_STATUS_ALLOWED);
45    $smarty->assign('message', _("Your account has been succesfully activated!\n\nYou may now browse to a remote Internet address and take advantage of the free Internet access!\n\nIf you get prompted for a login, enter the username and password you have just created."));
46} catch (Exception $e) {
47    $smarty->assign('message', $e->getMessage());
48}
49
50require_once BASEPATH.'classes/MainUI.php';
51$ui = new MainUI();
52$ui->setMainContent($smarty->fetch("templates/validate.html"));
53$ui->display();
54//$smarty->display("templates/validate.html");
55?>
Note: See TracBrowser for help on using the browser.