USPEO SAM DA NAPRAVIM!!!
Evo je kompletna stranica:
Code:
<?php $id = $_GET['ID'] ?>
<?php require_once('Connections/MySQL_MegaTV.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 = "greska.php?ID=Pristup Odbijen!";
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
mysql_select_db($database_MySQL_MegaTV, $MySQL_MegaTV);
$query_Proizvodi = "SELECT ID, NAME, PRICE FROM proizvodi WHERE id = $id";
$Proizvodi = mysql_query($query_Proizvodi, $MySQL_MegaTV) or die(mysql_error());
$row_Proizvodi = mysql_fetch_assoc($Proizvodi);
$totalRows_Proizvodi = mysql_num_rows($Proizvodi);
mysql_select_db($database_MySQL_MegaTV, $MySQL_MegaTV);
$query_more_info = "SELECT ID, Proizvodjac, Opis, Slika, Sastav, Tezina FROM artikli_detalji WHERE id = $id";
$more_info = mysql_query($query_more_info, $MySQL_MegaTV) or die(mysql_error());
$row_more_info = mysql_fetch_assoc($more_info);
$totalRows_more_info = mysql_num_rows($more_info);
?>
<!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>MEGATV Shop</title>
</head>
<style type="text/css">
<!--
body {
background-image: url(background.png);
background-repeat: repeat-x;
background-color: #FFFFFF;
}
.style4 {
background-color: #FF0000;
}
.all {
color: #000000;
background-color: #FF0000;
}
.style5 {
background-color: #FF0000;
color: #CC6600;
font-style: italic;
}
.kategorija {
font-style: italic;
text-decoration: overline;
background-color: #666666;
}
-->
</style>
<body>
<h1 align="left" class="style5">Detalji o proizvodu - <?php echo $row_Proizvodi['NAME']; ?></h1>
<div align="left" class="style4">
<p><em class="kategorija"><strong>OSNOVNE INFORMACIJE</strong></em><br />
<em>ID:</em><br />
<strong><?php echo $row_Proizvodi['ID']; ?></strong><br />
<em>Naziv: </em><br />
<strong><?php echo $row_Proizvodi['NAME']; ?></strong><br />
<em>Cena: </em><br />
<strong><?php echo $row_Proizvodi['PRICE']; ?></strong></p>
<p><em class="kategorija"><strong>DETALJNE INFORMACIJE</strong></em><em>
<br />
Proizvođač<br /></em><strong><?php echo $row_more_info['Proizvodjac']; ?></strong><br />
<em>Opis</em><br />
<strong><?php echo $row_more_info['Opis']; ?></strong><br />
<em>Slika</em><br />
<strong><a href="<?php echo $row_more_info['Slika']; ?>"><img src="<?php echo $row_more_info['Slika']; ?>" width="100" height="100" border="0" /></a></strong><br />
<em>Sastav</em><br />
<strong><?php echo $row_more_info['Sastav']; ?></strong><br />
<em>Težina</em><br />
<strong><?php echo $row_more_info['Tezina']; ?></strong></p>
<p><br />
<a href="admin.php"><em><strong>Administracija</strong></em></a></p>
</div>
</body>
</html>
<?php
mysql_free_result($Proizvodi);
mysql_free_result($more_info);
?>
Problem je bio u tome što:
a)sam trebao postaviti
Code:
<?php $id = $_GET['ID'] ?>
na početak,a ne na kraj stranice
b)
Code:
<?php echo $row_more_info['NESTO']; ?>
treba da ide posle podesavanja konekcije ,a ne pre!
Sd me muce ostale stvari koje sam naveo u prvoj poruci...