<?php require_once('Connections/dulceria.php'); ?>
<?php
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['usuario'])) {
  $loginUsername=$_POST['usuario'];
  $password=$_POST['contrasena'];
  $MM_fldUserAuthorization = "";
  $MM_redirectLoginSuccess = "Desechables.HTML";
  $MM_redirectLoginFailed = "error.html";
  $MM_redirecttoReferrer = false;
  mysql_select_db($database_dulceria, $dulceria);
  
  $LoginRS__query=sprintf("SELECT USUARIO, PASSWORD FROM logeo WHERE USUARIO=%s AND PASSWORD=%s",
    GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text")); 
   
  $LoginRS = mysql_query($LoginRS__query, $dulceria) 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 );
  }
}
?>
<?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['contrasena'];
  $MM_fldUserAuthorization = "";
  $MM_redirectLoginSuccess = "bienvenido.php";
  $MM_redirectLoginFailed = "error.html";
  $MM_redirecttoReferrer = false;
  mysql_select_db($database_dulceria, $dulceria);
  
  $LoginRS__query=sprintf("SELECT USUARIO, PASSWORD FROM logeo WHERE USUARIO=%s AND PASSWORD=%s",
    GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text")); 
   
  $LoginRS = mysql_query($LoginRS__query, $dulceria) 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 );
  }
}
?>
<html>
<head>
<title>P&aacute;gina principal</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body,td,th {
	color: #F0F0F0;
}
.Estilo1 {color: #000000}
body {
	background-color: #FFFFFF;
	background-image: url(img/fondo%20amarilo.jpg);
}
.Estilo2 {color: #00CC00}
.Estilo3 {color: #669900}
.style4 {
	font-size: 24px;
	color: #000000;
	font-family: Arial, Helvetica, sans-serif;
}
.style8 {color: #0000CC}
.style10 {font-family: Arial, Helvetica, sans-serif}
.style11 {font-size: 36px; color: #0033CC; font-family: Arial, Helvetica, sans-serif; }
.style12 {font-size: 36px; color: #000000; font-family: Arial, Helvetica, sans-serif; }
.style12 {	font-size: 40px
}
.style13 {	font-size: 36px;
	color: #000000;
	font-family: Geneva, Arial, Helvetica, sans-serif;
}
#apDiv1 {	position:absolute;
	width:429px;
	height:50px;
	z-index:1;
	left: 315px;
	top: 15px;
}
.style16 {color: #0000CC; font-weight: bold; }
.style18 {
	font-family: Arial, Helvetica, sans-serif;
	font-weight: bold;
	color: #000000;
}
.style19 {font-size: 16px}
#apDiv2 {
	position:absolute;
	width:893px;
	height:29px;
	z-index:2;
	left: 60px;
	top: 701px;
}
-->
</style>
<script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
</head>
<div align="center"><span class="Estilo2 Estilo3"><img src="img/logo dulceria.jpg" alt="logo dulceria" width="100" height="90
"></span><span class="style4"> </span>
    <div id="apDiv1">
      <p class="style4 style12"><font face="monotype corsiva">DELICIOUS CANDYS</font></p>
    </div>
  <span class="style13"><font face="monotype corsiva">Para el ni&ntilde;o que llevas dentro</font></span><span class="style12">.</span><span class="style10">..</span><br>
</div>
<table width="884" height="588" border="3" align="center" cellpadding="2" cellspacing="4">
  <!--DWLayoutTable-->
  <tr valign="top"> 
    <td width="132" rowspan="2" align="center" valign="top"><p>
      <script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0','width','156','height','44','title','¿Quienes somos?','src','button14','quality','high','pluginspage','http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash','bgcolor','#FFCC00','movie','button14' ); //end AC code
        </script>
        <noscript>
        <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="156" height="44" title="&iquest;Quienes somos?">
          <param name="BGCOLOR" value="#FFCC00">
          <param name="movie" value="button14.swf">
          <param name="quality" value="high">
          <embed src="button14.swf" width="156" height="44" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" bgcolor="#FFCC00" ></embed>
        </object>
        </noscript>
        </p>
      <p>
        <script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0','width','156','height','44','title','Objetivo','src','button15','quality','high','pluginspage','http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash','bgcolor','#FFCC00','movie','button15' ); //end AC code
        </script>
        <noscript>
        <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="156" height="44" title="Objetivo">
          <param name="movie" value="button15.swf">
          <param name="quality" value="high">
          <param name="bgcolor" value="#FFCC00">
          <embed src="button15.swf" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="156" height="44" bgcolor="#FFCC00"></embed>
        </object>
        </noscript>
      </p>
      <p>
        <script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0','width','156','height','44','title','Misión','src','button16','quality','high','pluginspage','http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash','bgcolor','#FFCC00','movie','button16' ); //end AC code
</script><noscript><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="156" height="44" title="Misi&oacute;n">
          <param name="BGCOLOR" value="#FFCC00">
          <param name="movie" value="button16.swf">
          <param name="quality" value="high">
          <embed src="button16.swf" width="156" height="44" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" bgcolor="#FFCC00" ></embed>
        </object></noscript>
      </p>
      <p>
        <script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0','width','156','height','44','title','Visión','src','button17','quality','high','pluginspage','http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash','bgcolor','#FFCC00','movie','button17' ); //end AC code
        </script>
        <noscript>
        <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="156" height="44" title="Visi&oacute;n">
          <param name="movie" value="button17.swf">
          <param name="quality" value="high">
          <param name="bgcolor" value="#FFCC00">
          <embed src="button17.swf" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="156" height="44" bgcolor="#FFCC00"></embed>
        </object>
        </noscript>
      </p>
      <p align="center">
        <script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0','width','156','height','44','title','Politicas','src','button18','quality','high','pluginspage','http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash','bgcolor','#FFCC00','movie','button18' ); //end AC code
</script><noscript><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="156" height="44" title="Politicas">
          <param name="movie" value="button18.swf">
          <param name="quality" value="high">
          <param name="bgcolor" value="#FFCC00">
          <embed src="button18.swf" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="156" height="44" bgcolor="#FFCC00"></embed>
        </object></noscript>
      </p>      
      <form ACTION="<?php echo $loginFormAction; ?>" name="form2" method="POST">
        <p align="center" class="style18 Estilo1 Estilo1">
          <label><span class="Estilo1 Estilo1">Solo personal Autorizado<br>
          <br>
          Usuario
          <input type="text" name="usuario" id="usuario">
          </span></label>
        </p>
        <p align="center" class="style16 style10 Estilo1 Estilo1 Estilo1 Estilo1 Estilo1"><span class="Estilo1">Contrase&ntilde;a </span>
          <input type="password" name="contrasena" id="contrasena">
        </p>
        <p align="center" class="style16 style10 Estilo1 Estilo1 Estilo1 Estilo1 Estilo1">
          <label></label>
          <label>
          <span class="style19">
          <input name="aceptar" type="submit" class="style18" id="aceptar" value="Aceptar">
          </span></label>
        </p>
      </form>    </td>
    <td width="722" height="2"></td>
  </tr>
  <tr valign="top">
    <td height="472" valign="top"><p align="center" class="style10">&nbsp; </p>
      <p align="center" class="style11 Estilo1 Estilo1 Estilo1"><span class="Estilo1">EXTENSO SURTIDO DE PRODUCTOS EN</span>:</p>
      <p>
        <script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','width','716','height','329','src','img/carrucel','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','movie','img/carrucel' ); //end AC code
        </script>
        <noscript>
        <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="716" height="329">
          <param name="movie" value="img/carrucel.swf">
          <param name="quality" value="high">
          <embed src="img/carrucel.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="716" height="329"></embed>
        </object>
        </noscript>
      </p>
    <p><a href="javascript:window.print(form2) "><img src="img/imprimir.jpg" alt="imprimir" width="27" height="24"></a></p></td>
  </tr>
  
  <tr valign="top">
    <td height="41"></td>
    <td></td>
  </tr>
</table>
<div id="apDiv2">
  <div align="right" class="Estilo1"><strong>&copy;2011 Valdez melo Jose Filiberto</strong></div>
</div>
</body>
</html>
