⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 favorite.php

📁 这个版本只是修正了一些BUG
💻 PHP
字号:
<?php
/***********************************************
    	favorite.php - 收藏夹

	Version  : 1.2
	Author   : Tracemouse (tracemouse@msn.com)
	Copyright:
	Writed   : 2003/08/08
	Modified : 2004/04/13
************************************************/
require "./include/base.php";
require "./include/buy.php";

$nav .= SEPARATER."<a href='myshop.php'>".$language['myshop']."</a>".SEPARATER.$language['myshop_favorite'];

if (!$islogin)
{
	include template('login');
	exit;
}

if($action=='add')
{
	$productid=intval($productid);
	$query=$db->query("select count(*) from $table_favorite where username='$_login_user' and productid=$productid");
	$num=$db->result($query,0);
	if ($num > 0) showmessage('fav_rtn_already',$referer);
	if($query=$db->query("INSERT INTO $table_favorite(productid,username,date) VALUES($productid,'$_login_user',$timestamp)",1))
	{
		showmessage('suc_add_fav');
	}
	else
	{
		showmessage('err_add_fav');
	}
}
elseif($action=='buyall')
{
	$query=$db->query("SELECT * FROM $table_favorite WHERE username='$_login_user'");
	while($dbq_rec = $db->fetch_array($query))
    	{
       	 	buy($dbq_rec['productid'],$_login_user);
    	}
    	$query=$db->query("delete from $table_favorite where username='$_login_user'",1);
    	showmessage('success','basket.php');
}
elseif($action=='delete')
{
	if(is_array($delete))
    	{
  		$ids = $comma = "";
  		foreach($delete as $id)
        	{
    			$ids .= "$comma'$id'";
			$comma = ", ";
   		}
   		$db->query("DELETE FROM $table_favorite WHERE productid IN ($ids)");
 	}
  	showmessage('delsuccess','favorite.php');
}

$favlist = array();
$query = $db->query("SELECT count(*) from $table_favorite where username='$_login_user'");
$favnum=$db->result($query,0);
$query = $db->query("SELECT a.productid,b.productname,b.ourprice,b.marketprice
         FROM $table_favorite a,$table_products b WHERE a.productid=b.productid AND a.username='$_login_user'");
while($dbq_rec = $db->fetch_array($query))
{
	$favlist[] = $dbq_rec;
}

include template('favorite');
?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -