im not too good with computers but hopefully a genius helps

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
findingkneemo
Forum Newbie
Posts: 3
Joined: Sun Jan 23, 2005 6:29 am

im not too good with computers but hopefully a genius helps

Post by findingkneemo »

hi. i'm not too good with computers but hopefully one of you genius kids can, kinda help me out.

i'm currently selling a product called neurolotion recipe (its my secret recipe to get rid of spider veins, all text, basically a big e-book), and i'm using http://www.clickbank.com because they can accept credit cards for me, without me having to buy the machine.

now what usually happens is, when someone purchases the book, it takes them to my own personal thank you page, in this thank you page, im so computer illiterate that since i don't want to have to deal with e-mails, i just placed a link that they can download from, it looks like this http://www.neurolotionx.com/thankyousite now on this page i made a link that looks like this http://www.neurolotionx/book/neurolotionsecrets.exe

if someone buys my product, and knows that the download is there forever they can just start distributing my book. now i read this today at the clickbank website
http://clickbank.com/crypto.html
i dont know what exactly that means, but i guess when someone buys my product it sends them a link, only for them to use and no one else.


basically what i want to accomplish is, when someone buys my book, either through my email automatically some how they receive the product, or some other way. i know how to password protect the thing, but i don't want to have it on a open website like http://www.neurolotionx/book/neurolotionsecrets.exe
where everyone can just come and download and give it away

thank you. sorry its so long!
AGISB
Forum Contributor
Posts: 422
Joined: Fri Jul 09, 2004 1:23 am

Post by AGISB »

I hate to break it to you, but anyone who downloads it once can put it up on his webpage and distribute it anyway. This simply is what any software or other publisher has to deal with.

First thing I would do is add some kind of authorisation to your website and only distribute the username and password for the buyer. With that you have some kind of control over how many times he downloads it and might revoke access if it it get out of hand.

This would be the easiest solution as it requires the least knowledge.
findingkneemo
Forum Newbie
Posts: 3
Joined: Sun Jan 23, 2005 6:29 am

Post by findingkneemo »

can you help me make one?
Ice794
Forum Newbie
Posts: 10
Joined: Wed Jan 19, 2005 9:52 am
Location: UK

Post by Ice794 »

AGISB, Another idea (complimenting what you've just said), to have the download link for each individual user to automatically break after being downloaded x number of times? Would that be easy to do?

Icé :cool:
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

short answer, yes.
findingkneemo
Forum Newbie
Posts: 3
Joined: Sun Jan 23, 2005 6:29 am

Post by findingkneemo »

i like ice's idea. ice do you know how to go about doing this? I'd greatly appreciate it. i'll send u some money through paypal, or removed. anyways hit me up if u can help me
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

uh-oh breast alert ;p

for example you could store which usercode (unique for each customer)
has access to download which file. the thankyou page would have to take care of that.

it's a bit simplified, but here is how it goes grosso-modo

Code: Select all

<?php
function passwordgen($length = 8)
&#123;
    $result = '';
    $alfabet = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';

    $len = strlen($alfabet) - 1;
    for ($i = 0; $i < $length; ++$i)
    &#123;
        $index = mt_rand(0, $len);
        $result .= $alfabet&#123;$index&#125;;
    &#125;
    
    return $result;
&#125;

$usercode = passwordgen(5);
$query = "INSERT INTO sale VALUES ('$usercode', '5')";
$result = mysql_query($query);
echo "You can surf to our download.php page an download with code $usercode";

then you also need a download page

Code: Select all

<?php

if (!isset($_POST&#1111;'usercode']))
&#123;
    exit();
&#125;
$usercode = mysql_escape_string($usercode);
$query = "SELECT * FROM sale WHERE usercode=$usercode";

$result = mysql_query($query);
if (!$result)
&#123;
    exit();
&#125;

$row = mysql_fetch_assoc($result);
if (!$row)
&#123;
     exit();
&#125;

if ($row&#1111;'count'] <= 0)
&#123;
   exit();
&#125;

$query = "UPDATE sale SET count=count-1 WHERE usercode='$usercode'";
mysql_query($query);

$file = $row&#1111;'file'];

$size = filesize($file);
$content = mime_content_type($file);
$name = basename($file);

header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: public");
header("Content-length: $size");
header("Content-type: $content");
header("Content-Disposition: attachment; filename=$name");
readfile($file);

?>
Post Reply