![Antiguo](http://static.forosdelweb.com/fdwtheme/images/statusicon/post_old.gif)
15/11/2011, 21:27
|
| | Fecha de Ingreso: julio-2009 Ubicación: colombia
Mensajes: 7
Antigüedad: 15 años, 6 meses Puntos: 0 | |
Respuesta: problema al conectar la base de datos. Tengo una duda con myIsam, ya que en el localhost cree la base de datos con InnoDB, y me funcionan todos los campos dinamicos, pero en el servidor de de miaarroba, solo esta para crear la base de datos en myIsam y no me funcionando correctamente.... Espero toda la colaboracion que puedan dar ya que tengo que entregar este trabajo de la u el proximo mes...
por ejemplo este es el codigo de loguin.php, y este es el error que aun no identifico,, Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in /home/webcindario/p/e/petweb/login.php on line 59
Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home/webcindario/p/e/petweb/login.php on line 64 <?php
# FileName="Connection_php_mysql.htm"
# Type="MYSQL"
# HTTP="true"
$hostname_conexion_petweb = "mysql.webcindario.com";
$database_conexion_petweb = "petweb";
$username_conexion_petweb = "petweb";
$password_conexion_petweb = "jenifer302";
$conexion_petweb = mysql_pconnect($hostname_conexion_petweb, $username_conexion_petweb, $password_conexion_petweb) or trigger_error(mysql_error(),E_USER_ERROR);
?>
<?php
if (isset($_POST['contrase'])){$_POST['contrase'] =sha1($_POST['contrase']);}
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$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;
}
}
?><?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['nombreusuario'])) {
$loginUsername=$_POST['nombreusuario'];
$password=$_POST['contrase'];
$MM_fldUserAuthorization = "admin_priv"; //
$MM_redirectLoginSuccess = "correcto.php";
$MM_redirectLoginFailed = "fallo.php";
$MM_redirecttoReferrer = false;
mysql_select_db($database_registro_usuarios, $registro_usuarios);
$LoginRS__query=sprintf("SELECT nombreusuario, contrase, admin_priv FROM usuarios WHERE nombreusuario=%s AND contrase=%s",
GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text"));
$LoginRS = mysql_query($LoginRS__query, $registro_usuarios) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);
if ($loginFoundUser) {
$loginStrGroup = mysql_result($LoginRS,0,'admin_priv');
//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=iso-8859-1" />
<title>Login</title>
</head>
<body>
<form ACTION="<?php echo $loginFormAction; ?>" id="form1" name="form1" method="POST">
<table width="268" border="0" cellspacing="5">
<tr>
<td>Nombre usuaurio</td>
<td><label>
<input type="text" name="nombreusuario" id="nombreusuario" />
</label></td>
</tr>
<tr>
<td>Contraseña</td>
<td><label>
<input type="password" name="contrase" id="contrase" />
</label></td>
</tr>
<tr>
<td> </td>
<td><label>
<input type="submit" name="hacerLogin" id="hacerLogin" value="Autentificar" />
</label></td>
</tr>
</table>
</form>
</body>
</html>
Última edición por jenju302; 15/11/2011 a las 21:36 |