Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Medical-Book.co.uk

Status
Not open for further replies.

chrismassey

Programmer
Joined
Aug 24, 2007
Messages
264
Location
GB
Hello,

My client and I have recently been very successful providing medical related courses and selling his publishings online...

A few months ago we decided to create a very simple website selling one of the clients books ( (excuse the extremely plain design) and because of the great interest and success, we have decided to develop this idea further...

We brought the domain medical-book.co.uk and we plan to use it to sell the clients other publishings and also provide a service where other users can sell their own books online (in eBook format OR a paperback book)...

I have decided that because I am most knowledgeble using Perl that I would write the entire interface using Perl (and of course HTML/CSS)...

I was wondering if anyone has built a similar system, in particular a system allowing users to pay for an eBook subscription, and then access it online. This is the most important aspect, although I have already done this on medical-interview-book.co.uk, the method is un-satisfactory.

If you have any tips on how I should plan doing this I would be very grateful. I am hoping to make the system as automated as possible. For example, once payment has been made then the user should be able to access the eBook immediately, whereas on Medical-Interview-Book.co.uk the "admin" has to confirm payment has been made before activating the users account.

So basically, any ideas or suggestions would be very useful. I have lots of conflicting ideas running through my head and I want to get it right from the start.

Thanks,

Chris
 
Sorry one more important aspect:

Any ideas on the format of the eBook, I was thinking PDF, MS Word, HTML and txt options. Is it easy to secure a PDF and MS Word document with possibly htaccess, and then open the PDF or MS Word file using Perl? I currently only know how to do this with HTML and txt files
 
The perl route would work but the functionality would depend on the background systems you are using.
What payment process are you using?
If your payment process confirms in real time then you can give instant access via a username and password otherwise there may be a delay while the transacton is checked and confirmed manually.

Keith
 
Aha, i'm glad you brought that up.

I am using paypal to process payments (as most people trust paypal). I am not certain if the way I currently use paypal confirms in real time.

Basically, the user has to confirm their name and email before entering paypal, this information is obviously carried to paypal. Once payment is complete the user is taken to a payment confirmation page I made. Now i'm not sure if the information (name and email) is automatically hiddenly carried to my confirmation page. If it is then a perl script could be used to compare this information to that completed before payment and if the user can now access the eBook etc etc.

I am probably going to have to completely re-think the e-commerce side of things because at the moment my method is too inefficient for both the user and the admin.
 
Look around on the paypal site, they must have some sort of an API that does the kind of thing you are wanting to do.

------------------------------------------
- Kevin, perl coder unexceptional! [wiggle]
 
Paypal has api's for that kind of stuff. They will even call scripts back on your site and pass information back that says if it was a success or a failure.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[noevil]
Travis - Those who say it cannot be done are usually interrupted by someone else doing it; Give the wrong symptoms, get the wrong solutions;
 
Thanks guys, I will have a look for PayPal API's and see how I can make it automated. Working on the registration form at the moment, I will most definately need some help with my regex's tomorrow. Once a regex is written its so obvious how it works, however I still can't seem to get my head round writing them, for examples an email address regex :s. Ill post them tomorrow if i'm having problems, thanks.
 
use Email::Valid for validating email addrsses

------------------------------------------
- Kevin, perl coder unexceptional! [wiggle]
 
Hey Kevin,

I got excited then. Unfortunately my web host doesn't provide Email::Valid although I am able to install my own modules, however i've never had to do this before so I have no idea how :s. In case you are interested, all the modules availalable for 1and1 is here:
If possible, I don't want to create another post, can you check if this MIME::Lite syntax looks ok to you?? In the documentation it shows an example of using qq with {}'s instead of ()'s...

Code:
## Send confirmation email
use MIME::Lite;
my ($confirmation_email)
$confirmation_email = MIME::Lite->new(From    => 'Medical-Book.co.uk',
				      To      => '$email',
                                      Subject => 'Medical-Book.co.uk Registration Confirmation',
                                      Type    => 'multipart/mixed');
                                      Data    => qq{<p>Confirmation message here<p>Second line test};
$confirmation_email->send();

Thanks alot,

Chris
 
some syntax errors in the code you posted, should be:

Code:
## Send confirmation email
use MIME::Lite;
my $confirmation_email = MIME::Lite->new(
   From    => 'Medical-Book.co.uk',
   To      => $email,
   Subject => 'Medical-Book.co.uk Registration Confirmation',
   Type    => 'multipart/mixed',
   Data    => qq{<p>Confirmation message here<p>Second line test};
$confirmation_email->send();

If the server allows you to install modules you should try installing Emaill::Valid. If you have a control panel where you install the modules from it is very simple. Usually all you have to do is enter the name of the module.

------------------------------------------
- Kevin, perl coder unexceptional! [wiggle]
 
Thanks alot for checking that section. Syntax checker was no use :). It works fine now!

I'm going to take a look at how to install modules this week, as I also want TK (though not sure if TK is compatible for CGI web based use).

Got most my registration script ready, just the regex's to finish.

Chris
 
Oops sorry, I forgot to mention I had to add a ending bracket

Original:
Data => qq{<p>Confirmation message here<p>Second line test};

New:
Data => qq{<p>Confirmation message here<p>Second line test});

Chris
 
Oops sorry, I forgot to mention I had to add a ending bracket

sorry about that [blush]

As far as I know, Tk can't be used as a web application. It certainly is not meant for that purpose.

------------------------------------------
- Kevin, perl coder unexceptional! [wiggle]
 
Hey Kevin,

My registration script is so far working almost perfectly. However once registered, a confirmation email isn't sent (could this be a time delay? Its been 10 minutes now...

Here are the important aspects regarding the email part...
Code:
$email = param('email');

## Send confirmation email
use MIME::Lite;
my ($confirmation_email);
$confirmation_email = MIME::Lite->new(From    => 'Medical-Book.co.uk',
				      To      => '$email',
                                      Subject => 'Medical-Book.co.uk Registration Confirmation',
                                      Type    => 'multipart/mixed',
                                      Data    => qq{<p>Line 1 <p>Line 2});
$confirmation_email->send(); 
####################

####################
## Confirmation page
use HTML::Template;
my ($template);
$template = HTML::Template->new(filename => "Register_Complete.htm");
print "Content-Type: text/html\n\n", $template->output;

I have never used MIME::Lite before so I am assuming it requires more information to send an email?

Chris
 
look here:

Code:
To      => '$email',

look at the code I posted:

Code:
To      => $email,

you are literally trying to send an email to $email, the single-quotes will not allow expansion of the variable.



------------------------------------------
- Kevin, perl coder unexceptional! [wiggle]
 
Ahhh, i'm so sorry. I see now. I didn't copy your code, I merely looked for the errors I made and changed them. Didn't notice that one.

I knew that, hehe.

Thanks Kevin, what would we do without you

Chris
 
It's past 1:00 AM here so I'll catch you later Chris. [sleeping2]

------------------------------------------
- Kevin, perl coder unexceptional! [wiggle]
 
Ok speak to you tomorrow. Thanks for the help.

Still having 1 problem, nothing is being printed in the email (the message). Ill probably have it fixed by tomorrow but wondering what i've done wrong. I've tried:

qw{message});
'message');
and
"message");

Any ideas,

Cheers
 
Told yer, I figured it.

I saw this piece of code before though I assumed it would attach a .txt file to the email...

$confirmation_email->attach(
Type =>'TEXT',
Data =>"Message");


Chris
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top