
05/04/2011, 17:40
|
| | Fecha de Ingreso: abril-2011 Ubicación: Colombia
Mensajes: 59
Antigüedad: 14 años Puntos: 19 | |
Respuesta: PHP Redireccionar después de Login (Novato) Pienso (no se) al final de loguearse y comprobarse aqui....
si se loguea bn debe enviarlo a ejemplo.html pero reitero ejemplo.html puede variar... (el link puede variar)
CODIGO: login.php
<?php
ob_start();
include("config.php");
// connect to the mysql server
$link = mysql_connect($server, $db_user, $db_pass)
or die ("Could not connect to mysql because ".mysql_error());
// select the database
mysql_select_db($database)
or die ("Could not select database because ".mysql_error());
$match = "select id from $table where username = '".$_POST['username']."'
and password = '".$_POST['password']."';";
$qry = mysql_query($match)
or die ("Could not match data because ".mysql_error());
$num_rows = mysql_num_rows($qry);
if ($num_rows <= 0) {
echo "Sorry, there is no username or password with: <strong>".$_POST['username']."</strong><br>";
echo "<a href=login.html>Try again</a>";
exit;
} else {
setcookie("loggedin", "".$_POST['username']."", time()+(3600 * 24));
echo "Welcome: <strong>".$_POST['username']."</strong><br>";
echo "Continue to the <a href=members.php>members</a> section.";
}
ob_end_flush();
?> |