Ver Mensaje Individual
  #10 (permalink)  
Antiguo 05/06/2012, 05:24
Avatar de oNefl0w189
oNefl0w189
 
Fecha de Ingreso: abril-2010
Ubicación: Valladolid
Mensajes: 117
Antigüedad: 14 años, 1 mes
Puntos: 4
Respuesta: ERROR -> Warning: mysql_select_db(): supplied argument...

prueba así:

Código PHP:
Ver original
  1. <?php
  2. include('Connections/MiConexion.php');
  3. // *** Validate request to login to this site.
  4. if (!isset($_SESSION)) {
  5. }
  6.  
  7. $loginFormAction = $_SERVER['PHP_SELF'];
  8. if (isset($_GET['accesscheck'])) {
  9.   $_SESSION['PrevUrl'] = $_GET['accesscheck'];
  10. }
  11.  
  12. if (isset($_POST['username'])) {
  13.   $loginUsername=$_POST['username'];
  14.   $password=$_POST['password'];
  15.   $MM_fldUserAuthorization = "";
  16.   $MM_redirectLoginSuccess = "autorizacion.php";
  17.   $MM_redirectLoginFailed = "login.php";
  18.   $MM_redirecttoReferrer = false;
  19.   mysql_select_db($database_MiConexion, $MiConexion);
  20.    
  21.   $LoginRS__query=sprintf("SELECT usuario, contrasena FROM usuarios WHERE usuario=%s AND contrasena=%s",
  22.     GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text"));  
  23.    
  24.   $LoginRS = mysql_query($LoginRS__query, $MiConexion) or die(mysql_error());
  25.   $loginFoundUser = mysql_num_rows($LoginRS);
  26.   if ($loginFoundUser) {
  27.      $loginStrGroup = "";
  28.      
  29.     if (PHP_VERSION >= 5.1) {session_regenerate_id(true);} else {session_regenerate_id();}
  30.     //declare two session variables and assign them
  31.     $_SESSION['MM_Username'] = $loginUsername;
  32.     $_SESSION['MM_UserGroup'] = $loginStrGroup;          
  33.  
  34.     if (isset($_SESSION['PrevUrl']) && false) {
  35.       $MM_redirectLoginSuccess = $_SESSION['PrevUrl'];    
  36.     }
  37.     header("Location: " . $MM_redirectLoginSuccess );
  38.   }
  39.   else {
  40.     header("Location: ". $MM_redirectLoginFailed );
  41.   }
  42. }
  43. ?>
  44.  
  45. <?php
  46. if (!function_exists("GetSQLValueString")) {
  47. function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")  
  48. {
  49.   if (PHP_VERSION < 6) {
  50.     $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  51.   }
  52.  
  53.   $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
  54.  
  55.   switch ($theType) {
  56.     case "text":
  57.       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  58.       break;    
  59.     case "long":
  60.     case "int":
  61.       $theValue = ($theValue != "") ? intval($theValue) : "NULL";
  62.       break;
  63.     case "double":
  64.       $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
  65.       break;
  66.     case "date":
  67.       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  68.       break;
  69.     case "defined":
  70.       $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
  71.       break;
  72.   }
  73.   return $theValue;
  74. }
  75. }
  76. ?>


Si no te funciona, prueba poniendo la linea

include('Connections/MiConexion.php');

en esta posicion:

session_start();
}
include('Connections/MiConexion.php');
__________________
Nunca dijeron que la vida sería fácil, sólo prometieron que valdría la pena vivirla.

Dar las gracias y añadir Karma, no cuesta nada, ¿Que menos si te ayudan? :)