gaim/www

Initial import into CVS
chipx86 start
2002-09-26, Christian Hammond
2b210e25fed4
Initial import into CVS
<?php
require "base.inc.php";
$missinginfo = false;
setup_site(-1);
if ($action == "resetpassword"):
setup_site("Reset Password");
if (!isset($username)):
start_section("Reset Password");
?>
<p>
Please enter your username. Your new password will be assigned to the address
on file.
</p>
<form method="post" action="login.php">
<input type="hidden" name="action" value="resetpassword" />
<table align="center" border="0" cellspacing="5" cellpadding="0" width="100%">
<tr>
<td align="right" width="50%">
<?php start_font(); ?>
<b>Username:</b>
<?php end_font(); ?>
</td>
<td width="50%">
<?php start_font(); ?>
<input type="text" name="username" />
<?php end_font(); ?>
</td>
</tr>
</table>
<br />
<div align="center">
<?php start_font(); ?>
<input type="submit" value="Reset Password" />
<?php end_font(); ?>
</div>
<?php
end_section();
print "</form>";
site_shutdown();
else:
$info = $users->get_user_info_from_username($username);
if ($info == NULL):
?>
<p>
You do not appear to be a registered user. Please
<a href="register.php">register</a> an account.
</p>
<?php
site_shutdown();
endif;
$newpass = substr($info["PASSWORD"], 2, 8);
$users->change_password($username, $newpass);
/* E-mail the person */
$email_address = $info["EMAIL"];
mail($email_address, "Password reset",
"Your password has been reset. Your new password is " .
$newpass . ".\n",
"From: nobody@gaim.sourceforge.net");
?>
<p>
Your password has been reset and mailed to
<?php print htmlentities($email_address) ?>.
</p>
<p>
Click <a href="<?php print $session->localUrl($PHP_SELF) ?>">here</a> to
go back to the login page.
</p>
<?php
endif;
site_shutdown();
elseif ($action == "login"):
$ok = $users->login($username, $password);
if (!$ok):
$missinginfo = true;
$userinfo = $users->get_user_info_from_username($username);
endif;
endif;
if ($users->logged_in()):
header("Location: " . $session->localUrl("plugins.php"));
exit;
endif;
setup_site("Login");
start_section("Log In");
?>
<form method="post" action="login.php">
<input type="hidden" name="action" value="login" />
<?php
if ($missinginfo):
?>
<p>
Your login or password was invalid. Please try again.
</p>
<?php
endif;
?>
<p>
To log into your account, enter your username and password below. If you do
not yet have an account, please
<a href="<?php print $session->localUrl('register.php'); ?>">register</a> one.
</p>
<p>
If you lost your password, click
<a href="<?php print $session->localUrl($PHP_SELF) ?>&action=resetpassword">here</a>
to reset it.
</p>
<table align="center" border="0" cellspacing="5" cellpadding="0">
<?php
form_item("Username", "username", $username, $username_missing, 15, 15);
form_item("Password", "password", $password, $password_missing, 15, 15);
?>
</table>
<br />
<div align="center"><input type="submit" value="Login" /></div>
</form>
<?php
end_section();
site_shutdown();
?>