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

📄 productinfo.cgi

📁 支持全流程的Perl+MySQL电子商务系统。完全公开代码。
💻 CGI
字号:
#!/usr/bin/perl
#
#
##########################################################
#					网络小厨房 商店系统
#					Net Kitchen SHOP
##########################################################
#首页代码
##########################################################

####################################################################################
#前端预处理
####################################################################################
use FindBin qw($Bin);
use lib "$Bin/library";
use iLcatlib;
use strict;
use vars qw(%FORM %CON %COOKIE $LIB $sth $row @userdata);

#获得系统参数
tie %CON, 'IniFiles', ( -file => "$Bin/nkshop.ini" );

#构造新对象
$LIB=iLcatlib->new(ttmlpath=>"$CON{path}{ttmlpath}");

#获得COOKIE
%COOKIE=$LIB->ReadCookie();

#获得提交内容
%FORM=$LIB->ReadParse();

#连接数据库
$LIB->MySQL_Connect(
	database=>"$CON{database}{database}",
	dbhost=>"$CON{database}{dbhost}",
	dbuser=>"$CON{database}{dbuser}",
	dbpwd=>"$CON{database}{dbpwd}"
);

#用户检测
@userdata=$LIB->key_proc("$COOKIE{'key'}","$CON{parameter}{timeout}");

#检测是否存在这个产品
my (%dbs,@view,$text,$life_product);
my ($num,$name,$image,$photo,$des,$spec_desc,@spec_desc,$spec,$price,$amount,$choosed,$sellout,$cretime,$inherit_cate,$life_foot);

#取得商品
$sth=$LIB->MySQL_Query("select num,name,image,photo,des,spec_desc,spec,price,amount,choosed,sellout,cretime,inherit_cate,life_foot from store where num = '$FORM{'num'}'");
$row = $sth->fetchrow_arrayref();
if ($row->[0] eq "") {$LIB->Error("无此商品存在");}
$num	=	$row->[0];
$name	=	$row->[1];
$image	=	$row->[2];
$photo	=	$row->[3];
$des	=	$row->[4];
@spec_desc	=	$LIB->Str_spec($row->[5]);
$spec_desc = "@spec_desc";
$spec	=	$row->[6];
$price	=	$row->[7];
$amount	=	$row->[8];
$choosed=	$row->[9];
$sellout=	$row->[10];
$cretime=	$row->[11];
$inherit_cate=$row->[12];
$life_foot=	$row->[13];

#取得相关商品
$sth=$LIB->MySQL_Query("select num,name from store where life_foot = '$life_foot'");
while (($row = $sth->fetchrow_arrayref)){
	$life_product .= qq~<a href="$CON{path}{cgiurl}/productinfo.cgi?num=$row->[0]">$row->[1]</a>&nbsp;&nbsp;~;
}

$text={
	num		=>	$num,
	name	=>	$name,
	photo	=>	$photo,
	des		=>	$des,
	spec_desc	=>	$spec_desc,
	spec	=>	$spec,
	price	=>	$price,
	amount	=>	$amount,
	choosed	=>	$choosed,
	sellout	=>	$sellout,
	cretime	=>	$cretime,
	life	=>	$life_product,
	cgiurl	=>	$CON{path}{cgiurl},
	imgurl	=>	$CON{path}{webimg},
	htmurl  =>	$CON{path}{htmurl},
};

@view=$LIB->Parse("shop_productinfo.htm",$text);

print @view;

#MySQL Disconnect
$LIB->MySQL_Disconnect();
#The END
$LIB->exit();

⌨️ 快捷键说明

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