Código PHP:
<?
session_start();
include("../conexion.php");
//user = mail
if(isset($_POST['mail']) and isset($_POST['pass']) and $_POST['mail'] != '' and $_POST['pass'] != '') {
$mail = $_POST['mail'];
$pass = $_POST['pass'];
$sql = "SELECT * FROM clientes WHERE mail='$mail' and pass='$pass'";
$result = mysql_query($sql) or die (mysql_error());
if($row = mysql_fetch_array($result)) {
$_SESSION['mail'] = $mail;
$_SESSION['pass'] = $pass;
?>
<script type="text/javascript">
alert(<? echo $_SESSION['mail'].' '.$_SESSION['pass']; ?>);
</script>
<?
?>
<script type="text/javascript">
alert("Ingreso Exitoso");
window.location = '../login/';
</script>
<?
}else{
?>
<script type="text/javascript">
alert("Has ingresado algun dato mal");
window.location = '../index.php';
</script>
<?
}
}else{
?>
<script type="text/javascript">
alert("Error!");
window.location = '../index.php';
</script>
<?
}
?>
Código PHP:
<?
include("../conexion.php");
?>
<script type="text/javascript">
alert(<? echo $_SESSION['mail'].' '.$_SESSION['pass']; ?>);
</script>
<?
if(isset($_SESSION['mail']) and isset($_SESSION['pass'])) {
$mail = $_SESSION['mail'];
$pass = $_SESSION['pass'];
$sql = "SELECT * FROM clientes WHERE mail='$mail' and pass='$pass'";
$result = mysql_query($sql) or die (mysql_error());
if($row = mysql_fetch_array($result)) {
$articulos = $row['articulos']; //numero de productos maximo que puede poner en el catalogo
$nombre = $row['user']; //nombre completo
$tel = $row['tel']; //telefo
$web = $row['web']; //web si es que la tiene
$dir = $row['dir']; //direcion
$agregados = $row['agregados']; //numero de productos agregados
}else{
?>
<script type="text/javascript">
alert("Error!");
window.location = '../index.php';
</script>
<?
}
}else{
?>
<script type="text/javascript">
alert("Error!");
window.location = '../index.php';
</script>
<?
}
?>