Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Boa tarde galera
Estou trabalhando com um script de Classificados Automotivos e me deparei com um problema, ele não possui uma área onde eu possa ver todos os anúncios publicados por um usuário. Como o site vai ter parceria com algumas revendedoras de carros, preciso de uma página assim.
Aqui está o painel do cliente
/applications/core/interface/imageproxy/imageproxy.php?img=http://www.autofacilweb.com.br/problema.jpg&key=7d15a6030b50b935d32e43dfe8fdb02a55d92c7e0e528dca1777755ea617437b" alt="problema.jpg" />
Segue o código da página
<?php require_once('../Connections/virtualcars.php'); ?>
<?php
// Require the MXI classes
require_once ('../includes/mxi/MXI.php');
// Load the tNG classes
require_once('../includes/tng/tNG.inc.php');
// Make unified connection variable
$conn_virtualcars = new KT_connection($virtualcars, $database_virtualcars);
//Start Restrict Access To Page
$restrict = new tNG_RestrictAccess($conn_virtualcars, "../");
//Grand Levels: Level
$restrict->addLevel("4" AND "3" AND "2" AND "1");
$restrict->Execute();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;
}
}
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_virtualcars, $virtualcars);
$query_Empresa = "SELECT * FROM empresa";
$Empresa = mysql_query($query_Empresa, $virtualcars) or die(mysql_error());
$row_Empresa = mysql_fetch_assoc($Empresa);
$totalRows_Empresa = mysql_num_rows($Empresa);
$colname_rsUserVeiculo = "-1";
if (isset($_SESSION['kt_login_id'])) {
$colname_rsUserVeiculo = $_SESSION['kt_login_id'];
}
mysql_select_db($database_virtualcars, $virtualcars);
$query_rsUserVeiculo = sprintf("SELECT usuarios.user_login, usuarios.user_nome, usuarios.user_email, usuarios.user_logo, veiculo.veiculo_placa, planos.plano_preco, marca.marca_nome, modelos.modelo_nome, ano.ano_nome, usuarios.user_telefone, veiculo.veiculo_status, veiculo.veiculo_id, usuarios.user_id FROM (((((veiculo LEFT JOIN usuarios ON usuarios.user_id=veiculo.veiculo_usuarios_id) LEFT JOIN planos ON planos.plano_id=veiculo.veiculo_plano_id) LEFT JOIN ano ON ano.ano_id=veiculo.veiculo_ano_id) LEFT JOIN modelos ON modelos.modelo_id=veiculo.veiculo_modelo_id) LEFT JOIN marca ON marca.marca_id=modelos.modelo_mar_id) WHERE user_id = %s", GetSQLValueString($colname_rsUserVeiculo, "int"));
$rsUserVeiculo = mysql_query($query_rsUserVeiculo, $virtualcars) or die(mysql_error());
$row_rsUserVeiculo = mysql_fetch_assoc($rsUserVeiculo);
$totalRows_rsUserVeiculo = mysql_num_rows($rsUserVeiculo);
?>
<!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>Painel de Controle - <?php echo $row_Empresa['e_nome']; ?> | Auto Facil Web</title>
<meta name="description" content="<?php echo $row_Empresa['e_descricao']; ?>"/>
<meta name="keywords" content="<?php echo $row_Empresa['e_keys']; ?>"/>
<meta name="copyright" content="Classificados e Revenda de Automóveis"/>
<meta name="author" content="http://www.autofacilweb.com.br"/>
<meta name="robots" content="index,follow" />
<meta name="googlebot" content="index,follow" />
<link href="estilo_admin.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
<!--
function tmt_confirm(msg){
document.MM_returnValue=(confirm(unescape(msg)));
}
//-->
</script>
</head>
<body>
<div id="box">
<!-- HEADER -->
<div class="header">
<?php
mxi_includes_start("header.php");
require(basename("header.php"));
mxi_includes_end();
?>
</div>
<!-- HEADER -->
<!-- MENU -->
<div class="menu">
<?php
mxi_includes_start("menu_vip.php");
require(basename("menu_vip.php"));
mxi_includes_end();
?>
</div><!-- TITULO -->
<div class="t_conteudo">
<h1>Administração - Atualmente vocÊ tem <?php echo $totalRows_rsUserVeiculo ?> Anuncio(s)</h1>
</div><!-- CONTEUDO -->
<div class="c_conteudo">
<div align="center">
<table width="100%" border="0" cellpadding="10" cellspacing="0">
<tr>
<td width="16%" bgcolor="#D9E25F"><strong>Marca</strong></td>
<td width="16%" bgcolor="#D9E25F"><strong>Modelo</strong></td>
<td width="16%" bgcolor="#D9E25F"><strong>Placa</strong></td>
<td width="16%" bgcolor="#D9E25F"><strong>Valor do Anúncio</strong></td>
<td width="16%" bgcolor="#D9E25F"><strong>Status</strong></td>
<td width="16%" bgcolor="#D9E25F"><strong> Editar Deletar</strong></td>
</tr>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><table width="100%" border="0">
<tr>
<td><table width="100%" border="0">
<tr>
<td><table width="100%" border="0">
<tr>
<?php
do { // horizontal looper version 3
?>
<td><table width="100%" border="0" cellspacing="0" cellpadding="10">
<tr>
<td width="16%"><p><?php echo $row_rsUserVeiculo['marca_nome']; ?></p></td>
<td width="16%"><p><?php echo $row_rsUserVeiculo['modelo_nome']; ?></p></td>
<td width="16%"><p><?php echo $row_rsUserVeiculo['veiculo_placa']; ?></p></td>
<td width="16%"><p><strong>R$ <?php echo $row_rsUserVeiculo['plano_preco']; ?>,00</strong></p></td>
<td width="16%"><?phpif (@$row_rsUserVeiculo['veiculo_status'] == 1) {
?>
<img src="img/online.png" width="140" height="30" alt="Ativo - Online" />
<?php<!-- PAGSEGURO -->
<form target="pagseguro" method="post"
action="https://pagseguro.uol.com.br/checkout/checkout.jhtml">
<input type="hidden" name="email_cobranca" value="<?php echo $row_Empresa['e_mail']; ?>" />
<input type="hidden" name="tipo" value="CP" />
<input type="hidden" name="moeda" value="BRL" />
<input type="hidden" name="item_id_1" value="<?php echo $row_rsUserVeiculo['veiculo_id']; ?>" />
<input type="hidden" name="item_descr_1" value="Anúncio do veiculo: <?php echo $row_rsUserVeiculo['marca_nome']; ?> <?php echo $row_rsUserVeiculo['modelo_nome']; ?> | Ano: <?php echo $row_rsUserVeiculo['ano_nome']; ?> | Placa: <?php echo $row_rsUserVeiculo['veiculo_placa']; ?>" />
<input type="hidden" name="item_quant_1" value="1" />
<input type="hidden" name="item_valor_1" value="<?php echo $row_rsUserVeiculo['plano_preco']; ?>00" /> <!-- 100 = R$ 1,00 -->
<input type="hidden" name="item_frete_1" value="0" />
<input type="hidden" name="item_peso_1" value="0" />
<input type="hidden" name="tipo_frete" value="EN" />
<input type="image" src="img/pagar.png" name="submit" alt="Pague com PagSeguro - é rápido, grátis e seguro!" />
</form>
<!-- PAGSEGURO -->
<?php }?></td>
<td width="16%" valign="top"><table width="100%" border="0" align="center" cellpadding="5" cellspacing="5">
<tr>
<td align="center"><a href="clientes_editar_anuncio.php?veiculo=<?php echo $row_rsUserVeiculo['veiculo_id']; ?>"><img src="img/editar.png" alt="Editar" width="38" height="30" border="0" /></a></td>
<td align="center"><a href="cliente_deletar_anuncio.php?veiculo=<?php echo $row_rsUserVeiculo['veiculo_id']; ?>"><img src="img/deletar.png" alt="Deletar" width="38" height="30" border="0" onclick="tmt_confirm('ATENÇÃO! Esta ação é irreversivel, depois de deletar o anúncio não será possivel recupera-lo.%0D%0ATem certeza que deseja excluir este anúncio?');return document.MM_returnValue" /></a></td>
</tr>
</table></td>
</tr>
<tr>
<td colspan="6"><hr class="KT_field_error" /></td>
</tr>
</table></td>
<?php
$row_rsUserVeiculo = mysql_fetch_assoc($rsUserVeiculo);
if (!isset($nested_rsUserVeiculo)) {
$nested_rsUserVeiculo= 1;
}
if (isset($row_rsUserVeiculo) && is_array($row_rsUserVeiculo) && $nested_rsUserVeiculo++ % 1==0) {
echo "</tr><tr>";
}
} while ($row_rsUserVeiculo); //end horizontal looper version 3
?>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table>
</div>
</div><!-- FOOTER -->
<div class="footer">
<?php
mxi_includes_start("footer.php");
require(basename("footer.php"));
mxi_includes_end();
?>
</div>
<!-- FOOTER -->
</div>
</body>
</html>
<?php
mysql_free_result($Empresa);
mysql_free_result($rsUserVeiculo);
?>
Gostaria que a página de anuncios do usuário fosse baseada no painel onde o cliente tem acesso a sua quantidade de anúncios.
Assim eu criaria um link na página da foto abaixo, onde um usuário teria acesso a todos os anúncios postados por um revendedor.
/applications/core/interface/imageproxy/imageproxy.php?img=http://www.autofacilweb.com.br/problema2.jpg&key=1a8c5558334bd0991d5b36a7bc8f01bf621961611526371811e0d57d08e93cfb" alt="problema2.jpg" />
Obrigado gente.
Carregando comentários...