<?
function confirm_pass($user, $pass, $cookie=1)
{
$pfile = "etc/$user";
if(!file_exists($pfile)) return false;
$fp = fopen($pfile, 'rb');
$rpass = fread($fp, filesize($pfile));
fclose($fp);
if(crypt($pass, $rpass) == $rpass)
{
if($cookie)
setcookie('as_username', $user, time()+31536000); // one year
return true;
}
return false;
}
/*
//This function's not, currently, used
function make_user($user, $pass, $admin_user, $admin_pass)
{
if(!confirm_pass($admin_user, $admin_pass, false))
return -1;
if(!file_exists("etc/adm/$admin_user"))
return -2;
if(file_exists("etc/$user"))
return 0;
$fp = fopen("etc/$user", "wb");
fwrite($fp, crypt($pass));
fclose($fp);
return 1;
}
*/
function change_pass($user, $opass, $npass, $cpass)
{
if(!confirm_pass($user, $opass, false) || $npass != $cpass)
return false;
$pfile = "etc/$user";
$fp = fopen($pfile, "wb");
fwrite($fp, crypt($npass));
fclose($fp);
return true;
}
?>
Latest News
Latest Software
read 0.3.6
kal, 2004/04/30 07:14:24.
nroff 1.10
kal, 2004/04/22 08:29:10.
Nenscript 1.13.3
kal, 2004/04/22 08:23:53.
necho 0.2.3
kal, 2004/04/19 10:58:47.
dgrep 0.1.4
kal, 2004/04/19 10:49:42.
kal, 2004/04/30 07:14:24.
nroff 1.10
kal, 2004/04/22 08:29:10.
Nenscript 1.13.3
kal, 2004/04/22 08:23:53.
necho 0.2.3
kal, 2004/04/19 10:58:47.
dgrep 0.1.4
kal, 2004/04/19 10:49:42.
Select Theme
Links