Main Page | Directories | File List | File Members

verify.php

Go to the documentation of this file.
00001 <?php
00002 # This file is part of the Savane project
00003 # <http:#gna.org/projects/savane/>
00004 #
00005 # $Id: verify.php 5187 2005-12-01 16:22:29Z yeupou $
00006 #
00007 #  Copyright 1999-2000 (c) The SourceForge Crew
00008 #  Copyright 2000-2003 (c) Free Software Foundation
00009 #
00010 #  Copyright 2002-2004 (c) Mathieu Roy <yeupou--at--gnu.org>
00011 # 
00012 # The Savane project is free software; you can redistribute it and/or
00013 # modify it under the terms of the GNU General Public License
00014 # as published by the Free Software Foundation; either version 2
00015 # of the License, or (at your option) any later version.
00016 #
00017 # The Savane project is distributed in the hope that it will be useful,
00018 # but WITHOUT ANY WARRANTY; without even the implied warranty of
00019 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020 # GNU General Public License for more details.
00021 #
00022 # You should have received a copy of the GNU General Public License
00023 # along with the Savane project; if not, write to the Free Software
00024 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00025 
00026 
00027 require "../include/pre.php";    
00028 
00029 ####### function login_valid()
00030 ####### checks for valid login from form post
00031 
00032 function verify_login_valid()   
00033 {
00034         global $HTTP_POST_VARS;
00035 
00036         if (!$GLOBALS['form_loginname']) return 0;
00037 
00038         # first check just confirmation hash
00039         $res = db_query('SELECT confirm_hash,status FROM user WHERE '
00040                 .'user_name=\''.$GLOBALS['form_loginname'].'\'');
00041 
00042         if (db_numrows($res) < 1) {
00043                 $GLOBALS['error_msg'] = _("Invalid username.");
00044                 return 0;
00045         }
00046         $usr = db_fetch_array($res);
00047 
00048         if (strcmp($GLOBALS['confirm_hash'],$usr['confirm_hash'])) {
00049                 $GLOBALS['error_msg'] = _("Invalid confirmation hash.");
00050                 return 0;
00051         }
00052 
00053         # then check valid login        
00054         return (session_login_valid($GLOBALS['form_loginname'],$GLOBALS['form_pw'],1));
00055 }
00056 
00057 ####### first check for valid login, if so, redirect
00058 
00059 if ($update){
00060         $success=verify_login_valid();
00061         if ($success) {
00062                 $res = db_query("UPDATE user SET status='A' WHERE user_name='$GLOBALS[form_loginname]'");
00063                 session_redirect($GLOBALS['sys_home']."account/first.php");
00064         }
00065 }
00066 
00067 site_header(array('title'=>_("Login")));
00068 
00069 print '<h3> '.sprintf(_("%s Account Verification"),$GLOBALS['sys_name']).'</h3>';
00070 print '<p>'._("In order to complete your registration, login now. Your account will then be activated for normal logins").'.</p>';
00071 
00072 
00073 print form_header($PHP_SELF, $form_id);
00074 
00075 print '<p><span class="preinput">'._("Login Name").':</span><br />&nbsp;&nbsp;';
00076 print form_input("text", "form_loginname");
00077 print '</p>';
00078 
00079 print '<p><span class="preinput">'._("Password").':</span><br />&nbsp;&nbsp;';
00080 print form_input("password", "form_pw");
00081 print '</p>';
00082 
00083 print form_input("hidden", "confirm_hash", $confirm_hash);
00084 print form_footer(_("Login"));
00085 
00086 site_footer(array());
00087 
00088 ?>

Generated on Sun Feb 26 13:23:04 2006 for Savane PHP Frontend Developer Reference by  doxygen 1.4.4