<?php
// technocurve arc 3 php bv block1/3 start
$color1 = "#CCFFFF";
$color2 = "#FFFFFF";
$color = $color1;
// technocurve arc 3 php bv block1/3 end
?>
<?php require_once('../Connections/conreceitas.php'); ?>
<?php
if (!isset($_SESSION)) {
  session_start();
}
$MM_authorizedUsers = "";
$MM_donotCheckaccess = "true";

// *** Restrict Access To Page: Grant or deny access to this page
function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) { 
  // For security, start by assuming the visitor is NOT authorized. 
  $isValid = False; 

  // When a visitor has logged into this site, the Session variable MM_Username set equal to their username. 
  // Therefore, we know that a user is NOT logged in if that Session variable is blank. 
  if (!empty($UserName)) { 
    // Besides being logged in, you may restrict access to only certain users based on an ID established when they login. 
    // Parse the strings into arrays. 
    $arrUsers = Explode(",", $strUsers); 
    $arrGroups = Explode(",", $strGroups); 
    if (in_array($UserName, $arrUsers)) { 
      $isValid = true; 
    } 
    // Or, you may restrict access to only certain users based on their username. 
    if (in_array($UserGroup, $arrGroups)) { 
      $isValid = true; 
    } 
    if (($strUsers == "") && true) { 
      $isValid = true; 
    } 
  } 
  return $isValid; 
}

$MM_restrictGoTo = "login/login_admin.php";
if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {   
  $MM_qsChar = "?";
  $MM_referrer = $_SERVER['PHP_SELF'];
  if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
  if (isset($_SERVER['QUERY_STRING']) && strlen($_SERVER['QUERY_STRING']) > 0) 
  $MM_referrer .= "?" . $_SERVER['QUERY_STRING'];
  $MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
  header("Location: ". $MM_restrictGoTo); 
  exit;
}
?>
<?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_conreceitas, $conreceitas);
$query_receitas = "SELECT * FROM receitas ORDER BY titulo ASC";
$receitas = mysql_query($query_receitas, $conreceitas) or die(mysql_error());
$row_receitas = mysql_fetch_assoc($receitas);
$totalRows_receitas = mysql_num_rows($receitas);
?>
<!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=utf-8" />
<title>LISTA DE RECEITAS</title>
<link href="style.css" rel="stylesheet" type="text/css" />
</head>

<body>
<table width="700" border="0" align="center" cellpadding="0" cellspacing="5">
  <tr>
    <td align="center" class="stilo"><span class="stilo24">UM COZINHEIRO E QUATRO ESFOMEADOS</span></td>
  </tr>
  <tr>
    <td align="center" class="stilo">RECEITAS</td>
  </tr>
  <tr>
    <td align="center" class="stilo">&nbsp;</td>
  </tr>
  <tr>
    <td align="center" class="stilo1">TOTAL DE RECEITAS =&nbsp;<?php echo $totalRows_receitas ?></td>
  </tr>
</table>
<?php do { ?>
  <table width="800" border="0" align="center" cellpadding="0" cellspacing="3">
    <tr <?php 
// technocurve arc 3 php bv block2/3 start
echo " style=\"background-color:$color\"";
// technocurve arc 3 php bv block2/3 end
?>>
      <td width="536"><a href="receita.php?id=<?php echo $row_receitas['id']; ?>" target="_parent" class="stilo1"><?php echo $row_receitas['titulo']; ?> <?php echo $row_receitas['autor']; ?></a></td>
      <td width="100" align="center"  class="stilo2"><?php echo $row_receitas['categoria']; ?></td>
           <td width="89" align="center"><a href="editar.php?id=<?php echo $row_receitas['id']; ?>" class="stilo1">EDITAR</a></td>
<td width="60" align="right"><a href="delete.php?id=<?php echo $row_receitas['id']; ?>"><img src="imagens/btExcluir2.gif" width="60" height="20" border="0" /></a></td>

    </tr>
    <?php 
// technocurve arc 3 php bv block3/3 start
if ($color == $color1) {
	$color = $color2;
} else {
	$color = $color1;
}
// technocurve arc 3 php bv block3/3 end
?>
  </table>
<?php } while ($row_receitas = mysql_fetch_assoc($receitas)); ?>
<p>&nbsp;</p>
<table width="700" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td colspan="3" align="center" class="stilo1">TOTAL DE RECEITAS = &nbsp;<?php echo $totalRows_receitas ?></td>
  </tr>
  <tr>
    <td align="center">&nbsp;</td>
    <td align="center" class="stilo1">&nbsp;</td>
    <td align="center">&nbsp;</td>
  </tr>
  <tr>
    <td width="207" align="center"><a href="inserir.php" target="_parent" class="stilo1">INSERIR</a></td>
    <td width="223" align="center" class="stilo1"><a href="inicio.php" target="_parent">INÍCIO</a></td>
    <td width="270" align="center"><a href="javascript:window.close()" class="stilo1" onmouseover="window.status='FECHAR';return true" onmouseout="window.status='';return true">FECHAR</a></td>
  </tr>
</table>
<p>&nbsp;</p>
</body>
</html>
<?php
mysql_free_result($receitas);
?>
