<?php require_once('Connections/cafe.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"] == "form1")) {
  $insertSQL = sprintf("INSERT INTO comments (COMMENT_ID, FIRST_NAME, LAST_NAME, TELEPHONE, EMAIL, SUBMIT_DATE, COMMENTS, ANSWERED) VALUES (%s, %s, %s, %s, %s, %s, %s, %s)",
                       GetSQLValueString($_POST['COMMENT_ID'], "int"),
                       GetSQLValueString($_POST['FIRST_NAME'], "text"),
                       GetSQLValueString($_POST['LAST_NAME'], "text"),
                       GetSQLValueString($_POST['TELEPHONE'], "text"),
                       GetSQLValueString($_POST['EMAIL'], "text"),
                       GetSQLValueString($_POST['SUBMIT_DATE'], "date"),
                       GetSQLValueString($_POST['COMMENTS'], "text"),
                       GetSQLValueString($_POST['ANSWERED'], "int"));

  mysql_select_db($database_cafe, $cafe);
  $Result1 = mysql_query($insertSQL, $cafe) or die(mysql_error());

  $insertGoTo = "final.php";
  if (isset($_SERVER['QUERY_STRING'])) {
    $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
    $insertGoTo .= $_SERVER['QUERY_STRING'];
  }
  header(sprintf("Location: %s", $insertGoTo));
}
?><?
session_start();
	if(isset($_SESSION['comentario'])){
		$mi_comentario=$_POST['comentario'];
}



?>


<!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"><!-- InstanceBegin template="/Templates/indexstore2.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>Documento sin t&iacute;tulo</title>
<!-- InstanceEndEditable -->
<!-- InstanceBeginEditable name="head" --><!-- InstanceEndEditable -->
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
.Estilo3 {font-family: Arial, Helvetica, sans-serif}
-->
</style>
<script type="text/JavaScript">
<!--
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
</head>

<body onload="MM_preloadImages('imagenes/hiasna2.png','imagenes/historia2.png','imagenes/tienda2.png','imagenes/Galeria2.png','imagenes/gaceta2.png','imagenes/foro2.png','imagenes/contacto2.png','herradero/herradero.gif')">

<div align="center">
    <table width="1094" height="50" border="0" cellpadding="0" cellspacing="0" background="imagenes pagina/menu_link.jpg">
    <tbody>
      <tr>
        <td colspan="7"><img src="imagenes/top2.png" width="1094" height="205" /></td>
      </tr>
      <tr>
        <td width="150" align="center"><a href="index.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('1','','imagenes/hiasna2.png',1)"><img src="imagenes/hiasna.png" name="1" width="150" height="50" border="0" id="1" /></a></td>
        <td width="150" align="center"><a href="historia/index.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('2','','imagenes/historia2.png',1)"><img src="imagenes/historia.png" name="2" width="150" height="50" border="0" id="2" /></a></td>
        <td width="150" align="center"><a href="tienda/index.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('3','','imagenes/tienda2.png',1)"><img src="imagenes/tienda.png" name="3" width="150" height="50" border="0" id="3" /></a></td>
        <td width="150" align="center"><a href="galeria/index.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('4','','imagenes/Galeria2.png',1)"><img src="imagenes/Galeria.png" name="4" width="150" height="50" border="0" id="4" /></a></td>
        <td width="150" align="center"><a href="GACETA.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('5','','imagenes/gaceta2.png',1)"><img src="imagenes/gaceta.png" name="5" width="150" height="50" border="0" id="5" /></a></td>
        <td width="150" align="center"><a href="foro_web.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('6','','imagenes/foro2.png',1)"><img src="imagenes/foro.png" name="6" width="150" height="50" border="0" id="6" /></a></td>
        <td width="150" align="center"><a href="COMMENTARIO.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('7','','imagenes/contacto2.png',1)"><img src="imagenes/contacto.png" name="7" width="150" height="50" border="0" id="7" /></a></td>
      </tr>
    </tbody>
  </table>
  <table width="1094" height="800" border="0" cellpadding="0" cellspacing="0">
    <tbody>
      <tr>
        <td width="208" align="center" valign="top" background="imagenes/Imagen2.png"><p>&nbsp;</p>
          <p><a href="o/herradero.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('8','','herradero/herradero.gif',1)"><img src="herradero/banner1.gif" name="8" width="163" height="79" border="0" id="8" /></a></p>
          <p align="center"><br />
              <a href="herradero.php"></a><br />
          </p></td>
        <td width="681" align="center" valign="top">&nbsp;
            <p>
              <!-- Start VideoLightBox.com BODY section -->
              <script type="text/javascript">

            </script>
              <script type="text/javascript"><div align="center">function onYouTubePlayerReady(playerId) { 
ytplayer = document.getElementById(&quot;video_overlay&quot;); 
ytplayer.setVolume(100); 
} 

</div></script>
              <!-- End VideoLightBox.com BODY section -->
              <br />
            </p>
          <!-- InstanceBeginEditable name="1" -->
          <form method="post" name="form1" action="<?php echo $editFormAction; ?>">
            <table align="center" bgcolor="#990000">

              <tr valign="baseline">
                <td nowrap align="right">NOMBRE:</td>
                <td><input type="text" name="FIRST_NAME" value="" size="32"></td>
              </tr>
              <tr valign="baseline">
                <td nowrap align="right">APELLIDO</td>
                <td><input type="text" name="LAST_NAME" value="" size="32"></td>
              </tr>
              <tr valign="baseline">
                <td nowrap align="right">TELEFONO</td>
                <td><input type="text" name="TELEPHONE" value="" size="32"></td>
              </tr>
              <tr valign="baseline">
                <td nowrap align="right">EMAIL:</td>
                <td><input type="text" name="EMAIL" value="" size="32"></td>
              </tr>

              <tr valign="baseline">
                <td nowrap align="right">COMENTARIO</td>
                <td><textarea name="COMMENTS" cols="30"></textarea></td>
              </tr>

              <tr valign="baseline">
                <td nowrap align="right">&nbsp;</td>
                <td><div align="center" class="Estilo3">
                  <input name="enviar" type="submit" id="enviar" value="Enviar">
                </div></td>
              </tr>
            </table>
            <input type="hidden" name="MM_insert" value="form1">
          </form>
          <p>&nbsp;</p>
          <!-- InstanceEndEditable --></td>
        <td width="205" valign="top" background="imagenes/Imagen3.png"><p>
            <!-- SiteSearch Google -->
            <input type="hidden" name="ie" value="UTF-8" />
            <input type="hidden" name="oe" value="UTF-8" />
            </p>
            <form method="get" action="http://www.google.com/search">
              <table bgcolor="#FFFFFF">
                <tr>
                  <td><input type="text" name="q" size="31" maxlength="255" value="" />
                      <input type="submit" name="btnG" value="Buscar en Google" />
                      <font size="-1">
                      <input type="hidden" name="domains" value="Hiasna " />
                      <br />
                      <input type="radio" name="sitesearch" value="" />
                        Web
                        <input type="radio" name="sitesearch" value="Google" checked="checked" />
                        Hiasna<br />
                    </font></td>
                </tr>
              </table>
            </form>
          <!-- SiteSearch Google --></td>
      </tr>
    </tbody>
  </table>
  <table width="1094" border="0" cellspacing="0" cellpadding="0">
    <tbody>
      <tr>
        <td height="30" align="right" background="imagenes/bottom.png">&nbsp;</td>
      </tr>
    </tbody>
  </table>
</div>
</body>
<!-- InstanceEnd --></html>
