her er lib.php:
Men ellers kan du hente hele scriptet her..:
http://www.webscriptworld.com/scripts/wsm.phtmlPS: Glædelig Jul
<?
function style () {
include(\"vars.php\");
echo \"<STYLE TYPE=\\\"text/css\\\">
<!--
BODY {
font-family : $font;
font-size : $font_size pt;
color : Black;
font-weight : normal;
}
TD {
font-family : $font;
font-size : $font_size pt;
color : Black;
font-weight : normal;
}
INPUT {
font-family : $font;
font-size : $font_size pt;
color : Black;
font-weight : normal;
}
-->
</STYLE>\";
}
function dispHeader ($categ,$search,$cat) {
include(\"vars.php\");
echo \"
<SCRIPT LANGUAGE=\\\"JavaScript\\\">
<!--
function jumpto(){
location = document.links.link_select.options[document.links.link_select.selectedIndex].value
}
-->
</SCRIPT>
<center>
<table width=\\\"460\\\">
<tr>
<td>
<p><table width=\\\"100%\\\" border=\\\"1\\\" cellspacing=\\\"0\\\" cellpadding=\\\"2\\\" bgcolor=\\\"$tdbg\\\" bordercolor=\\\"black\\\" bordercolorlight=\\\"black\\\" bordercolordark=\\\"black\\\">
<tr>
<td><font color=\\\"$font1\\\"><b>Store Options</b></font></td>
</tr>
</table>
<table width=\\\"470\\\" border=\\\"0\\\" cellspacing=\\\"0\\\" cellpadding=\\\"0\\\">
<form method=\\\"POST\\\" name=\\\"links\\\">
<tr>
<td width=\\\"160\\\" valign=\\\"TOP\\\">
<br><select name=\\\"link_select\\\">
<P><option value=\\\"index.php\\\">View all products\";
$cartFile = File(\"dbase.txt\");
$length = sizeof($cartFile);
$i = 1;
while ($i < $length):
$tok = strtok($cartFile[$i],\"|\");
$categ = $tok;
if (!$lookupAr[$categ]):
$categ2 = \"$categ\";
$categ = ereg_replace(\"&\",\"%26\",$categ);
echo \"<option value=\\\"index.php?cat=$categ\\\">$categ2 \\n\";
$lookupAr[$categ] = 1;
endif;
$i++;
endwhile;
echo \"</select>
<input type=\\\"button\\\" value=\\\"go\\\" onClick=\\\"jumpto()\\\">
</td>
</form>
<form method=\\\"post\\\" action=\\\"index.php\\\">
<td align=\\\"right\\\" valign=\\\"bottom\\\">
<input type=\\\"hidden\\\" name=\\\"option\\\" value=\\\"search\\\">
<input type=\\\"text\\\" name=\\\"search\\\" size=\\\"17\\\" value=\\\"$search\\\">
<input type=\\\"submit\\\" value=\\\"Search\\\">
</td>
</tr>
</form>
</table>
<p align=\\\"right\\\"><a href=\\\"mailto:$store_email\\\">Email Us</a>\"; if ($faqs != \"\"): echo \" | <a href=\\\"$faqs\\\">FAQs</a>\"; endif; echo \" | <a href=\\\"view.php\\\">View Shopping</a> | <a href=\\\"checkout.php\\\">Check Out</a>\";
}
function dispFooter () {
include(\"vars.php\");
echo \"<center>All prices quoted in $currency. Prices are \";
if ($tax == \"no\"): echo \"exclusive\"; else: echo \"inclusive\"; endif;
echo \" of $tax_name.
</center>
</td>
</tr>
</table>\";
}
function displayProd ($categ,$type,$id,$name,$options,$price,$normpr,$img,$stockop,$advdate,$details,$desc) {
include(\"vars.php\");
echo \"<P><table>
<tr>\";
if ($img != \"\"):
echo \"<td valign=\\\"top\\\"><img src=\\\"images/$img\\\" border=\\\"0\\\"></td><td width=\\\"30\\\"></td>\";
if ($details != \"\"):
echo \"<p><font size=\\\"1\\\"><center><a href=\\\"$details\\\">Click for more details</a>\";
endif;
endif;
echo \"<td valign=\\\"top\\\">
<font color=\\\"$font1\\\"><b>$name</b></font>\";
if ($stockop == \"advance\"):
echo \"<br><b>Advance Order Only</b> - Available $advdate\";
elseif ($stockop == \"outof\"):
echo \"<br><b>Out of Stock</b>\";
endif;
echo \"<p>$desc\";
if ($stockop == \"instock\" || $stockop == \"advance\"):
if ($type == \"single\"):
if ($normpr != \"\"):
echo \"<p>RRP: <strike>$cur$normpr</strike> | <font color=\\\"$font2\\\"><b>Our Price: $cur$price</b></font>\";
else:
echo \"<p><font color=\\\"$font2\\\"><b>Price: $cur$price</b></font>\";
endif;
echo \" | <input name=\\\"\".$id.\"info\\\" type=\\\"hidden\\\" value=\\\"$name|$price\\\"> \";
else:
$tokAr = explode(\"~\",$options);
$numTok = sizeof($tokAr);
for ($i=0;$i<$numTok;$i++) {
if (trim($tokAr[$i])!=\"\") {
$tokformat = ereg_replace(\" - \",\"|\",$tokAr[$i]);
$tok = ereg_replace(\" - \",\" - $cur\",$tokAr[$i]);
$options2 .= \"<option value=\\\"$name - $tokformat\\\">$tok\";
}
}
$options = $options2;
echo \"<p><select name=\\\"\".$id.\"info\\\">$options</select> \";
endif;
echo \"<input type=\\\"value\\\" name=\\\"\".$id.\"quant\\\" value=\\\"1\\\" size=\\\"3\\\"> <input type=\\\"button\\\" name=\\\"\".$id.\"add\\\" value=\\\"Add\\\" onclick=\\\"addItem(document.itemsform.\".$id.\"info,document.itemsform.\".$id.\"quant.value)\\\">\";
endif;
echo \"</td>
</tr>
</table>
<P><hr width=\\\"100%\\\" size=\\\"1\\\" noshade color=\\\"black\\\">\";
}
function dispRegForm ($user,$email,$passwd,$firstname,$surname,$billing_adr,$delivery_adr,$evening_ph,$day_ph,$fax,$paytype,$ccno,$ccexp,$noc,$option) {
include(\"vars.php\");
$billing_adr = ereg_replace(\"<br>\",\"\\n\",$billing_adr);
$delivery_adr = ereg_replace(\"<br>\",\"\\n\",$delivery_adr);
echo \"<p><table border=\\\"0\\\" cellspacing=\\\"0\\\" cellpadding=\\\"2\\\">
<tr>
<td colspan=\\\"2\\\"><font color=\\\"$font2\\\"><b>Contact Details<br><br></b></td>
</tr>\";
if ($option != \"update\"):
echo \"<tr>
<td width=\\\"140\\\">Username:</td>
<td width=\\\"200\\\"><input type=\\\"text\\\" name=\\\"user\\\" value=\\\"$user\\\" size=\\\"30\\\"></td>
</tr>\";
else:
echo \"<input type=\\\"hidden\\\" name=\\\"user\\\" value=\\\"$user\\\">
<input type=\\\"hidden\\\" name=\\\"passwd\\\" value=\\\"$passwd\\\">
<input type=\\\"hidden\\\" name=\\\"option\\\" value=\\\"update2\\\">\";
endif;
echo \"<tr>
<td>Email:</td>
<td><input type=\\\"text\\\" name=\\\"email\\\" value=\\\"$email\\\" size=\\\"30\\\"></td>
</tr>\";
if ($option != \"update\"):
echo \"<tr>
<td>Password:</td>
<td><input type=\\\"password\\\" name=\\\"passwd\\\" value=\\\"$passwd\\\" size=\\\"30\\\"></td>
</tr>\";
endif;
echo \"<tr>
<td>First Name :</td>
<td><input type=\\\"text\\\" name=\\\"firstname\\\" value=\\\"$firstname\\\" size=\\\"30\\\"></td>
</tr>
<tr>
<td>Surname :</td>
<td><input type=\\\"text\\\" name=\\\"surname\\\" value=\\\"$surname\\\" size=\\\"30\\\"></td>
</tr>
<tr>
<td valign=\\\"top\\\">Billing Address:</td>
<td><textarea name=\\\"billing_adr\\\" cols=\\\"26\\\" rows=\\\"4\\\" wrap=\\\"physical\\\">$billing_adr</textarea></td>
</tr>
<tr>
<td valign=\\\"top\\\">Delivery Address:</td>
<td><textarea name=\\\"delivery_adr\\\" cols=\\\"26\\\" rows=\\\"4\\\" wrap=\\\"physical\\\">$delivery_adr</textarea></td>
</tr>
<tr>
<td>Home Phone:</td>
<td><input type=\\\"text\\\" name=\\\"evening_ph\\\" value=\\\"$evening_ph\\\" size=\\\"30\\\"></td>
</tr>
<tr>
<td>Work Phone:</td>
<td><input type=\\\"text\\\" name=\\\"day_ph\\\" value=\\\"$day_ph\\\" size=\\\"30\\\"></td>
</tr>
<tr>
<td>Fax:</td>
<td><input type=\\\"text\\\" name=\\\"fax\\\" value=\\\"$fax\\\" size=\\\"30\\\"></td>
</tr>
<tr>
<td colspan=\\\"2\\\"><br><br><font color=\\\"$font2\\\"><b>Preferred Payment Method<br><br></b></td>
</tr>
<tr>
<td width=\\\"140\\\">Payment Type:</td>
<td width=\\\"200\\\"><select name=\\\"paytype\\\">\";
$cartFile = File(\"paytype.txt\");
$length = sizeof($cartFile);
$i = 0;
while ($i < $length):
$pt = ($cartFile[$i]);
echo \"<option\"; if ($paytype != \"\"): if (eregi($paytype,$pt)): echo \" selected\"; endif; endif; echo \">$pt\";
$i++;
endwhile;
echo \"</select>
</td>
</tr>
<tr>
<td>Credit Card No.:</td>
<td><input type=\\\"text\\\" name=\\\"ccno\\\" value=\\\"$ccno\\\" size=\\\"30\\\"></td>
</tr>
<tr>
<td>Expiry Date:</td>
<td><input type=\\\"text\\\" name=\\\"ccexp\\\" value=\\\"$ccexp\\\" size=\\\"30\\\"></td>
</tr>
<tr>
<td>Name on Card:</td>
<td><input type=\\\"text\\\" name=\\\"noc\\\" value=\\\"$noc\\\" size=\\\"30\\\"></td>
</tr>
</table>\";
}
?>