I need to update a legacy code and for that I need to make two modifications to it.
The first modification is to abandon the mysql_*
functions and use the PDO.
The second is to update the database so that I can not register two user names and passwords with the same values.
Code that looks for Nome
and imgPerfil
of a user:
<?php
require_once "includes/config.php";
$Usuario = $_SESSION["Usuario"];
$Senha = $_SESSION["Senha"];
$SQL = mysql_query("SELECT Nome, imgPerfil FROM administradores WHERE Usuario=$Usuario' AND Senha='$Senha' ");
Code that takes user values:
<?php
while($Linha = mysql_fetch_assoc($SQL)) {
$nomeUser = $Linha['Nome'];
$imgpUser = $Linha['imgPerfil'];
}
Code that prints the values:
<?php echo $nomeUser; ?>
and
<?php echo $imgpUser; ?>