//$Revision$
/*
* This file is part of WCOMPTA.
*
* WCOMPTA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* WCOMPTA is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with WCOMPTA; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
//$Revision$
// Auteur Dany De Bontridder ddebontridder@yahoo.fr
/*++
* function : CheckUser
* Parameter : none
* return : not use
* Description :
* Check if user is active and exists in the
* repository
* Automatically redirect
*
++*/
function CheckUser()
{
global $g_user,$g_pass,$IsValid;
echo_debug("CheckUser");
$res=0;
$pass5=md5($g_pass);
if ( $IsValid == 1 ) { return; }
$cn=pg_connect("dbname=account_repository host=127.0.0.1 user='webcompta'");
if ( $cn != false ) {
$sql="select ac_users.use_login,ac_users.use_active, ac_users.use_pass
from ac_users
where ac_users.use_login='$g_user'
and ac_users.use_active=1
and ac_users.use_pass='$pass5'";
echo_debug("Sql = $sql");
$ret=pg_exec($cn,$sql);
$res=pg_NumRows($ret);
echo_debug("Number of found rows : $res");
}
if ( $res == 0 ) {
echo '';
echo "
";
echo "