Eu possuo um form de login, onde o formulario compara o username e a senha com o banco mysql, e caso seja afirmativo, redireciona para a pagina painel.php.
Mas eu gostaria que quando formulario fizesse o login, ele enviasse o ID do usuário que esta fazendo login, e envie pela url o parametro ID.
A url ficaria assim pagina.php?id=1
Esse é o meu formulário, de login, que eu fiz pelo dreamweaver cs4
Pergunta
3dmaniaco
Tranquilo Pessoal ?
Eu possuo um form de login, onde o formulario compara o username e a senha com o banco mysql, e caso seja afirmativo, redireciona para a pagina painel.php.
Mas eu gostaria que quando formulario fizesse o login, ele enviasse o ID do usuário que esta fazendo login, e envie pela url o parametro ID.
A url ficaria assim pagina.php?id=1
Esse é o meu formulário, de login, que eu fiz pelo dreamweaver cs4
<?php require_once('../Connections/Abyara.php'); ?> <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { if (PHP_VERSION < 6) { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; } $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? doubleval($theValue) : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } mysql_select_db($database_Abyara, $Abyara); $query_RsListar = "SELECT * FROM cadastro ORDER BY id_cadastro ASC"; $RsListar = mysql_query($query_RsListar, $Abyara) or die(mysql_error()); $row_RsListar = mysql_fetch_assoc($RsListar); $totalRows_RsListar = mysql_num_rows($RsListar); ?> <?php // *** Validate request to login to this site. if (!isset($_SESSION)) { session_start(); } $loginFormAction = $_SERVER['PHP_SELF']; if (isset($_GET['accesscheck'])) { $_SESSION['PrevUrl'] = $_GET['accesscheck']; } if (isset($_POST['username'])) { $loginUsername=$_POST['username']; $password=$_POST['senha']; $MM_fldUserAuthorization = ""; $MM_redirectLoginSuccess = "adicionar.php"; $MM_redirectLoginFailed = "login.php"; $MM_redirecttoReferrer = false; mysql_select_db($database_Abyara, $Abyara); $LoginRS__query=sprintf("SELECT username, senha FROM cadastro WHERE username=%s AND senha=%s", GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text")); $LoginRS = mysql_query($LoginRS__query, $Abyara) or die(mysql_error()); $loginFoundUser = mysql_num_rows($LoginRS); if ($loginFoundUser) { $loginStrGroup = ""; //declare two session variables and assign them $_SESSION['MM_Username'] = $loginUsername; $_SESSION['MM_UserGroup'] = $loginStrGroup; if (isset($_SESSION['PrevUrl']) && false) { $MM_redirectLoginSuccess = $_SESSION['PrevUrl']; } header("Location: " . $MM_redirectLoginSuccess ); } else { header("Location: ". $MM_redirectLoginFailed ); } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <form id="form1" name="form1" method="POST" action="<?php echo $loginFormAction; ?>"> <table width="100" border="0" cellspacing="0" cellpadding="0"> <tr> <td><label> <input type="text" name="username" id="username" /> </label></td> </tr> <tr> <td> </td> </tr> <tr> <td><label> <input type="text" name="senha" id="senha" /> </label></td> </tr> <tr> <td><input type="submit" name="button" id="button" value="Login" /></td> </tr> </table> </form> </body> </html> <?php mysql_free_result($RsListar); ?>Já tentei fazer de varias formas, mas não deu certo, como posso fazer ?
Desde já, muito obrigado.
Link para o comentário
Compartilhar em outros sites
3 respostass a esta questão
Posts Recomendados
Participe da discussão
Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.