eBook authors eBook Software - create and publish your own ebooks
Create your own eBooks
Learn How To Create, Publish & Market E-Books
E-Book Creation Software
Add sophisticated multimedia to your E-Books
Create E-Book covers in minutes
E-Book Marketing & Promotion made easy
Search engine for E-Books
Interviews with eBook authors
Tools for building better eBooks
Archived Message:

1000 passwords with PHP

EBookCompiler crystal said in this thread about selling 1000 passwords using ASP

Hi Sunnil,

I would like to know how to do this with PHP. I can always install and customize existing code, but I haven't had the time to learn to write it for myself. Does anybody have a snippet that will do this already made?

My server doesn't have ASP, I'm running on Red Hat...I guess that CGI would be ok too, but I actually prefer PHP. It's dynamic and can do other cool things that I have programmed into my pages - and I can't exactly name my pages with BOTH a php and a cgi extension, obviously.

Thanks for your time

Original ASP thread:http://www.ebookfriends.com/cgi-bin/ikonboard/topic.cgi?forum=1&topic=19&start=0

Now for a PHP version: This may not be perfect, but is close...  hopefully you can fix (and maybe point out) any minor errors

1. Generate the password list with 1,000 passwords and save into the PHP
file say passwordlist.php

2. Make your E-Book link to the sales page with a parameter


3. Make a page on your site call sellpassword.php

<TITLE>Sell a password</TITLE>
add some text here
/* $x is in the URL query string */
if ( $x != "" )
echo "Are you ready to buy a password?" ;
echo "<BR><BR>"  ;
/* edit the next line to include your nickname and product number and name */
echo "<A HREF=http://www.clickbank.net/sell.cgi?link=nickname/1/Product_Name&x=" . $x ;
echo ">Click here to buy password number " . $x ;
echo "</A>"  ;
} else
echo "<FORM METHOD=GET ACTION=sellpassword.php>" ;
echo "Enter the number of the password (1 to 1000) that you want to buy" ;
echo "<INPUT MAXLENGTH=4 NAME=\"x\" SIZE=4>" ;
echo "<BR><INPUT TYPE=SUBMIT VALUE=\"Buy Now\">"  ;
echo "</FORM>" ;
add some text here

The above sells a single clickbank product, and passes x thru as a parameter
to the thank you page. Edit the line which is marked

4. Make you thank you page, say thankyou.php

include "passwordlist.php" ;

/* $x is in the URL query string */

if ( $x != "" )
echo "Your password is " . $passwordlist[$x] ;
} else
echo "An error occured, contact the webmaster for help" ;
add text here
add text here

Posted on: 8:23 pm on August 24, 2001
crystal Ok, thanks.  I'll try that.

I'm in them middle of trying to get my new phpnuke installed this week, so I probably won't be able to do it until at least this weekend, but when I do, I'll definitely let you know how it works!

I didn't expect an answer so quickly!  

Thanks a bunch!


Posted on: 4:19 pm on August 25, 2001
EBookCompiler Glad to be of help.  I'm sure it's right or very close (I didn't test)

I dunno if you noticed, but I used to use ASP for most stuff. Now i have changed all my sites, exceptwww.hits4me.comand part of domaincavern.com to PHP

Horrible job: But I got pretty good at turning ASP into PHP

Incidentally threre is also a program (DOS based) caused ASP2PHP which is out there on the net, freeware I think, that does a 90% conversion of ASP to PHP.  You have to do some manual changes as well, but it works pretty good.  I have to admit, I did NOT use this program, as I prefer to edit my code manually and know exactly what's happening.

Posted on: 9:49 pm on August 25, 2001
denis Hi everybody,
I am a real newbie and would like to know if somebody knows how to do this using cgi script (I mean manage 1000 passwords and have only one thank you page).
Thanks for your reply.

Posted on: 7:33 pm on November 21, 2001
paulg I'm a bit new to PHP, being more familiar with perl, so I'm having great fun with this

I've got the first part working OK and it is sending the correct parameters through to my merchant account, and the ordering page is fine.  However, when the parameters come back to the thankyou / password page I get the full list of 1000 passwords!!!

Testing it manually does the same:
http://www.mydomain.com/thankyou.php?$x=1gives me the whole lot.

Am I missing something? I assume that the passwordlist.php file is just a standard text file residing in the same directory as the other php files, with permissions set to 755.

Any advice appreciated. Thanks.

Posted on: 4:50 pm on December 18, 2001

I assume that the passwordlist.php file is just a standard text file residing in the same directory as the other php files, with permissions set to 755.

No it's PHP code.  THe Edit Security dialog box has an option to generate this code - there is a Save as button there.

Also the URL needs to be something like


Use $ for variables in PHP code, but not in the URL

Posted on: 2:39 pm on December 20, 2001
paulg Fantastic - thanks for that Sunil.

Now for hopefully my last query on this subject, my (registered) e-book compiler only seems to want to generate or import 500 passwords, not 1000.  Why would this be?

Posted on: 3:25 pm on December 20, 2001
EBookCompiler 500: I've never seen that happen even on Win95

Are you sure that they aren't there, and just not being displayed?  or maybe you already had some present - 1000 is the total number?  or maybe there's a gap in your the file you're (?) importing at line 500?.... gotta be something like that

Posted on: 8:42 am on December 26, 2001
paulg OK I've checked this again -  I have a list of 1000 passwords which will not import. I am absolutely certain that the file is exactly 1000 lines long, I've checked it in an html editor. If I remove one line so that there are 999 passwords, then it will import, and then I have to manually add the last one.

Posted on: 12:38 am on January 14, 2002
EBookCompiler I think you found a bug Paul.

I'll check this out and hopefully fix for 4.10

In the meantime, as you've done import 999, then add the last 1 manually

BTW I am having a crazy time right now  I want to get this 4.10 version out, but I'm also wanting to get it perfect.

Posted on: 3:31 am on January 18, 2002
paulg Sunil - perfection is one of those intangibles!  However, if you find that you need an extra beta tester, I'd be more than happy to assist in the quest.

Posted on: 10:17 pm on January 18, 2002
EBookCompiler Thanks Paul

I will take you up on that, I will post here when I'm ready.  I'll post here and email too.

4.10 is (mostly) to address annoyances, etc.  I have a few new features turned off in the code with ifdef (this is how you comment stuff out in C++) but I'm thinking about enabling at least some of them

By the way I expect to be slower than usual in answering emails (and maybe on this board) at least for the next week or so, but I will answer.  

Posted on: 4:16 am on January 19, 2002
EBookCompiler push

4.20 which begins beta testing today, fixes the 999 bug

Posted on: 3:15 pm on March 19, 2002
EbookHeaven Hi Sunil,

I copied the code you posted in this thread and uploaded the files to my server. When I click upon the link in the ebook, it calls the sellpassword.asp page, but the P in the {} is not replaced with a number as I thought it would be. The address in the browser is exactly the same as in the ebook's link including the {p}

I am not at all familiar with Php, so please bear with me on this. I would very much like to make this work.

By copying your code exactly, have I in fact made a newbie mistake? I thought the ebook would automatically replace the p with a number so that it would "follow through" the Clickbank purchase and be used by the Thankyou page.


Posted on: 11:14 pm on April 23, 2002
EBookCompiler The link containing {p} goes inside your ebook.  Enter this in the URL field on Edit System Pages / Password Protection Tab / System Generated page

The ebook will expand this to the number of the password, so the link in the ebook (on the page which says this page is password protected) actually ends up meaning something like this:


Ends up going to

The PHP code which is in the sellpassword.php file on your site, gets the value of x, and generates the correct sales page

I'm not certain what you've done wrong, but all the {p} stuff is inside the ebook.  

The PHP scripts see only the expanded value of {p}, namely which ever number

Posted on: 11:36 pm on April 23, 2002
paulg Perhaps you have forgotten to enable pre-processing for the page that contains the {p} tag?

Posted on: 11:38 pm on April 23, 2002
EBookCompiler Good point Paul

if you use "MY Own page" for the password protected page, or you want the buy password link from the ebook to go from some other page in the ebook, put in the {p} like this - [={p}] and enable the preprocessor on the file (Files tab in the compiler)

Posted on: 2:29 am on April 24, 2002
EbookHeaven Thanks guys,

I think it was the pre-processor thingy.

Posted on: 9:16 am on April 24, 2002
EbookHeaven A quick update on my problem. It was the pre-processor, but entirely my own fault. I entered this:

[{p}] and should have entered this: [={p}]

That pesky equels sign tripped me up. Thanks for the help.

Posted on: 9:44 am on April 24, 2002
ravijp Hi all,

With Sunil's support, I have developed a script, which combines the best feature of the Activ Ebook Compiler - the 1000-password generation - and that of my own script, the ClickBank download protector, which protects your thank-you page from hackers.

This is written in PHP, and takes the password generation feature of Sunil's compiler a step forward, by showing you how to combine the passwords generated with a script that helps you deliver those passwords right from a link in your ebook, while also protecting your thank-you page.

Here's the link to the script:


Ravi Jayagopal

Posted on: 5:12 pm on January 24, 2003
NymRod I didn't get the 1000 password list script Sunil posted to work.
It always includes the entire password list.

How should passwordlist.php be configured?

Does anybody have that script working?

Sunil, have you tested that script yet to see if it worked?
I noticed in an earlier post you said you hadn't tested it.

Is there any way to do it so the password number needed isn't visible in the URL?



Posted on: 4:18 pm on April 10, 2003
EBookCompiler The start of this thread is pretty old

The code at
has been tested, and has been for some time

To make passwordlist.php use the save option in Edit Security, and make sure you save into PHP format

Posted on: 4:30 pm on April 10, 2003
NymRod "make sure you save into PHP format"

That's the part I'm not sure about.
What should this 10 password list look like in PHP format?


Should they be in an array or in a list, one password per line?



Posted on: 4:53 pm on April 10, 2003
EBookCompiler In 4.01 or later

Click Edit Security

Click Save

In the  Save as Type option, click PHP source code, and the compiler will generate the file for you

Posted on: 1:43 am on April 11, 2003
NymRod Oh, I see. I didn't know about the Save as Type part of it.
I configured it manually like so,


I put the ERROR in there because it starts counting at 0 instead of 1 to get it on the right password for that number.
With the line returns removed in the array the passwordlist.php is 9.8kb in file size opposed to 18.4kb when saved with the Save as Type option.

I learn something new everyday.
The bad part is when my head gets full I'll have to forget something old to remember something new, by the time I approach the near genius status I'll have forgotten how to walk or talk.


Posted on: 3:07 am on April 11, 2003

List All Archived Forums

Copyright © 2000-2018, Answers 2000 Limited.

With any business, it is up to the individual owner of said business to ensure the success of the business. You may make more or less than any sample figures or results that might be quoted on our web sites or other publications. All business involves risk, and many businesses do not succeed. Further, Answers 2000 Limited does NOT represent that any particular individual or business is typical, or that any results or experiences achieved by any particular individual/business is necessarily typical.

Disclosure: Our company's websites' content (including this website's content) includes advertisements for our own company's websites, products, and services, and for other organization's websites, products, and services. In the case of links to other organization's websites, our company may receive a payment, (1) if you purchase products or services, or (2) if you sign-up for third party offers, after following links from this website. Unless specifically otherwise stated, information about other organization's products and services, is based on information provided by that organization, the product/service vendor, and/or publicly available information - and should not be taken to mean that we have used the product/service in question. Additionally, our company's websites contain some adverts which we are paid to display, but whose content is not selected by us, such as Google AdSense ads. For more detailed information, please see Advertising/Endorsements Disclosures

Our sites use cookies, some of which may already be set on your computer. Use of our site constitutes consent for this. For details, please see Privacy.

Click privacy for information about our company's privacy, data collection and data retention policies, and your rights.

Contact Us    About and Terms Of Use    Privacy    Advertising/Endorsements Disclosures