0
Good morning, I have an administrative access page for the Adms of my site but have a part of the code in one of the pages, to create and modify users and passwords, that I would like to appear only when the user "TESTS" is connected on the page. I’m a little layy in PHP so I believe I’ve done something wrong or I’m missing something.
Inside this page is a STRING that calls the name of the connected user, and I am using the same STRING to do, which would be $_SESSION['nome_usuario']
.
<?php if ($_SESSION['nome_usuario'] = "TESTES") { ?>
"Codigos em HTML e PHP que cria e modifica usuarios"...
<?php } ?>
In case I wanted to SE
user is equal to "TESTS" it displays the codes and if it is not the same do not present anything. I thank you for all help.
Well, I put echo but I can’t apply the code, inside HTML and PHP has single and double quotes, any of the two that I put to echo will be broken in the middle of the code.
– Fratura Exposta
When there are quotes, you can do: echo "my test content "xxxx" ";
– Sr. André Baill
I took the code and created in another file a
STRING
to call him, but the page is showing an error and does not show the code. he is giving this error– Fratura Exposta
Parse error: syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE), expecting identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING) in C:\xampp\htdocs\fraturaexposta.esy.es\Login\Paginas\functions\criausuario.php on line 10
``– Fratura Exposta
and the error would be in the if of that part of the code
// Apaga usuários

if ( isset( $_GET['del'] ) ) {

 // Delete de cara (sem confirmação)

 $pdo_insere = $conexao_pdo->prepare('DELETE FROM usuarios WHERE user_id=?');

 $pdo_insere->execute( array( (int)$_GET['del'] ) );

 

 // Redireciona para o index.php

 header('location: ../index.php');

}
– Fratura Exposta
I used exactly as you showed in the first example and used before double quotes
– Fratura Exposta