Location: PHPKode > projects > Standardized Test Practice Engine > stpe/admin/index.php
<?php
/*
Copyright 2004 by Jonathan Bell and Daniel Perelman
This file is part of STPE - the Standardized Test Practice Engine.

    STPE 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.

    STPE 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 Foobar; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/
include_once("../globals.inc.php");
?>
<?php
include("login.inc.php");

if(isset($_POST['password1'])){
	if($_POST['password1'] == $_POST['password2']){
		$pass=md5($_POST['password1']."hide@address.com#L$JODFJLKSDFM><CMC*#KLSJDFKLZ");
		$sql2 = "SELECT * from `students` WHERE `teacher_name` = '$PHP_AUTH_USER' LIMIT 1";
$total_result = @mysql_query($sql2, $connection) or die("Error #". mysql_errno() . ": " . mysql_error());
$total_found = @mysql_num_rows($total_result);

	while ($row = mysql_fetch_array($total_result)) {
	    $emailaddy=$row['email'];
	}
		$sql = "UPDATE `passwords` SET `password` = '$pass' where `name` = '$PHP_AUTH_USER'";
		$total_result = @mysql_query($sql, $connection) or die("Error #". mysql_errno() . ": " . mysql_error());
		$themessage = 'Just a little note reminding you - you have just changed your password to '.$_POST['password1'].'

Cheers,
Jonathan Bell
Dan Perelman';

sock_mail($emailaddy,"Your [updated] logon credentials for the Amity SAT II Chemistry site",$themessage,"","hide@address.com");

	}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title><?php echo $site_name; ?> Admin: Home</title>

<link rel="stylesheet" type="text/css" href="../style.css" />
</head>
<body>
<?php include("../header.inc.php"); ?>
	<table>
		<tr valign="top">
			<?php include("../nav.inc.php"); ?>
			<td class="maincontent">
				<p>Welcome to the administration control panel, <?php echo $PHP_AUTH_USER ?>. Please select an action.</p>
				<p><a href="counter.php">Counter stats</a></p>
				<table>
				<tr>
				<th>Test adding users</th><th>Test taking users</th><th>Review management</th><th>Other</th></tr>
				
				<tr>
				<td><a href="newadder.php">New test adding user</a></td>
				<td><a href="newtake.php">New test taking user</a><br />
				<a href="newtake.php?method=import">Import test taking users</a></td>
				<td></td>
				<td><a href="newadmin.php">New administrator</a></td>
				</tr>
				
				<tr>
				<td><a href="editadders.php">Edit test adding users</a></td>
				<td><a href="edittake.php">Edit test taking users</a></td>
				<td><a href="editreview.php">Edit a review</a><br />
				<a href="editquestions.php">Edit questions</a></td>
				<td><a href="editadmin.php">Edit administrators</a></td>
				</tr>
				
				<tr>
				<td><a href="deleteadder.php">Delete test adding user</a></td>
				<td><a href="deletetake.php">Delete test takers</a></td>
				<td><a href="deletereview.php">Delete a review</a><br />
				<a href="deletequestions.php">Delete questions</a></td>
				<td><a href="deleteadmin.php">Delete an administrator</a></td>
				</tr>
				
				<tr>
				<td><a href="viewadders.php">View test adding users</a></td>
				<td></td>
				<td></td>
				<td><a href="resultslist.php">View test results</a></td></tr>
				
				
				</table>
				<a id="update" name="update" title="update"></a><p>Or... Change your password. Please enter your password twice.<br />
				<?php
				if(isset($_POST['password1']) & $_POST['password1'] != $_POST['password2']){
					echo "<br /><strong>Wups... your passwords don't match!</strong><br />";
				}
				?>
				</p>
				<form method="post" action="index.php">
				<p><input type="password" name="password1" /><br />
				<input type="password" name="password2" /><br /><br />
				<input type="submit" /></p>
				</form>
				
			</td>
		</tr>
	</table>
<?php include("../footer.inc.php"); ?>
</body>
</html>
Return current item: Standardized Test Practice Engine