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):
<?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 :-|
Thanks.