Category Archives: eCommerce

Hit counter PHP Scripts

A very simple Web Page traffic Hit counter. This FREE counter can be used in any html page with PHP support. This is free and easy to install. This click counter is PHP supported and indicates the number of hits, a particular webpage has received. Just copy the code and start tracking click countings / traffic in your html web pageYou can set any initial values to start with. Simple To Use.

 

<?php
include "header.php";
@session_start();
$oout=$_GET['out'];
if($oout=="signout"){
session_unset();
session_destroy();
}
?>
<td align=center>
<br>
<table width=70% height=250 align=center bgcolor=white>
<tr><td style="color: green; font-size: 13px;">
<ul type=circle><li>Hscripts.com is one of the most used free web resourse site online.</li>
<li>This site started on 6.10.2004 and now has around 2,00,000 unique visitors every month.</li>
<li>Free scripts will be available from the link: <a style="color: #0A3FFF; text-decoration: none;" href="http://hscripts.com/scripts/php">
http://hscripts.com/scripts/php</a></li>
<li>Licensed scripts can be purchased from the link: <a style="color: #0A3FFF; text-decoration: none;" href="http://hscripts.com/scripts/php/licensed/index.php">
http://hscripts.com/scripts/php/licensed/index.php</a></li>
<li>Hscripts.com is part of HIOX network of websites.</li>
<li>HIOX network include sites as mentioned in the link: <a style="color: #0A3FFF; text-decoration: none;" href="http://hiox.com">
http://hiox.com</a></li>
</ul>
</td></tr></table>
</td>
<?php
include "footer.php";
?>

PHP MySQL open-source e-commerce system

ApPHP Shopping Cart is a PHP/MySQL open-source e-commerce system. It is a fully customizable shopping cart, specially designed for web. ApPHP Shopping Cart allows visitors to collect items in a virtual shopping cart over multiple product web pages without losing the items ordered.

 

 

<?php
/*
WP-Cache Config Sample File

See wp-cache.php for author details.
*/


define( 'WPCACHEHOME', WP_CONTENT_DIR . '/plugins/wp-super-cache/' );

$cache_compression = 0; // Super cache compression
$cache_enabled = false;
$super_cache_enabled = false;
$cache_max_time = 3600; //in seconds
//$use_flock = true; // Set it true or false if you know what to use
$cache_path = WP_CONTENT_DIR . '/cache/';
$file_prefix = 'wp-cache-';

// We want to be able to identify each blog in a WordPress MU install
$blogcacheid = '';
if( defined( 'VHOST' ) ) {
$blogcacheid = 'blog'; // main blog
if( constant( 'VHOST' ) == 'yes' ) {
$blogcacheid = $_SERVER['HTTP_HOST'];
} else {
$request_uri = preg_replace('/[ <>\'\"\r\n\t\(\)]/', '', str_replace( '..', '', $_SERVER['REQUEST_URI'] ) );
if( strpos( $request_uri, '/', 1 ) ) {
if( $base == '/' ) {
$blogcacheid = substr( $request_uri, 1, strpos( $request_uri, '/', 1 ) - 1 );
} else {
$blogcacheid = str_replace( $base, '', $request_uri );
$blogcacheid = substr( $blogcacheid, 0, strpos( $blogcacheid, '/', 1 ) );
}
if ( '/' == substr($blogcacheid, -1))
$blogcacheid = substr($blogcacheid, 0, -1);
}
}
}

// Array of files that have 'wp-' but should still be cached
$cache_acceptable_files = array( 'wp-comments-popup.php', 'wp-links-opml.php', 'wp-locations.php' );

$cache_rejected_uri = array('wp-.*.php', 'index.php');
$cache_rejected_user_agent = array ( 0 => 'bot', 1 => 'ia_archive', 2 => 'slurp', 3 => 'crawl', 4 => 'spider');

// Change this to 1 to enable experimental code that tries to serve slightly
// out of date content to anon users while a new supercache file is being
// generated.
$cache_rebuild_files = 0;

// Just modify it if you have conflicts with semaphores
$sem_id = 5419;

if ( '/' != substr($cache_path, -1)) {
$cache_path .= '/';
}

?>

ApPHP script for Shopping Cart ecommerce

ApPHP Shopping Cart is a PHP/MySQL open-source e-commerce system. It is a fully customizable shopping cart, specially designed for web. ApPHP Shopping Cart allows visitors to collect items in a virtual shopping cart over multiple product web pages without losing the items ordered.

################################################################################
##              -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =-                 #
## --------------------------------------------------------------------------- #
##  ApPHP Shopping Cart (Advanced) version 2.0.1                               #
##  Developed by:  ApPHP <info@apphp.com>                                      #
##  License:       GNU LGPL v.3                                                #
##  Site:          http://www.apphp.com/php-shopping-cart/                     #
##  Copyright:     ApPHP Shopping Cart (c) 2010. All rights reserved.          #
##                                                                             #
##  Additional modules (embedded):                                             #
##  -- openWYSIWYG v1.4.7 (free cross-browser)          http://openWebWare.com #
##  -- ApPHP Easy Installer v2.0.5 (installation module)      http://apphp.com #
##  -- ApPHP Tabs v2.0.3 (tabs menu control)                  http://apphp.com #
##  -- Crystal Project Icons (icons set)               http://www.everaldo.com #
##  -- Securimage v1.0.2 (captcha script)            http://www.phpcaptcha.org #
##  -- Google AJAX Libraries API                  http://code.google.com/apis/ #
##                                                                             #
################################################################################

Software requirements: PHP 5.0 or later version.

A new installation of ApPHP Shopping Cart is a very straight forward process:

Step 1. Uncompressing downloaded file.
-------------------------------------
Uncompress the ApPHP Shopping Cart version 2.x.x script archive. The archive will create
a directory called "php_shopping_cart_2xx"


Step 2. Uploading files.
-------------------------------------
Upload content of this folder (all files and directories it includes) to your
document root (public_html, www, httpdocs etc.) or your shopping cart directory using FTP.
Pay attention to DON'T use the capital letters in the name of the folder (for Linux users).

public_html/
or
public_html/{shopping-cart directory}/

Rename default.htaccess into .htaccess if you need to add PHP5 handler.


Step 3. Creating database.
-------------------------------------
Using your hosting Control Panel, phpMyAdmin or another tool, create your database
and user, and assign that user to the database. Write down the name of the
database, username, and password for the site installation procedure.


Step 4. Running install.php file.
-------------------------------------
Now you can run install.php file. To do this, open a browser and type in Address Bar

http://{www.mydomain.com}/install.php
or
http://{www.mydomain.com}/{shopping-cart directory}/install.php

Follow instructions on the screen. You will be asked to enter: database host,
database name, username and password. Also you need to enter admin username and
admin password, that will be used to get access to administration area of the
site.


Step 5. Setting up access permissions.
-------------------------------------
Check access permissions to images/uploads/. You need to have 755 permissions
to this folder.


Step 6. Deleting install.php file.
-------------------------------------
After successful installation you will get an appropriate message and warning to
remove install.php file. For security reasons, please delete install file
immediately.


Congratulations, you now have ApPHP Shopping Cart v.2.x.x. Installed!

PHP NET Compact Framework Package E-Commerce

MW6 QRCode .NET CF package has three 100% managed code libraries for Pocket PC, Windows CE and Smartphone platforms, the libraries can generate QRCode format pattern data and your applications can use this pattern data to render QRCode barcode onto E-Commerce.

 

 

<?php
session_start();
header("Cache-control: private");
header('Content-Type: text/html; charset=utf-8');
require("_add_item.php");
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
 <title><?=$g_page_title?></title>

 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 <link rel="stylesheet" type="text/css" media="all" href="../global/jscalendar/skins/aqua/theme.css" title="Aqua" />
 <script type="text/javascript" src="../global/jscalendar/calendar.js"></script>
 <script type="text/javascript" src="../global/jscalendar/calendar-setup.js"></script>
 <script type="text/javascript" src="../global/jscalendar/lang/calendar-en.js"></script>

 <link rel="stylesheet" type="text/css" href="../global/styles.css" />
 <script type="text/javascript" src="../global/validation.js"></script>

</head>
<body>

<?php
require("../global/banner.php");

$page = "items";
$page_link = true;
require("../global/nav.php");
?>

<div id="main_area">

 <table cellpadding="30" width="100%">
 <tr>
 <td>

 <div>Add Item</div>

 <?php display_message($success, $message); ?>

 <div>
 This page lets you add a new item. <!--  You can also <a href="items_bulk_upload.php">bulk upload
 multiple items from a CSV file</a>. -->
 </div>

 <br />

 <form action="<?=$_SERVER['PHP_SELF']?>" method="post">

 <table width="700">
 <tr>
 <td width="160">Date Added</td>
 <td>

 <table cellspacing='0' cellpadding='0' border='0'>
 <tr>
 <td><input type="text" name="date_added" id="date_added" style="width: 130px;" value="<?php echo $date_added; ?>" /></td>
 <td><img src='../images/calendar_icon.gif' id="date_added_img" border='0' /></td>
 </tr>
 </table>

 <script type="text/javascript">
 // init a Calendar for this row
 Calendar.setup({
 inputField     :    "date_added",
 showsTime      :    true,
 timeFormat     :    "24",
 ifFormat       :    "%Y-%m-%d %H:%M:00",
 button         :    "date_added_img",
 align          :    "B2",
 singleClick    :    true
 });
 </script>

 </td>
 </tr>

 <?php
 // show the appropriate columns
 while (list($row_num, $row_info) = each($item_settings))
 {
 $row_title = $row_info[0];
 ?>
 <tr>
 <td width="160"><?=$row_title?></td>
 <td><input type="text" name="row_<?=$row_num?>" value="" style="width: 100%;" /></td>
 </tr>
 <?php
 }
 ?>

 <tr>
 <td> </td>
 <td>
 <input type="submit" name="submit" value="&amp;nbsp;ADD ITEM&amp;nbsp;" style="margin-top: 5px;" />
 <input type="submit" name="submit_invoice" value="&amp;nbsp;ADD ITEM AND INVOICE &amp;gt;&amp;gt;" style="margin-top: 5px;" />
 </td>
 </tr>
 </table>

 </form>

 </td>
 </tr>
 </table>

</div>

</body>
</html>

&amp;nbsp;

PHP Scripts Enterprise Groupware System E-Commerce

Enterprise Groupware System is a fully Open Source web-based CRM & business system.Enterprise Groupware System EGS allows you to: – Manage accounts, leads and customers – Track sales opportunities and pipelines – Organise your activities – Plan c E-Commerce.

 

 

<?php

session_start();
header("Cache-control: private");
header('Content-Type: text/html; charset=utf-8');

require("_items_bulk_upload.php");

?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
 <title><?=$g_page_title?></title>

 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 <link rel="stylesheet" type="text/css" href="global/styles.css" />

</head>
<body>

<?php
require("global/banner.php");

$page = "items";
$page_link = true;
require("global/nav.php");
?>

<div id="main_area">

 <table cellpadding="30" width="100%">
 <tr>
 <td>

 <div>Bulk Upload Items</div>

 <p>
 For convenience, this page allows you to bulk upload items to the database from a CSV (comma-separated
 values) spreadsheet. <a href="global/example.xls">Click here for an empty spreadsheet</a> which you can
 use as a template to add your own content. If you wish, you can set the default dates for the
 items in the CSV file. You may sort and filter by dates on the main <b>items</b> page - which can
 be helpful to quickly locate specific items and invoices.
 </p>
 <br />

 <?=display_message($success, $message)?>

 <form action="<?=$_SERVER['PHP_SELF']?>" method="post" enctype="multipart/form-data">

 <table cellspacing="0" cellpadding="1">
 <tr>
 <td width="100"><b>File</b>:</td>
 <td><input type="file" name="file" /></td>
 </tr>
 <tr>
 <td><b>Item Date</b>:</td>
 <td>
 <select name="month">
 <option value="1" <?php if ($current_month == "1") echo "selected"; ?>>January</option>
 <option value="2" <?php if ($current_month == "2") echo "selected"; ?>>February</option>
 <option value="3" <?php if ($current_month == "3") echo "selected"; ?>>March</option>
 <option value="4" <?php if ($current_month == "4") echo "selected"; ?>>April</option>
 <option value="5" <?php if ($current_month == "5") echo "selected"; ?>>May</option>
 <option value="6" <?php if ($current_month == "6") echo "selected"; ?>>June</option>
 <option value="7" <?php if ($current_month == "7") echo "selected"; ?>>July</option>
 <option value="8" <?php if ($current_month == "8") echo "selected"; ?>>August</option>
 <option value="9" <?php if ($current_month == "9") echo "selected"; ?>>September</option>
 <option value="10" <?php if ($current_month == "10") echo "selected"; ?>>October</option>
 <option value="11" <?php if ($current_month == "11") echo "selected"; ?>>November</option>
 <option value="12" <?php if ($current_month == "12") echo "selected"; ?>>December</option>
 </select>
 <select name="year">
 <?php
 $start_year = $current_year + 5;
 $end_year   = $current_year - 10;

 for ($i=$start_year; $i>$end_year; $i--)
 {
 $selected = ($i == $current_year) ? "selected" : "";
 echo "<option value='$i' $selected>$i</option>\n";
 }
 ?>
 </select>
 </td>
 </tr>
 </table>

 <br />

 <p>
 <input type="submit" value="&amp;nbsp;UPLOAD&amp;nbsp;" />
 </p>

 </form>

 </td>
 </tr>
 </table>

</div>

</body>
</html>

&amp;nbsp;

PHP Scripts Open-source e-commerce solution

cpCommerce is an open-source e-commerce solution that is maintained by templates and modules. Features: – Template Based – Modular – Reports – Administration Levels – Customer Viewing – Purchase History – Payment Methods – Categories – Manuf E-Commerce.

 

 

<?php
session_start();
header("Cache-control: private");
header('Content-Type: text/html; charset=utf-8');
require("_index.php");
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
 <title><?=$g_page_title?></title>

 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 <link rel="stylesheet" type="text/css" href="../global/styles.css" />
 <script type="text/javascript" src="../global/prototype.js"></script>
 <script type="text/javascript" src="../global/flagging.js"></script>

 <script type="text/javascript">
 g_page_item_ids = new Array(<?php echo join(",", $flagged_item_ids); ?>);
 var g_root_url  = "<?=$g_root_url?>";
 </script>

</head>
<body>

<?php
require("../global/banner.php");

$page = "items";
require("../global/nav.php");
?>

<div id="main_area">

 <table cellpadding="30" width="100%">
 <tr>
 <td>

 <div>Items</div>

 <?php
 if (!$item_settings_setup)
 {
 echo "<p>
 <b>Your item settings haven't yet been configured.</b>
 </p>

 <p>
 This page lets you manage \"items\" for which you are invoicing. For example, this could
 be services, physical items - whatever you need. Black Sheep Invoices lets
 you precisely determine what information you want stored. But first, you need to tell it what!
 </p>

 <p>
 Note: you can create invoices without using the Items feature. However, if you want to keep
 track of things that you are invoicing for, Items are a handy way to keep a log. They are
 also helpful if you often invoice for the same item: it'll save you a lot of typing!
 </p>

 <ul>
 <li><a href='../settings/index.php?tab=item_fields'>Item Settings</a></li>
 </ul>
 "
;
 }
 else if ($num_results == 0)
 {
 ?>
 <p>
 Sorry, no items were found. Click the 'Add Item' button below to add an item.
 </p>

 <p>
 <input type="button" value="&amp;nbsp;ADD ITEM&amp;nbsp;" onclick="window.location='add_item.php'" />
 </p>

 <?php
 }
 else
 {
 ?>
 <p>
 This page lists all items in the database. Items are anything for which you are invoicing - they may be physical
 items that you have sold, services rendered or anything else. This section is not strictly necessary for creating
 an invoice; it simply provides you with an additional way to catalogue items on your invoices. Click on the table
 columns to sort by that column.
 </p>

 <?php

 if ($item_settings_setup)
 {

 // display page navigation
 display_page_nav($num_results, $settings["num_items_per_page"], $request['items_page_num'], "order={$request['items_order']}", "items_page_num");
 ?>

 <table cellspacing="1" cellspacing="1" width="100%">
 <tr>
 <th width="30">
 <?php
 if ($request['items_order'] == "item_id")
 echo "<a href='{$_SERVER['PHP_SELF']}?items_order=item_id_desc'>ID</a>";
 else
 echo "<a href='{$_SERVER['PHP_SELF']}?items_order=item_id'>ID</a>";
 ?>
 </th>

 <?php
 // show the appropriate columns
 while (list($row_num, $row_info) = each($item_settings))
 {
 if ($row_info[1] == "no")
 continue;

 $row_title = $row_info[0];

 echo "<th>";

 if ($request['items_order'] == "row_$row_num")
 echo "<a href='{$_SERVER['PHP_SELF']}?items_order=row_{$row_num}_desc'>$row_title</a>";
 else
 echo "<a href='{$_SERVER['PHP_SELF']}?items_order=row_{$row_num}'>$row_title</a>";

 echo "</th>";
 }
 reset($item_settings);
 ?>

 <th width="100" nowrap>
 <?php
 if ($request['items_order'] == "date_added")
 echo "<a href='{$_SERVER['PHP_SELF']}?items_order=date_added_desc'>Date Added</a>";
 else
 echo "<a href='{$_SERVER['PHP_SELF']}?items_order=date_added'>Date Added</a>";
 ?>
 </th>
 <th width="80" align="center">EDIT</th>
 <th width="80" align="center">FLAGGED</th>
 </tr>

 <?php
 $row_count = 0;
 while ($record = mysql_fetch_assoc($search_query))
 {
 $item_id = $record["item_id"];
 $date_info = date("M jS, Y", convert_datetime_to_timestamp($record["date_added"]));
 $class = ($row_count % 2 == 0) ? "odd_row" : "even_row";
 $image = (in_array($item_id, $flagged_item_ids)) ? "flagged_small_selected.png" : "flagged_small_unselected.png";

 echo "<tr class='$class'>
 <td class='bold'>$item_id</td>"
;

 while (list($row_num, $row_info) = each($item_settings))
 {
 if ($row_info[1] == "no")
 continue;

 $content = $record["row_$row_num"];

 echo "<td>$content</td>";
 }
 reset($item_settings);

 echo "
 <td>$date_info</td>
 <td align='center' class='action_cell'><a href='edit_item.php?item_id=$item_id'>EDIT</a></td>
 <td align='center'><div onclick='flag_item($item_id)' class='flag_div'><img id='flag_item_id_$item_id' src='../images/$image' width='15' height='15' border='0' /></div></td>
 </tr>"
;

 $row_count++;
 }

 echo "</table>";
 }
 ?>

 <br />

 <p>
 <input type="button" value="&amp;nbsp;ADD ITEM&amp;nbsp;" onclick="window.location='add_item.php'" />
 </p>

 <?php
 }
 ?>

 </td>
 </tr>
 </table>

</div>

</body>
</html>

&amp;nbsp;

Black Sheep Invoices Scripts for E-Commerce

Black Sheep Invoices is a free, GNU-licensed script for managing invoices.Features:- Simple to use. Quickly generates clear, attractive invoices – Printer-friendly and PDF view/print of all invoices – Entirely brandable to your company or person (no reference to Black Sheep Software) – Option to upload company logo – Database is customizable to store whatever invoice data you need – Choice of $ or &pound; currency – Stores client information to allow you to re-invoice the same client multiple times – May set custom invoice numbering scheme, specify whatever invoice date.

 

 

<?php
session_start();
header("Cache-control: private");
header('Content-Type: text/html; charset=utf-8');
require("_index.php");
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
 <title><?=$g_page_title?></title>
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 <link rel="stylesheet" type="text/css" href="global/styles.css" />
 <script type="text/javascript" src="global/validation.js"></script>
 <script type="text/javascript" src="misc/lightbox/js/prototype.js"></script>
 <script type="text/javascript" src="misc/lightbox/js/scriptaculous.js"></script>
 <script type="text/javascript" src="misc/lightbox/js/lightbox.js"></script>
 <link rel="stylesheet" type="text/css" href="misc/lightbox/css/lightbox.css" media="screen" />
</head>
<body>

<?php
require("global/banner.php");
?>

<div id="main_area">

 <br />

 <p>Please Log In</p>

 <p>
 Log in below to access the Administration Panel.
 </p>

 <form name="login" action="<?=$_SERVER['PHP_SELF']?>?page=login" method="post">
 <input type="hidden" name="action" value="login" />

 <?php
 if (!empty($error))
 echo "<div class='error' style='width: 500px;'><span><span><span><span><span><span><span><span>$error</span></span></span></span></span></span></span></span></div><br />\n";
 ?>

 <table>
 <tr>
 <td width="90">Email</td>
 <td width="150"><input type="textbox" size="30" name="email" value="<?=$email?>"></td>
 </tr>
 <tr>
 <td>Password</td>
 <td><input type="password" size="30" name="password" value="<?=$password?>"></td>
 </tr>
 <tr>
 <td></td>
 <td>
 <script type="text/javascript">
 <!--
 document.write('<input type="submit" value="&amp;nbsp;LOG IN&amp;nbsp;" style="margin-top: 5px;">&amp;nbsp;');
 -->
 </script>
 </td>
 </tr>
 </table>

 </form>

 <noscript>
 <br />
 <div style="margin:3px;">
 In order to log in and use Simple Invoices, you must have javascript enabled
 in your browser. Please enable it now, and click refresh in your browser.
 </div>
 </noscript>

</div>

</body>
</html>

&amp;nbsp;

PHP Scripts for Freya Database E-Comerce

Freya Database is a Web 2.0 (AJAX) based software for money management. Works with various users, accounts, operations, with stats, charts and with a high security level. It needs a web server, PHP 5 and MySQL to run on a local computer, or a web hosting to run on the internet.

 

 

<?php
//     Zen Database Manager (Database Import/Export For ZenCart)
//     Copyright (C) 2005 Jarrod Connolly
//
//     This program is free software; you can redistribute it and/or modify
//     it under the terms of the GNU General Public License as published by
//     the Free Software Foundation; either version 2 of the License, or
//     (at your option) any later version.
//
//     This program is distributed in the hope that it will be useful,
//     but WITHOUT ANY WARRANTY; without even the implied warranty of
//     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//     GNU General Public License for more details.
//
//     You should have received a copy of the GNU General Public License
//     along with this program; if not, write to the Free Software
//     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA


 // include library for working with zip files
 require_once('pclzip.lib.php');


 function cleartempfolder()
 {
 global $tempdir, $tablenamelist;

 foreach ($tablenamelist as $i => $tablename)
 {
 $filename = $tempdir.$tablename.'.xml';
 if( file_exists($filename) )
 {
 unlink( $filename );
 }
 }

 if( file_exists($tempdir.'export.zip') )
 {
 unlink( $tempdir.'export.zip' );
 }
 }
 function createexportfile()
 {
 global $tempdir, $tablenamelist;

 // list of xml files for zip
 $filelist = array();

 foreach ($tablenamelist as $i => $tablename)
 {
 $filename = $tempdir.$tablename.'.xml';

 // query database and save xml file
 $xml = BuildZenXML('select * from '.$tablename, $tablename);

 //save xml data to file
 WriteXMLDataToFile( $xml, $filename );

 // add filename to array
 $filelist[]=$filename;
 }

 // create zip archive for download
 $archive = new PclZip($tempdir.'export.zip');
 $v_list = $archive->add( $filelist, PCLZIP_OPT_REMOVE_PATH, $tempdir );
 if ($v_list == 0)
 {
 die("Error : ".$archive->errorInfo(true));
 }
 }

 function downloadfile()
 {
 global $tempdir;

 $fileName = "export.zip"; // supply a file name.
 $fileString=$tempdir.$fileName; // combine the path and file

 // translate file name properly for Internet Explorer.
 if (strstr($_SERVER['HTTP_USER_AGENT'], "MSIE"))
 {
 $fileName = preg_replace('/\./', '%2e', $fileName, substr_count($fileName, '.') - 1);
 }

 // make sure the file exists before sending headers
 if(!$fdl=fopen($fileString,'r'))
 {
 die("Cannot Open File!");
 }
 else
 {
 header("Cache-Control: ");// leave blank to avoid IE errors
 header("Pragma: ");// leave blank to avoid IE errors
 header("Content-type: application/octet-stream");
 header("Content-Disposition: attachment; filename=\"".$fileName."\"");
 header("Content-length:".(string)(filesize($fileString)));
 sleep(1);
 fpassthru($fdl);
 fclose($fd1);
 }
 }

 function testtempdir()
 {
 global $tempdir;

 if (!is_dir("$tempdir"))
 {
 echo "<br>The directory <b>(" . $tempdir . ")</b> doesn't exist";
 }
 if (!is_writeable("$tempdir"))
 {
 echo "<br>The directory <b>(" . $tempdir . ")</b> is NOT writable, Please Chmod (777)";
 }
 }


 function moveuploadfile()
 {
 global $tempdir;

 if (is_uploaded_file($_FILES['uploadedfile']['tmp_name']))
 {
 //get file size
 $size = $_FILES['uploadedfile']['size'];

 //get filename
 //$filename =  $_FILES['uploadedfile']['name'];
 $filename = 'export.zip';

 // put uploaded file in temp folder
 move_uploaded_file($_FILES['uploadedfile']['tmp_name'],$tempdir.$filename);
 }
 }


 function unpackuploadfile()
 {
 global $tempdir;

 $archive = new PclZip($tempdir.'export.zip');
 $archive->extract(PCLZIP_OPT_PATH, $tempdir);
 }

 function makedatabasechanges()
 {
 global $tempdir, $tablenamelist;

 foreach ($tablenamelist as $i => $tablename)
 {
 $filename = $tempdir.$tablename.'.xml';

 $data = GetXMLDataFromFile( $filename );

 UpdateDataBase( $data, $tablename );
 }
 }
 function UpdateDataBase( $data, $tablename )
 {
 global $db;

 $parser = xml_parser_create();
 xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
 xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
 xml_parse_into_struct($parser, $data, $values, $tags);
 xml_parser_free($parser);


 foreach ($tags as $key=>$val)
 {
 if( $key == $tablename )
 {
 $rsTableMeta = $db->MetaColumns($tablename);

 for ($i=0; $i < count($val); $i+=2)
 {
 $query = 'update '.$tablename.' set ';
 $whereclause = '';

 $offset = $val[$i] + 1;
 $len = $val[$i + 1] - $offset;

 $tvalues = array_slice($values, $offset, $len);

 for ($j=0; $j < count($tvalues); $j++)
 {
 $fieldname = $tvalues[$j]["tag"];
 $fieldvalue = mysql_escape_string( $tvalues[$j]["value"] );

 $fieldflags = $rsTableMeta[strtoupper($fieldname)]->flags;
 $flagarray = explode( " ", $fieldflags );

 if( in_array( "primary_key", $flagarray ) )
 {
 if( $whereclause == "" )
 {
 $whereclause = ' where ';
 }
 else
 {
 $whereclause .= ' and ';
 }

 $whereclause .= $fieldname."='".$fieldvalue."'";

 }
 else
 {
 $query .= $fieldname."='".$fieldvalue."',";
 }
 }
 $query = substr($query,0,strlen($query)-1);
 $query .= $whereclause;

 $db->Execute($query);
 }

 }
 }

 }
 function GetXMLDataFromFile( $filename )
 {
 $data = '';

 if (file_exists($filename))
 {
 $f = fopen($filename,'r');
 $data = fread($f,filesize($filename));
 fclose($f);
 }

 return $data;
 }
 function WriteXMLDataToFile( $xmldata, $filename )
 {
 $f = @fopen($filename,'w');
 @fwrite($f,$xmldata);
 @fclose($f);
 }

 function &amp; BuildZenXML($query, $tablename)
 {
 global $db;

 $rs = $db->Execute($query);

 $xml .= '<ZEN>'."\n";

 while (!$rs->EOF)
 {
 $xml .= "\t".'<'.$tablename.'>'."\n";

 $keys = $rs->fields;

 foreach($keys as $FieldName => $FieldValue)
 {
 $content = $FieldValue;

 if( $content != NULL )
 {
 $xml .= "\t\t".'<'.strtolower($FieldName).'>';

 $content =&amp; str_replace( "&amp;", "&amp;amp;", $content );
 $content =&amp; str_replace( ">", "&amp;gt;", $content );
 $content =&amp; str_replace( "<", "&amp;lt;", $content );
 $content =&amp; str_replace( "'", "&amp;apos;", $content );
 $content =&amp; str_replace( '"', "&amp;quot;", $content );

 $xml .= $content;

 $xml .= '</'.$FieldName.'>'."\n";
 }
 }

 $xml .= "\t".'</'.$tablename.'>'."\n";

 $rs->MoveNext();
 $j++;
 }

 $xml .= '</ZEN>'."\n";

 //@$rs->Move(0);


 return $xml;
 }

?>

&amp;nbsp;

PHP Scripts Zen Database Manager E-Commerce

The first part is a PHP addon for the admin section of Zen Cart that allows export/import of records into the Zen Cart database. It will allow record insert, update and delete. The second part is a windows application written in C# that will let you manage your Zen Cart product database. You will be able to manage Manufacturers, Categories and Products. There will be full support for multiple languages in Zen Cart.

 

 

<?php
//     Zen Database Manager (Database Import/Export For ZenCart)
//     Copyright (C) 2005 Jarrod Connolly
//
//     This program is free software; you can redistribute it and/or modify
//     it under the terms of the GNU General Public License as published by
//     the Free Software Foundation; either version 2 of the License, or
//     (at your option) any later version.
//
//     This program is distributed in the hope that it will be useful,
//     but WITHOUT ANY WARRANTY; without even the implied warranty of
//     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//     GNU General Public License for more details.
//
//     You should have received a copy of the GNU General Public License
//     along with this program; if not, write to the Free Software
//     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA


 // required stuff
 require('includes/application_top.php');
 //require(DIR_FS_CATALOG .'includes/database_tables.php');

 // Config File
 require('zendbmanagerconfig.php');

 // Functions
 require('zendbmanagerfunctions.php');

 // we are exporting a file
 if( $_GET['action'] == 'export' )
 {
 // clean files from temp folder
 cleartempfolder();

 // create the XML file from the database
 createexportfile();

 // send export file to user
 downloadfile();
 }

 // we are importing a file
 if( $_GET['action'] == 'import' )
 {
 // clean files from temp folder
 cleartempfolder();

 // copy upload file to temp dir and rename
 moveuploadfile();

 // unzip export file
 unpackuploadfile();

 // process XML files and make DB changes
 makedatabasechanges();
 }
?>

<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
 <head>
 <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
 <title><?php echo TITLE; ?></title>
 <link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
 <link rel="stylesheet" type="text/css" href="includes/cssjsmenuhover.css" media="all" id="hoverJS">
 <script language="javascript" src="includes/menu.js"></script>
 <script language="javascript" src="includes/general.js"></script>
 <script type="text/javascript">
 <!--
 function init()
 {
 cssjsmenu('navbar');
 if (document.getElementById)
 {
 var kill = document.getElementById('hoverJS');
 kill.disabled = true;
 }
 }
 // -->
 </script>
 </head>
 <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF" onload="init();">
 <?php require(DIR_WS_INCLUDES . 'header.php'); ?>
 <table border="0" width="100%" cellspacing="2" cellpadding="2">
 <tr>
 <td>
 <table border="0" width="100%" cellspacing="0" cellpadding="2">
 <tr>
 <td><?php echo HEADING_TITLE . ' ' . ZENDBMANAGER_VERSION; ?></td>
 <td align="right"><?php echo zen_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
 </tr>
 </table>
 </td>
 </tr>
 <tr>
 <td style="color:red;">
 <?php testtempdir( $tempdir ); ?>
 </td>
 </tr>
 <tr>
 <td>
 <form ACTION="zendbmanager.php?action=export" METHOD=POST>
 <div align = "left">
 <b><?PHP ECHO ZENDBMANAGER_DOWNLOAD_FILE;?></b>
 <br>
 <input type="submit" name="buttonexport" value="<?php echo ZENDBMANAGER_EXPORT_BUTTON;?>">
 </div>
 </form>
 </td>
 </tr>
 <tr>
 <td>
 <FORM ENCTYPE="multipart/form-data" ACTION="zendbmanager.php?action=import" METHOD=POST>
 <div align = "left">
 <br>
 <b><?PHP ECHO ZENDBMANAGER_UPLOAD_FILE;?></b>
 <br>
 <input name="uploadedfile" type="file" size="50">
 <input type="submit" name="buttonimport" value="<?php echo ZENDBMANAGER_IMPORT_BUTTON;?>">
 </div>
 </form>
 </td>
 </tr>
 </table>
 <?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
 </body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

&amp;nbsp;

 

PHP Scripts Camel Shopping Cart E-Commerce

Camel Shopping Cart is a fully customizable shopping cart system created in php with mysql database. It includes also a backend to manage the store. E-Commerce.

 

 

<?php
include('variables.php');

$connect = mysql_connect($host,$username,$password);
if (!$connect) {
 die('Could not connect: ' . mysql_error());
}
@mysql_select_db($database) or die( "Unable to select database");

$q = $_GET[q];
if (!$q)
{
$q = "0";
}

$query = "SELECT * FROM links WHERE link = '$q'";
$result = mysql_query($query);

$nums = mysql_num_rows($result);
 if($nums < 1)

 {
 echo "Unknown Product. Please contact <a href=\"mailto:$paypalemail\">$paypalemail</a>";
 }
 else
{

$row=mysql_fetch_assoc($result);

$filepath = $row["getfilename"];
$dltimes = $row["dltimes"];
$minusone = $dltimes-1;

if ($dltimes>0)
{

$location = 'myfiles/'. $filepath;

$changequery = "UPDATE links SET dltimes = '$minusone' WHERE link = '$q'";
$changeresult = mysql_query($changequery);

 $filename = 'dummy.zip';
 $filename = realpath($location);

 $file_extension = strtolower(substr(strrchr($filename,"."),1));

 switch ($file_extension) {
 case "pdf": $ctype="application/pdf"; break;
 case "exe": $ctype="application/octet-stream"; break;
 case "zip": $ctype="application/zip"; break;
 case "rar": $ctype="application/x-rar-compressed"; break;
 case "doc": $ctype="application/msword"; break;
 case "xls": $ctype="application/vnd.ms-excel"; break;
 case "ppt": $ctype="application/vnd.ms-powerpoint"; break;
 case "gif": $ctype="image/gif"; break;
 case "png": $ctype="image/png"; break;
 case "jpe": case "jpeg":
 case "jpg": $ctype="image/jpg"; break;
 default: $ctype="application/octet-stream";
 }

 if (!file_exists($filename)) {
 die("NO FILE HERE");
 }

 header("Pragma: public");
 header("Expires: 0");
 header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
 header("Cache-Control: private",false);
 header("Content-Type: $ctype");


 header("Content-Disposition: attachment; filename=\"".$filepath. "\";");

 header("Content-Transfer-Encoding: binary");
 header("Content-Length: ".@filesize($filename));
 set_time_limit(0);
 @readfile("$filename") or die("File not found.");

}
else
{
echo "No more downloads";
}
}


?>

&amp;nbsp;