61 lines
		
	
	
		
			1.9 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			61 lines
		
	
	
		
			1.9 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?
 | 
						|
 $sin_error = false;
 | 
						|
 if ( empty($user) || empty($user_pwd) )
 | 
						|
 { 
 | 
						|
  $sin_error = false;
 | 
						|
 } else {
 | 
						|
  // Comprobar que login/user sean válidos...
 | 
						|
	$conexion = mysql_connect( 'localhost', 'syncro_users', '29dic2001' ) OR die("No puedo conectar");
 | 
						|
	$id = mysql_select_db( 'SYNCRO', $conexion ) OR die("No puedo abrir Base de Datos");
 | 
						|
 | 
						|
	$consulta = 'SELECT id, Apodo, Password FROM users WHERE Apodo = "' . $user . '"';
 | 
						|
	$res = mysql_query( $consulta, $conexion ) OR die("No puedo realizar la consulta");
 | 
						|
	if (  mysql_num_rows($res) > 0 )
 | 
						|
	{
 | 
						|
		$pwd = mysql_result( $res, 0, 'Password' );
 | 
						|
		if ( strcmp( $pwd, $user_pwd ) == 0 )
 | 
						|
		{ 
 | 
						|
			session_name( "SYNCRO" );
 | 
						|
			$v1="user_id";
 | 
						|
			$v2="user_name";
 | 
						|
			$v3="user_auth";
 | 
						|
			session_register($v1,$v2,$v3);
 | 
						|
			session_start();
 | 
						|
	
 | 
						|
		        $sin_error = true;
 | 
						|
			$user_id = mysql_result( $res, 0, "id" );
 | 
						|
			$user_name = $user;
 | 
						|
			$user_auth = true;
 | 
						|
			$sin_error = true;
 | 
						|
		}
 | 
						|
	}
 | 
						|
	mysql_free_result($res);
 | 
						|
	mysql_close($conexion);
 | 
						|
 }
 | 
						|
 | 
						|
 if ( $sin_error == false )
 | 
						|
 {
 | 
						|
   echo "<META CONTENT=\"0; URL=error.htm\" HTTP-EQUIV=\"REFRESH\">";
 | 
						|
 } else {
 | 
						|
?>
 | 
						|
<HTML>
 | 
						|
<HEAD>
 | 
						|
        <script language="JavaScript" TYPE="text/javascript">
 | 
						|
                window.status = "SYNCRO v1.0";
 | 
						|
        </script>
 | 
						|
	<LINK REL="SHORTCUT ICON" HREF="images/syncro.ico">
 | 
						|
<title>-= SYNCRO =-</title>
 | 
						|
</HEAD>
 | 
						|
   <FRAMESET COLS=120,* FRAMEBORDER=NO border="0" color="#000000" NORESIZE FRAMESPACING="0" marginwidth=0 marginheight=0>
 | 
						|
    <FRAME SCROLLING=NO NORESIZE SRC="gestion-menu.php?<?=SID?>" NAME="menu" border=0 marginwidth=0 marginheight=0>
 | 
						|
    <FRAMESET ROWS=*,210 FRAMEBORDER=NO border="0" NORESIZE FRAMESPACING="0" marginwidth=0 marginheight=0>
 | 
						|
     <FRAME NORESIZE SRC="gestion-listado.php" NAME="listado" border=0 marginwidth=0 marginheight=0>
 | 
						|
     <FRAME NORESIZE SRC="news.php" NAME="preview" border=0 marginwidth=0 marginheight=4>
 | 
						|
    </FRAMESET>
 | 
						|
   </FRAMESET>
 | 
						|
<? 
 | 
						|
} 
 | 
						|
?>
 | 
						|
</HTML>
 | 
						|
 |