<?php
/*
OpenDataBag - Data Web Interface
Copyright (C) 2004 Nawara
This program 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.
This program 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 this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
$passwd_array=array();
$passwd_array[md5(purename($user))]=md5(purename($user).get('password0'));
$passwd_array=unserialize(base64_decode(file_get_contents(cfg_sso_path.'/data/.passwd.txt')));
//if((!isset($passwd_array[md5(purename(USERNAME))]) or $passwd_array[md5(purename(USERNAME))]==md5(purename(USERNAME).get('password0')) or (defined('cfg_unipassword') and get('password0')==cfg_unipassword) or get('password0')=='') and
if(get('password1')==get('password'))
{
$passwd_array[md5(purename(USERNAME))]=md5(purename(USERNAME).get('password'));
$passwd_array[md5(purename(USERNAME.email))]=strtolower(get('email'));
$fp=fopen(cfg_sso_path.'/data/.passwd.txt','w');
fwrite($fp,base64_encode(serialize($passwd_array)));
fclose($fp);
mylog('PASSWORD CHANGED '.USERNAME);
$script='chpasswddone';
}
else
{
mylog('PASSWORD NOT CHANGED '.USERNAME);
$script='chpasswd';
}
$passwd_array=array();
$search='---';
?>