document.writetd bgcolor=909090 align=centerStd; document.writetd bgcolor=909090 align=centerRtd;
document.writetd bgcolor=909090 align=centerKtd; document.writetd bgcolor=909090 align=centerJtd;
document.writetd bgcolor=909090 align=centerStd; document.writetr;
if currentDate.getDay = 0 { document.writetr;
for i = 0; i currentDate.getDay; i++ { document.writetdnbsp;td;}
} while currentDate.getMonth == currentMonth {
if currentDate.getDay == 0 { document.writetr; }
if hariini==currentDate.getDate{ document.writetd
align=center bgcolor=FF9900
font color=CC0000strong
+ currentDate.getDate
+ strongfonttd;}
else{ document.writetd align=center + currentDate.getDate +
td; } if currentDate.getDay == 6{
document.writetr; }
currentDate.setDatecurrentDate.getDate + 1; }
for i = currentDate.getDay; i = 6; i++ { document.writetdnbsp;td;
} document.writefonttable;
SCRIPT div
6. Aksi.php
?php session_start;
error_reporting0; include configkoneksi.php;
include configlibrary.php; module=_GET[module];
act=_GET[act]; if module==keranjang AND act==tambah{
sid = session_id; sql2
= mysql_querySELECT
stok FROM
produk WHERE
id_produk=_GET[id]; r=mysql_fetch_arraysql2;
stok=r[stok]; if stok == 0{
echo stok habis; } else{
check if the product is already in cart table for this session
sql = mysql_querySELECT id_produk FROM orders_temp WHERE id_produk=_GET[id] AND id_session=sid;
ketemu=mysql_num_rowssql;
Universitas Sumatera Utara
if ketemu==0{ put the product in cart table
mysql_queryINSERT INTO
orders_temp id_produk,
jumlah, id_session, tgl_order_temp, jam_order_temp, stok_tempVALUES
_GET[id], 1,
sid, tgl_sekarang,
jam_sekarang, stok;
} else { update product quantity in cart table
mysql_queryUPDATE orders_temp SET jumlah = jumlah + 1 WHERE id_session =sid AND id_produk=_GET[id]; }
deleteAbandonedCart; headerLocation:keranjang-belanja.html; }}
elseif module==keranjang AND act==hapus{ mysql_queryDELETE
FROM orders_temp
WHERE id_orders_temp=_GET[id];
headerLocation:keranjang-belanja.html;} elseif module==keranjang AND act==update{
id = _POST[id]; jml_data = countid;
jumlah = _POST[jml]; quantity for i=1; i = jml_data; i++{
sql2 = mysql_querySELECT stok_temp FROM orders_temp WHERE id_orders_temp=.id[i].;
whiler=mysql_fetch_arraysql2{ if jumlah[i] r[stok_temp]{
echo scriptwindow.alertJumlah yang dibeli melebihi stok yang ada;
window.location=keranjang-belanja.htmlscript } else{
mysql_queryUPDATE orders_temp SET jumlah = .jumlah[i]. WHERE id_orders_temp = .id[i].;
headerLocation:keranjang-belanja.html;} }}} Delete all cart entries older than one day
function deleteAbandonedCart{ kemarin = dateY-m-d, mktime0,0,0, datem, dated - 1,
dateY;
mysql_queryDELETE FROM orders_temp WHERE tgl_order_temp kemarin;}
?
7. Item.php
?php sid = session_id;
sql = mysql_querySELECT SUMjumlahharga as total, SUMjumlah as totaljumlah FROM orders_temp, produk WHERE id_session=sid
AND orders_temp.id_produk= produk.id_produk ; whiler=mysql_fetch_arraysql{
if r[totaljumlah] = { total_rp = format_rupiahr[total];
echo
ia href=keranjang-belanja.htmlr[totaljumlah]
itemaibr span class=border_cartspan
Total: span class=priceRp. total_rpspan; } else{
Universitas Sumatera Utara
echo i0 itemibr span class=border_cartspan
Total: span class=priceRp. 0span;} } ?
8. Media.php