<?php 
session_start();
/*
 * changepasswd.php
 * 
 * Copyright 2009, 2018 Pedro Quaresma <pedro@mat.uc.pt>
 * 
 * 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., 51 Franklin Street, Fifth Floor, Boston,
 * MA 02110-1301, USA.
 */

require_once("../servidor.php");

require($entradaFILE.'header.php');

$putilizador     = $_SESSION['utilizador'];
$psenha          = $_SESSION['senha'];
$pTipoUtilizador = $_SESSION['tipoUtilizador'];
$vUsername       = $_SESSION['username'];

?>
<?php
require($entradaFILE.'dbLogin.php');
?>


<center>
<h3 class="maketitle">New Password</h3>
</center>

<hr/>

<?php

$sqlUserNameType = "SELECT name,type
                      FROM users
                     WHERE username='$vUsername'";

$resultadoUserNameType = mysqli_query($ligacao,$sqlUserNameType);

$linha = mysqli_fetch_assoc($resultadoUserNameType);

$vType = $linha['type'];
$vName = $linha['name'];


echo "<br />\n";
echo "  <form action='cChangepasswd.php' method='post'>\n";
echo "<table width=250 cellpadding=2 cellspacing=0 bgcolor='#cccccc'>\n";
echo "<tr><td>New password:</td>\n"; 
echo "<td><input type='password' name='newPasswd' size=16 maxlength=16></td>\n"; 
echo "</tr>\n";
echo "<tr><td>Repeat new password:</td>\n"; 
echo "<td><input type='password' name='newPasswd2' size=16 maxlength=16></td>\n";
echo "</tr>\n";
echo "<tr><td colspan=2 align='center'><input type='submit' value='Change password'>\n";
echo "</td></tr>\n"; 
echo "</table>\n"; 
echo "<br />\n"; 
?>


<p>&nbsp;</p>

<?php
require($entradaFILE.'footer.php');
?>
