So i have a project, that have a simple login system. There is a "users" table, that have "username" and "password" ecnrypted with SHA1.
And i have a simple form, that will change the password of the account that is logged in. But it is not working. Here is what i got:
<?php
include('connect.php');
if(isset($_POST['change']))
{
$nova_password = $_POST["nova_password"];
session_start();
$utilizador = $_SESSION['username'];
if (empty($nova_password)) {
$nopassword = '<span class="error">Insira uma nova password!</span></br>';
echo $nopassword;
}
if(!empty($nova_password))
{
$query = mysql_query("update users set password=SHA1('$nova_password') where username='$utilizador'");
$sucesso = '<span class="yes">Password Alterada com Sucesso!</span>';
echo $sucesso;
}
} //END IF
?>
When i go to the page, it says:"A session had already been started - ignoring session_start()".
This error appear before i click the button.