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:

PHP script with Formmail form

Felixx Hi Sunil,
I wanted to know if you can help with that. I compiled an ebook, which I intend to distribute for free. Some of the pages are passw. protected and when the user gets to a pass protected page he can click on the link and come to my web site where I have this form to collect first and last name and email address. I wan't to use the PHP script (below) somehow together with my Formmail form (.cgi) to collect his/her info and also the password number, requested by the ebook and give him/her the password. Here is the script I got from ebookcode.com (Issue Passwords From Members' Area Using PHP):

$maxpassword = 1000 ; // Change this line to number of passwords
include 'passwordlist.php' ;
if ( isset( $_POST['x'] ) )
$x = $_POST['x'] ;
} else
$x = "" ;

$y = trim( ereg_replace('[^0-9]','',$x ) ) ;
if ( $y != $x )
echo 'Enter a number 1 to '.$maxpassword.'<BR><BR>' ;
$x = "" ;

if ( $x != "" )
if ( $x < 1 )
$x = "" ;
echo 'Enter a number 1 to '.$maxpassword.'<BR><BR>' ;
if ( $x > $maxpassword )
$x = "" ;
echo 'Enter a number 1 to '.$maxpassword.'<BR><BR>' ;

if ( $x == "" )
echo '<FORM METHOD="POST" ACTION="getpassword.php">' ;
echo 'Enter Password Number (1 to 1000):<BR>' ;
echo '<INPUT TYPE="TEXT" NAME="x" VALUE="" SIZE=4>' ;
echo '<BR><BR>' ;
echo '<INPUT TYPE="SUBMIT" VALUE=" Go! ">' ;
echo '</FORM>' ;
} else
echo "Your password is " . $passwordlist[$x] ;

My questions are:
1. Where to place the passwordlist.php file? Is it where my form web page is located in my web site?
2. When I run the PHP script by itself the browser gives me the message "getpassword.php can't be found". How can I create this file and what should I have in it? Also where to put it?
3. Where to put these lines from my formmail in the php:

<form action="http://www.mywebsite.com/cgi-bin/formmail/formmail.cgi" method="post" enctype="application/x-www-form-urlencoded" name="form1">

and the rest of the <input ***********************> lines from the formmail?

Sorry, I know that's a lot of questions but I figured if I post them here may be other Activ Ebook users will benefit from the answers as well.
I will GREATLY appreciate if you find the time to answer my questions. I hope what I want to do is achievable :-|

Posted on: 11:06 pm on April 1, 2006
EBookCompiler I think that I emailed you about this?

1. Yes

2. I'm not sure I understand this one

3. This is the big one:  It sounds like you are trying to combine the password script, with a formmail script.  I'm sure it's possible, but it's programming task which requires non-trivial (not massive but some) programming work.  If you're not a PHP programmer, you need to get some help from a PHP programmer to do the code.

Posted on: 3:30 pm on April 19, 2006

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