?? readme
字號:
This file contains information and installation instructions for MyCart, ashopping cart designed for MySQL and PHP.These instructions are for MyCart version 1999.10.27MyCart was designed by Christopher Ostmo of Rosenet Internet Services.Feel free to use and modify these scripts to suit your needs. All that Iask is that you keep all "Created by..." or "Designed by..." type markingsin their places, and please let me know what you think.MyCart has been tested using PHP3 and MySQL 3.21.xx. These scripts shouldwork for other databases with little or no modification.If you need help with MySQL, PHP or site design, Rosenet technicians areavailable for fee-based consultation.Technical support for MyCart can be obtained by subscribing to Rosenet'sPHP and MySQL mailing list. To do so, go to the web address:http://modems.rosenet.net/mysql/list.phpFor a list of important changes in this version, consult the CHANGE file.INSTALLATION & SETUPStep 1 - Unpack the distribution.If you are reading this message, then you have probably already completedstep one. If you need help unpacking these files, consult the Unix manpages (type "man gzip" or "man tar" at the command propmpt) or WindowsWinZip help files.When you unpack this distribution, it will create a directory called"Cart" in the current directory. I unpacked the distribution in our webserver's root directory, so people can access MyCart at:http://my.domain.com/Cart/You don't have to do this, but it may simplify the rest of the setup ifyou do.When you unpack the distribution, several files will be in the top leveldirectory and in one subdirectory called "admin." As it's name implies,the "admin" directory is for administrative functions. In case yourdistribution does not unpack properly, here is where the files belong.In the Cart root directory:- CHANGE- Cart.php- README- addCart.php- addQuantity.php- addQuantityResponse.php- checkout.php- description.php- emptyCart.php- index.php- items.php- order.php- receipt.php- removeItem.php- userInfo.php- viewCart.phpAnd in the /admin directory:- addCategory.php- addCategoryResponse.php- addItem.php- addItemResponse.php- addPicture.php- index.php- receipt.php- removeCategory.php- removeCategory2.php- removeCategoryResponse.php- removeItem.php- removeItem2.php- removeItemResponse.php- searchReceipts.php- searchReceiptsResponse.php- updateItem.php- updateItem2.php- updateItemResponse.php- upload.php- uploadItem.phpStep 2 - Setup MySQLI created one database with 7 tables. You can setup the database andtables as you see fit, but if you use my example, it will require lessmodification of the scripts. This example assumes that you have access tothe Unix command prompt to manipulate MySQL. You can also follow theseinstructions fairly closely if you have access to a MySQL User Interface(like FaceMySQL - http://modems.rosenet.net/mysql/).The database name is a variable and can be changed easily, so you can callit whatever you would like. The table names are not as easy to change,so I would stick to the names given in this example. In this example, Icalled the database "Cart."-Create the database:mysqladmin create Cart-Connect to the database and create the tables:mysqlconnect CartCREATE TABLE Buyers (Name VARCHAR(100) NOT NULL,Address1 VARCHAR(100) NOT NULL,Address2 VARCHAR(100) NOT NULL,City VARCHAR(100) NOT NULL,State CHAR(2) NOT NULL,Zip VARCHAR(20) NOT NULL,Email VARCHAR(100) NOT NULL,DayPhone VARCHAR(100) NOT NULL,EvePhone VARCHAR(100) NOT NULL,Contact INT(1) NOT NULL,PayMethod VARCHAR(100) NOT NULL,CCType VARCHAR(100) NOT NULL,CCNum VARCHAR(100) NOT NULL,CCExpire VARCHAR(100) NOT NULL,OrderTotal DECIMAL(8,2) NOT NULL,Date VARCHAR(100) NOT NULL,OrderNumber BIGINT NOT NULL,UserID VARCHAR(100) NOT NULL,BuyerID BIGINT NOT NULL AUTO_INCREMENT,PRIMARY KEY (BuyerID));CREATE TABLE CartItems (UserID VARCHAR(100) NOT NULL,ItemID VARCHAR(25) NOT NULL,ItemQuantity INT(4) NOT NULL,Date VARCHAR(100) NOT NULL,CartItemsID BIGINT NOT NULL AUTO_INCREMENT,PRIMARY KEY (CartItemsID));CREATE TABLE Category (Category VARCHAR(100) NOT NULL,CategoryID BIGINT NOT NULL AUTO_INCREMENT,PRIMARY KEY (CategoryID));CREATE TABLE Items (ItemSKU VARCHAR(25) NOT NULL,ItemName VARCHAR(100) NOT NULL,ItemDescription MEDIUMTEXT NOT NULL,ItemCost DECIMAL(7,2) NOT NULL,Category BIGINT NOT NULL,ShippingCost DECIMAL(6,2) NOT NULL,ItemID BIGINT NOT NULL AUTO_INCREMENT,PRIMARY KEY (ItemID));CREATE TABLE Orders (BuyerID BIGINT NOT NULL,UserID VARCHAR(100) NOT NULL,Date VARCHAR(100) NOT NULL,OrderTotal DECIMAL(8,2) NOT NULL,OrderNumber BIGINT NOT NULL AUTO_INCREMENT,PRIMARY KEY (OrderNumber));CREATE TABLE Receipts (BuyerID BIGINT NOT NULL,UserID VARCHAR(100) NOT NULL,OrderNumber BIGINT NOT NULL,Date VARCHAR(100) NOT NULL,ItemID BIGINT NOT NULL,ItemSKU VARCHAR(25) NOT NULL,ItemName VARCHAR(100) NOT NULL,ItemCost DECIMAL(7,2) NOT NULL,ShippingCost DECIMAL(6,2) NOT NULL,ItemQuantity INT NOT NULL,TotalCost DECIMAL(8,2) NOT NULL);CREATE TABLE Users (User VARCHAR(100) NOT NULL,Date INT(4) NOT NULL);Step 3 - Setup your php3_include_pathThese scripts use a require statement that calls "Cart.php" In order forthis to work properly, you need to set PHP's include path so that it willlook in the Cart root directory. If your web server allows .htaccessfiles to override Apache config file settings, then place a file called.htaccess in you Cart root directory with the following line:php3_include_path /path/to/CartIf you cannot override Apache config file settings through .htaccess, thenyou can place the above line in your web server's <VirtualHost...>directive in the Apache config files.For PHP4, this may be changed to "php4_include_path" or "php_include_path"- I'm not sure as PHP4 is still in beta at the time of this writing.If you use a web server other than Apache, you will need to check your webserver's documentation for details.If you can't do either of those, create a PHP script which contains thefollowing line:<? phpinfo(); ?>When you view that script in a web browser, you will see a directivecalled "include_path" in the Configuration table. Place the Cart.php filein one of the directories listed.If you can't make anything work, change the require(...) statement in thefiles of the admin directory to read:require("../Cart.php");Step 4 - Modify Cart.phpReplace the variables in the first section to reflect information abouthow to contact your company. The $NoShipping variable is the textstring to send to the customer when you have not specified a shippingcost. NOTE: The "$Email" variable must be defined and valid! This is theaddress to which orders are mailed.Replace the variables in the second section with your proper database HostName, Username, Password and Database Name ("Cart" in the above example).Replace the variables in the third section with the absolute (Unix) pathand relative (to web users) path to your MyCart scripts. Do not endeither of these with a forward slash ( / ). You need to precede the$Relative variable with a forward slash.Step 5 - Create the images directoryCreate a directory off of your Cart directory called "images"Make the images directory owned by the same user and group as httpd(usually nobody:wheel). Make this directory user and group readable,writable and executable and make it world readable and executable.Unix users will use the commands:chown nobody:wheel imageschmod 775 imagesThis gives the images directory the following permissions:drwxrwxr-x nobody wheel imagesStep 6 - Setup your catalogGo to the Cart/admin directory and add some product categories. Once youhave done this, you can add individual products.Step 7 - Protect your admin directoryYou should have some sort of protection (preferrably password protection)on your admin directory. Consult your web server documentation forinstructions.SPECIAL NOTESMyCart has been fairly well tested under a lot of circumstances. Here area few things to keep in mind:-These files use an extension of .php for future compatibility with thePHP4 "standard" file names. If your web server does not support the .phpextension as valid PHP scripts, you will need to either instruct it to doso (this can be accomplished in Apache by adding an "AddType" directive inyour Apache config files or .htaccess file - see your web server's andPHP's documentation), or you will need to rename the scripts with validPHP script extensions.-When users add an item to their cart, increase the quantity of an item intheir cart, empty their cart, or remove an item from their cart, they areautomatically forwarded to the viewCart.php page. You can insteadforward them to another page (like the first page of your catalog) byediting the ("Location:...") tag in the addCart.php,addQuantityResponse.php, emptyCart.php and removeItem.php pages.-If you need to upload pictures that are larger than 200K (pray for thecustomers that have to wait for them to download!), you can modify theupdateItemResponse.php script in the admin directory. You need toincrease the MAX_FILE_SIZE value.-I purposefully kept MyCart pretty bland and unformatted. This shouldmake it easier for an individual user to customize it to suit his or her needs. Please work around the code that I have created and create aninterface that will be aesthetically pleasing to your customers.-If you need to store receipts and user information for more than oneyear, modify the index.php file in the admin directory. Immediately Afterthe line that reads:$pieces=explode(":",$Da);Add:$pieces[0]=bcadd($pieces[0],4);The "4" will cause information to be stored for 5 years. Change the "4"above to one less than the desired number of years to store theinformation.LEGALESEThese scripts were created and made freely available to further theknowledge and use of PHP and MySQL. These scripts are provided "as-is"and carry no warranty, either stated or implied. Rosenet and it'semployees take no responsibility for any damages (real or imagined) thatoccur as a result of using these scripts or instructions . By using thesescripts, you agree to be completely responsible for any damages to yourcomputer system(s) or network(s).These scripts are available as free software. Feel free to use and modifythem as you deem necessary. If you wish to distribute these scripts,please ask for permission first. If you plan to distribute these scriptsor any derivative thereof in a commercial package (one for which youreceive monetary compensation), please consider helping us to further ourefforts by offering to share a portion of the proceeds.FUTURE AND SUPPORTIf you need to contact me with any questions, bug reports or featurerequests, I can be e-mailed at:support@rosenet.netThe fact that I have a job and a family (both of which I would like tokeep) means that I simply don't have time to answer many technical supportquestions. Please be kind to me and direct technical support questions tothe mailing list mentioned near the top of this file.http://www.rosenet.net/ - Rosenet Internet Serviceshttp://modems.rosnet.net/mysql/ - Rosenet's MySQL Utilities and Future Versions of This Softwarehttp://modems.rosenet.net/ - For Modem HelpThis file, these scripts and "MyCart" areCopyright 1998-1999, Rosenet Internet Services
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -