* * $Id: login.php,v 1.4 2000/08/02 20:26:28 haakon Exp $ * * 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. */ include ".sipsconfig.php"; include $config["sipssys"] ."/code/box.inc.php"; function generatePassword() { srand((double)microtime()*1000000); while ($i < 8) { switch (rand(0, 2)) { case 0: // add lowcase char $pass .= chr(rand(97, 122)); break; case 1: // add a capital char $pass .= chr(rand(65, 90)); break; case 2: // add a number $pass .= chr(rand(48, 57)); break; } $i++; } return $pass; } if ($action == "login") { if ($username) { if (file_exists($config["sipssys"] ."/users/$username[0]/$username/user")) { $cryptpass = md5($password); if (getUserValue($username, "Password") == $cryptpass) { $cryptuser = "$username:$cryptpass"; setcookie("user", $cryptuser, time() + ($config["cookietime"] * 86400)); header("Location: " .$config["httpbase"] ."/index.php"); print(" Systemowy błąd logowania !!!
skontaktuj się z administratorem systemu
lub kliknij by ponowić:Kliknij."); } else { $msg = i18n("The password you gave is incorrect. Try again in the login box below."); if (getUserValue($username, "Email") != "") { $msg .= " " .i18n("If you can't remember your password, we can email you a new one.") ."\n"; $msg .= "

"; } } } else $msg = i18n("I couldn't log you in!"); } } else if ($action == "emailpass") { $newpass = generatePassword(); setUserValue($mailtousr, "Password", md5($newpass)); mail(getUserValue($mailtousr, "Email"), i18n("Your new #1# password", $config["sitename"]), i18n("We have assigned you a new password at #1#", $config["sitename"]) .":\n\n$newpass\n\n" .i18n("You should log in with this password and change it!") ."\n\n" .i18n("Thanks for using #1#.", $config["sitename"]), "From: " .$config["siteadmin"] ."\nReply-To: " .$config["siteadmin"]); } printTop(i18n("login")); if ($msg) printBox(i18n("Login Problem"), "", "", $msg); if ($action == "emailpass") printBox(i18n("Check your mail"), "", "", i18n("Your new password has been sent to your e-mail address.")); $box = getBoxData("login"); printBox($box["Title"], $box["URL"], $box["Include"], $box["HTML"], $boxes[$i]); printBottom(); ?>