rendered paste body<?php require_once('../Connections/josephlocal.php');
//initialize the session
session_start();
if (!isset($_SESSION)) {
session_start();
}
// ** Logout the current user. **
$logoutAction = $_SERVER['PHP_SELF']."?doLogout=true";
if ((isset($_SERVER['QUERY_STRING'])) && ($_SERVER['QUERY_STRING'] != "")){
$logoutAction .="&". htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_GET['doLogout'])) &&($_GET['doLogout']=="true")){
//to fully log out a visitor we need to clear the session varialbles
$_SESSION['MM_Username'] = NULL;
$_SESSION['MM_UserGroup'] = NULL;
$_SESSION['PrevUrl'] = NULL;
unset($_SESSION['MM_Username']);
unset($_SESSION['MM_UserGroup']);
unset($_SESSION['PrevUrl']);
$logoutGoTo = "login.php";
if ($logoutGoTo) {
header("Location: $logoutGoTo");
exit;
}
}
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 = "erro.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($QUERY_STRING) && strlen($QUERY_STRING) > 0)
$MM_referrer .= "?" . $QUERY_STRING;
$MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
header("Location: ". $MM_restrictGoTo);
exit;
}
$colname_Recordset1 = "-1";
if (isset($_SESSION['MM_Username'])) {
$colname_Recordset1 = (get_magic_quotes_gpc()) ? $_SESSION['MM_Username'] : addslashes($_SESSION['MM_Username']);
}
mysql_select_db($database_josephlocal, $josephlocal);
$query_Recordset1 = sprintf("SELECT * FROM vendedores WHERE login = '%s'", $colname_Recordset1);
$Recordset1 = mysql_query($query_Recordset1, $josephlocal) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
if ($_SERVER['REQUEST_METHOD']=="POST") {
$parcela = $_SESSION['parcela_1'];
$num_1 = $_SESSION['num_1_s'];
if ($_POST['add']) {
$num_1[] = $_POST['num_1'];
$parcela[] = $_POST['parcela'];
$_SESSION['num_1_s'] = $num_1;
$_SESSION["parcela_1"] = $parcela;
} if ( $_POST['salvar'] ) {
$tudo = $_SESSION['tudo'];
$data = date('Y/m/d');
$sql = "INSERT INTO temp (id_vendedor,verificado,dataenvio,query) VALUES ('".$row_Recordset1['id']."','".$row_Recordset1['usa_site']."','".$data."','**".$tudo."')";
$salva=mysql_query($sql);
echo "Dados enviados com sucesso<br />";
echo "<a href='login.php'>Voltar ao Login</a>";
session_destroy();
exit;
}
}
if ( $_POST['excluir'] ) {
echo "Cancelar Lançamentos<br />";
echo "<a href='login.php'>Voltar ao Login</a>";
session_destroy();
exit;
}
elseif ( @$_REQUEST['acao'] == 'D') {
$qnt = count($num_1);
$arrTmp = NULL;
if ( $qnt > 0 ) {
for ($i=0; $i< $qnt; $i++) {
if ( $_REQUEST['id'] != $i ) {
$arrTmp[] = $num_1[$i];
}
}
}
$_SESSION = $arrTmp;
header('Location: '.$_SERVER['PHP_SELF']);
exit;
}
?>
<!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>Untitled Document</title>
<link rel="stylesheet" href="../style.css" type="text/css">
<style type="text/css">
<!--
.style7 { font-size: 18px;
font-family: Arial, Helvetica, sans-serif;
font-weight: bold;
}
.style4 {color: #FF9900}
.style8 {color: #FF0000}
body {
background-color: #e2f4fe;
}
-->
</style>
</head>
<body>
<div class="geral" id="geral">
<div style="width:105px; border: 3px #ffffff; z-index: 5; top:9px; float:left; position:absolute; left: 30px; height: 101px; background-image: url(../images/logo01.jpg); border: 1px none #000000;"></div>
<div id="conteudo">
<div style="width:98%; border: 3px #ffffff; top:24px; float:left; position:relative; left: 3px;">
<form id="form1" name="form1" method="post" action="index.php">
<div>
<div>
<div align="center"><strong>Posto de Recebimento: <span class="style8"><?php echo $row_Recordset1['vendedor']; ?></span></strong> - <a href="<?php echo $logoutAction ?>">SAIR</a><br />
<span class="style1">Cod. Barra:
<input type="text" class="est_text" name="num_1" id="num_1" />
-
<input name="parcela" type="text" class="est_par" id="parcela" />
</span>
</label>
<label>
<input type="submit" class="botao" name="add" value="LANÇAR" />
</label>
</div>
</div>
</div>
</form>
</div>
<div style="width:98%; border: 3px #ffffff; top:72px; float:left; position:absolute; left: 5px; height: 10px;">
<form id="form1" name="form2" method="post" action="index.php">
<table width="100%" height="100%" border="1" align="center" cellpadding="0" cellspacing="0">
<tr>
<th width="17%" scope="col">num_1</th>
<th width="12%" scope="col">num_2</th>
<th width="14%" scope="col">parcela</th>
<th width="37%" scope="col">nome</th>
<th width="9%" scope="col">valor</th>
<th width="5%" scope="col">data</th>
<th width="6%" scope="col">excluir</th>
</tr>
<?
$tabela = '';
$tudo = '';
for ($i=0;$i<sizeof($num_1);$i++) {
$sql = "SELECT PC.num_1,PC.num_2,C.cliente FROM promocoes_carnes PC INNER JOIN clientes C ON PC.cliente = C.id and PC.num_1='".$num_1[$i]."';" or die ("erro");
$rs = mysql_query($sql);
$tCliente = mysql_fetch_array($rs);
$valor = "15,00";
$linkDel = $_SERVER['PHP_SELF'].'?id='.$i.'&acao=D';
$data = date ("j/m/Y");
$tabela .= '<tr>';
$tabela .= '<td>'.$num_1[$i].'</td>';
$tabela .= '<td>'.$tCliente['num_2'].'</td>';
$tabela .= '<td>'.$parcela[$i].'</td>';
$tabela .= '<td>'.$tCliente['cliente'].'</td>';
$tabela .= '<td>'.$valor.'</td>';
$tabela .= '<td>'.$data.'</td>';
$tabela .= '<td><a href="'.$linkDel.'">Exclui</a></td>';
$tabela .= '</tr>';
$total = $_SESSION['valor1'] + $_SESSION['valor2'];
$tudo .= $num_1[$i].',,'.$tCliente['num_2'].',,'.$parcela[$i].',,'.$valor.',,'.$data.';;';
}
$_SESSION['tudo'] = $tudo;
echo $tabela;
echo (var_dump ($tudo));
?>
</table>
<p align="center">
<br />
<input type="submit" name="salvar" class="botao" value="Salvar" />
<label>
<input name="excluir" type="submit" id="excluir" class="botao" value="excluir" />
</label>
<label> </label>
</p>
</form>
</div>
</div>
<div style="width:92px; z-index: 5; top:7px; float:left; position:absolute; left: 621px; height: 96px; background-image: url(../images/logo02.jpg); layer-background-image: url(../images/logo02.jpg); border: 1px none #000000;"></div>
<div style="width:298px; z-index: 5; top:22px; float:left; position:absolute; left: 256px; height: 63px;">
<p align="center" class="style7"><span class="style4">11º Promoção</span><br />
Pelayo Magraner<br />
ROTARY CLUBE DE APARECIDA </p>
</div>
</div>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>