<?php require_once('../Connections/controlacceso.php'); ?>
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $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;
}

$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
  $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form4")) {
  $insertSQL = sprintf("INSERT INTO contrl (Id, Usuario, Contraseņa) VALUES (%s, %s, %s)",
                       GetSQLValueString($_POST['Id'], "int"),
                       GetSQLValueString($_POST['Usuario'], "text"),
                       GetSQLValueString($_POST['Contrasea'], "text"));

  mysql_select_db($database_controlacceso, $controlacceso);
  $Result1 = mysql_query($insertSQL, $controlacceso) or die(mysql_error());
}

mysql_select_db($database_controlacceso, $controlacceso);
$query_Recordset1 = "SELECT * FROM contrl";
$Recordset1 = mysql_query($query_Recordset1, $controlacceso) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<?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['Contrasea'];
  $MM_fldUserAuthorization = "";
  $MM_redirectLoginSuccess = "pagina inicial.php";
  $MM_redirectLoginFailed = "pagini.php";
  $MM_redirecttoReferrer = false;
  mysql_select_db($database_controlacceso, $controlacceso);
  
  $LoginRS__query=sprintf("SELECT Usuario, Contraseņa FROM contrl WHERE Usuario='%s' AND Contraseņa='%s'",
    get_magic_quotes_gpc() ? $loginUsername : addslashes($loginUsername), get_magic_quotes_gpc() ? $password : addslashes($password)); 
   
  $LoginRS = mysql_query($LoginRS__query, $controlacceso) 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 );
  }
}
?>
<!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>Corner of Coffee</title>
<style type="text/css">
<!--
body {
	background-image: url(black.jpg);
	margin-top: 5px;
	margin-bottom: 0px;
}
.Estilo9 {color: #FF0000; font-family: Broadway; }
.Estilo12 {font-family: "Century Gothic"}
.Estilo14 {font-family: "Century Gothic"; font-size: 14px; }
.Estilo15 {
	font-size: 18px;
	font-weight: bold;
}
a:link {
	text-decoration: none;
}
a:visited {
	text-decoration: none;
}
a:hover {
	text-decoration: none;
}
a:active {
	text-decoration: none;
}
.Estilo20 {font-family: "Century Gothic"; color: #000000; }
-->
</style></head>

<body>
<table width="960" border="1" align="center">
  <tr>
    <td colspan="2"><img src="encabezado.JPG" width="949" height="90" /></td>
  </tr>
  <tr>
    <td width="84" height="30" bgcolor="#FFCCCC"><div align="center"><span class="Estilo9"><a href="index.php">Inicio</a></span></div></td>
    <td width="860" bgcolor="#FFCCCC"><div align="center"><span class="Estilo9"><a href="Empleados.html"></a></span></div></td>
  </tr>
</table>
<table width="960" border="1" align="center">
  <tr>
    <td width="760" bgcolor="#FFFFFF"><div align="justify">
      <p>&nbsp;</p>
      <p><img src="cafe1.jpg" width="350" height="333" align="left" /><span class="Estilo14">Usted forma parte del equipo de <span class="Estilo15">Corner of Coffee</span>, la vida o quiz&aacute; el destino te ha tra&iacute;do hacia nosotros, eres muy afortunado (a), pues en &eacute;l encontrar&aacute;s un gran ambiente y un buen equipo de trabajo, claro que eso depende en gran medida de ti y de tu disposici&oacute;n de cooperar en lo que se requiere. </span>        </p>
    </div>
      <p align="justify" class="Estilo14">Esta nota es una manera de decirte que estamos felices de que te hayas unido a nosotros. Durante las pr&oacute;ximas semanas aprender&aacute;s las t&eacute;cnicas de nuestro negocio, podr&aacute;s apreciar que en <span class="Estilo15">corner of coffee</span> todos los programas y las oportunidades de ascenso te ayudar&aacute;n a triunfar.</p>
      <p align="justify" class="Estilo14">Una vez m&aacute;s BIENVENIDO A NUESTRO EQUIPO. Ahora eres parte de una industria l&iacute;der, conocida por sus productos de gran calidad que satisfacen a todos y cada uno de nuestros clientes.</p>
      <p align="justify" class="Estilo14">RECUERDA: LA META ES TUYA, TU EMPE&Ntilde;O, ENERG&Iacute;A, LAS GANAS Y TU DEDICACI&Oacute;N HABLAR&Aacute;N POR TI.</p>
      <p align="justify" class="Estilo14">BIENVENIDO Y MUCHA SUERTE...</p>
      <p align="justify" class="Estilo14">ATENTAMENTE.<br />
        Gerencia</p>
    <p align="justify" class="Estilo14">&nbsp;</p></td>
    <td><table width="190" border="1" align="right">
      <tr>
        <td bgcolor="#00FFFF"><form method="POST" name="form4" action="<?php echo $loginFormAction; ?>">
            <table align="center">
              <tr valign="baseline">
                <td align="right" nowrap bgcolor="#FFCC66"><span class="Estilo20">Usuario:</span></td>
                <td bgcolor="#FFCC66"><input name="Usuario" type="text" value="" size="32"></td>
              </tr>
              <tr valign="baseline">
                <td align="right" nowrap bgcolor="#FFCC66"><span class="Estilo20">Contraseņa:</span></td>
                <td bgcolor="#FFCC66"><input name="Contrasea" type="password" value="" size="32"></td>
              </tr>
              <tr valign="baseline">
                <td colspan="2" align="right" nowrap bgcolor="#FFCC66"><label>
                <input type="submit" name="Submit" value="Ingresar" />
                </label></td>
              </tr>
            </table>
            </form>
          </td>
      </tr>
    </table></td>
  </tr>
  
  <tr bgcolor="#FFFFFF">
    <td height="35" colspan="2" bordercolor="#F0F0F0" bgcolor="#FFCCCC"><div align="center" class="Estilo12">Todos los derechos reservados&trade;</div></td>
  </tr>
</table>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>
