Foros del Web » Programando para Internet » PHP »

inicio de sesion

Estas en el tema de inicio de sesion en el foro de PHP en Foros del Web. buenos dias, este es mi primer post, quisiera que me ayudaran con algo, estoy creando una aplicacion php con dreamweaver todo funciona muy bien en ...

  #1 (permalink)  
Antiguo 22/11/2011, 08:07
Avatar de memp500  
Fecha de Ingreso: octubre-2011
Ubicación: venezuela
Mensajes: 40
Antigüedad: 12 años, 6 meses
Puntos: 0
inicio de sesion

buenos dias, este es mi primer post, quisiera que me ayudaran con algo, estoy creando una aplicacion php con dreamweaver todo funciona muy bien en localhost con xxamp pero al llevar los archivor al servidor remoto de pago me sale el siguiente error:

"Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/sidarco/public_html/intranet/cover/header.php:4) in /home/sidarco/public_html/intranet/sec/inicio.php on line 37"

he leido por hay varias soluciones pero no doy con la respuesta

mi pagina web la estoy haciendo modular por lo que el index lo tengo de la siguiente forma:

Código:
<?php 
?>
<?php include("cover/header.php"); ?>
<div id="marco">
<div id="header">
<div id="logo">
  <div id="menu"><?php include("modulos/mod_menu/menu.php"); ?>
</div>
</div>
</div>
<div id="contenido">
<div id="sidebar"><?php include("cover/sidebar.php"); ?></div>
<div id="conten"><?php include("cover/sistem.php"); ?></div>
</div>
<div id="footframe">
<div id="time"><div class="style23"><?php include("modulos/mod_reloj/reloj.php"); ?></div></div>
<div id="footer"><?php include("modulos/mod_derautor/derechoautor.php"); ?></div>
</div>
</div>
<?php include("cover/footer.php"); ?>
el error lo arroja inicio.php aca les coloco el codigo:

Código:
<?php require_once('Connections/config.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $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;
}
}

mysql_select_db($database_config, $config);
$query_Recordset1 = "SELECT * FROM ft_usuarios";
$Recordset1 = mysql_query($query_Recordset1, $config) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);

$colname_Recordset2 = "-1";
if (isset($_SESSION['MM_username'])) {
  $colname_Recordset2 = $_SESSION['MM_username'];
}
mysql_select_db($database_config, $config);
$query_Recordset2 = sprintf("SELECT usuario FROM ft_usuarios WHERE usuario = %s", GetSQLValueString($colname_Recordset2, "text"));
$Recordset2 = mysql_query($query_Recordset2, $config) or die(mysql_error());
$row_Recordset2 = mysql_fetch_assoc($Recordset2);
$totalRows_Recordset2 = mysql_num_rows($Recordset2);
?>
<?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['usuario'])) {
  $loginUsername=$_POST['usuario'];
  $password=$_POST['pass'];
  $MM_fldUserAuthorization = "";
  $MM_redirectLoginSuccess = "index.php?seccion=welcome";
  $MM_redirectLoginFailed = "index.php?seccion=falleuser";
  $MM_redirecttoReferrer = false;
  mysql_select_db($database_config, $config);
  
  $LoginRS__query=sprintf("SELECT usuario, pass FROM ft_usuarios WHERE usuario=%s AND pass=%s",
    GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text")); 
   
  $LoginRS = mysql_query($LoginRS__query, $config) or die(mysql_error());
  $loginFoundUser = mysql_num_rows($LoginRS);
  if ($loginFoundUser) {
     $loginStrGroup = "";
    
    //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 );
  }
}
?>
<div id="content-box">
		<div class="padding">
			<div class="login" id="element-box">
				<div class="t">
					<div class="t">
						<div class="t"></div>
					</div>
				</div>
				<div class="m">

					<h1>Ingreso de Usuarios Registrados</h1>
					
							<div id="section-box">
			<div class="t">
				<div class="t">
					<div class="t"></div>
		 		</div>
	 		</div>
			<div class="m">
				<form ACTION="<?php echo $loginFormAction; ?>" style="clear: both;" id="form-login" name="login" method="POST">
	<p id="form-login-username">
		<label for="modlgn_username">Usuario</label>
		<input type="text" size="15" class="inputbox" id="modlgn_username" name="usuario">
	</p>

	<p id="form-login-password">
		<label for="modlgn_passwd">Contraseña</label>
		<input type="password" size="15" class="inputbox" id="modlgn_passwd" name="pass">
	</p>
		<p style="clear: both;" id="form-login-lang">
		
	<div class="button_holder">
	<div class="button1">
		<div class="next">
			<a onclick="login.submit();">
				Entrar</a>

		</div>
	</div>
	</div>
	<div class="clr"></div>
	<input type="submit" value="Entrar" style="border: 0; padding: 0; margin: 0; width: 0px; height: 0px;">
	
	
	</form>
<div class="clr"></div>
			</div>
<div class="b">
				<div class="b">
		 			<div class="b"></div>
				</div>
			</div>
		</div>
		
					<p>Ingresa un nombre de usuario y contraseña validos para acceder al Sistema.</p>
					<p>
						<a href="javascript:history.back(1)">Regresar a la Pagina Anterior</a>
					</p>
					<div id="lock"></div>
					<div class="clr"></div>
				</div>
    <div class="h_green" id="border-top">
		<div>
			<div>
				<div class="adminform">Insurance Broker Sistem By ARTEM LABS, CA</div>
			</div>
		</div>
	</div>
                <div class="b">
					<div class="b">
						<div class="b"></div>
					</div>
				</div>
			</div>
						<div class="clr"></div>
		</div>
</div>
	<div id="border-bottom"><div><div></div></div>
</div>
</body><?php
mysql_free_result($Recordset1);

mysql_free_result($Recordset2);
?>
bien sabria agradecer que me ayudaran a encontrar el problema
__________________
crear soluciones y oportunidades de desarrollo y crecimiento
  #2 (permalink)  
Antiguo 22/11/2011, 08:17
Avatar de Eleazan  
Fecha de Ingreso: abril-2008
Ubicación: Ibiza
Mensajes: 1.879
Antigüedad: 16 años
Puntos: 326
Respuesta: inicio de sesion

session_start() debe ser lo PRIMERO que tenga la página xD
__________________
>> Eleazan's Source
>> @Eleazan
  #3 (permalink)  
Antiguo 22/11/2011, 08:37
Avatar de memp500  
Fecha de Ingreso: octubre-2011
Ubicación: venezuela
Mensajes: 40
Antigüedad: 12 años, 6 meses
Puntos: 0
Respuesta: inicio de sesion

Cita:
Iniciado por Eleazan Ver Mensaje
session_start() debe ser lo PRIMERO que tenga la página xD
si ya he leido en varias partes lo que me comentas, hice el cambio puse el session stars en la parte superior de inicio.php pero sigue dando el error.
__________________
crear soluciones y oportunidades de desarrollo y crecimiento
  #4 (permalink)  
Antiguo 22/11/2011, 08:39
webankenovi
Invitado
 
Mensajes: n/a
Puntos:
Respuesta: inicio de sesion

<?php
// *** Validate request to login to this site.
if (!isset($_SESSION)) {
session_start();
}

esto esta mal seria asi
Código PHP:
Ver original
  1. <?php require_once('Connections/config.php'); ?>
  2. <?php
  3. sesion_start();
  4. if (!function_exists("GetSQLValueString")) {
  5. function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
  6. {
  7.   if (PHP_VERSION < 6) {
  8.     $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  9.   }
  10.  
  11.   $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
  12.  
  13.   switch ($theType) {
  14.     case "text":
  15.       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  16.       break;    
  17.     case "long":
  18.     case "int":
  19.       $theValue = ($theValue != "") ? intval($theValue) : "NULL";
  20.       break;
  21.     case "double":
  22.       $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
  23.       break;
  24.     case "date":
  25.       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  26.       break;
  27.     case "defined":
  28.       $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
  29.       break;
  30.   }
  31.   return $theValue;
  32. }
  33. }
  34.  
  35. mysql_select_db($database_config, $config);
  36. $query_Recordset1 = "SELECT * FROM ft_usuarios";
  37. $Recordset1 = mysql_query($query_Recordset1, $config) or die(mysql_error());
  38. $row_Recordset1 = mysql_fetch_assoc($Recordset1);
  39. $totalRows_Recordset1 = mysql_num_rows($Recordset1);
  40.  
  41. $colname_Recordset2 = "-1";
  42. if (isset($_SESSION['MM_username'])) {
  43.   $colname_Recordset2 = $_SESSION['MM_username'];
  44. }
  45. mysql_select_db($database_config, $config);
  46. $query_Recordset2 = sprintf("SELECT usuario FROM ft_usuarios WHERE usuario = %s", GetSQLValueString($colname_Recordset2, "text"));
  47. $Recordset2 = mysql_query($query_Recordset2, $config) or die(mysql_error());
  48. $row_Recordset2 = mysql_fetch_assoc($Recordset2);
  49. $totalRows_Recordset2 = mysql_num_rows($Recordset2);
  50. ?>
  51. <?php
  52. // *** Validate request to login to this site.
  53. if (!isset($_SESSION)) {
  54.  
  55. }
  56.  
  57. $loginFormAction = $_SERVER['PHP_SELF'];
  58. if (isset($_GET['accesscheck'])) {
  59.   $_SESSION['PrevUrl'] = $_GET['accesscheck'];
  60. }
  61.  
  62. if (isset($_POST['usuario'])) {
  63.   $loginUsername=$_POST['usuario'];
  64.   $password=$_POST['pass'];
  65.   $MM_fldUserAuthorization = "";
  66.   $MM_redirectLoginSuccess = "index.php?seccion=welcome";
  67.   $MM_redirectLoginFailed = "index.php?seccion=falleuser";
  68.   $MM_redirecttoReferrer = false;
  69.   mysql_select_db($database_config, $config);
  70.  
  71.   $LoginRS__query=sprintf("SELECT usuario, pass FROM ft_usuarios WHERE usuario=%s AND pass=%s",
  72.     GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text"));
  73.    
  74.   $LoginRS = mysql_query($LoginRS__query, $config) or die(mysql_error());
  75.   $loginFoundUser = mysql_num_rows($LoginRS);
  76.   if ($loginFoundUser) {
  77.      $loginStrGroup = "";
  78.    
  79.     //declare two session variables and assign them
  80.     $_SESSION['MM_Username'] = $loginUsername;
  81.     $_SESSION['MM_UserGroup'] = $loginStrGroup;      
  82.  
  83.     if (isset($_SESSION['PrevUrl']) && false) {
  84.       $MM_redirectLoginSuccess = $_SESSION['PrevUrl']; 
  85.     }
  86.     header("Location: " . $MM_redirectLoginSuccess );
  87.   }
  88.   else {
  89.     header("Location: ". $MM_redirectLoginFailed );
  90.   }
  91. }
  92. ?>
  93. <div id="content-box">
  94.         <div class="padding">
  95.             <div class="login" id="element-box">
  96.                 <div class="t">
  97.                     <div class="t">
  98.                         <div class="t"></div>
  99.                     </div>
  100.                 </div>
  101.                 <div class="m">
  102.  
  103.                     <h1>Ingreso de Usuarios Registrados</h1>
  104.                    
  105.                             <div id="section-box">
  106.             <div class="t">
  107.                 <div class="t">
  108.                     <div class="t"></div>
  109.                 </div>
  110.             </div>
  111.             <div class="m">
  112.                 <form ACTION="<?php echo $loginFormAction; ?>" style="clear: both;" id="form-login" name="login" method="POST">
  113.     <p id="form-login-username">
  114.         <label for="modlgn_username">Usuario</label>
  115.         <input type="text" size="15" class="inputbox" id="modlgn_username" name="usuario">
  116.     </p>
  117.  
  118.     <p id="form-login-password">
  119.         <label for="modlgn_passwd">Contraseña</label>
  120.         <input type="password" size="15" class="inputbox" id="modlgn_passwd" name="pass">
  121.     </p>
  122.         <p style="clear: both;" id="form-login-lang">
  123.        
  124.     <div class="button_holder">
  125.     <div class="button1">
  126.         <div class="next">
  127.             <a onclick="login.submit();">
  128.                 Entrar</a>
  129.  
  130.         </div>
  131.     </div>
  132.     </div>
  133.     <div class="clr"></div>
  134.     <input type="submit" value="Entrar" style="border: 0; padding: 0; margin: 0; width: 0px; height: 0px;">
  135.    
  136.    
  137.     </form>
  138. <div class="clr"></div>
  139.             </div>
  140. <div class="b">
  141.                 <div class="b">
  142.                     <div class="b"></div>
  143.                 </div>
  144.             </div>
  145.         </div>
  146.        
  147.                     <p>Ingresa un nombre de usuario y contraseña validos para acceder al Sistema.</p>
  148.                     <p>
  149.                         <a href="javascript:history.back(1)">Regresar a la Pagina Anterior</a>
  150.                     </p>
  151.                     <div id="lock"></div>
  152.                     <div class="clr"></div>
  153.                 </div>
  154.     <div class="h_green" id="border-top">
  155.         <div>
  156.             <div>
  157.                 <div class="adminform">Insurance Broker Sistem By ARTEM LABS, CA</div>
  158.             </div>
  159.         </div>
  160.     </div>
  161.                 <div class="b">
  162.                     <div class="b">
  163.                         <div class="b"></div>
  164.                     </div>
  165.                 </div>
  166.             </div>
  167.                         <div class="clr"></div>
  168.         </div>
  169. </div>
  170.     <div id="border-bottom"><div><div></div></div>
  171. </div>
  172. </body><?php
  173. mysql_free_result($Recordset1);
  174.  
  175. mysql_free_result($Recordset2);
  176. ?>

sessioin_start() siempre antes de verificar una sesion
  #5 (permalink)  
Antiguo 22/11/2011, 08:50
Avatar de memp500  
Fecha de Ingreso: octubre-2011
Ubicación: venezuela
Mensajes: 40
Antigüedad: 12 años, 6 meses
Puntos: 0
Respuesta: inicio de sesion

Cita:
Iniciado por webankenovi Ver Mensaje
<?php
// *** Validate request to login to this site.
if (!isset($_SESSION)) {
session_start();
}

esto esta mal seria asi
Código PHP:
Ver original
  1. <?php require_once('Connections/config.php'); ?>
  2. <?php
  3. sesion_start();
  4. if (!function_exists("GetSQLValueString")) {
  5. function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
  6. {
  7.   if (PHP_VERSION < 6) {
  8.     $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  9.   }
  10.  
  11.   $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
  12.  
  13.   switch ($theType) {
  14.     case "text":
  15.       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  16.       break;    
  17.     case "long":
  18.     case "int":
  19.       $theValue = ($theValue != "") ? intval($theValue) : "NULL";
  20.       break;
  21.     case "double":
  22.       $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
  23.       break;
  24.     case "date":
  25.       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  26.       break;
  27.     case "defined":
  28.       $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
  29.       break;
  30.   }
  31.   return $theValue;
  32. }
  33. }
  34.  
  35. mysql_select_db($database_config, $config);
  36. $query_Recordset1 = "SELECT * FROM ft_usuarios";
  37. $Recordset1 = mysql_query($query_Recordset1, $config) or die(mysql_error());
  38. $row_Recordset1 = mysql_fetch_assoc($Recordset1);
  39. $totalRows_Recordset1 = mysql_num_rows($Recordset1);
  40.  
  41. $colname_Recordset2 = "-1";
  42. if (isset($_SESSION['MM_username'])) {
  43.   $colname_Recordset2 = $_SESSION['MM_username'];
  44. }
  45. mysql_select_db($database_config, $config);
  46. $query_Recordset2 = sprintf("SELECT usuario FROM ft_usuarios WHERE usuario = %s", GetSQLValueString($colname_Recordset2, "text"));
  47. $Recordset2 = mysql_query($query_Recordset2, $config) or die(mysql_error());
  48. $row_Recordset2 = mysql_fetch_assoc($Recordset2);
  49. $totalRows_Recordset2 = mysql_num_rows($Recordset2);
  50. ?>
  51. <?php
  52. // *** Validate request to login to this site.
  53. if (!isset($_SESSION)) {
  54.  
  55. }
  56.  
  57. $loginFormAction = $_SERVER['PHP_SELF'];
  58. if (isset($_GET['accesscheck'])) {
  59.   $_SESSION['PrevUrl'] = $_GET['accesscheck'];
  60. }
  61.  
  62. if (isset($_POST['usuario'])) {
  63.   $loginUsername=$_POST['usuario'];
  64.   $password=$_POST['pass'];
  65.   $MM_fldUserAuthorization = "";
  66.   $MM_redirectLoginSuccess = "index.php?seccion=welcome";
  67.   $MM_redirectLoginFailed = "index.php?seccion=falleuser";
  68.   $MM_redirecttoReferrer = false;
  69.   mysql_select_db($database_config, $config);
  70.  
  71.   $LoginRS__query=sprintf("SELECT usuario, pass FROM ft_usuarios WHERE usuario=%s AND pass=%s",
  72.     GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text"));
  73.    
  74.   $LoginRS = mysql_query($LoginRS__query, $config) or die(mysql_error());
  75.   $loginFoundUser = mysql_num_rows($LoginRS);
  76.   if ($loginFoundUser) {
  77.      $loginStrGroup = "";
  78.    
  79.     //declare two session variables and assign them
  80.     $_SESSION['MM_Username'] = $loginUsername;
  81.     $_SESSION['MM_UserGroup'] = $loginStrGroup;      
  82.  
  83.     if (isset($_SESSION['PrevUrl']) && false) {
  84.       $MM_redirectLoginSuccess = $_SESSION['PrevUrl']; 
  85.     }
  86.     header("Location: " . $MM_redirectLoginSuccess );
  87.   }
  88.   else {
  89.     header("Location: ". $MM_redirectLoginFailed );
  90.   }
  91. }
  92. ?>
  93. <div id="content-box">
  94.         <div class="padding">
  95.             <div class="login" id="element-box">
  96.                 <div class="t">
  97.                     <div class="t">
  98.                         <div class="t"></div>
  99.                     </div>
  100.                 </div>
  101.                 <div class="m">
  102.  
  103.                     <h1>Ingreso de Usuarios Registrados</h1>
  104.                    
  105.                             <div id="section-box">
  106.             <div class="t">
  107.                 <div class="t">
  108.                     <div class="t"></div>
  109.                 </div>
  110.             </div>
  111.             <div class="m">
  112.                 <form ACTION="<?php echo $loginFormAction; ?>" style="clear: both;" id="form-login" name="login" method="POST">
  113.     <p id="form-login-username">
  114.         <label for="modlgn_username">Usuario</label>
  115.         <input type="text" size="15" class="inputbox" id="modlgn_username" name="usuario">
  116.     </p>
  117.  
  118.     <p id="form-login-password">
  119.         <label for="modlgn_passwd">Contraseña</label>
  120.         <input type="password" size="15" class="inputbox" id="modlgn_passwd" name="pass">
  121.     </p>
  122.         <p style="clear: both;" id="form-login-lang">
  123.        
  124.     <div class="button_holder">
  125.     <div class="button1">
  126.         <div class="next">
  127.             <a onclick="login.submit();">
  128.                 Entrar</a>
  129.  
  130.         </div>
  131.     </div>
  132.     </div>
  133.     <div class="clr"></div>
  134.     <input type="submit" value="Entrar" style="border: 0; padding: 0; margin: 0; width: 0px; height: 0px;">
  135.    
  136.    
  137.     </form>
  138. <div class="clr"></div>
  139.             </div>
  140. <div class="b">
  141.                 <div class="b">
  142.                     <div class="b"></div>
  143.                 </div>
  144.             </div>
  145.         </div>
  146.        
  147.                     <p>Ingresa un nombre de usuario y contraseña validos para acceder al Sistema.</p>
  148.                     <p>
  149.                         <a href="javascript:history.back(1)">Regresar a la Pagina Anterior</a>
  150.                     </p>
  151.                     <div id="lock"></div>
  152.                     <div class="clr"></div>
  153.                 </div>
  154.     <div class="h_green" id="border-top">
  155.         <div>
  156.             <div>
  157.                 <div class="adminform">Insurance Broker Sistem By ARTEM LABS, CA</div>
  158.             </div>
  159.         </div>
  160.     </div>
  161.                 <div class="b">
  162.                     <div class="b">
  163.                         <div class="b"></div>
  164.                     </div>
  165.                 </div>
  166.             </div>
  167.                         <div class="clr"></div>
  168.         </div>
  169. </div>
  170.     <div id="border-bottom"><div><div></div></div>
  171. </div>
  172. </body><?php
  173. mysql_free_result($Recordset1);
  174.  
  175. mysql_free_result($Recordset2);
  176. ?>

sessioin_start() siempre antes de verificar una sesion
lo hice como dices pero sigue dando el mismo error :(
__________________
crear soluciones y oportunidades de desarrollo y crecimiento
  #6 (permalink)  
Antiguo 22/11/2011, 08:52
webankenovi
Invitado
 
Mensajes: n/a
Puntos:
Respuesta: inicio de sesion

sesion_start() debe estar antes de cualquier isset de session pero solo una vez , si esto no es tu problema pon el error que te marca y la linea donde te da el error y haber si lo solucionamos

Última edición por webankenovi; 22/11/2011 a las 08:59
  #7 (permalink)  
Antiguo 22/11/2011, 09:06
webankenovi
Invitado
 
Mensajes: n/a
Puntos:
Respuesta: inicio de sesion

Código PHP:
Ver original
  1. <?php session_start();
  2. require_once('Connections/config.php');
  3.  
  4. if (!function_exists("GetSQLValueString")) {
  5. function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
  6. {
  7.   if (PHP_VERSION < 6) {
  8.     $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  9.   }
  10.  
  11.   $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
  12.  
  13.   switch ($theType) {
  14.     case "text":
  15.       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  16.       break;    
  17.     case "long":
  18.     case "int":
  19.       $theValue = ($theValue != "") ? intval($theValue) : "NULL";
  20.       break;
  21.     case "double":
  22.       $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
  23.       break;
  24.     case "date":
  25.       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  26.       break;
  27.     case "defined":
  28.       $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
  29.       break;
  30.   }
  31.   return $theValue;
  32. }
  33. }
  34.  
  35. mysql_select_db($database_config, $config);
  36. $query_Recordset1 = "SELECT * FROM ft_usuarios";
  37. $Recordset1 = mysql_query($query_Recordset1) or die(mysql_error());
  38. $row_Recordset1 = mysql_fetch_assoc($Recordset1);
  39. $totalRows_Recordset1 = mysql_num_rows($Recordset1);
  40.  
  41. $colname_Recordset2 = "-1";
  42. if (isset($_SESSION['MM_username'])) {
  43.   $colname_Recordset2 = $_SESSION['MM_username'];
  44. }
  45. mysql_select_db($database_config, $config);
  46. $query_Recordset2 = sprintf("SELECT usuario FROM ft_usuarios WHERE usuario = %s", GetSQLValueString($colname_Recordset2, "text"));
  47. $Recordset2 = mysql_query($query_Recordset2) or die (mysql_error());
  48. $row_Recordset2 = mysql_fetch_assoc($Recordset2);
  49. $totalRows_Recordset2 = mysql_num_rows($Recordset2);
  50.  
  51. // *** Validate request to login to this site.
  52. if (!isset($_SESSION)) {
  53.  
  54. }
  55.  
  56. $loginFormAction = $_SERVER['PHP_SELF'];
  57. if (isset($_GET['accesscheck'])) {
  58.   $_SESSION['PrevUrl'] = $_GET['accesscheck'];
  59. }
  60.  
  61. if (isset($_POST['usuario'])) {
  62.   $loginUsername=$_POST['usuario'];
  63.   $password=$_POST['pass'];
  64.   $MM_fldUserAuthorization = "";
  65.   $MM_redirectLoginSuccess = "index.php?seccion=welcome";
  66.   $MM_redirectLoginFailed = "index.php?seccion=falleuser";
  67.   $MM_redirecttoReferrer = false;
  68.   mysql_select_db($database_config, $config);
  69.  
  70.   $LoginRS__query=sprintf("SELECT usuario, pass FROM ft_usuarios WHERE usuario=%s AND pass=%s",
  71.     GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text"));
  72.    
  73.   $LoginRS = mysql_query($LoginRS__query, $config) or die(mysql_error());
  74.   $loginFoundUser = mysql_num_rows($LoginRS);
  75.   if ($loginFoundUser) {
  76.      $loginStrGroup = "";
  77.    
  78.     //declare two session variables and assign them
  79.     $_SESSION['MM_Username'] = $loginUsername;
  80.     $_SESSION['MM_UserGroup'] = $loginStrGroup;      
  81.  
  82.     if (isset($_SESSION['PrevUrl']) && false) {
  83.       $MM_redirectLoginSuccess = $_SESSION['PrevUrl']; 
  84.     }
  85.     header("Location: " . $MM_redirectLoginSuccess );
  86.   }
  87.   else {
  88.     header("Location: ". $MM_redirectLoginFailed );
  89.   }
  90. }
  91. ?>
  92. <div id="content-box">
  93.         <div class="padding">
  94.             <div class="login" id="element-box">
  95.                 <div class="t">
  96.                     <div class="t">
  97.                         <div class="t"></div>
  98.                     </div>
  99.                 </div>
  100.                 <div class="m">
  101.  
  102.                     <h1>Ingreso de Usuarios Registrados</h1>
  103.                    
  104.                             <div id="section-box">
  105.             <div class="t">
  106.                 <div class="t">
  107.                     <div class="t"></div>
  108.                 </div>
  109.             </div>
  110.             <div class="m">
  111.                 <form ACTION="<?php echo $loginFormAction; ?>" style="clear: both;" id="form-login" name="login" method="POST">
  112.     <p id="form-login-username">
  113.         <label for="modlgn_username">Usuario</label>
  114.         <input type="text" size="15" class="inputbox" id="modlgn_username" name="usuario">
  115.     </p>
  116.  
  117.     <p id="form-login-password">
  118.         <label for="modlgn_passwd">Contraseña</label>
  119.         <input type="password" size="15" class="inputbox" id="modlgn_passwd" name="pass">
  120.     </p>
  121.         <p style="clear: both;" id="form-login-lang">
  122.        
  123.     <div class="button_holder">
  124.     <div class="button1">
  125.         <div class="next">
  126.             <a onclick="login.submit();">
  127.                 Entrar</a>
  128.  
  129.         </div>
  130.     </div>
  131.     </div>
  132.     <div class="clr"></div>
  133.     <input type="submit" value="Entrar" style="border: 0; padding: 0; margin: 0; width: 0px; height: 0px;">
  134.    
  135.    
  136.     </form>
  137. <div class="clr"></div>
  138.             </div>
  139. <div class="b">
  140.                 <div class="b">
  141.                     <div class="b"></div>
  142.                 </div>
  143.             </div>
  144.         </div>
  145.        
  146.                     <p>Ingresa un nombre de usuario y contraseña validos para acceder al Sistema.</p>
  147.                     <p>
  148.                         <a href="javascript:history.back(1)">Regresar a la Pagina Anterior</a>
  149.                     </p>
  150.                     <div id="lock"></div>
  151.                     <div class="clr"></div>
  152.                 </div>
  153.     <div class="h_green" id="border-top">
  154.         <div>
  155.             <div>
  156.                 <div class="adminform">Insurance Broker Sistem By ARTEM LABS, CA</div>
  157.             </div>
  158.         </div>
  159.     </div>
  160.                 <div class="b">
  161.                     <div class="b">
  162.                         <div class="b"></div>
  163.                     </div>
  164.                 </div>
  165.             </div>
  166.                         <div class="clr"></div>
  167.         </div>
  168. </div>
  169. <div id="border-bottom"><div><div></div></div>
  170. </div>
  171. </body><?php
  172. mysql_free_result($Recordset1);
  173.  
  174. mysql_free_result($Recordset2);
  175. ?>
  #8 (permalink)  
Antiguo 22/11/2011, 14:37
Avatar de memp500  
Fecha de Ingreso: octubre-2011
Ubicación: venezuela
Mensajes: 40
Antigüedad: 12 años, 6 meses
Puntos: 0
Respuesta: inicio de sesion

lo he echo como dices y nada sigue apareciendo el error solo que en la linea 2 donde esta el session star()
__________________
crear soluciones y oportunidades de desarrollo y crecimiento
  #9 (permalink)  
Antiguo 22/11/2011, 14:39
webankenovi
Invitado
 
Mensajes: n/a
Puntos:
Respuesta: inicio de sesion

pon el error y el codigo de la linea que falla
  #10 (permalink)  
Antiguo 22/11/2011, 14:51
Avatar de memp500  
Fecha de Ingreso: octubre-2011
Ubicación: venezuela
Mensajes: 40
Antigüedad: 12 años, 6 meses
Puntos: 0
Respuesta: inicio de sesion

Error:
Código HTML:
Ver original
  1. Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/sidarco/public_html/intranet/cover/header.php:4) in /home/sidarco/public_html/intranet/sec/inicio.php on line 2
  2.  
  3. Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/sidarco/public_html/intranet/cover/header.php:4) in /home/sidarco/public_html/intranet/sec/inicio.php on line 2

Codigo:
INICIO.PHP
Código PHP:
Ver original
  1. <?php
  2. require_once('Connections/config.php'); ?>
  3. <?php
  4. if (!function_exists("GetSQLValueString")) {
  5. function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
  6. {
  7.   if (PHP_VERSION < 6) {
  8.     $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  9.   }
  10.  
  11.   $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
  12.  
  13.   switch ($theType) {
  14.     case "text":
  15.       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  16.       break;    
  17.     case "long":
  18.     case "int":
  19.       $theValue = ($theValue != "") ? intval($theValue) : "NULL";
  20.       break;
  21.     case "double":
  22.       $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
  23.       break;
  24.     case "date":
  25.       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  26.       break;
  27.     case "defined":
  28.       $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
  29.       break;
  30.   }
  31.   return $theValue;
  32. }
  33. }
  34.  
  35. mysql_select_db($database_config, $config);
  36. $query_Recordset1 = "SELECT * FROM FT_USUARIOS";
  37. $Recordset1 = mysql_query($query_Recordset1, $config) or die(mysql_error());
  38. $row_Recordset1 = mysql_fetch_assoc($Recordset1);
  39. $totalRows_Recordset1 = mysql_num_rows($Recordset1);
  40.  
  41. $colname_Recordset2 = "-1";
  42. if (isset($_SESSION['MM_username'])) {
  43.   $colname_Recordset2 = $_SESSION['MM_username'];
  44. }
  45. mysql_select_db($database_config, $config);
  46. $query_Recordset2 = sprintf("SELECT usuario FROM FT_USUARIOS WHERE usuario = %s", GetSQLValueString($colname_Recordset2, "text"));
  47. $Recordset2 = mysql_query($query_Recordset2, $config) or die(mysql_error());
  48. $row_Recordset2 = mysql_fetch_assoc($Recordset2);
  49. $totalRows_Recordset2 = mysql_num_rows($Recordset2);
  50. ?>
  51. <?php
  52.     // *** Validate request to login to this site.
  53.     if (!isset($_SESSION)) {
  54.     }
  55.  
  56. $loginFormAction = $_SERVER['PHP_SELF'];
  57. if (isset($_GET['accesscheck'])) {
  58.   $_SESSION['PrevUrl'] = $_GET['accesscheck'];
  59. }
  60.  
  61. if (isset($_POST['usuario'])) {
  62.   $loginUsername=$_POST['usuario'];
  63.   $password=$_POST['pass'];
  64.   $MM_fldUserAuthorization = "";
  65.   $MM_redirectLoginSuccess = "index.php?seccion=welcome";
  66.   $MM_redirectLoginFailed = "index.php?seccion=falleuser";
  67.   $MM_redirecttoReferrer = false;
  68.   mysql_select_db($database_config, $config);
  69.  
  70.   $LoginRS__query=sprintf("SELECT id_cliente, primer_apellido FROM ft_clientes WHERE id_cliente=%s AND primer_apellido=%s",
  71.     GetSQLValueString($loginUsername, "int"), GetSQLValueString($password, "text"));
  72.    
  73.   $LoginRS = mysql_query($LoginRS__query, $config) or die(mysql_error());
  74.   $loginFoundUser = mysql_num_rows($LoginRS);
  75.   if ($loginFoundUser) {
  76.      $loginStrGroup = "";
  77.    
  78.     //declare two session variables and assign them
  79.     $_SESSION['MM_Username'] = $loginUsername;
  80.     $_SESSION['MM_UserGroup'] = $loginStrGroup;      
  81.  
  82.     if (isset($_SESSION['PrevUrl']) && false) {
  83.       $MM_redirectLoginSuccess = $_SESSION['PrevUrl']; 
  84.     }
  85.     header("Location: " . $MM_redirectLoginSuccess );
  86.   }
  87.   else {
  88.     header("Location: ". $MM_redirectLoginFailed );
  89.   }
  90. }
  91. ?>
  92. <div id="content-box">
  93.         <div class="padding">
  94.             <div class="login" id="element-box">
  95.                 <div class="t">
  96.                     <div class="t">
  97.                         <div class="t"></div>
  98.                     </div>
  99.                 </div>
  100.                 <div class="m">
  101.  
  102.                     <h1>Ingreso de Usuarios Registrados</h1>
  103.                    
  104.                             <div id="section-box">
  105.             <div class="t">
  106.                 <div class="t">
  107.                     <div class="t"></div>
  108.                 </div>
  109.             </div>
  110.             <div class="m">
  111.                 <form ACTION="<?php echo $loginFormAction; ?>" style="clear: both;" id="form-login" name="login" method="POST">
  112.     <p id="form-login-username">
  113.         <label for="modlgn_username">Usuario</label>
  114.         <input type="text" size="15" class="inputbox" id="modlgn_username" name="usuario">
  115.     </p>
  116.  
  117.     <p id="form-login-password">
  118.         <label for="modlgn_passwd">Contraseña</label>
  119.         <input type="password" size="15" class="inputbox" id="modlgn_passwd" name="pass">
  120.     </p>
  121.         <p style="clear: both;" id="form-login-lang">
  122.        
  123.     <div class="button_holder">
  124.     <div class="button1">
  125.         <div class="next">
  126.             <a onclick="login.submit();">
  127.                 Entrar</a>
  128.  
  129.         </div>
  130.     </div>
  131.     </div>
  132.     <div class="clr"></div>
  133.     <input type="submit" value="Entrar" style="border: 0; padding: 0; margin: 0; width: 0px; height: 0px;">
  134.    
  135.    
  136.     </form>
  137. <div class="clr"></div>
  138.             </div>
  139. <div class="b">
  140.                 <div class="b">
  141.                     <div class="b"></div>
  142.                 </div>
  143.             </div>
  144.         </div>
  145.        
  146.                     <p>Ingresa un nombre de usuario y contraseña validos para acceder al Sistema.</p>
  147.                     <p>
  148.                         <a href="javascript:history.back(1)">Regresar a la Pagina Anterior</a>
  149.                     </p>
  150.                     <div id="lock"></div>
  151.                     <div class="clr"></div>
  152.                 </div>
  153.     <div class="h_green" id="border-top">
  154.         <div>
  155.             <div>
  156.                 <div class="adminform">Insurance Broker Sistem By ARTEM LABS, CA</div>
  157.             </div>
  158.         </div>
  159.     </div>
  160.                 <div class="b">
  161.                     <div class="b">
  162.                         <div class="b"></div>
  163.                     </div>
  164.                 </div>
  165.             </div>
  166.                         <div class="clr"></div>
  167.         </div>
  168. </div>
  169.     <div id="border-bottom"><div><div></div></div>
  170. </div>
  171. </body><?php
  172. mysql_free_result($Recordset1);
  173.  
  174. mysql_free_result($Recordset2);
  175. ?>
__________________
crear soluciones y oportunidades de desarrollo y crecimiento
  #11 (permalink)  
Antiguo 22/11/2011, 14:51
webankenovi
Invitado
 
Mensajes: n/a
Puntos:
Respuesta: inicio de sesion

prueba esto y si falla me pones los errores o si kieres ponme los errores de tu codigo y el codigo de donde falla y haber si lo solucionamos
Código PHP:
Ver original
  1. <?php session_start();
  2.     require_once('Connections/config.php');
  3.     $loginFormAction = $_SERVER['PHP_SELF'];
  4.     if (!function_exists("GetSQLValueString")) {
  5.     function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
  6.     {
  7.       if (PHP_VERSION < 6) {
  8.         $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  9.       }
  10.      
  11.       $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
  12.      
  13.       switch ($theType) {
  14.         case "text":
  15.           $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  16.           break;    
  17.         case "long":
  18.         case "int":
  19.           $theValue = ($theValue != "") ? intval($theValue) : "NULL";
  20.           break;
  21.         case "double":
  22.           $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
  23.           break;
  24.         case "date":
  25.           $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  26.           break;
  27.         case "defined":
  28.           $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
  29.           break;
  30.       }
  31.       return $theValue;
  32.     }
  33.     }
  34.      
  35.     mysql_select_db($database_config);
  36.     $query_Recordset1 = "SELECT * FROM ft_usuarios";
  37.     $Recordset1 = mysql_query($query_Recordset1,$config) or die(mysql_error());
  38.     $Recordset1_results = mysql_fetch_array($Recordset1) ;
  39.     mysql_free_result($Recordset1) ;
  40.      
  41.     $colname_Recordset2 = "-1";
  42.     if (isset($_SESSION['MM_username'])) {
  43.       $colname_Recordset2 = $_SESSION['MM_username'];
  44.     }
  45.     mysql_select_db($database_config);
  46.     $query_Recordset2 = sprintf("SELECT usuario FROM ft_usuarios WHERE usuario = %s", GetSQLValueString($colname_Recordset2, "text"));
  47.     $Recordset2 = mysql_query($query_Recordset2) or die (mysql_error());
  48.     $Recordset2_results = mysql_fetch_array($Recordset2) ;
  49.     mysql_free_result($Recordset2) ;
  50.      
  51.     // *** Validate request to login to this site.
  52.     if (!isset($_SESSION)) {
  53.      
  54.    echo 'esto para que lo kieres usar????';
  55.    
  56.    
  57.     }
  58.      
  59.  
  60.     if (isset($_GET['accesscheck'])) {
  61.       $_SESSION['PrevUrl'] = $_GET['accesscheck'];
  62.     }
  63.      
  64.     if (isset($_POST['usuario'])) {
  65.       $loginUsername=$_POST['usuario'];
  66.       $password=$_POST['pass'];
  67.       $MM_fldUserAuthorization = "";
  68.       $MM_redirectLoginSuccess = "index.php?seccion=welcome";
  69.       $MM_redirectLoginFailed = "index.php?seccion=falleuser";
  70.       $MM_redirecttoReferrer = false;
  71.      
  72.       mysql_select_db($database_config);
  73.       $LoginRS__query=sprintf("SELECT usuario, pass FROM ft_usuarios WHERE usuario='%s' AND pass='%s'",
  74.         GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text"));
  75.        
  76.       $LoginRS = mysql_query($LoginRS__query, $config) or die(mysql_error());
  77.       $loginFoundUser = mysql_num_rows($LoginRS);
  78.       if ($loginFoundUser) {
  79.          $loginStrGroup = "";
  80.        
  81.         //declare two session variables and assign them
  82.         $_SESSION['MM_Username'] = $loginUsername;
  83.         $_SESSION['MM_UserGroup'] = $loginStrGroup;      
  84.      
  85.         if (isset($_SESSION['PrevUrl']) && false) {
  86.           $MM_redirectLoginSuccess = $_SESSION['PrevUrl'];
  87.         }
  88.         header("Location: " . $MM_redirectLoginSuccess );
  89.       }
  90.       else {
  91.         header("Location: ". $MM_redirectLoginFailed );
  92.       }
  93.     }
  94.     ?>
  95.     <div id="content-box">
  96.             <div class="padding">
  97.                 <div class="login" id="element-box">
  98.                     <div class="t">
  99.                         <div class="t">
  100.                             <div class="t"></div>
  101.                         </div>
  102.                     </div>
  103.                     <div class="m">
  104.      
  105.                         <h1>Ingreso de Usuarios Registrados</h1>
  106.                        
  107.                                 <div id="section-box">
  108.                 <div class="t">
  109.                     <div class="t">
  110.                         <div class="t"></div>
  111.                     </div>
  112.                 </div>
  113.                 <div class="m">
  114.                     <form ACTION="<?php echo $loginFormAction; ?>" style="clear: both;" id="form-login" name="login" method="POST">
  115.         <p id="form-login-username">
  116.             <label for="modlgn_username">Usuario</label>
  117.             <input type="text" size="15" class="inputbox" id="modlgn_username" name="usuario">
  118.         </p>
  119.      
  120.         <p id="form-login-password">
  121.             <label for="modlgn_passwd">Contraseña</label>
  122.             <input type="password" size="15" class="inputbox" id="modlgn_passwd" name="pass">
  123.         </p>
  124.             <p style="clear: both;" id="form-login-lang">
  125.            
  126.         <div class="button_holder">
  127.         <div class="button1">
  128.             <div class="next">
  129.                 <a onclick="login.submit();">
  130.                     Entrar</a>
  131.      
  132.             </div>
  133.         </div>
  134.         </div>
  135.         <div class="clr"></div>
  136.         <input type="submit" value="Entrar" style="border: 0; padding: 0; margin: 0; width: 0px; height: 0px;">
  137.        
  138.        
  139.         </form>
  140.     <div class="clr"></div>
  141.                 </div>
  142.     <div class="b">
  143.                     <div class="b">
  144.                         <div class="b"></div>
  145.                     </div>
  146.                 </div>
  147.             </div>
  148.            
  149.                         <p>Ingresa un nombre de usuario y contraseña validos para acceder al Sistema.</p>
  150.                         <p>
  151.                             <a href="javascript:history.back(1)">Regresar a la Pagina Anterior</a>
  152.                         </p>
  153.                         <div id="lock"></div>
  154.                         <div class="clr"></div>
  155.                     </div>
  156.         <div class="h_green" id="border-top">
  157.             <div>
  158.                 <div>
  159.                     <div class="adminform">Insurance Broker Sistem By ARTEM LABS, CA</div>
  160.                 </div>
  161.             </div>
  162.         </div>
  163.                     <div class="b">
  164.                         <div class="b">
  165.                             <div class="b"></div>
  166.                         </div>
  167.                     </div>
  168.                 </div>
  169.                             <div class="clr"></div>
  170.             </div>
  171.     </div>
  172.     <div id="border-bottom"><div><div></div></div>
  173.     </div>
  174.     </body>
  #12 (permalink)  
Antiguo 22/11/2011, 14:54
webankenovi
Invitado
 
Mensajes: n/a
Puntos:
Respuesta: inicio de sesion

esos errores pueden ser causados por espacion en blanco antes de <? o de session_start() puede ser eso limpia el codigo de espacios y prueba haber
  #13 (permalink)  
Antiguo 22/11/2011, 14:54
Avatar de memp500  
Fecha de Ingreso: octubre-2011
Ubicación: venezuela
Mensajes: 40
Antigüedad: 12 años, 6 meses
Puntos: 0
Respuesta: inicio de sesion

sale el mismo error solo que en linea 1

Código HTML:
Ver original
  1. Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/sidarco/public_html/intranet/cover/header.php:4) in /home/sidarco/public_html/intranet/sec/inicio.php on line 1
  2.  
  3. Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/sidarco/public_html/intranet/cover/header.php:4) in /home/sidarco/public_html/intranet/sec/inicio.php on line 1

de todas maneras si quieres te envio todas las partes de la web para que veas bien todo el codigo o si puedes recomiendame agun otro metodo para que funciones sin tener estos errores.

lo raro es que en localhost funciona correctamente y no muestra errores
__________________
crear soluciones y oportunidades de desarrollo y crecimiento
  #14 (permalink)  
Antiguo 22/11/2011, 14:57
webankenovi
Invitado
 
Mensajes: n/a
Puntos:
Respuesta: inicio de sesion

has probado a limpiar los espacios en blanco como te dije??
  #15 (permalink)  
Antiguo 22/11/2011, 15:01
Avatar de memp500  
Fecha de Ingreso: octubre-2011
Ubicación: venezuela
Mensajes: 40
Antigüedad: 12 años, 6 meses
Puntos: 0
Respuesta: inicio de sesion

si listo revise el codigo no hay espacios en blanco antes de <? o se session
__________________
crear soluciones y oportunidades de desarrollo y crecimiento
  #16 (permalink)  
Antiguo 22/11/2011, 15:01
webankenovi
Invitado
 
Mensajes: n/a
Puntos:
Respuesta: inicio de sesion

y el archivo cover/header.php q ay ay?

"Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/sidarco/public_html/intranet/cover/header.php:4) in /home/sidarco/public_html/intranet/sec/inicio.php on line 37"
  #17 (permalink)  
Antiguo 22/11/2011, 15:06
Avatar de memp500  
Fecha de Ingreso: octubre-2011
Ubicación: venezuela
Mensajes: 40
Antigüedad: 12 años, 6 meses
Puntos: 0
Respuesta: inicio de sesion

cual principio?????????? quitando session star()?

si era asi quite session star y no sale el error
__________________
crear soluciones y oportunidades de desarrollo y crecimiento
  #18 (permalink)  
Antiguo 22/11/2011, 15:07
webankenovi
Invitado
 
Mensajes: n/a
Puntos:
Respuesta: inicio de sesion

ya te funciona bien dices?? confirma!!
  #19 (permalink)  
Antiguo 22/11/2011, 15:22
Avatar de memp500  
Fecha de Ingreso: octubre-2011
Ubicación: venezuela
Mensajes: 40
Antigüedad: 12 años, 6 meses
Puntos: 0
Respuesta: inicio de sesion

no sale el error en inicio.php pero al loguearse con usuario y contraseña no redirige la pagina se queda en inicio.php y arroja el siguiente error:

Código HTML:
Ver original
  1. Warning: Cannot modify header information - headers already sent by (output started at /home/sidarco/public_html/intranet/cover/header.php:4) in /home/sidarco/public_html/intranet/sec/inicio.php on line 84
__________________
crear soluciones y oportunidades de desarrollo y crecimiento
  #20 (permalink)  
Antiguo 22/11/2011, 15:27
webankenovi
Invitado
 
Mensajes: n/a
Puntos:
Respuesta: inicio de sesion

ponme el codigo completo de inicio tal y como lo tienes ahora y marca en rojo la linea 84 solo tienes ese error no linea 84??
  #21 (permalink)  
Antiguo 22/11/2011, 15:30
Avatar de memp500  
Fecha de Ingreso: octubre-2011
Ubicación: venezuela
Mensajes: 40
Antigüedad: 12 años, 6 meses
Puntos: 0
Respuesta: inicio de sesion

Código PHP:
Ver original
  1. <?php require_once('Connections/config.php'); ?>
  2. <?php
  3. if (!function_exists("GetSQLValueString")) {
  4. function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
  5. {
  6.   if (PHP_VERSION < 6) {
  7.     $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  8.   }
  9.  
  10.   $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
  11.  
  12.   switch ($theType) {
  13.     case "text":
  14.       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  15.       break;    
  16.     case "long":
  17.     case "int":
  18.       $theValue = ($theValue != "") ? intval($theValue) : "NULL";
  19.       break;
  20.     case "double":
  21.       $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
  22.       break;
  23.     case "date":
  24.       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  25.       break;
  26.     case "defined":
  27.       $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
  28.       break;
  29.   }
  30.   return $theValue;
  31. }
  32. }
  33.  
  34. mysql_select_db($database_config, $config);
  35. $query_Recordset1 = "SELECT * FROM FT_USUARIOS";
  36. $Recordset1 = mysql_query($query_Recordset1, $config) or die(mysql_error());
  37. $row_Recordset1 = mysql_fetch_assoc($Recordset1);
  38. $totalRows_Recordset1 = mysql_num_rows($Recordset1);
  39.  
  40. $colname_Recordset2 = "-1";
  41. if (isset($_SESSION['MM_username'])) {
  42.   $colname_Recordset2 = $_SESSION['MM_username'];
  43. }
  44. mysql_select_db($database_config, $config);
  45. $query_Recordset2 = sprintf("SELECT usuario FROM FT_USUARIOS WHERE usuario = %s", GetSQLValueString($colname_Recordset2, "text"));
  46. $Recordset2 = mysql_query($query_Recordset2, $config) or die(mysql_error());
  47. $row_Recordset2 = mysql_fetch_assoc($Recordset2);
  48. $totalRows_Recordset2 = mysql_num_rows($Recordset2);
  49. ?>
  50. <?php
  51. // *** Validate request to login to this site.
  52. if (!isset($_SESSION)) {
  53. }
  54.  
  55. $loginFormAction = $_SERVER['PHP_SELF'];
  56. if (isset($_GET['accesscheck'])) {
  57.   $_SESSION['PrevUrl'] = $_GET['accesscheck'];
  58. }
  59.  
  60. if (isset($_POST['usuario'])) {
  61.   $loginUsername=$_POST['usuario'];
  62.   $password=$_POST['pass'];
  63.   $MM_fldUserAuthorization = "";
  64.   $MM_redirectLoginSuccess = "?seccion=welcome";
  65.   $MM_redirectLoginFailed = "?seccion=falleuser";
  66.   $MM_redirecttoReferrer = false;
  67.   mysql_select_db($database_config, $config);
  68.  
  69.   $LoginRS__query=sprintf("SELECT usuario, pass FROM FT_USUARIOS WHERE usuario=%s AND pass=%s",
  70.     GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text"));
  71.    
  72.   $LoginRS = mysql_query($LoginRS__query, $config) or die(mysql_error());
  73.   $loginFoundUser = mysql_num_rows($LoginRS);
  74.   if ($loginFoundUser) {
  75.      $loginStrGroup = "";
  76.    
  77.     //declare two session variables and assign them
  78.     $_SESSION['MM_Username'] = $loginUsername;
  79.     $_SESSION['MM_UserGroup'] = $loginStrGroup;      
  80.  
  81.     if (isset($_SESSION['PrevUrl']) && false) {
  82.       $MM_redirectLoginSuccess = $_SESSION['PrevUrl']; 
  83.     }
  84.     header("Location: " . $MM_redirectLoginSuccess );
  85.   }
  86.   else {
  87.     header("Location: ". $MM_redirectLoginFailed ); [COLOR="Red"]linea 84[/COLOR]
  88.   }
  89. }
  90. ?>
  91. <div id="content-box">
  92.         <div class="padding">
  93.             <div class="login" id="element-box">
  94.                 <div class="t">
  95.                     <div class="t">
  96.                         <div class="t"></div>
  97.                     </div>
  98.                 </div>
  99.                 <div class="m">
  100.  
  101.                     <h1>Ingreso de Usuarios Registrados</h1>
  102.                    
  103.                             <div id="section-box">
  104.             <div class="t">
  105.                 <div class="t">
  106.                     <div class="t"></div>
  107.                 </div>
  108.             </div>
  109.             <div class="m">
  110.                 <form ACTION="<?php echo $loginFormAction; ?>" style="clear: both;" id="form-login" name="login" method="POST">
  111.     <p id="form-login-username">
  112.         <label for="modlgn_username">Usuario</label>
  113.         <input type="text" size="15" class="inputbox" id="modlgn_username" name="usuario">
  114.     </p>
  115.  
  116.     <p id="form-login-password">
  117.         <label for="modlgn_passwd">Contraseña</label>
  118.         <input type="password" size="15" class="inputbox" id="modlgn_passwd" name="pass">
  119.     </p>
  120.         <p style="clear: both;" id="form-login-lang">
  121.        
  122.     <div class="button_holder">
  123.     <div class="button1">
  124.         <div class="next">
  125.             <a onclick="login.submit();">
  126.                 Entrar</a>
  127.  
  128.         </div>
  129.     </div>
  130.     </div>
  131.     <div class="clr"></div>
  132.     <input type="submit" value="Entrar" style="border: 0; padding: 0; margin: 0; width: 0px; height: 0px;">
  133.    
  134.    
  135.     </form>
  136. <div class="clr"></div>
  137.             </div>
  138. <div class="b">
  139.                 <div class="b">
  140.                     <div class="b"></div>
  141.                 </div>
  142.             </div>
  143.         </div>
  144.        
  145.                     <p>Ingresa un nombre de usuario y contraseña validos para acceder al Sistema.</p>
  146.                     <p>
  147.                         <a href="javascript:history.back(1)">Regresar a la Pagina Anterior</a>
  148.                     </p>
  149.                     <div id="lock"></div>
  150.                     <div class="clr"></div>
  151.                 </div>
  152.     <div class="h_green" id="border-top">
  153.         <div>
  154.             <div>
  155.                 <div class="adminform">Insurance Broker Sistem By ARTEM LABS, CA</div>
  156.             </div>
  157.         </div>
  158.     </div>
  159.                 <div class="b">
  160.                     <div class="b">
  161.                         <div class="b"></div>
  162.                     </div>
  163.                 </div>
  164.             </div>
  165.                         <div class="clr"></div>
  166.         </div>
  167. </div>
  168.     <div id="border-bottom"><div><div></div></div>
  169. </div>
  170. </body><?php
  171. mysql_free_result($Recordset1);
  172.  
  173. mysql_free_result($Recordset2);
  174. ?>
__________________
crear soluciones y oportunidades de desarrollo y crecimiento
  #22 (permalink)  
Antiguo 22/11/2011, 15:39
webankenovi
Invitado
 
Mensajes: n/a
Puntos:
Respuesta: inicio de sesion

error detectado para solucionarlo explicame unas cosas

if (!isset($_SESSION)) {
}

1- esto para que lo kieres???



if (isset($_GET['accesscheck'])) {
$_SESSION['PrevUrl'] = $_GET['accesscheck'];
}

2- $_GET['accesscheck'] de donde lo sacas ?que es ?por que yo no veo que mandes nada por la url con ese nombre entnces $_SESSION['PrevUrl'] falla y no redirecciona bien

explicame eso y te pongo el codigo
  #23 (permalink)  
Antiguo 22/11/2011, 15:42
Avatar de jotaincubus  
Fecha de Ingreso: mayo-2005
Ubicación: Medellin - Colombia
Mensajes: 1.797
Antigüedad: 18 años, 11 meses
Puntos: 394
Respuesta: inicio de sesion

El problema se presenta por muchas razones, debes fijarte en:

1. La pagina header.php esta creando un session_start()
2. La pagina header.php esta imprimiendo algo antes del session_start()
3. La pagina header.php tiene espacios en blanco en la linea numero 1
__________________
Por que existe gente que no agradece después de que se le ha brindado tiempo y ayuda ???
  #24 (permalink)  
Antiguo 22/11/2011, 15:43
webankenovi
Invitado
 
Mensajes: n/a
Puntos:
Respuesta: inicio de sesion

eso ya esta solucionado amigo
  #25 (permalink)  
Antiguo 22/11/2011, 15:44
Avatar de memp500  
Fecha de Ingreso: octubre-2011
Ubicación: venezuela
Mensajes: 40
Antigüedad: 12 años, 6 meses
Puntos: 0
Respuesta: inicio de sesion

te repito como dice al principio cuando abri el tema lo estoy haciendo con dreamweaver, por lo que dreamweaver genera ese codigo cuando hago el juego de registros y el inicio de sesion al conectar usuario con la bd
__________________
crear soluciones y oportunidades de desarrollo y crecimiento
  #26 (permalink)  
Antiguo 22/11/2011, 15:46
webankenovi
Invitado
 
Mensajes: n/a
Puntos:
Respuesta: inicio de sesion

no me contestaste memp500
  #27 (permalink)  
Antiguo 22/11/2011, 15:47
Avatar de memp500  
Fecha de Ingreso: octubre-2011
Ubicación: venezuela
Mensajes: 40
Antigüedad: 12 años, 6 meses
Puntos: 0
Respuesta: inicio de sesion

Cita:
Iniciado por jotaincubus Ver Mensaje
El problema se presenta por muchas razones, debes fijarte en:

1. La pagina header.php esta creando un session_start()
2. La pagina header.php esta imprimiendo algo antes del session_start()
3. La pagina header.php tiene espacios en blanco en la linea numero 1
gracias a tu respuesta, pero te respondo el header.php no tiene espacios es blaco y tampoco crea un session_start te coloco el codigo aca:

header.php
Código HTML:
Ver original
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <title><?php echo $titulo; ?></title>
  4. <meta name="description" content="<?php echo $desciption; ?>"/>
  5. <meta name="keywords" content="<?php echo $keywords; ?>"/>
  6. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  7. <meta name="generator" content="http://artemlabs.com" />
  8. <meta name="robots" content="index,follow" />
  9. <link href="css/stylecssmemp.css" rel="stylesheet" type="text/css" />
  10. <link type="text/css" rel="stylesheet" media="all" href="/css/sistem_acces.css" />
  11. </head>
__________________
crear soluciones y oportunidades de desarrollo y crecimiento
  #28 (permalink)  
Antiguo 22/11/2011, 15:50
Avatar de memp500  
Fecha de Ingreso: octubre-2011
Ubicación: venezuela
Mensajes: 40
Antigüedad: 12 años, 6 meses
Puntos: 0
Respuesta: inicio de sesion

Cita:
Iniciado por webankenovi Ver Mensaje
no me contestaste memp500
te repito el codigo lo genera dreamweaver..........

al entrar con usuario y contraseña correctos debe redireccionar en la url a index.php?seccion=welcome

debe ser esto lo que envia el GET
__________________
crear soluciones y oportunidades de desarrollo y crecimiento
  #29 (permalink)  
Antiguo 22/11/2011, 15:51
webankenovi
Invitado
 
Mensajes: n/a
Puntos:
Respuesta: inicio de sesion

Debes poner el codigo php luego tu header y luego el contenido si pones el header antes del php da error xq imprimes antes de session_start()
  #30 (permalink)  
Antiguo 22/11/2011, 15:53
webankenovi
Invitado
 
Mensajes: n/a
Puntos:
Respuesta: inicio de sesion

prueba y me cuentas

Código PHP:
Ver original
  1. <?php require_once('Connections/config.php');
  2. if (!function_exists("GetSQLValueString")) {
  3.     function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
  4.     {
  5.       if (PHP_VERSION < 6) {
  6.         $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  7.       }
  8.      
  9. $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
  10.      
  11.       switch ($theType) {
  12.         case "text":
  13.           $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  14.           break;    
  15.         case "long":
  16.         case "int":
  17.           $theValue = ($theValue != "") ? intval($theValue) : "NULL";
  18.           break;
  19.         case "double":
  20.           $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
  21.           break;
  22.         case "date":
  23.           $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  24.           break;
  25.         case "defined":
  26.           $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
  27.           break;
  28.       }
  29.       return $theValue;
  30.     }
  31.     }
  32.      
  33.     mysql_select_db($database_config, $config);
  34.     $query_Recordset1 = "SELECT * FROM FT_USUARIOS";
  35.     $Recordset1 = mysql_query($query_Recordset1, $config) or die(mysql_error());
  36.     $row_Recordset1 = mysql_fetch_assoc($Recordset1);
  37.     $totalRows_Recordset1 = mysql_num_rows($Recordset1);
  38.      
  39.     $colname_Recordset2 = "-1";
  40.     if (isset($_SESSION['MM_username'])) {
  41.         $colname_Recordset2 = $_SESSION['MM_username'];
  42.         }
  43.        
  44.     mysql_select_db($database_config, $config);
  45.     $query_Recordset2 = sprintf("SELECT usuario FROM FT_USUARIOS WHERE usuario = %s", GetSQLValueString($colname_Recordset2, "text"));
  46.     $Recordset2 = mysql_query($query_Recordset2, $config) or die(mysql_error());
  47.     $row_Recordset2 = mysql_fetch_assoc($Recordset2);
  48.     $totalRows_Recordset2 = mysql_num_rows($Recordset2);
  49.  
  50.     // *** Validate request to login to this site.
  51.     if (!isset($_SESSION)) {
  52.     }
  53.      
  54.     $loginFormAction = $_SERVER['PHP_SELF'];
  55.    
  56.     if (isset($_GET['accesscheck'])) {
  57.       $_SESSION['PrevUrl'] = $_GET['accesscheck'];
  58.     }
  59.      
  60.     if (isset($_POST['usuario'])) {
  61.       $loginUsername=$_POST['usuario'];
  62.       $password=$_POST['pass'];
  63.       $MM_fldUserAuthorization = "";
  64.       $MM_redirectLoginSuccess = "?seccion=welcome";
  65.       $MM_redirectLoginFailed = "?seccion=falleuser";
  66.       $MM_redirecttoReferrer = false;
  67.       mysql_select_db($database_config, $config);
  68.      
  69.       $LoginRS__query=sprintf("SELECT usuario, pass FROM FT_USUARIOS WHERE usuario=%s AND pass=%s",
  70.         GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text"));
  71.        
  72.       $LoginRS = mysql_query($LoginRS__query, $config) or die(mysql_error());
  73.       $loginFoundUser = mysql_num_rows($LoginRS);
  74.      
  75.       if ($loginFoundUser) {
  76.          $loginStrGroup = "";}
  77.        
  78.         //declare two session variables and assign them
  79.         $_SESSION['MM_Username'] = $loginUsername;
  80.         $_SESSION['MM_UserGroup'] = $loginStrGroup;  
  81.        
  82.            
  83.  
  84.         header("Location: " . $MM_redirectLoginSuccess );
  85.        
  86. }?>
  87.     <div id="content-box">
  88.             <div class="padding">
  89.                 <div class="login" id="element-box">
  90.                     <div class="t">
  91.                         <div class="t">
  92.                             <div class="t"></div>
  93.                         </div>
  94.                     </div>
  95.                     <div class="m">
  96.      
  97.                         <h1>Ingreso de Usuarios Registrados</h1>
  98.                        
  99.                                 <div id="section-box">
  100.                 <div class="t">
  101.                     <div class="t">
  102.                         <div class="t"></div>
  103.                     </div>
  104.                 </div>
  105.                 <div class="m">
  106.             <form action="<?php echo $loginFormAction; ?>" style="clear: both;" id="form-login" name="login" method="POST">
  107.         <p id="form-login-username">
  108.             <label for="modlgn_username">Usuario</label>
  109.             <input type="text" size="15" class="inputbox" id="modlgn_username" name="usuario">
  110.         </p>
  111.      
  112.         <p id="form-login-password">
  113.             <label for="modlgn_passwd">Contraseña</label>
  114.             <input type="password" size="15" class="inputbox" id="modlgn_passwd" name="pass">
  115.         </p>
  116.             <p style="clear: both;" id="form-login-lang">
  117.            
  118.         <div class="button_holder">
  119.         <div class="button1">
  120.             <div class="next">
  121.                 <a onclick="login.submit();">
  122.                     Entrar</a>
  123.      
  124.             </div>
  125.         </div>
  126.         </div>
  127.         <div class="clr"></div>
  128.         <input type="submit" value="Entrar" style="border: 0; padding: 0; margin: 0; width: 0px; height: 0px;">
  129.        
  130.        
  131.         </form>
  132.     <div class="clr"></div>
  133.                 </div>
  134.     <div class="b">
  135.                     <div class="b">
  136.                         <div class="b"></div>
  137.                     </div>
  138.                 </div>
  139.             </div>
  140.            
  141.                         <p>Ingresa un nombre de usuario y contraseña validos para acceder al Sistema.</p>
  142.                         <p>
  143.                             <a href="javascript:history.back(1)">Regresar a la Pagina Anterior</a>
  144.                         </p>
  145.                         <div id="lock"></div>
  146.                         <div class="clr"></div>
  147.                     </div>
  148.         <div class="h_green" id="border-top">
  149.             <div>
  150.                 <div>
  151.                     <div class="adminform">Insurance Broker Sistem By ARTEM LABS, CA</div>
  152.                 </div>
  153.             </div>
  154.         </div>
  155.                     <div class="b">
  156.                         <div class="b">
  157.                             <div class="b"></div>
  158.                         </div>
  159.                     </div>
  160.                 </div>
  161.                             <div class="clr"></div>
  162.             </div>
  163.     </div>
  164.         <div id="border-bottom"><div><div></div></div>
  165.     </div>
  166.     </body><?php
  167.     mysql_free_result($Recordset1);
  168.      
  169.     mysql_free_result($Recordset2);
  170.     ?>

Etiquetas: sesión, sesiones_en_php
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 04:40.