<?php
error_reporting(0);

/* Replace these variables with information about your company */
$Company ='Your Company';
$Address1='555 Any St.';
$Address2='PO Box 3';
$City    ='AnyTown';
$State   ='OR';
$Zip     ='97777';
$Phone   ='(777) 555-1212';
$Web     ='http://www.nukestore.com';
$Email   ='sales@nukestore.com';

$NoShipping = 'Shipping Extra';
$MailHeader = 'Mail Header';
$MailFooter = 'Mail Footer';


/* Replace these variables with information for connecting to your database server */
/*
$DBHost='localhost';
$DBUser='root';
$DBPass='';
$DBName='nukeshop';

/*/
include ("../functions.inc.php");

$DBHost=$hostname;
$DBUser=$userdb;
$DBPass=$passdb;
$DBName=$database;


/* Replace these variables with the absolute and relative paths to your MyCart scripts */
/*
$WebRoot="/local/htdocs/apps/cart";
$Relative="/apps/cart";
/*/
$WebRoot="/usr/path/nukestore.com/httpdocs";
$Relative="/";


$WebHost='www.nukestore.com';
$Panel='panel';
$images='/usr/path/nukestore.com/httpdocs/images';
$image='http://www.nukestore.com/images';
function redFont($font,$text) {
echo "<FONT FACE=\"$font\" COLOR=\"#000080\">$text</FONT>";
}

function blueFont($font,$text) {
echo "<FONT FACE=\"$font\" size=\"3\" COLOR=\"#000000\">$text</FONT>";
}

function colorFont($color,$font,$text) {
echo "<FONT FACE=\"$font\" COLOR=\"$color\">$text</FONT>";
}

function fontFace($font,$text) {
echo "<FONT FACE=\"$font\">$text</FONT>";
}

function fontSize($size,$color,$font,$text) {
echo "<FONT FACE=\"$font\" COLOR=\"$color\" SIZE=\"$size\">$text</FONT>";
}

function commonHeader($Company,$title) {
global $Panel,$LoggedIn,$Relative,$UID,$d,$PHP_SELF;
include("$Panel/panel.head");

echo "<CENTER>";
if (empty($LoggedIn)) {
     fontFace("Arial","<A class=link-head HREF=\"$PHP_SELF?topic=login.php&UID=$UID\">User Login</A>");
} else {
     fontFace("Arial","<A class=link-head HREF=\"$PHP_SELF?topic=home.php\">Logout</A>");
}
echo ' &nbsp; | &nbsp; ';
fontFace("Arial","<A class=link-head HREF=\"$PHP_SELF?topic=home.php&UID=$UID\">Our Catalog</A>");
echo ' &nbsp; | &nbsp; ';
fontFace("Arial","<A class=link-head HREF=\"$PHP_SELF?topic=viewCart.php&UID=$UID\">Your Cart</A>");
echo ' &nbsp; | &nbsp; ';
fontFace("Arial","<A class=link-head HREF=\"$PHP_SELF?topic=userInfo.php&UID=$UID\">Check Out</A>");
echo ' &nbsp; | &nbsp; ';
fontFace("Arial","<A class=link-head HREF=\"$PHP_SELF?topic=viewOrders.php&UID=$UID\">Your Account</A>");
echo "<BR>";

if (!empty($LoggedIn))
     blueFont('Arial', "You are logged in as $LoggedIn<br><br>");
}

function commonFooter($Relative,$UID) {
global $Panel;
include("$Panel/panel.foot");
}

function adminHeader($Company,$title) {
global $Panel,$Relative,$PHP_SELF,$d;
include("$Panel/panel.head");
fontFace("Arial","<A HREF='$PHP_SELF?topic=buyerSearch.php'>Buyers</A>");
echo ' &nbsp; | &nbsp; ';
fontFace("Arial","<A HREF='$PHP_SELF?topic=searchReceipts.php'>Receipts</A>");
echo ' &nbsp; | &nbsp; ';
fontFace("Arial","<A HREF='$PHP_SELF?topic=category.php'>Categories</A>");
echo ' &nbsp; | &nbsp; ';
fontFace("Arial","<A HREF='$PHP_SELF?topic=updateItem.php'>Items</A>");
echo ' &nbsp; | &nbsp; ';
fontFace("Arial","<A HREF='$PHP_SELF?topic=itemOptions.php'>Item Options</A>");
echo ' &nbsp; | &nbsp; ';
fontFace("Arial","<A HREF='$PHP_SELF?topic=orderOptions.php'>Order Options</A>");
echo '<br>';
fontFace("Arial","<A HREF='$PHP_SELF?topic=pictures.php'>Pictures</A>");
echo ' &nbsp; | &nbsp; ';
fontFace("Arial","<A HREF='$PHP_SELF?topic=mailCompose.php'>Mail to Buyers</A>");
echo ' &nbsp; | &nbsp; ';
fontFace("Arial","<A HREF='../index.php?topic=store'>Catalog</A>");
echo ' &nbsp; | &nbsp; ';
fontFace("Arial","<A HREF=\"$PHP_SELF?topic=home.php\">Cart Admin</A>");
echo ' &nbsp; | &nbsp; ';
fontFace("Arial","<A HREF='./templates.php'>Content Management</A>");
echo '<br><br>';
}

function adminFooter($Relative) {
global $Panel;

include("$Panel/panel.foot");
}

function receiptHeader($Company,$title) {
echo "<HTML><TITLE>$Company Receipt - $title</TITLE><BODY BGCOLOR=\"#FFFFFF\">";
}

function receiptFooter($Company) {
global $Panel;
echo "<BR><BR><CENTER>";
fontFace("Arial","Thank you for ordering from <B>$Company</B>");
echo "</CENTER><BR><BR>";
include("$Panel/panel.foot");
}

mysql_connect($DBHost,$DBUser,$DBPass);
mysql_select_db($DBName);

if (!empty($UID)) {
     $result = mysql_query("SELECT count(*) FROM Users WHERE User='$UID'");
     $num = intval(mysql_result($result,0,0));
     if ($num == 0)
          $UID = '';
}

if (empty($UID)) {
     $dt=date("YmdHis");
     $UID="$dt$REMOTE_ADDR";
     $date=date("z");
     mysql_query("INSERT INTO Users VALUES ('$UID','$date')");
}

$user = mysql_query("SELECT Name FROM Buyers WHERE UserID = '$UID'");
list($LoggedIn) = mysql_fetch_row($user);
mysql_free_result($user);
?>
