<?php
// If this file is not included from the MMHTTPDB possible hacking problem.
if (!function_exists('create_error')){
die();
}
define('MYSQL_NOT_EXISTS', create_error("Your PHP server doesn't have the MySQL module loaded or you can't use the mysql_(p)connect functions."));
define('CONN_NOT_OPEN_GET_TABLES', create_error('The Connection could not be opened when trying to retrieve the tables.'));
define('CONN_NOT_OPEN_GET_DB_LIST', create_error('The Connection could not be opened when trying to retrieve the database list.'));
if (!function_exists('mysql_connect') || !function_exists('mysql_pconnect') || !extension_loaded('mysql')){
echo MYSQL_NOT_EXISTS;
die();
}
// Now let's handle the crashes or any other PHP errors that we can catch
function KT_ErrorHandler($errno, $errstr, $errfile, $errline) {
global $f, $already_sent;
$errortype = array (
1 => "Error",
2 => "Warning",
4 => "Parsing Error",
8 => "Notice",
16 => "Core Error",
32 => "Core Warning",
64 => "Compile Error",
128 => "Compile Warning",
256 => "User Error",
512 => "User Warning",
1024=> "User Notice",
2048=> "E_ALL",
2049=> "PHP5 E_STRICT"
);
$str = sprintf("[%s]\n%s:\t%s\nFile:\t\t'%s'\nLine:\t\t%s\n\n", date('d-m-Y H:i:s'),(isset($errortype[@$errno])?$errortype[@$errno]:('Unknown '.$errno)),@$errstr,@$errfile,@$errline);
if (error_reporting() != 0) {
@fwrite($f, $str);
if (@$errno == 2 && isset($already_sent) && !$already_sent==true){
$error = '<ERRORS>'."\n";
$error .= '<ERROR><DESCRIPTION>An Warning Type error appeared. The error is logged into the log file.</DESCRIPTION></ERROR>'."\n";
$error .= '</ERRORS>'."\n";
$already_sent = true;
echo $error;
}
}
}
if ($debug_to_file){
$old_error_handler = set_error_handler("KT_ErrorHandler");
}
class MySqlConnection
{
/*
// The 'var' keyword is deprecated in PHP5 ... we will define these variables at runtime.
var $isOpen;
var $hostname;
var $database;
var $username;
var $password;
var $timeout;
var $connectionId;
var $error;
*/
function MySqlConnection($ConnectionString, $Timeout, $Host, $DB, $UID, $Pwd)
{
$this->isOpen = false;
$this->timeout = $Timeout;
$this->error = '';
if( $Host ) {
$this->hostname = $Host;
}
elseif( preg_match("/host=([^;]+);/", $ConnectionString, $ret) ) {
$this->hostname = $ret[1];
}
if( $DB ) {
$this->database = $DB;
}
elseif( preg_match("/db=([^;]+);/", $ConnectionString, $ret) ) {
$this->database = $ret[1];
}
if( $UID ) {
$this->username = $UID;
}
elseif( preg_match("/uid=([^;]+);/", $ConnectionString, $ret) ) {
$this->username = $ret[1];
}
if( $Pwd ) {
$this->password = $Pwd;
}
elseif( preg_match("/pwd=([^;]+);/", $ConnectionString, $ret) ) {
$this->password = $ret[1];
}
}
function Open()
{
$this->connectionId = mysql_connect($this->hostname, $this->username, $this->password);
if (isset($this->connectionId) && $this->connectionId && is_resource($this->connectionId))
{
$this->isOpen = ($this->database == "") ? true : mysql_select_db($this->database, $this->connectionId);
}
else
{
$this->isOpen = false;
}
}
function TestOpen()
{
return ($this->isOpen) ? '<TEST status=true></TEST>' : $this->HandleException();
}
function Close()
{
if (is_resource($this->connectionId) && $this->isOpen)
{
if (mysql_close($this->connectionId))
{
$this->isOpen = false;
unset($this->connectionId);
}
}
}
function GetTables($table_name = '')
{
$xmlOutput = "";
if ($this->isOpen && isset($this->connectionId) && is_resource($this->connectionId)){
// 1. mysql_list_tables and mysql_tablename are deprecated in PHP5
// 2. For backward compatibility GetTables don't have any parameters
if ($table_name === ''){
$table_name = @$_POST['Database'];
}
//added backtick for handling reserved words and special characters
//http://dev.mysql.com/doc/refman/5.0/en/legal-names.html
$sql = ' SHOW TABLES FROM ' . $this->ensureTicks($table_name) ;
$results = mysql_query($sql, $this->connectionId) or $this->HandleException();
$xmlOutput = "<RESULTSET><FIELDS>";
// Columns are referenced by index, so Schema and
// Catalog must be specified even though they are not supported
$xmlOutput .= '<FIELD><NAME>TABLE_CATALOG</NAME></FIELD>'; // column 0 (zero-based)
$xmlOutput .= '<FIELD><NAME>TABLE_SCHEMA</NAME></FIELD>'; // column 1
$xmlOutput .= '<FIELD><NAME>TABLE_NAME</NAME></FIELD>'; // column 2
$xmlOutput .= "</FIELDS><ROWS>";
if (is_resource($results) && mysql_num_rows($results) > 0){
while ($row = mysql_fetch_array($results)){
$xmlOutput .= '<ROW><VALUE/><VALUE/><VALUE>' . $row[0]. '</VALUE></ROW>';
}
}
$xmlOutput .= "</ROWS></RESULTSET>";
}
return $xmlOutput;
}
function GetViews()
{
// not supported
return "<RESULTSET><FIELDS></FIELDS><ROWS></ROWS></RESULTSET>";
}
function GetProcedures()
{
// not supported
return "<RESULTSET><FIELDS></FIELDS><ROWS></ROWS></RESULTSET>";
}
function GetColumnsOfTable($TableName)
{
$xmlOutput = "";
//added backtick for handling reserved words and special characters
//http://dev.mysql.com/doc/refman/5.0/en/legal-names.html
$query = "DESCRIBE ".$this->ensureTicks($TableName);
$result = mysql_query($query) or $this->HandleException();
if ($result)
{
$xmlOutput = "<RESULTSET><FIELDS>";
// Columns are referenced by index, so Schema and
// Catalog must be specified even though they are not supported
$xmlOutput .= "<FIELD><NAME>TABLE_CATALOG</NAME></FIELD>"; // column 0 (zero-based)
$xmlOutput .= "<FIELD><NAME>TABLE_SCHEMA</NAME></FIELD>"; // column 1
$xmlOutput .= "<FIELD><NAME>TABLE_NAME</NAME></FIELD>"; // column 2
$xmlOutput .= "<FIELD><NAME>COLUMN_NAME</NAME></FIELD>";
$xmlOutput .= "<FIELD><NAME>DATA_TYPE</NAME></FIELD>";
$xmlOutput .= "<FIELD><NAME>IS_NULLABLE</NAME></FIELD>";
$xmlOutput .= "<FIELD><NAME>COLUMN_SIZE</NAME></FIELD>";
$xmlOutput .= "</FIELDS><ROWS>";
// The fields returned from DESCRIBE are: Field, Type, Null, Key, Default, Extra
while ($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
$xmlOutput .= "<ROW><VALUE/><VALUE/><VALUE/>";
// Separate type from size. Format is: type(size)
if (preg_match("/(.*)\((.*)\)/", $row["Type"], $ret))
{
$type = $ret[1];
$size = $ret[2];
}
else
{
$type = $row["Type"];
$size = "";
}
// MySQL sets nullable to "YES" or "", so we need to set "NO"
$null = $row["Null"];
if ($null == "")
$null = "NO";
$xmlOutput .= "<VALUE>" . $row["Field"] . "</VALUE>";
$xmlOutput .= "<VALUE>" . $type . "</VALUE>";
$xmlOutput .= "<VALUE>" . $null . "</VALUE>";
$xmlOutput .= "<VALUE>" . $size . "</VALUE></ROW>";
}
mysql_free_result($result);
$xmlOutput .= "</ROWS></RESULTSET>";
}
return $xmlOutput;
}
function GetParametersOfProcedure($ProcedureName, $SchemaName, $CatalogName)
{
// not supported on MySQL
return '<RESULTSET><FIELDS></FIELDS><ROWS></ROWS></RESULTSET>';
}
function ExecuteSQL($aStatement, $MaxRows)
{
if ( get_magic_quotes_gpc() )
{
$aStatement = stripslashes( $aStatement ) ;
}
$xmlOutput = "";
$result = mysql_query($aStatement) or $this->HandleException();
if (isset($result) && is_resource($result))
{
$xmlOutput = "<RESULTSET><FIELDS>";
$fieldCount = mysql_num_fields($result);
for ($i=0; $i < $fieldCount; $i++)
{
$meta = mysql_fetch_field($result);
if ($meta)
{
$xmlOutput .= '<FIELD';
$xmlOutput .= ' type="' . $meta->type;
$xmlOutput .= '" max_length="' . $meta->max_length;
$xmlOutput .= '" table="' . $meta->table;
$xmlOutput .= '" not_null="' . $meta->not_null;
$xmlOutput .= '" numeric="' . $meta->numeric;
$xmlOutput .= '" uns
没有合适的资源?快使用搜索试试~ 我知道了~
购物系统.zip 附带有详细文档!
共94个文件
gif:42个
php:28个
jpg:11个
2 下载量 107 浏览量
2023-06-30
00:02:46
上传
评论 1
收藏 760KB ZIP 举报
温馨提示
实验报告 ==== ---- ### 实验目的 此次实验,要通过php+mysql来实现一个购物系统. #### 前台管理 > * 会员登录,系统对用户登录输入的用户名密码进行验证。 > *新用户注册,要求提供用户的详细资料。 > * 商品浏览, 用户在网上对本站点所提供的商品进行浏览(用户无需注册)。 > * 商品详情,可以查看商品的详细信息。 #### 后台管理 > * 管理员登录,系统对管理员登录输入的用户名密码进行验证。 > * 商品分类模块,添加分类,分类列表、编辑分类、删除分类 > * 商品管理模块,添加商品、商品列表、编辑商品、删除商品 > * 用户管理模块,添加用户、用户列表、编辑用户、删除用户 ### 相关技术 网上购物系统采用的主要技术解决方案是基于服务器端的脚本语言PHP、开源数据库MySQL,Web服务器Apache,以及操作系统Linux。 除此之外,为了使数据库的操作更加便捷,还使用了数据库管理工具phpMyAdmin。 > * 2.1php PHP是为Web设计使用的服务器脚本语言。当HTML页面嵌入PHP代码时,访问者可
资源推荐
资源详情
资源评论
收起资源包目录
购物系统.zip (94个子文件)
购物系统
login.php 5KB
prod_edit.php 7KB
products_add.php 8KB
reg.php 6KB
数据库
shop.sql 5KB
prod_add.php 7KB
ordershow_admin.php 7KB
prod_list.php 6KB
orderpro.php 6KB
fupaction.php 980B
find_prod.php 6KB
car.php 7KB
_notes
find_prod.php.mno 556B
products.php.mno 305B
.mno 128B
index.php.mno 401B
products_type.php.mno 401B
find_order.php 6KB
prod_del.php 367B
find_member.php 6KB
style
style.css 11KB
products.php 7KB
car_edit.php 7KB
index.php 7KB
EcShowMsg.php 6KB
type_add.php 6KB
products_type.php 6KB
_mmServerScripts
mysql.php 12KB
MMHTTPDB.php 4KB
_notes
dwsync.xml 349B
order_search.php 7KB
fupload.php 4KB
car_del.php 383B
Scripts
expressInstall.swf 773B
swfobject_modified.js 21KB
images
6415.gif 3KB
6404.jpg 19KB
6405.gif 5KB
2.jpg 7KB
6410.gif 3KB
6437.gif 4KB
Thumbs.db 141KB
6413.gif 3KB
6451.gif 3KB
6.jpg 2KB
6420.gif 3KB
1.jpg 6KB
6438.gif 4KB
banner.swf 107KB
6426.gif 5KB
6442.gif 4KB
6416.gif 3KB
6422.gif 4KB
6430.gif 9KB
6423.gif 5KB
5.jpg 17KB
6453.gif 4KB
6421.gif 4KB
6450.gif 3KB
6401.jpg 10KB
6431.gif 9KB
6402.gif 3KB
6417.gif 3KB
6412.gif 3KB
TopMenu.swf 18KB
6441.gif 4KB
6427.gif 152B
6407.jpg 24KB
6408.gif 2KB
6434.gif 12KB
6403.jpg 104KB
6418.gif 3KB
6406.gif 59KB
6436.gif 4KB
6428.gif 7KB
icon_prev.gif 3KB
6433.gif 9KB
6429.gif 9KB
6440.gif 4KB
6435.gif 6KB
6409.gif 2KB
6452.gif 4KB
3.jpg 10KB
6439.gif 4KB
6432.gif 9KB
6425.jpg 81KB
6424.gif 18KB
6411.gif 3KB
6414.gif 3KB
4.jpg 41KB
6419.gif 3KB
type_del.php 373B
type_edit.php 6KB
prodtype_list.php 6KB
共 94 条
- 1
资源评论
ReganYue
- 粉丝: 3290
- 资源: 92
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功