code of index.php
Code: Select all
<?php
require_once('library/mysql.class.php');
require_once('library/global.inc.php');
require_once('library/functions.inc.php');
session_start();
$cart = $_SESSION['cart'];
?>
<?php
include 'top.php';
?>
<?php
echo writeShoppingCart();
?>
<p></p>
</td>
</tr>
</table>
<?php
$self=$_SERVER['PHP_SELF'];
// how many rows to show per page
$rowsPerPage = 12;
if (isset($_GET['rowsPerPage'])) {
$rowsPerPage = $_GET['rowsPerPage'];
}
$pageNum = 1;
// if $_GET['page'] defined, use it as page number
if(isset($_GET['page']))
{
$pageNum = $_GET['page'];
}
// counting the offset
$offset = ($pageNum - 1) * $rowsPerPage;
$catagory ='';
if (isset($_GET['catagory'])) {
$catagory = $_GET['catagory'];
}
// by default we show first page
if (isset($_GET['catagory'])) {
$catagory = $_GET['catagory'];
}
$remove_these = array ( ',' );
$catagory = str_replace ( $remove_these , '' , $catagory );
$catagory = str_replace ( ' ' , '' , $catagory );
$catagory = str_replace ( ' ' , '' , $catagory );
$catagory = str_replace ( 'necklace' , '.' , $catagory );
if ($catagory == "")
{
echo "
<title>Mudit International India - Collection of Necklaces </title>
<meta NAME='description' CONTENT='Our necklaces are handcrafted with unique design elements for a look that is wonderfully elegant and charming. You'll find beaded necklaces that create colorful dimension while our precious and semi precious stone necklaces provide unique natural element'>
<meta NAME='keywords' CONTENT='Handcrafted necklaces, beaded necklaces, precious stone and semi-precious stone necklaces'>
";
include 'matter.php';
print "<table> <tr>";
$query ="SELECT id, name,address,code, description, catagory
FROM necklaces WHERE name LIKE 'kkkk' ";;
}
else {
// After we've cleaned the string, we break it down into seperate words
$search_terms = explode ( ' ' , $catagory );
// Then we start our query string...
$query = 'SELECT id, name,address,code, description, catagory
FROM necklaces WHERE catagory LIKE "ZZZ" ';
// ...and we add each word to the query string
$x = 0;
foreach ( $search_terms as $word ) {
if ( $x == 0 ) {
$query .= 'OR catagory LIKE "%' . $word . '%" OR name LIKE "%' . $word . '%" OR code LIKE "' . $word . '"';
$x = 1;
} else {
$query .= 'OR catagory like "%' . $word . '%"';
}
}
// Finally, we end the query string.
$query .= '';
}
$pagingQuery = "LIMIT $offset, $rowsPerPage";
$result = mysql_query($query. $pagingQuery) or die('Error, query failed');
$result2 = mysql_query($query) or die('Error, query failed');
$maxresults = mysql_num_rows($result2);
if ($catagory == "")
{
print "";
}
else {
print '<meta NAME="description" CONTENT="Our necklaces are handcrafted with unique design elements for a look that is wonderfully elegant and charming. You will find beaded necklaces that create colorful dimension while our precious and semi precious stone necklaces provide unique natural element">
<meta NAME="keywords" CONTENT="'.$catagory.', Handcrafted necklaces, beaded necklaces, precious stone and semi-precious stone necklaces">
<title> '.$catagory.' - Collection of '.$catagory.' </title> <p align="right"> <font
face="Century" size="3">There are' .$maxresults.' necklaces.</font></p><p align="center">
<table> <tr>';
}
$i = 1; //set $i to 1 outside the loop
while(list($id, $name, $address, $code, $description) = mysql_fetch_array($result))
{
echo '<td><table cellspacing="0" cellpadding="0" width="100%" border="0">
<tr>
<td>
<table cellspacing="0" cellpadding="0" border="0">
<tr>
<td width="12">
<p>
<img height="30" src="global/layout2/categorybox_11.gif" width="12"></p>
</td>
<td class="cellbackdark" width="100%">
<p style="margin-top: 0; margin-bottom: 0">
<a href="details.php?id='.$id.'&catagory='.$catagory.'"> <span class="lightcontrastcolor"><span class="bigselect"><b> '.$name.'S</b></span></span></a></p>
</td>
<td width="12">
<p>
<img height="30" src="global/layout2/categorybox_12.gif" width="12"></p>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="cellbacklight" style="BORDER-RIGHT: #97BFF2 1px solid; PADDING-RIGHT: 2px; BORDER-TOP: #97BFF2 1px solid; PADDING-LEFT: 2px; PADDING-BOTTOM: 2px; BORDER-LEFT: #97BFF2 1px solid; PADDING-TOP: 2px; BORDER-BOTTOM: #97BFF2 1px solid" valign="top">
<table cellspacing="0" cellpadding="0" width="100%" border="0" id="00009">
<tr>
<td style="BORDER-RIGHT: #97BFF2 2px dotted; PADDING-RIGHT: 2px; PADDING-LEFT: 2px; PADDING-BOTTOM: 2px; PADDING-TOP: 2px; HEIGHT: 74px" valign="top" align="middle" width="104" height="74">
<p style="margin-top: 0; margin-bottom: 0">
<a id="'.$id.'" class="highslide" onclick="return hs.expand(this)" href="jewelery/images/necklaces/'.$address.'" ><img src="jewelery/images/necklaces/small/small_'.$address.'" alt="Image of $name necklace " title="Image of '.$name.'necklace" ></a><div class="highslide-caption" id="caption-for-'.$id.'"> '.$name.'<br>Code : '.$code.'<br>Metal :"non allergic" </div>
</td>
<td style="PADDING-RIGHT: 2px; PADDING-LEFT: 2px; PADDING-BOTTOM: 2px; PADDING-TOP: 2px" valign="top">
<span class="smallselect">
<p style="margin-top: 0; margin-bottom: 0">'.$name.'S<br>
'.$description.' <br>
Code: '.$code.'<br><br>
<a href="cart.php?action=add&id='.$id.'&catagory='.$catagory.'&rowsPerPage='.$rowsPerPage.'&page='.$pageNum.'">Add to Basket</a>
<br><br><a href="details.php?id='.$id.'&catagory='.$catagory.'">Product Details</a><br><br><a href="print.php?id='.$id.'&catagory='.$catagory.'">Print This Necklace</a><font size="2"><br><br>Minimun quantity:<b>25</B> <br><br>Shipment time:90 days.<br><br>Payment:100% advance</font>
</p>
<table width="100%" border="0" id="table167">
<tr>
<td style="BORDER-BOTTOM: #97BFF2 2px dotted">
<p style="margin-top: 0; margin-bottom: 0">
<img height="5" src="http://www.muditinternational.com/global/layout2/spacer.gif" width="20" border="0"></p>
</td>
</tr>
<tr>
<td style="PADDING-RIGHT: 4px; PADDING-LEFT: 4px; PADDING-BOTTOM: 4px; PADDING-TOP: 4px" align="right">
<p style="margin-top: 0; margin-bottom: 0"> </p>
</td>
</tr>
</table>
</span></td>
</tr>
</table>
</td>
</tr>
</table><td width="10">
<img height="10" src="http://www.muditinternational.com/global/layout2/spacer.gif" width="10" border="0"></td>'.'</td>'; //display the records in a <td>
$i = $i + 1; //add 1 to $i
if ($i == 3) { //when you have echoed 3 <td>'s
echo '</tr><tr>'; //echo a new row
$i = 1; //reset $i
} //close the if
}
//close the while loop
echo '</tr></table>' ;//close out the table
// how many rows we have in database
if ($catagory == "")
{
$query ="SELECT id, name,address,code, description, catagory
FROM necklaces WHERE name LIKE 'kkkk' ";
}
else {
// After we've cleaned the string, we break it down into seperate words
$search_terms = explode ( ' ' , $catagory );
// Then we start our query string...
$query = 'SELECT COUNT(id) AS numrows FROM necklaces WHERE catagory LIKE "ZZZ" ';
// ...and we add each word to the query string
$x = 0;
foreach ( $search_terms as $word ) {
if ( $x == 0 ) {
$query .= 'OR catagory LIKE "%' . $word . '%" OR name LIKE "%' . $word . '%" OR code LIKE "' . $word . '"';
$x = 1;
} else {
$query .= 'OR catagory like "%' . $word . '%"';
}
}
// Finally, we end the query string.
$query .= '';
}
$result = mysql_query($query) or die('Error, query failed');
$row = mysql_fetch_array($result, MYSQL_ASSOC);
$numrows = $row['numrows'];
// how many pages we have when using paging?
$maxPage = ceil($numrows/$rowsPerPage);
// print the link to access each page
$self = $_SERVER['PHP_SELF'];
$nav = '';
for($page = 1; $page <= $maxPage; $page++)
{
if ($page == $pageNum)
{
$nav .= " $page "; // no need to create a link to current page
}
else
{
$nav .= " <a href=\"$self?catagory=$catagory&rowsPerPage=$rowsPerPage&page=$page\">$page</a> ";
}
}
// creating previous and next link
// plus the link to go straight to
// the first and last page
if ($pageNum > 1)
{
$page = $pageNum - 1;
$prev = " <a href=\"$self?catagory=$catagory&rowsPerPage=$rowsPerPage&page=$page\"><< Previous</a> ";
$first = " <a href=\"$self?catagory=$catagory&rowsPerPage=$rowsPerPage&page=1\">First Page</a> ";
}
else
{
$prev = ' '; // we're on page one, don't print previous link
$first = ' '; // nor the first page link
}
if ($pageNum < $maxPage)
{
$page = $pageNum + 1;
$next = " <a href=\"$self?catagory=$catagory&rowsPerPage=$rowsPerPage&page=$page\">Next Page >></a> ";
$last = " <a href=\"$self?catagory=$catagory&rowsPerPage=$rowsPerPage&page=$maxPage\">Last Page</a> ";
}
else
{
$next = ' '; // we're on the last page, don't print next link
$last = ' '; // nor the last page link
}
// print the navigation link
echo "<table cellSpacing='0' cellPadding='0' border='0'> <tr><td width='12'> <img height='30' src='global/layout2/categorybox_11.gif' width='12'></td>
<td class='cellbackdark' width='100%'><p align='center'> <font face='Verdana' style='font-size: 11pt' >$prev $nav $next </font></td> <td width='12'> <img height='30' src='global/layout2/categorybox_12.gif' width='12'></td> </tr> </table> ";
//echo $first . $prev . $nav . $next . $last;
echo '<table border="0" width="100%" id="table1"> <tr> <td>';
$result6 = mysql_query('SELECT description FROM stones WHERE name LIKE "%'.$catagory.'%"');
if (!$result6) {
die('Could not query:' . mysql_error());
}
$row = mysql_fetch_array($result6); // outputs third employee's name
echo "".$row['description'];
echo '</td> </tr> </table>';
// and close the database connection
?>
<?php
include 'bottom.php';
?>codes of top.php
Code: Select all
<html>
<head>
<?php
$_SERVER['FULL_URL'] = 'http';
$script_name = '';
if(isset($_SERVER['REQUEST_URI'])) {
$script_name = $_SERVER['REQUEST_URI'];
} else {
$script_name = $_SERVER['PHP_SELF'];
if($_SERVER['QUERY_STRING']>' ') {
$script_name .= '?'.$_SERVER['QUERY_STRING'];
}
}
if(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']=='on') {
$_SERVER['FULL_URL'] .= 's';
}
$_SERVER['FULL_URL'] .= '://';
if($_SERVER['SERVER_PORT']!='80') {
$_SERVER['FULL_URL'] .=
$_SERVER['HTTP_HOST'].':'.$_SERVER['SERVER_PORT'].$script_name;
} else {
$_SERVER['FULL_URL'] .= $_SERVER['HTTP_HOST'].$script_name;
}
$janu= $_SERVER['FULL_URL'];
$url = str_replace ( 'www.' , 'www.it.' , $janu );
echo '<div style="position: absolute; height: 20px; z-index: 1; visibility: visible; float:right; left:1; top:0" id="layer2">
<p align="right" style="margin-top: 0; margin-bottom: 0"> <font face="Century" size="1">
<a href="'.$url.'"><font color="#b05800">ITALIANO</font></a></font></p>
</div>';
?>
<script type="text/javascript" src="highslide/highslide.js">
hs.graphicsDir = 'http://www.muditinternational.com/highslide/graphics/';
</script>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv=content-type content="text/html; charset=windows-1252">
<meta name="revisit" content="2 days">
<meta name="verify-v1" content="Bfx29DNnJrZ9Yz2AHjJMM7AXUS94KVG2OGThp0cmyik=" />
<meta name="robots" content="index,follow">
<meta name="author" content="mudit international">
<meta name="classification" content="art">
<link rel="stylesheet" type="text/css" href="_themes/blueprint-janu-gallery/kc.css">
<link rel="stylesheet" type="text/css" href="_themes/blueprint-janu-gallery/janu.css">
<link rel="stylesheet" href="cart-demo/css/styles.css" />
</head>
<!--<div style="position: absolute; height: 20px; z-index: 1; visibility: visible; float:right; right:1; top:0" id="layer2">
<p align="right" style="margin-top: 0; margin-bottom: 0"> <font face="Century" size="1">|
<a href="contactus.htm"><font color="#b05800">CONTACT US</font></a>|
<font color="#b05800"><a href="customer.htm"><font color="#b05800">
CUSTOMER SERVICE</font></a>
</font>| <a href="wholesale.htm"><font color="#b05800">WHOLE SALE</font></a>|
<a href="sitemap.htm"><font color="#b05800">SITEMAP</font></a>|
<a href="faq.htm"><font color="#b05800">FAQ</font></a>|</font></p>
</div> -->
<body leftmargin="0" topmargin="0" rightmargin="0" bottommargin="0" onload>
<div id="highslide-container">
</div>
<font size="1" face="Arial">
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0" valign="top" id="table59">
<tr>
<td width="100%" height="100" valign="top" background="global/layout2/gen_11.1.gif">
<table width="100%" height="100" border="0" cellpadding="0" cellspacing="0" valign="top" id="table60">
<tr>
<td width="768" height="100" valign="top">
<img src="global/layout2/gen_9.1.JPG" width="768" height="100" alt="MUDIT INTERNATONAL"></td>
<td width="100%" height="100" align="right" valign="top" background="global/layout2/gen_11.1.gif">
<p> <font size="1" face="Arial">
<?php echo '<form name="form0" action="index.php" method="get" style="text-align: right">
<input type="text" name="catagory" value ="" >
<select size="1" name="rowsPerPage">
<option>10</option>
<option>20</option>
<option>30</option>
</select><br>
<input type="submit" name="Submit" value="Search" />
</form>';
?></p></td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="100%" height="30" valign="top" background="global/layout2/gen_14.1.gif">
<table width="100%" height="30" border="0" cellpadding="0" cellspacing="0" valign="top" id="table61">
<tr>
<td width="768" height="30" valign="top">
<img src="global/layout2/gen_12.1.gif" width="768" alt="EXPLORE INDIA"></td>
<td width="100%" height="30" align="right" valign="top" background="global/layout2/gen_14.1.gif">
<img src="global/layout2/gen_13.1.gif" width="9" height="30" alt=""></td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="100%" height="100%">
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0" valign="top" bgcolor="#FFFFFF" id="table62">
<tr>
<td width="170" height="100%" valign="top" background>
<table width="170" height="100%" border="0" cellpadding="0" cellspacing="0" valign="top" id="table63">
<tr>
<td width="170" height="15" valign="top">
<img src="global/layout2/gen_15.1.gif" width="170" height="15" alt=""></td>
</tr>
<tr>
<td width="170" valign="top" bgcolor="#326DAF" background="global/layout2/gen_16.1.gif">
<body>
<table width="99" border="0" cellspacing="0" cellpadding="0" id="table64">
<tr height="83">
<td align="left" valign="top" height="83">
<table border="0" style="border-collapse: collapse" width="10%" id="table192">
<tr>
<td id="portfolio-on">
<span lang="en-us"><b>
<span style="font-weight: 400">
<a href="index.php">HOME</font></a></span></b></font></span></td>
</tr>
<tr>
<td id="portfolio">
<p><a href="index.php?catagory=NECKLACE">
NECKLACES</font></a></font></p>
</td>
</tr><tr>
<td id="contact">
<a href="index.php?catagory=NEWARRIVAL">
2008 NEW ARRIVALS</font></a></td>
</tr>
</nobr><nobr>
<tr>
<td id="contact">
<a href="index.php?catagory=New Necklaces ">
2007 HIT NECKLACES</font></a></td>
</tr>
</nobr><nobr>
<tr>
<td id="contact">
<a href="index.php?catagory=Hit Necklaces">
ALL TIME HIT </font></a></td>
</tr>
</nobr><nobr>
<tr>
<td id="contact">
<a href="index.php?catagory=UP Coming Necklaces">
COMING SOON </font></a></td>
</tr>
</nobr><nobr>
<tr>
<td id="contact">
<a href="index.php?catagory=Agate Necklaces">
AGATE</font></a></td>
</tr>
</nobr><nobr>
<tr>
<td id="contact">
<a href="index.php?catagory=2 Line Necklaces">
2 STRING</font></a></td>
</tr>
</nobr><nobr>
<tr>
<td id="contact">
<a href="index.php?catagory=3 string Necklaces">
3 STRING</font></a></td>
</tr>
</nobr><nobr>
<tr>
<td id="contact">
<a href="index.php?catagory=Amethyst Necklaces">
AMETHYST</font></a></td>
</tr>
</nobr><nobr>
<tr>
<td id="contact">
<a href="index.php?catagory=Aventurine Necklaces">
AVENTURINE</font></a></td>
</tr>
</nobr><nobr>
<tr>
<td id="contact">
<a href="index.php?catagory=Bloodstone Necklaces">
BLOODSTONE</font></a></td>
</tr>
</nobr><nobr>
<tr>
<td id="contact">
<a href="index.php?catagory=Citrine Necklaces">
CITRINE QUARTZ</font></a></td>
</tr>
</nobr><nobr>
<tr>
<td id="contact">
<a href="index.php?catagory=Carnelian Necklaces">
CARNELIAN</font></a></td>
</tr>
</nobr><nobr>
<tr>
<td id="contact">
<a href="index.php?catagory=Garnet Necklaces">
GARNET</font></a></td>
</tr>
</nobr><nobr>
<tr>
<td id="contact">
<a href="index.php?catagory=Goldstone Necklaces">
GOLDSTONE</font></a></td>
</tr>
</nobr><nobr>
<tr>
<td id="contact">
<a href="index.php?catagory=LAPIZ LAZULI Necklaces">
LAPIS LAZULI</font></a></td>
</tr>
</nobr><nobr>
<tr>
<td id="contact">
<a href="index.php?catagory=Moonstone Necklaces">
MOONSTONE</font></a></td>
</tr>
</nobr><nobr>
<tr>
<td id="contact">
<a href="index.php?catagory=Pearl Necklaces">
PEARL</font></a></td>
</tr>
</nobr><nobr>
<tr>
<td id="contact">
<a href="index.php?catagory=Peridot Necklaces">
PERIDOT</font></a></td>
</tr>
</nobr><nobr>
<tr>
<td id="contact">
<a href="index.php?catagory=ROSE Necklaces">
ROSE QUARTZ</font></a></td>
</tr>
</nobr><nobr>
<tr>
<td id="contact">
<a href="index.php?catagory=Tigereye Necklaces">
TIGEREYE</font></a></td>
</tr>
</nobr><nobr>
<tr>
<td id="contact">
<a href="index.php?catagory=White Necklaces">
WHITE QUARTZ</font></a></td>
</tr>
</nobr><nobr>
<tr>
<td id="contact">
<a href="index.php?catagory=Pendant Necklaces">
PENDANT</font></a></td>
</tr>
</nobr><nobr>
<tr>
<td id="contact">
<a href="index.php?catagory=LONG Necklaces">
LONG</font></a></td>
</tr>
</nobr><nobr>
<tr>
<td id="contact">
<a href="index.php?catagory=HORN Necklaces">
HORN</font></a></td>
</tr>
</nobr><nobr>
<tr>
<td id="contact">
<a href="index.php?catagory=BONE Necklaces">
BONE</font></a></td>
</tr>
</nobr><nobr>
<tr>
<td id="contact">
<a href="index.php?catagory=WOOD Necklaces">
WOOD</font></a></td>
</tr>
</nobr><nobr>
<tr>
<td id="contact">
<a href="index.php?catagory=GLASS Necklaces">
GLASS</font></a></td>
</tr>
</tr>
<!--<tr>
<td id="portfolio">
<b><span style="font-weight: 400">
<a href="jewelery/jewellery.htm">JEWELRY</font></a></span></b></font></td>
</tr>
<tr>
<td id="portfolio"><span lang="en-us">
<b><span style="font-weight: 400">
<a href="sculptures/sculptures.htm">
SCULPTURES</font></a></span></b></font></span></td>
</tr>
<tr>
<td id="portfolio">
<a href="handicrafts/handicraft.htm">
HANDICRAFTS</font></a></td>
</tr>
<tr>
<td id="portfolio">
<a href="paintings/painting.htm">
PAINTINGS</font></a></td>
<td id="portfolio"></td> </tr> -->
<tr>
<td id="portfolio"><script type="text/javascript" src="http://www.it.muditinternational.com/livehelp/livehelp_js.php?department=1&pingtimes=15"></script></td>
</tr>
<tr>
<td id="portfolio"><script type="text/javascript"><!--
google_ad_client = "pub-8083615707381808";
/* long */
google_ad_slot = "6119734355";
google_ad_width = 120;
google_ad_height = 240;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</td></tr><tr></tr><tr>
<td id="portfolio"><script type="text/javascript"><!--
google_ad_client = "pub-8083615707381808";
/* 120x600, created 3/7/08 */
google_ad_slot = "2651053866";
google_ad_width = 120;
google_ad_height = 600;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</td></tr>
</tr>
</table>
</nobr></td>
</body>
</tr>
</table>
<p><br>
<br>
</p>
</td>
</tr>
<tr>
<td width="170" height="100%" valign="top" bgcolor="#326DAF" background="global/layout2/gen_16.1.gif">
<img src="global/layout2/spacer.gif" width="170" height="1"></td>
</tr>
<tr>
<td width="170" height="20" valign="top" bgcolor="#326DAF">
<img src="global/layout2/gen_17.1.gif" width="170" height="20" alt=""></td>
</tr>
</table>
</td>
<td dir="LTR" width="100%" height="100%" valign="top">
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0" valign="top" id="table66">
<tr>
<td width="100%" height="42" valign="top" background="global/layout2/gen_22.1.gif">
<table width="100%" height="42" border="0" cellpadding="0" cellspacing="0" valign="top" id="table67">
<tr>
<td width="195" height="42" valign="top" bgcolor="#FFFFFF">
<img src="global/layout2/gen_0.1.gif" width="195" height="42" alt=""></td>
<td width="100%" height="42" valign="top" bgcolor="#FFFFFF" background="global/layout2/gen_2.1.gif">
<img src="global/layout2/spacer.gif" width="1" height="1"></td>
<td width="412" height="42" valign="top" bgcolor="#FFFFFF">
<img src="global/layout2/gen_1.1.gif" width="412" height="42" alt=""></td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="100%" height="100%" valign="top" bgcolor="#FFFFFF">
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0" valign="top" id="table68">
<tr>
<td width="25" height="5" valign="top" bgcolor="#FFFFFF" background="global/layout2/gen_21.1.gif">
<img src="global/layout2/spacer.gif" width="1" height="1"></td>
<td width="100%" height="100%" valign="top" background="global/layout2/gen_22.1.gif">
<table border="0" width="100%" id="table35">
<tr>
<td>Code: Select all
<table border="0" width="100%" id="table35">
<tr>
<td>
<p></p>
</td>
</tr>
</table>
</td>
<td width="25" height="5" valign="top" bgcolor="#FFFFFF" background="global/layout2/gen_23.1.gif">
<img src="global/layout2/spacer.gif" width="1" height="1"></td>
</tr>
<tr>
<td width="25" height="24" valign="top" bgcolor="#FFFFFF">
<img src="global/layout2/gen_24.1.gif" width="25" height="24" alt=""></td>
<td width="100%" height="24" valign="top" bgcolor="#FFFFFF" background="global/layout2/gen_26.1.gif">
<img src="global/layout2/spacer.gif" width="1" height="1"></td>
<td width="25" height="24" valign="top" bgcolor="#FFFFFF">
<img src="global/layout2/gen_25.1.gif" width="25" height="24" alt=""></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
<!-- End Center -->
</tr>
</table>
</td>
</tr>
<tr>
<td width="100%" valign="top" bgcolor="#326DAF">
<table width="100%" border="0" cellpadding="0" cellspacing="0" valign="top">
<tr>
<td width="16" height="3" valign="top" bgcolor="#C3C5CA">
<img src="global/layout2/gen_27.1.gif" width="16" height="3" alt=""></td>
<td width="100%" height="3" valign="top" bgcolor="#C3C5CA" background="global/layout2/gen_29.1.gif">
<img src="global/layout2/spacer.gif" width="1" height="1"></td>
<td width="16" height="3" align="right" valign="top" bgcolor="#C3C5CA">
<img src="global/layout2/gen_28.1.gif" width="16" height="3" alt=""></td>
</tr>
<tr>
<td width="16" height="8" valign="top" bgcolor="#C3C5CA" background="global/layout2/gen_30.1.gif">
<img src="global/layout2/gen_30.1.gif" width="16" height="8" alt=""></td>
<td width="100%" height="3" valign="top" bgcolor="#C3C5CA"><br>
<div style="position: absolute; width: 194px; height: 20px; z-index: 1; top: 148px; visibility: visible; right:25" id="layer1">
<p align="right" style="margin-top: 0; margin-bottom: 0"> <font face="Century" size="1"><?php echo $catagory; ?></font></p>
</div>
<font face="verdana, arial, helvetica" size="1"><center>
<div align="center">
<table border="0" style="border-collapse: collapse" width="412" id="table24">
<tr>
<td>
<p align="center">
<font face="verdana, arial, helvetica" size="1"><?php include ("navigation-bottom.htm");?></font></p>
</td>
</tr>
</table>
<p align="center" style="margin-top: 0; margin-bottom: 0"> </p>
<table border="0" style="border-collapse: collapse" width="749" id="table35">
<tr>
<td>
<p align="center" style="margin-top: 0; margin-bottom: 0">
<font face="verdana, arial, helvetica" size="1"><?php include ("navigation-bottom-2.htm");?></font></p>
</td>
</tr>
</table>
</div>
</center></font>
<div align="center">
<table border="0" cellpadding="0" cellspacing="3" id="table34">
<tr>
<td align="center">
<p style="margin-top: 0; margin-bottom: 0">
<font face="Century" size="2">Thanks for visiting
<a href="http://www.muditinternational.com">
<font color="#FF0000">Mudit International</font></a></font></p>
</td>
</tr>
</table>
</div>
<center>
<table border="0" cellpadding="0" cellspacing="3">
<tr>
<td align="center">
<p style="margin-top: 0; margin-bottom: 0">
<font face="Century" size="2">Website build by</font></p>
<p style="margin-top: 0; margin-bottom: 0">
<font face="Century" size="2">
<a title="Bhavatmaj Seth" href="mailto:bhavatmaj@gmail.com">
Bhavatmaj Seth</a></font></p>
</td>
</tr>
</table><table border="0" cellpadding="0" cellspacing="3">
<tr>
<td align="center">
<p style="margin-top: 0; margin-bottom: 0">
<font face="Century" size="2"><script type="text/javascript"><!--
google_ad_client = "pub-8280551646817777";
/* */
google_ad_slot = "3194631203";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</font></p>
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-3690928-1";
urchinTracker();
</script><a href="http://www.muditinternational.com/link.php">Directory</a>
<A href="0308.php?Action=Links"> Related Sites</A> | <A href="SpyderMap.php">SpyderMap</A> | <A href="0308.php?Action=Webring"> Web Portal</A>
<a href="http://www.muditinternational.com/z/z.php"> Resources</a>
<a href="http://www.muditinternational.com/z/z1.php" target="_blank"> Link Exchange</a>
<a href="http://www.muditinternational.com/links.htm" title=" Links " target="_blank"> links </a><font color="#C3C5CA"></font>
</td>
</tr>
</table>
</center></td>
<td width="16" height="8" align="right" valign="top" bgcolor="#C3C5CA" background="global/layout2/gen_31.1.gif">
<img src="global/layout2/gen_31.1.gif" width="16" height="8" alt=""></td>
</tr>
<tr>
<td width="16" height="14" valign="top" bgcolor="#C3C5CA">
<img src="global/layout2/gen_32.1.gif" width="16" height="14" alt=""></td>
<td width="100%" height="14" valign="top" bgcolor="#C3C5CA" background="global/layout2/gen_34.1.gif">
<img src="global/layout2/spacer.gif" width="1" height="1"></td>
<td width="16" height="14" align="right" valign="top" bgcolor="#C3C5CA">
<img src="global/layout2/gen_33.1.gif" width="16" height="14" alt=""></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
<td width="50%" height="100%" valign="top" bgcolor="#FFFFFF">
</td>
</tr>
</table>
</body>
</html>Code: Select all
<?php
function writeShoppingCart() {
$cart = $_SESSION['cart'];
if (isset($_GET['catagory'])) {
$catagory = $_GET['catagory'];
}
if (!$cart) {
return '<p></p>';
} else {
// Parse the cart session variable
$items = explode(',',$cart);
$s = (count($items) > 1) ? 's':'';
return '<p align="right"><a href="cart.php?catagory='.$catagory.'">You have '.count($items).' item'.$s.' in your shopping cart</a><p>';
}
}
function showCart() {
global $db;
$cart = $_SESSION['cart'];
$rowsPerPage = 12;
if (isset($_GET['rowsPerPage'])) {
$rowsPerPage = $_GET['rowsPerPage'];
}
$pageNum = 1;
// if $_GET['page'] defined, use it as page number
if(isset($_GET['page']))
{
$pageNum = $_GET['page'];
}
if (isset($_GET['catagory'])) {
$catagory = $_GET['catagory'];
}
if ($cart) {
$items = explode(',',$cart);
$contents = array();
foreach ($items as $item) {
$contents[$item] = (isset($contents[$item])) ? $contents[$item] + 1 : 1;
}
$output[] = '<form action="cart.php?action=update" method="post" id="cart">';
Echo "<table>";
foreach ($contents as $id=>$qty) {
$sql = 'SELECT * FROM necklaces WHERE id = '.$id;
$result = $db->query($sql);
$row = $result->fetch();
extract($row);
$output[] = '<td><table cellspacing="0" cellpadding="0" width="100%" border="0"><tr><td><table cellspacing="0" cellpadding="0" border="0"> <tr> <td width="12"><p> <img height="30" src="http://www.muditinternational.com/global/layout2/categorybox_11.gif" width="12"></p> </td> <td class="cellbackdark" width="150"> <p style="margin-top: 0; margin-bottom: 0"><span class="lightcontrastcolor"><span class="bigselect"><b>NECKLACE </b></span></span></p> </td> <td width="12"><p><img height="30" src="http://www.muditinternational.com/global/layout2/categorybox_12.gif" width="12"></p></td> </tr></table> </td></tr><tr><td class="cellbacklight" style="BORDER-RIGHT: #97BFF2 1px solid; PADDING-RIGHT: 2px; BORDER-TOP: #97BFF2 1px solid; PADDING-LEFT: 2px; PADDING-BOTTOM: 2px; BORDER-LEFT: #97BFF2 1px solid; PADDING-TOP: 2px; BORDER-BOTTOM: #97BFF2 1px solid" valign="top"><table cellspacing="0" cellpadding="0" width="100%" border="0" id="00009">
<tr><td style="BORDER-RIGHT: #97BFF2 2px dotted; PADDING-RIGHT: 2px; PADDING-LEFT: 2px; PADDING-BOTTOM: 2px; PADDING-TOP: 2px; HEIGHT: 74px" valign="top" align="middle" width="104" height="74"><p style="margin-top: 0; margin-bottom: 0">
<img src="http://www.muditinternational.com/jewelery/images/necklaces/small/small_'.$address.'" alt="$name necklace" title="'.$name.' NECKLACE" ></td><td style="PADDING-RIGHT: 2px; PADDING-LEFT: 2px; PADDING-BOTTOM: 2px; PADDING-TOP: 2px" valign="top"> <span class="smallselect"><span class="smallselect"><p style="margin-top: 0; margin-bottom: 0">Necklace of: '.$name.'<br> '.$description.' <br>
Code: '.$code.' <a href="?action=delete&id='.$id.'&catagory='.$catagory.'&rowsPerPage='.$rowsPerPage.'&page='.$pageNum.'" class="r"><img border="0" src="http://www.muditinternational.com/images/TEXTBOX/b_drop.png" > Remove necklace</a><br>Quantity :<input type="text" name="qty'.$id.'" value="'.$qty.'" size="3" maxlength="3" /><input type="hidden" name="catagory" value='.$catagory.' /><input type="hidden" name="catagory1" value='.$catagory.' /> <input type="submit" value="Update" ><table width="100%" border="0" id="table167"> <tr> <td style="BORDER-BOTTOM: #97BFF2 2px dotted"> </td> </tr> <tr> <td style="PADDING-RIGHT: 4px; PADDING-LEFT: 4px; PADDING-BOTTOM: 4px; PADDING-TOP: 4px" align="right"> </td> </tr> </table></span></td> </tr> </table> </td> </tr></table><tr>';
$total += 1 * $qty;
$output[] = '</tr>';
}
$output[] ='</form></table><p>Total necklaces: <strong>'.$total.'</strong></p><script type="text/javascript"><!--
google_ad_client = "pub-8083615707381808";
/* 250x250, created 3/4/08 */
google_ad_slot = "1070084534";
google_ad_width = 250;
google_ad_height = 250;
//-->
</script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>';
$div = join('', $output);
$data= base64_encode($div);
$output[] ='<form method="post" name="email" action="email.php"><input type="hidden" name="data" value="'.$data.'">';
$output[] ='<p>Name <input type="text" name="name" size="20"></p><p>Email <input type="text" name="email" size="20"></p><p>Phone <input type="text" name="phone" size="20"></p><p>Address<textarea rows="1" name="address" cols="50"></textarea></p><p>Comments<textarea rows="2" name="Comments" cols="40"></textarea></p><button type="submit">check out</button></form>';
$output[] ='<form action="index.php?catagory='.$catagory.'&rowsPerPage='.$rowsPerPage.'&page='.$pageNum.'" method="post"><button type="submit">BACK TO SHOPPING</button></form>';
} else {
$output[] = '<p>Your Cart is Empty </p>';
}
return join('',$output);
}
?>
Code: Select all
<?php
require_once('library/mysql.class.php');
require_once('library/global.inc.php');
require_once('library/functions.inc.php');
session_start();
// Process actions
$cart = $_SESSION['cart'];
$action = $_GET['action'];
if (isset($_GET['catagory'])) {
$catagory = $_GET['catagory'];
}
if (isset($_GET['catagory1'])) {
$catagory1 = $_GET['catagory1'];
}
switch ($action) {
case 'add':
if ($cart) {
$cart .= ','.$_GET['id'];
} else {
$cart = $_GET['id'];
}
break;
case 'delete':
if ($cart) {
$items = explode(',',$cart);
$newcart = '';
foreach ($items as $item) {
if ($_GET['id'] != $item) {
if ($newcart != '') {
$newcart .= ','.$item;
} else {
$newcart = $item;
}
}
}
$cart = $newcart;
}
break;
case 'update':
if ($cart) {
$newcart = '';
foreach ($_POST as $key=>$value) {
if (stristr($key,'qty')) {
$id = str_replace('qty','',$key);
$items = ($newcart != '') ? explode(',',$newcart) : explode(',',$cart);
$newcart = '';
foreach ($items as $item) {
if ($id != $item) {
if ($newcart != '') {
$newcart .= ','.$item;
} else {
$newcart = $item;
}
}
}
for ($i=1;$i<=$value;$i++) {
if ($newcart != '') {
$newcart .= ','.$id;
} else {
$newcart = $id;
}
}
}
}
}
$cart = $newcart;
break;
}
$_SESSION['cart'] = $cart;
?>
<?php
include 'top.php';
?>
<?php
echo writeShoppingCart();
?>
<?php
echo showCart();
?>
</td>
<?php
include 'bottom.php';
?>