Installing Scripts
Script Customisation
The minimum customisation you'll need do is to change the database settings for scripts which use it. You'll also need to change any graphics, copy or specific text - i.e. in the emails sent to your customer.
Most of the scripts have a block of 'constants' at the top - these are actually variables which you need to set to the appropriate values. You'll need to set up:
- The database connection parameters - DBName, UserName, Password.
- Your URL for any cookie operations
- You email address for return emails
- The title of your product.
- The location of your login page / sales banner.
- Session length (timeout) - NOTE, some webservers are set up only to allow cookies to be set if this period is quite long - this will manifest as cookies not being set.
You can make more extensive changes to the scripts. Here are some ideas:
- Changing the layout or look of any of the pages generated by the scripts.
- Store more or less order data than at present.
- Separate customer and sales info.
- Send yourself update emails (e.g. every 10 orders, signups etc.)
- Changing the number of levels of referrals in the affiliates script.
- Recording the users IP address in the security scripts - for extra security.
Most of these simply require you cut and paste some lines of code, and then modify them as appropriate. Take your time to understand how each bit works and you'll soon find it makes sense!
Before you start coding, decide exactly what you want it to do. Also, consider everything that could go wrong and design with this in mind.
Ensure that whatever happens, you don't lose any incoming orders!
TIP: When you make changes to a program, make SMALL changes - i.e. one thing at a time, then test it. If you make lots of big changes, then test it and it doesn't work - you may have trouble finding out why!
Read the chapters on Programming for an overview of programming.
|
Script Installation
Once you've personalised your script. You have to transfer it to your webhost - i.e. upload it. There's two main ways to do this, using FTP or using telnet.
Using telnet, you would:
- Copy the text of the file from your HTML editor, into the Windows clipboard. (From the Edit menu, choose 'Select All', then 'Copy')
- Open a telnet window to your webhost.
- Go to the cgi-bin (or appropriate) directory.
- Type:
cat >filename
- Paste the text into the file. (using the 'Edit / Paste' menu item, or typing 'Ctrl-V' or 'Shift-Ins')
- Close the file by typing 'Ctrl-D'
Or, you can use an FTP program to upload files, such as Arachnophilia's 'Update Web Site' function in the 'Tools' menu. (See either Arachnophilia's help, or the module on uploading your pages.)
Perl scripts should be installed into the cgi-bin directory off your home directory on your webhosting machine. You can upload them using FTP.
You'll also have to change the Unix file permissions for the script so it can be executed. Use the following command:
chmod +x ebot.pl
chmod 774 ipn.php
PHP scripts are just like webpages and should be kept in your website directory along with everyhing else.
| INFO: The permissions for ipn.php have to be set so the file is readable by anyone (World readable) because it's started by a completely unknown process - the PayPal system. (i.e. a process that's unknown on our webserver - it's running on another) |
The script is now ready to run!
Testing
Once installed, you can test the script works as expected. For example, you can send emails to ebot.pl, or use the test form to test ipn.php (see the paypal automation, and scripts download pages).
If you've modified the code, it must be thoroughly tested. If you've just changed the email text, a quick run will prove it's still working.
A Quick Test:
PayPal do not allow you to buy things from yourself. So in order to test your script, you'll need access to another PayPal account (or credit card). If you got a personal PayPal account - use that.
Alter the code on your 'Buy Me' button so the product only costs 1c.
Open a browser to your website, and using your other credit card/account, buy your test item.
Check to see that:
- A confirmation email arrived from PayPal to your friend's email address.
- A confirmation email arrived from Your Website to your friend's email address, containing the product password.
- Your PayPal account was credited.
- The database was updated with the order info.
A test form is included on the free scripts page. This form emulates the PayPal system's IPN post. You can use this form to test your script works and handles the data correctly. Simply upload tf.html onto your website (i.e. in the same directory as your script) then open it in a browser window, and click submit.
To perform a complete and thorough test, you should create a list of all the different things you want the script to handle (called different 'cases' in programming terminology).
You write the test cases, and what you expect to happen in a test document (leaving space to write down what actually happens!). Then you manually create some calls to the script (or emails you can send) that will test those cases. Finally you actually run the test and see whether the expected occurs.
For a more detailed discussion on testing software, read the Chapters on programming, especially Programming Part 2
Examples:
Case 1 - All OK...
Send an email with all the correct data in it to ebot@yourdomain.com
EXPECTED RESULT: Puts the data into the database, gets the correct password out, and emails it to the customer correctly.
Case 2 - Bad Product ID...
Send an email with all the correct data in it - except no Product ID - to ebot@yourdomain.com
EXPECTED RESULT: Puts the data into the database, fails to get any password out, and emails the 'error in order' email to the customer.
Obviously, if you find problems, they must be fixed before any more testing is worthwhile.
Testing is a somewhat dull process, but it removes the anxiety of not being sure! You do not want to lose orders. If you are fairly new to programming - there will be bugs - definitely.
|
|