<?php
include ("../include/session.php");

date_default_timezone_set('Africa/Gaborone');
$entry_date = date("Y-m-d H:i:s", time()); 

$userid = mysql_real_escape_string($_POST['user_select']);
$userpassword = mysql_real_escape_string($_POST['user_password_text']);

$table_name = $_SESSION['db_prefix']."_users";
$name_query = "SELECT  username FROM $table_name WHERE userid = '".$userid."' ";
$name_result = execsql($name_query);
$user_name = mysql_result($name_result, 0, "username");


$table_name = $_SESSION['db_prefix']."_users";
$reset_query = "UPDATE $table_name SET password = '". md5($userpassword) ."' WHERE userid = '".$userid ."' ";
$reset_result = mySQL_query($reset_query);

$user_id = $_SESSION['username'];

date_default_timezone_set('Africa/Gaborone');
$entry_date = date("Y-m-d H:i:s", time()); 

$table_name = $_SESSION['db_prefix']."_tracking_admin";
$trackingQuery = "INSERT INTO $table_name (entry_date, user_name, action, details_1, details_2, details_3, details_4) VALUES ('".$entry_date."' ,'".$_SESSION['username']."', '3', '".$user_name."' ,'','','' )";
$trackingResult = mySQL_query($trackingQuery);
?>
<script language="javascript" type="text/javascript">
         window.location="user_list.php";
</script>

																  