Jump to content
  • Revista PROGRAMAR: Já está disponível a edição #60 da revista programar. Faz já o download aqui!

dudusf04

mostrar o menu quando fazer login

Recommended Posts

dudusf04

Bom dia!!

pessoal estou com uma grande duvida.. nao estou conseguindo fazer o menu aparecer quando faço login..

qualquer ajuda é bem vinda obg!!

esta aqui o código:

function menu()
{
// set server access variables
$host = "localhost";
$user = "root";
$pass = "";
$db = "casamento";

// open connection
$connection = mysql_connect($host, $user, $pass) or die ("Unable to connect!");

// select database
mysql_select_db($db) or die ("Unable to select database!");

// create query
$query = "SELECT * FROM menusback INNER JOIN utilizadoresmenusback ON menusback.IdUtilizador=Utilizadoresmenusback.idUtilizador";

//ELECT * FROM utilizadores WHERE Email=\"$username\" AND Senha=\"$password\"
// execute query
$result = mysql_query($query) or die ("Error in query: $query. ".mysql_error());

// free result set memory
mysql_free_result($result);

// close connection
mysql_close($connection);

}

if(isset($_POST['submit_login'])){
if (menu=='IdUtilizador')
include "function.php";
header("location : menu.php");
}

Edited by Rui Carlos
Formatação do código.

Share this post


Link to post
Share on other sites
NunoDinis

Segue um exemplo bem simples:

$query = mysql_query("SELECT * FROM TABELA WHERE user = '$login' AND passe = '$senha'", $db);
 $login = mysql_num_rows($query); 
 if ($login == 1) {
  header("location : menu.php");
} else {
  echo "Dados incorretos!";
}

Edited by NunoDinis

Estranha forma de vida que tem a capacidade de transformar comandos em mensagens de erro.

ndsotware.org

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.