Ver Mensaje Individual
  #4 (permalink)  
Antiguo 05/10/2007, 15:56
guiyermo
 
Fecha de Ingreso: octubre-2005
Mensajes: 91
Antigüedad: 18 años, 6 meses
Puntos: 0
Re: conexión de la BBDD en el servidor

gracias por las respuestas.
Os posteo un ejemplo más sencillo pero con el que tengo el mismo problema de no conexión: este ejemplo es muy simple porque es validar dos usuarios con sus passwords para que te permita avanzar en el visionado de la página

Cita:
<?php require_once('Connections/conexion.php'); ?>
<?php
// *** Validate request to login to this site.
session_start();

$loginFormAction = $_SERVER['PHP_SELF'];
if (isset($accesscheck)) {
$GLOBALS['PrevUrl'] = $accesscheck;
session_register('PrevUrl');
}

if (isset($_POST['usuario'])) {
$loginUsername=$_POST['usuario'];
$password=$_POST['password'];
$MM_fldUserAuthorization = "";
$MM_redirectLoginSuccess = "menu.html";
$MM_redirectLoginFailed = "index.html";
$MM_redirecttoReferrer = false;
mysql_select_db($database_conexion, $conexion);

$LoginRS__query=sprintf("SELECT usuario, password FROM usuarios WHERE usuario='%s' AND password='%s'",
get_magic_quotes_gpc() ? $loginUsername : addslashes($loginUsername), get_magic_quotes_gpc() ? $password : addslashes($password));

$LoginRS = mysql_query($LoginRS__query, $conexion) 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 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=iso-8859-1" />
<title>validaci&oacute;n usuarios registrados</title>

<style type="text/css">
<!--
.Estilo1 {
color: #CCCC00;
font-size: 12px;
}
.Estilo2 {font-size: 14px}
.Estilo3 {
font-family: Arial, Helvetica, sans-serif;
font-size: 14px;
color: #4A0603;
}
-->
</style>
</head>

<body>
<center>
<form name="form1" id="form1" method="POST" action="<?php echo $loginFormAction; ?>">
<table width="66%" height="462" border="0" cellspacing="8" background="fondopermiso.jpg">
<tr>
<td width="9%">&nbsp;</td>
<td width="15%">&nbsp;</td>
<td width="26%">&nbsp;</td>
<td width="16%">&nbsp;</td>
<td width="34%">&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td><span class="Estilo3">Usuario</span></td>
<td><input name="usuario" type="text" id="usuario" /></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td><span class="Estilo3">Password</span></td>
<td><input name="password" type="text" id="password" /></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td><input type="submit" name="Submit" value="Entrar" /></td>
</tr>
<tr>
<td colspan="4" bgcolor="#460000"><div align="center" class="Estilo1 Estilo2">Sol.licita tu codi d'usuari i password trucan al 609 240
265 </div></td>
<td>&nbsp;</td>
</tr>
<tr>
<td height="142">&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table>
</form>
</center>
</body>
</html>
Aquí también se me plantea el mismo problema pues no sé si realmente tengo un problema de código o es que hay otros errores.

Os agradeceré mucho me orienteis para resolverlo