bababoy wrote: |
Hi everybody!
I need a block for Aser's Shop module
Somebody help me! Please. |
Code: |
<?php
/************************************************************************/
/* PHP-NUKE: Web Portal System */
/* =========================== */
/* */
/* Copyright (c) 2002 by Francisco Burzi */
/* http://phpnuke.org */
/* */
/* Andrei Orlov http://www.x-prices.com */
/* */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License. */
/************************************************************************/
/* Additional security checking code 2003 by chatserv */
/* http://www.nukefixes.com -- http://www.nukeresources.com */
/************************************************************************/
if (eregi("block-Aser_Shop.php",$_SERVER[PHP_SELF])) {
Header("Location: index.php");
die();
}
global $db, $user, $cookie;
$Asers_Shop = "Asers_Shop"; //Module name as folder name
if(is_user($user)) {
cookiedecode($user);
$auth_name = $cookie[1];
$result = $db->sql_query("SELECT * FROM asershop_orders WHERE uname='$auth_name'");
$numrows = $db->sql_numrows($result);
if($numrows > 0) {
$content_c .= "<br><center><a href=\"modules.php?name=$Asers_Shop&s_op=vieworders\"><img src = \"modules/$Asers_Shop/images/your_orders.gif\" border =\"0\"></a></center>";
}
}
$cid = $_GET['cid'];
$lid = $_GET['lid'];
$name = $_GET['name'];
if(!isset($cid) && isset($lid) && $name == "$Asers_Shop") {
$result = $db->sql_query("SELECT cid FROM asershop_products WHERE lid = '$lid'");
list($cid)=$db->sql_fetchrow($result);
}
$content .= "<center><a href=\"modules.php?name=$Asers_Shop&s_op=viewcart\"><img src = \"modules/$Asers_Shop/images/your_cart.gif\" border =\"0\"></a></center>";
$content .= "<font class=\"option\"><strong><big>·;</big></strong> ;;<a href=\"modules.php?name=$Asers_Shop\">à¢éÒÃéÒ¹</a></font><br>";
if ($name != "$Asers_Shop" || !isset($cid)) {
$result = $db->sql_query("SELECT cid, title FROM asershop_categories WHERE parentid='0' order by title");
while(list($cid, $title) = $db->sql_fetchrow($result)) {
$content .= "<font class=\"content\"><strong><big>·;</big></strong> ;<a href=\"modules.php?name=$Asers_Shop&s_op=viewproduct&cid=$cid\">$title</a></font><br>";
}
$content .= $content_c;
} else {
$result = $db->sql_query("SELECT parentid, title FROM asershop_categories WHERE cid='$cid'");
$row = $db->sql_fetchrow($result);
$parentid = intval($row['parentid']);
$title = $row['title'];
$title3 = "<img src=\"images/arrow.gif\" border=\"0\"><font class=\"content\"><strong><big> ;;</big></strong><a href=modules.php?name=$Asers_Shop&s_op=viewproduct&cid=$cid>$title</a></font>";
$ptitle = getparentmenulink($parentid,"",$Asers_Shop);
$content .= $ptitle;
$content .= $title3;
$result = $db->sql_query("SELECT cid, title FROM asershop_categories WHERE parentid='$cid' order by title");
while($row = $db->sql_fetchrow($result)) {
$cid1 = intval($row['cid']);
$title = $row['title'];
$content .= "<br><font class=\"content\"> ;; ;; ;; ;;<a href=modules.php?name=$Asers_Shop&s_op=viewproduct&cid=$cid1>$title</a>";
}
$sql = "SELECT cid, title, parentid FROM asershop_categories WHERE parentid='$parentid' and cid != '$cid'";
$result1 = $db->sql_query($sql);
while($row = $db->sql_fetchrow($result1)) {
$cid1 = intval($row['cid']);
$ptitle1 = $row['title'];
$parentid = $row['parentid'];
$parentmenu .= "<br><font class=\"content\"><strong><big>+</big></strong> ;;<a href=modules.php?name=$Asers_Shop&s_op=viewproduct&cid=$cid1>$ptitle1</a>";
}
$content .= $parentmenu;
if ($parentid != 0) {
while($parentid != 0) {
$result = $db->sql_query("SELECT cid, parentid FROM asershop_categories WHERE cid='$parentid'");
$row = $db->sql_fetchrow($result);
$parentid = $row['parentid'];
$cid3 = $row['cid'];
}
$result = $db->sql_query("SELECT cid, title FROM asershop_categories WHERE parentid='0' and cid != '$cid3' order by title");
while(list($cid, $title) = $db->sql_fetchrow($result)) {
$endcontent .= "<br><font class=\"content\"><strong><big>·;</big></strong> ;;<a href=\"modules.php?name=$Asers_Shop&s_op=viewproduct&cid=$cid\">$title</a></font>";
}
}
$content .= $endcontent;
$content .= "<br>".$content_c;
}
function getparentmenulink($parentid,$ptitle,$Asers_Shop) {
global $db;
$parentid = intval($parentid);
if ($parentid!=0) {
$sql = "SELECT cid, title, parentid FROM asershop_categories WHERE cid='$parentid'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$cid = intval($row['cid']);
$title = $row['title'];
$parentid = $row['parentid'];
$ptitle="<font class=\"content\"><strong><big>·;</big></strong> ;;<a href=modules.php?name=$Asers_Shop&s_op=viewproduct&cid=$cid>$title</a></font><br>".$ptitle;
}
if ($parentid!=0) {
$ptitle=getparentmenulink($parentid,$ptitle,$Asers_Shop);
}
return $ptitle;
}
?> |