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

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

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

  • Completed integration of new interface with new objects
  • 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');
28require_once BASEPATH.'classes/MainUI.php';
29
30try {
31    if (!isset($_REQUEST["token"]))
32        throw new Exception(_('No token specified!'));
33       
34    if (!isset($_REQUEST["user_id"]))
35        throw new Exception(_('No user ID specified!'));
36
37    $user = User::getObject($_REQUEST['user_id']);
38
39    if ($db->EscapeString($_REQUEST['token']) != $user->getValidationToken())
40        throw new Exception(_('The validation token does not match the one in the database.'));
41
42    if ($user->getAccountStatus() == ACCOUNT_STATUS_ALLOWED)
43        throw new Exception(_('Your account has already been activated.'));
44
45    $user->SetAccountStatus(ACCOUNT_STATUS_ALLOWED);
46    $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."));
47} catch (Exception $e) {
48    $smarty->assign('message', $e->getMessage());
49}
50
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.