Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Galera eu peguei um cadastro simples na net.
Coloquei nesse cadastro o campo GAL esse campo vai ser cadastrado na tabela sql. Pois vai ser a chave do redirecionamento
para cada usuario.
O usuario quando logado vai ser redirecionado para um link do MYeGallery o que vai mudar de um link para o outro é o GAL.
Ou seja cada usario vai ser enviado para a sua respectiva categoria.
Exemplo
Keruba cadastrado com o GAL=8
vai para dll.php?pp=0,3&do=mostragal&gid=8
Joao cadastrado com a GAL=7
vai para dll.php?pp=0,3&do=mostragal&gid=7
e assim por diante... mesmo sendo novato http://forum.imasters.com.br/public/style_emoticons/default/blush.gif consegui construir a tabela sql com os campos e a parte de cadastro.
agora eu nao sei como fazer pra quando logar.. o usuario ser redirecionado usando o endereço
dll.php?pp=0,3&do=mostragal&gid=?
onde ? vai ser a GAL q foi cadastrada junto com a senha dele.
Espero sinceramente uma ajuda. vlww galera .. vou postar aqui o login.php e o index.php (index eu modifiquei para colocar o campo GAL)
index.php
<?php require_once('Connections/loguin.php'); ?>
<?php
// *** Redirect if username exists
$MM_flag="MM_insert";
if (isset($_POST[$MM_flag])) {
$MM_dupKeyRedirect="erro_user.php";
$loginUsername = $_POST['USER'];
$LoginRS__query = "SELECT `USER` FROM usuarios WHERE `USER`='" . $loginUsername . "'";
mysql_select_db($database_loguin, $loguin);
$LoginRS=mysql_query($LoginRS__query, $loguin) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);
//if there is a row in the database, the username was found - can not add the requested username
if($loginFoundUser){
$MM_qsChar = "?";
//append the username to the redirect page
if (substr_count($MM_dupKeyRedirect,"?") >=1) $MM_qsChar = "&";
$MM_dupKeyRedirect = $MM_dupKeyRedirect . $MM_qsChar ."requsername=".$loginUsername;
header ("Location: $MM_dupKeyRedirect");
exit;
}
}
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $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;
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "loguin")) {
$insertSQL = sprintf("INSERT INTO usuarios (`USER`, GAL, SENHA) VALUES (%s, %s, %s)",
GetSQLValueString($_POST['USER'], "text"),
GetSQLValueString($_POST['GAL'], "text"),
GetSQLValueString($_POST['SENHA'], "text"));
mysql_select_db($database_loguin, $loguin);
$Result1 = mysql_query($insertSQL, $loguin) or die(mysql_error());
$insertGoTo = "senha_aceita.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>kikoweb.com</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
.style1 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: smaller;
font-weight: bold;
font-style: italic;
}
.style2 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
font-weight: bold;
}
-->
</style>
</head>
<body>
<form action="<?php echo $editFormAction; ?>" method="POST" name="loguin" id="loguin">
<blockquote>
<p align="left">
<span class="style2">Crie sua Senha </span><br>
<br>
<input name="USER" type="text" id="USER" size="25">
<br>
<br>
<input name="GAL" type="text" id="GAL" size="25">
<br>
<input name="SENHA" type="password" id="SENHA" size="25">
<br>
<input type="submit" value="Criar senha">
<input type="hidden" name="MM_insert" value="loguin">
</p>
</blockquote>
</form>
<br>
<a href="logar.php"><span class="style1">Testar senha</span></a>
</body>
</html>
logar.php
<?php require_once('Connections/loguin.php'); ?><?php
// *** Validate request to login to this site.
session_start();
$loginFormAction = $_SERVER['PHP_SELF']; $GLOBALS['PrevUrl'] = $accesscheck;
session_register('PrevUrl');
}
if (isset($_POST['USER'])) {
$user = $_POST['USER'];
$senha = $_POST['SENHA'];
$gal= $_POST['GAL'];
$MM_fldUserAuthorization = "";
$MM_redirectLoginSuccess = "ola.php";
$MM_redirectLoginFailed = "erro.php";
$MM_redirecttoReferrer = false;
mysql_select_db($database_loguin, $loguin);
$Fetch_query=mysql_query("SELECT USER, SENHA FROM usuarios WHERE USER='$loginUsername' AND SENHA='$password'");
$fetch_gal = mysql_fetch_array($Fetch_query);
$LoginRS = mysql_query($LoginRS__query, $loguin) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);
if ($loginFoundUser) {
$loginStrGroup = "";
//declare two session variables and assign them
$GLOBALS['MM_Username'] = $loginUsername;
$GLOBALS['MM_UserGroup'] = $loginStrGroup;
//register the session variables
session_register("MM_Username");
session_register("MM_UserGroup");
if (isset($_SESSION['PrevUrl']) && false) {
$MM_redirectLoginSuccess = $_SESSION['PrevUrl'];
}
header("Location: " . $MM_redirectLoginSuccess );
}
else {
header("Location: ". $MM_redirectLoginFailed );
}
}
?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "[http://www.w3.org/TR/html4/loose.dtd">](http://www.w3.org/TR/html4/loose.dtd)
<html>
<head>
<title>kikoweb.com</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">.style1 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-weight: bold;
font-style: italic;
font-size: small;
}</style>
</head>
<body>
<form action="<?php echo $loginFormAction; ?>" method="POST" name="logar" id="logar">
<p class="style1"><a href="index.php">Pagina inicial </a><br>
<br>
Digite sua senha para entrar. <br>
</p>
<blockquote>
<p>
<input name="USER" type="text" id="USER" size="25">
<br>
<input name="SENHA" type="password" id="SENHA" size="25">
<br>
<input type="submit" value="Logar">
</p>
</blockquote>
</form>
</body>
</html>Carregando comentários...