Showing posts with label inline. Show all posts
Showing posts with label inline. Show all posts

Friday, January 21, 2011

Alertpay ™ PHP Shopping Page v3.0

So as I mentioned earlier I have made some changes like you don't need a separate download and cancel page all is done in just one page. Script is easy to change you have to just edit the all.js file everytime you add a new product.

all.js

// Alertpay PHP Shopping Page Script v3.0
// Script written By Tanmay Das
// © Copyright Designinline.com. All rights reserved.
// http://www.designinline.elementfx.com
listDisplay([
// 'name of the thumbshot, screenshot and .zip file to be downloaded', 'name of the product','author','price',
'H5p9O33k7Uf5','HTML Template','Tanmay Das','18',
'2','www.123.com','Link2','17',
'3','www.123.com','Link3','19',
'4','www.123.com','Link4','25']);
function listDisplay(dataArr)
{
var furl, name, author, r1, l, v;
v = 4;
l = (dataArr.length / v)-(dataArr.length / v);
while(l<[dataArr.length/v])
{
furl = dataArr[l * v];
name = dataArr[(l * v)+1];
author = dataArr[(l * v)+2];
r1 = dataArr[(l * v)+3];
r2 = dataArr[(l * v)+4];

document.write('<div id="thumb_div">');
document.write('<table width="200" border="0" cellspacing="0" cellpadding="0">');
document.write('<tr><td>'+name+'</td></tr>');
document.write('<tr><td><img src="template/thumbs/'+furl+'.jpg" width="200" height="150" /></td></tr>');
document.write('<tr><td width="53">Author : '+author+'</td></tr>');
document.write('<tr><td>Price : $'+r1+'</td></tr>');
document.write('<tr><td height="20" align="center"><a href="http://www.titan4119.110mb.com/buy.php?');
document.write('id='+furl+'&amp;name='+name+'&amp;aut='+author+'&amp;r1='+r1+'" target="_self">');
document.write('View Template</a></td></tr>');
document.write('<tr><td align="center"><a href="http://www.yoursite.com/template/buy.php?');
document.write('id='+furl+'&amp;name='+name+'&amp;aut='+author+'&amp;r1='+r1+'" target="_self">');
document.write('<img src="../images/buy_small.gif" width="115" height="27" border="0" /></a></td></tr>');
document.write('</table>');
document.write('</div>');
l++;
}
}
Copy it, save it as all.js (for now) and change the links given in bold


buy.php

<?php
// Alertpay PHP Shopping Page Script v3.0
// Script written By Tanmay Das
// © Copyright Designinline.com. All rights reserved.
// http://www.designinline.elementfx.com
$default0 = 'all';
$dbase = isset($_GET['db']) ? $_GET['db'] : $default0;
$dbase = basename($dbase);
$default1 = 'test';
$furl = isset($_GET['id']) ? $_GET['id'] : $default1;
$furl = basename($furl);
$default2 = 'Name of the Template';
$fname = isset($_GET['name']) ? $_GET['name'] : $default2;
$fname = basename($fname);
$default3 = 'Tanmay Das';
$author = isset($_GET['aut']) ? $_GET['aut'] : $default3;
$author = basename($author);
$default4 = '0';
$price1 = isset($_GET['r1']) ? $_GET['r1'] : $default4;
$price1 = basename($price1);
$default5 = '0';
if (file_exists('download/'.$furl.'.zip'))    {
echo('<table width="1000" border="0" cellspacing="0" cellpadding="0">');
echo('<tr><td width="75%"><img src="preview/'.$furl.'.jpg" /></td>');
echo('<td width="25%" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">');
echo('<tr><td>'.$fname.'</td></tr><tr><td>&nbsp;</td></tr>');
echo('<tr><td>Author : '.$author.'</td></tr><tr><td>&nbsp;</td></tr>');
echo('<tr><td>Commercial Licence (Price : $'.$price1.')</td></tr><tr><td align="center">');
echo('<form method="post" action="https://www.alertpay.com/checkout" >');
echo('<input type="hidden" name="ap_purchasetype" value="item-goods"/>');
echo('<input type="hidden" name="ap_merchant" value="you@yoursite.com"/>');
echo('<input type="hidden" name="ap_itemname" value="'.$fname.' (Commercial Licence)"/>');
echo('<input type="hidden" name="ap_currency" value="USD"/>');
echo('<input type="hidden" name="ap_returnurl" value="http://www.yoursite.com/download.php?s=0&name='.$fname.'&aut='.$author.'&rs='.$r1.'&id='.$furl.'"/>');
echo('<input type="hidden" name="ap_itemcode" value="'.$furl.'"/>');
echo('<input type="hidden" name="ap_quantity" value="1"/>');
echo('<input type="hidden" name="ap_amount" value="'.$price1.'"/>');
echo('<input type="hidden" name="ap_cancelurl" value="http://www.yoursite.com/download.php?s=1&name='.$fname.'&aut='.$author.'&rs='.$r1.'&id='.$furl.'"/>');
echo('<input type="image" name="ap_image" src="buy.gif"/>');
echo('</form></td></tr><tr><td>&nbsp;</td></tr></table>');
}
else if(!file_exists('template/dbase/'.$dbase.'.js'))
{
echo('<h5>There has been an ERROR</h5>');
}
else
{
echo('<script type="text/javascript" src="template/dbase/all.js"></script>');
}
?>
Copy it save it as buy.php (for now) and edit everything in bold


download.php

<?php
// Alertpay PHP Shopping Page Script v3.0
// Script written By Tanmay Das
// © Copyright Designinline.com. All rights reserved.
// http://www.designinline.elementfx.com
$default0 = 'home';
$furl = isset($_GET['id']) ? $_GET['id'] : $default0;
$furl = basename($furl);
$default1 = 'name';
$fname = isset($_GET['name']) ? $_GET['name'] : $default1;
$fname = basename($fname);
$default3 = 'Tanmay Das';
$author = isset($_GET['aut']) ? $_GET['aut'] : $default3;
$author = basename($author);
$default4 = '0';
$price = isset($_GET['rs']) ? $_GET['rs'] : $default4;
$price = basename($price);
$default5 = '5';
$status = isset($_GET['s']) ? $_GET['s'] : $default5;
$status = basename($status);
if ($status == '0')
{
header('Location: http://www.yoursite.com/download/'.$furl.'C.zip');
echo ('Thank You for Purchasing HTML Template named '.$fname.' by '.$author.' with  Commercial Licence priced $'.$price);
echo ('<div align="center"><b>Download is in progress</b><br />');
echo ('<img src="../images/load.gif" width="32" height="32" /><br />');
echo ('If the download doesn&acute;t starts within 5sec<br>');
echo ('<a href="http://www.yoursite.com/download/'.$furl.'C.zip">Click Here</a> to download manually</div>');
}
else if ($status == '1')
{
echo ('Sorry but the transaction was not successfull');
}
else
{
echo ('You have some error');
}
?>
Copy and save it as download.php (for now) and change everything in bold


That's it important thing is to just go through the codes and change the links to where you have placed each file. The thumbnail image, screenshot image and the .zip file to be downloaded have the same name for ease of use, hence they are placed in different folders e.g.-thumbs, preview and download.
The buy buttons you can download from AlertPay™. Just go to Bussiness Tools > Generate a "Buy Now" Button and then select the button and copy it's url.

www.designinline.elementfx.com verified by Alertpay™

Good news,
My site Design InLine has been verified by AlertPay™. So now I can sell my web-templates from my site and in celebration of this news I am posting my AlertPay™ PHP Shopping Page v3.0 for you.
I have made some changes to my PHP Shopping Page v2.0 which include.
Instead of the following pages.
Buy.html
dbase.js
purchase.php
download.php and
cancel.php

This script uses just
all.js (you can make separate .js file for each category of your product)
buy.php and
download.php

So I hope you like it.

Saturday, January 15, 2011

Simple Shopping Cart with Alertpay™

Many of you must be thinking about putting a shopping cart on your site, blog to earn some cash, sell your HTML templates or images or scripts. But shopping cart takes a little effort to run. I mean My SQL or a flat file database. Also many free scripts use a .cgi file, if you have paid hosting then no problem, but if you have free hosting (like my www.designinline.elementfx.com ) then you are not given access to any .cgi file on the server.
So after fiddling around with PHP, I made a script that uses neither a database (My SQL or flat file) nor .cgi file. It is a simple PHP file that calls the variable from the link to load data and sends the user to your AlertPay page to buy your file. So all you have to do is upload the screenshot image file, flash files (if any) and the zip file to be downloaded and using only three files you can sell all your files. I have used AlertPay because I have an account there also I tried to open a PayPal™ account but I didn't succeed. So here is my script.
You might remember earlier I had posted a tutorial I modified to make PHP Templates. The script is more or less the same but I modified it more so that instead of calling a php file. It calls .jpg preview of the template and inserts all the data from the link into itself. Sample.
To start just copy and paste this code in the body tag and save it as say cart.php.
// Simple PHP Shopping Page Script
// © Copyright, Design InLine.com
// Script created by Tanmay Das
<?php
$default1 = 'test';
$furl = isset($_GET['id']) ? $_GET['id'] : $default1;
$furl = basename($furl);
$default2 = 'Name of the Template';
$fname = isset($_GET['name']) ? $_GET['name'] : $default2;
$fname = basename($fname);
$default3 = 'Tanmay Das';
$author = isset($_GET['aut']) ? $_GET['aut'] : $default3;
$author = basename($author);
$default4 = '0';
$price1 = isset($_GET['r1']) ? $_GET['r1'] : $default4;
$price1 = basename($price1);
$default5 = '0';
$price2 = isset($_GET['r2']) ? $_GET['r2'] : $default5;
$price2 = basename($price2);
if (file_exists('download/'.$furl.'.zip'))    {
echo('<table width="1000" border="0" cellspacing="0" cellpadding="0">');
echo('<tr><td width="75%"><img src="preview/'.$furl.'.jpg" /></td>');
echo('<td width="25%" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">');
echo('<tr><td>'.$fname.'</td></tr><tr><td>&nbsp;</td></tr>');
echo('<tr><td>Author : '.$author.'</td></tr><tr><td>&nbsp;</td></tr>');
echo('<tr><td>Commercial Licence (Price : $'.$price1.')</td></tr><tr><td align="center">');
echo('<form method="post" action="https://www.alertpay.com/checkout" >');
echo('<input type="hidden" name="ap_purchasetype" value="item-goods"/>');
echo('<input type="hidden" name="ap_merchant" value="yourmail@yoursite.com"/>');
echo('<input type="hidden" name="ap_itemname" value="'.$fname.' (Commercial Licence)"/>');
echo('<input type="hidden" name="ap_currency" value="USD"/>');
echo('<input type="hidden" name="ap_returnurl" value="http://www.yoursite.com/c_download.php?id='.$furl.'"/>');
echo('<input type="hidden" name="ap_itemcode" value="'.$furl.'"/>');
echo('<input type="hidden" name="ap_quantity" value="1"/>');
echo('<input type="hidden" name="ap_amount" value="'.$price1.'"/>');
echo('<input type="hidden" name="ap_cancelurl" value="http://www.yoursite.com/c_cancel.php?id='.$furl.'"/>');
echo('<input type="image" name="ap_image" src="buy.gif"/>');
echo('</form></td></tr><tr><td>&nbsp;</td></tr>');
echo('<tr><td>Developer&acute;s Licence (Price : $'.$price2.')</td></tr>');
echo('<tr><td align="center"><form method="post" action="https://www.alertpay.com/checkout" >');
echo('<input type="hidden" name="ap_purchasetype" value="item-goods"/>');
echo('<input type="hidden" name="ap_merchant" value="yourmail@yoursite.com"/>');
echo('<input type="hidden" name="ap_itemname" value="'.$fname.' (Developer&acute;s Licence)"/>');
echo('<input type="hidden" name="ap_currency" value="USD"/>');
echo('<input type="hidden" name="ap_returnurl" value="http://www.yoursite.com/d_download.php?id='.$furl.'"/>');
echo('<input type="hidden" name="ap_itemcode" value="'.$furl.'"/>');
echo('<input type="hidden" name="ap_quantity" value="1"/>');
echo('<input type="hidden" name="ap_amount" value="'.$price2.'"/>');
echo('<input type="hidden" name="ap_cancelurl" value="http://www.yoursite.com/d_cancel.php?id='.$furl.'"/>');
echo('<input type="image" name="ap_image" src="buy.gif"/>');
echo('</form></td></tr></table></td></tr></table>');
}
else
{
echo('The template you are looking for was not found');
}
?>

Now for the link.
http://www.yoursite.com/cart.php?id=12345&name=Name of the Template&aut=Author's Name&r1=10&r2=20
OK the "id" is the name of your screenshot file (the image file that you'll give for preview) which should be in the "preview" folder also the name of the .zip/.rar file (the one that others will download) which should be in the "download" folder. You can change the folders by changing their paths.
The "name" in the link is the name you want to give to the template or script to download to make it look fancy. The "aut" is the name of the author of the file and "r1" and "r2" are the variables carrying the price to Alertpay™.

The download file is also very simple. Just copy and paste this code in download .php.

<?php
$default = 'home';
$furl = isset($_GET['id']) ? $_GET['id'] : $default;
$furl = basename($furl);
header('Location: http://www.yoursite.com/download/'.$furl.'.zip');
?>
<div align="center"><b>Download is in progress</b><br />
<img src="load.gif" width="32" height="32" /><br />
If the download doesn't starts in 5 sec then <a href="<?php echo('http://www.yoursite.com/download/'.$furl.'.zip'); ?>">Click Here</a> to download manually.</div>

It is a simple script right just make the files, upload them and test them out. You'll figure it out very easily.

P.S.- The script is still a work in progress. I have still some work to do on it to make it secure. It is basically for those who want to earn some cash, if you really want to earn your living of selling the I suggest you look for a more secure shopping cart.