Jump to content


nandatn

Member Since 30/06/2008
Offline Last Active 21/05/2009, 20:12
-----

Topics I've Started

Voltar Para Resultados

11/09/2008, 18:43

Tenho uma página busca, uma pagina resultados, e uma pagina detalhes.
Preciso fazer na página detalhes, um link " Voltar para resultados", eu nao sei como resgatar os valores informados inicialmente na busca para informa-las novamente no link.
Se alguem puder me ajudar...

Relacionamento Entre Tabels

10/09/2008, 21:58

Estou com o seguinte problema,

Tenho um banco com duas tabelas, uma imoveis e uma imagens.

A tabela imoveis e imagens precisam se relacionar. Na tabela imagens estarão as imagens que podem ser uma ou muitas imagens relacionadas a cada imovel.

Até ai tudo bem.

Quando realizo uma busca para me retornar apenas um resultado dos imoveis e ilimitadas imagens ok...
Funciona do jeito que preciso..

Quando realizo uma consulta que pode me gerar mais resultados , me retorna registros tanto de uma quanto de outra tabela, como tenho mais fotos que imoveis, aparecem registros de imoveis repetidos com fotos diferentes, ja tentei no select inner join , left join , outer , right e nada continuo com o mesmo resultado.
Se alguem puder me ajudar agradeço ....

SELECT *  FROM imagens   LEFT OUTER JOIN imoveis ON imagens.id_imovel = imoveis.id WHERE preco <= '$ate' AND bairro = '%s'  AND dorm ='$valordorm' "

Erro Quando Carrega Via Case Switch

30/06/2008, 19:04

Gente é o seguinte,
As páginas são carregadas via require/ ou include ( alternei entre os dois para ver se era ai o erro), o menu uso o case switch, o site funciona legal normalmente, o problema agora me apareceu quando uso meu sistema de login, rola incompatibilidade, e nao consigo acessar a pagina de login e de inserção de conteudo quando acesso a pagina direto do index.
Quando acesso direto a pagina login.php ele funciona normalmente.
Não sei o que ocorre....

O index....

<?php
if (isset($_GET['local'])){
switch ($_GET['local']){
case 01:
include "pecas_inicio.php";
break;
case 02:
include "pecas.php";
break;
case 03:
include "home.php";
break;
case 04:
include "shows_inicio.php";
break;
case 05:
include "shows.php";
break;
case 06:
include "inserir2.php";
break;
case 07:
include "dancas_inicio.php";
break;
case 12:
include "dancas.php";
break;
case 13:
include "cursos.php";
break;
case 14:
include "cursos_inicio.php";
break;
case 15:
include "cadastro.php";
break;
case 16:
include "links_inicio.php";
break;
case 17:
include "login.php";
break;
}
}else{
include "centro.php";
}
?>

o login.php

<?php require_once('Connections/conexao.php'); ?>
<?php
// *** Validate request to login to this site.


$loginFormAction = $_SERVER['PHP_SELF'];
if (isset($_GET['accesscheck'])) {
$_SESSION['PrevUrl'] = $_GET['accesscheck'];
}

if (isset($_POST['login'])) {
$loginUsername=$_POST['login'];
$password=$_POST['senha'];
$MM_fldUserAuthorization = "";
$MM_redirectLoginSuccess = "logado1.php";
$MM_redirectLoginFailed = "erro.php";
$MM_redirecttoReferrer = false;
mysql_select_db($database_conexao, $conexao);

$LoginRS__query=sprintf("SELECT usuario, senha FROM usuario WHERE usuario='%s' AND senha='%s'",
get_magic_quotes_gpc() ? $loginUsername : addslashes($loginUsername), get_magic_quotes_gpc() ? $password : addslashes($password));

$LoginRS = mysql_query($LoginRS__query, $conexao) 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 );
}
}
?>

logado:

<?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 = "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;
}
?>
<?php require_once('Connections/conexao.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']);
}

$usuario = isset($_SESSION['MM_Username']) ? $_SESSION['MM_Username'] : FALSE;
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO links (link, nome_link, link_descricao,usuario) VALUES (%s, %s, %s,'$usuario')",
GetSQLValueString($_POST['lonk'], "text"),
GetSQLValueString($_POST['nome_link'], "text"),
GetSQLValueString($_POST['link_descricao'], "text"));


mysql_select_db($database_conexao, $conexao);
$Result1 = mysql_query($insertSQL, $conexao) or die(mysql_error());
}


?>


IPB Skin By Virteq