forked from science-ation/science-ation
112 lines
3.5 KiB
PHP
112 lines
3.5 KiB
PHP
<?
|
|
/*
|
|
This file is part of the 'Science Fair In A Box' project
|
|
SFIAB Website: http://www.sfiab.ca
|
|
|
|
Copyright (C) 2005 Sci-Tech Ontario Inc <info@scitechontario.org>
|
|
Copyright (C) 2005 James Grant <james@lightbox.org>
|
|
|
|
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, version 2.
|
|
|
|
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; see the file COPYING. If not, write to
|
|
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
Boston, MA 02111-1307, USA.
|
|
*/
|
|
?>
|
|
<?
|
|
require("common.inc.php");
|
|
include "register_judges.inc.php";
|
|
|
|
//send the header
|
|
send_header("Judges Registration - Change Password");
|
|
|
|
if(!$_SESSION['judges_password_expired'])
|
|
{
|
|
echo "<a href=\"register_judges_main.php\"><< ".i18n("Back to Judges Registration Summary")."</a><br />";
|
|
echo "<br />";
|
|
}
|
|
|
|
if($_POST['action']=="save")
|
|
{
|
|
//first, lets see if they choosed the same password again (bad bad bad)
|
|
$q=mysql_query("SELECT password FROM judges WHERE id='".$_SESSION['judges_id']."' AND email='".$_SESSION['email']."' AND password='".$_POST['pass1']."'");
|
|
if(mysql_num_rows($q))
|
|
{
|
|
echo error(i18n("You cannot choose the same password again. Please choose a different password"));
|
|
}
|
|
//now make sure their password is good
|
|
else if(!$_POST['pass1'])
|
|
{
|
|
echo error(i18n("New Password is required"));
|
|
}
|
|
else if(!$_POST['pass2'])
|
|
{
|
|
echo error(i18n("Confirm New Password is required"));
|
|
}
|
|
else if($_POST['pass1'] != $_POST['pass2'])
|
|
{
|
|
echo error(i18n("Passwords do not match"));
|
|
}
|
|
else
|
|
{
|
|
if($config['judges_password_expiry_days']>0)
|
|
$ex="passwordexpiry=DATE_ADD(CURDATE(),INTERVAL ".$config['judges_password_expiry_days']." DAY)";
|
|
else
|
|
$ex="passwordexpiry=NULL";
|
|
|
|
mysql_query("UPDATE judges SET password='".$_POST['pass1']."', $ex WHERE id='".$_SESSION['judges_id']."' AND email='".$_SESSION['email']."'");
|
|
echo happy(i18n("Password successfully changed"));
|
|
if($_SESSION['judges_password_expired'])
|
|
{
|
|
unset($_SESSION['judges_password_expired']);
|
|
echo "<a href=\"register_judges_main.php\"><< ".i18n("Back to Judges Registration Summary")."</a><br />";
|
|
echo "<br />";
|
|
send_footer();
|
|
exit;
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if($_SESSION['judges_password_expired'])
|
|
echo error(i18n("Your password has expired. You must choose a new password now"));
|
|
|
|
}
|
|
echo "<form name=\"changepassform\" method=\"post\" action=\"register_judges_password.php\">\n";
|
|
echo "<input type=\"hidden\" name=\"action\" value=\"save\" />\n";
|
|
|
|
echo "<br />";
|
|
echo "<table>";
|
|
echo "<tr><td>";
|
|
echo i18n("Enter New Password:");
|
|
echo "</td><td>";
|
|
echo "<input type=\"password\" size=\"10\" name=\"pass1\">";
|
|
echo "</td></tr>";
|
|
echo "<tr><td>";
|
|
echo i18n("Confirm New Password:");
|
|
echo "</td><td>";
|
|
echo "<input type=\"password\" size=\"10\" name=\"pass2\">";
|
|
echo "</td></tr>";
|
|
echo "</table>";
|
|
|
|
|
|
echo "<input type=\"submit\" value=\"".i18n("Change Password")."\" />\n";
|
|
echo "</form>";
|
|
|
|
if(!$_SESSION['judges_password_expired'])
|
|
{
|
|
echo "<br />";
|
|
echo "<a href=\"register_judges_main.php\"><< ".i18n("Back to Judges Registration Summary")."</a><br />";
|
|
}
|
|
|
|
send_footer();
|
|
?>
|