CorpImages.net - Online Hosting Manual by chenmeixiu

VIEWS: 114 PAGES: 102

									CorpImages.net
 Online Hosting Manual




                    CoprImages.net – All Around Marketing
                                 Service@CospImages.net
                                     www,CorpImages.net
                             1 (877) 472-7997 (US only)
                         +1 (520) 396-4580 (outside US)
                       +1 (801) 516-3854 (worldwide fax)
                                                                                                                                                Internet All Around Marketing




              GENERAL
CHAPTER ONE - GENERAL INFORMATION ............................................................................................................ 1
      ABOUT THIS MANUAL .............................................................................................................................................................. 1
      ACCOUNT BILLING SUPPORT ................................................................................................................................................... 1
      TECHNICAL SUPPORT ............................................................................................................................................................... 1
        Down Servers ...................................................................................................................................................................... 1
        Your Site Directories and Files ........................................................................................................................................... 2
              CONTROL
CHAPTER TWO - CONTROL PANEL ............................................................................................................................. 4
      CONTROL PANEL ENTRY PAGE ................................................................................................................................................ 4
      OPTIONS................................................................................................................................................................................... 5
        Account Management: ........................................................................................................................................................ 5
        AnonFTP:............................................................................................................................................................................ 5
        Archive Manager: ............................................................................................................................................................... 5
        Billing History:.................................................................................................................................................................... 5
        Change Password: .............................................................................................................................................................. 5
        Counters:............................................................................................................................................................................. 5
        File Manager: ..................................................................................................................................................................... 5
        Formmail: ........................................................................................................................................................................... 5
        Help: ................................................................................................................................................................................... 5
        Mail Manager: .................................................................................................................................................................... 6
        Mailing List:........................................................................................................................................................................ 6
        Mime Types: ........................................................................................................................................................................ 6
        MS FrontPage:.................................................................................................................................................................... 6
        MySQL Database:............................................................................................................................................................... 6
        Network Trouble Shooter:................................................................................................................................................... 6
        Newsletter: .......................................................................................................................................................................... 7
        PGP: ................................................................................................................................................................................... 7
        PGPMail: ............................................................................................................................................................................ 7
        Protect Directories: ............................................................................................................................................................ 7
        Redirect URL: ..................................................................................................................................................................... 7
        Search Engine: .................................................................................................................................................................... 7
        Shopping Cart: .................................................................................................................................................................... 7
        Site Creation Tool:.............................................................................................................................................................. 7
        Site Statistics: ...................................................................................................................................................................... 7
        SSH: .................................................................................................................................................................................... 8
                                         (UPLOADING            INTENANCE)........... 9
                                                             MAINTENANCE)
CHAPTER THREE - FTP & FETCH INSTRUCTIONS (UPLOADING AND SITE MAINTENANCE)
      INTRODUCTION TO FTP ........................................................................................................................................................... 9
        For PC Users (WS_FTP) .................................................................................................................................................... 9
        For Mac Users (Fetch)...................................................................................................................................................... 11
        Bookmarking the Connection ............................................................................................................................................ 12
        How to Transfer Files ....................................................................................................................................................... 13
               TELNET
CHAPTER FOUR - TELNET ACCESS ............................................................................................................................ 14
      SETTING UP SECURECRT:...................................................................................................................................................... 14
                                                  SENDING EMAIL).................................... 21
CHAPTER FIVE - POP3 EMAIL SETTINGS (RECEIVING AND SENDING EMAIL)
                                   (RECEIVING
      RECEIVING YOUR E-MAIL ....................................................................................................................................................... 21
      SENDING YOUR E-MAIL .......................................................................................................................................................... 21
        Eudora Lite Mail:.............................................................................................................................................................. 21


 ii                                                                                                                                                                                        Index
                                                                                                                                          Internet All Around Marketing

      Netscape Internet Mail:..................................................................................................................................................... 22
      Microsoft Outlook: ............................................................................................................................................................ 22
                   MANAGER        LISTS.................................................................................................. 24
CHAPTER SIX - MAIL MANAGER & MAIL LISTS
   MAIL MANAGER: ................................................................................................................................................................... 24
    Mail Manager Overview ................................................................................................................................................... 24
    Creating New Pop3 Accounts ........................................................................................................................................... 24
    Change Password.............................................................................................................................................................. 25
    Delete A Pop3 Email Account........................................................................................................................................... 25
    Forwarding Email............................................................................................................................................................. 26
    Create Autoresponders...................................................................................................................................................... 26
    About Email Aliases .......................................................................................................................................................... 26
   MAIL LISTS ............................................................................................................................................................................ 26
    To set up a new mailing list............................................................................................................................................... 27
    How to subscribe to a list.................................................................................................................................................. 27
    To subscribe to the digest: ................................................................................................................................................ 27
    How to send an email to the list ........................................................................................................................................ 27
    How to unsubscribe to a list.............................................................................................................................................. 27
    To unsubscribe from the digest ......................................................................................................................................... 27
    How to administer the list ................................................................................................................................................. 28
    I would like to set up a newsletter. Can I get SmartList to do this? .................................................................................. 28
    I already have a list of addresses for my mailing list. How can I subscribe the entire list? ............................................. 28
    How to create a moderated list ......................................................................................................................................... 29
    Where to get more information about SmartList............................................................................................................... 30
                MICROSOFT           98................................................................................................ 31
CHAPTER SEVEN - MICROSOFT FRONTPAGE 98
   PUBLISHING A WEB................................................................................................................................................................ 31
   OPENING AN EXISTING WEB .................................................................................................................................................. 31
   TROUBLESHOOTING COMMON PROBLEMS WITH FP 98 .......................................................................................................... 31
     Getting error - "Root Web Busy" ...................................................................................................................................... 31
     Server timing out when publishing large sites. ................................................................................................................. 32
     Getting Error - "Front Page Extensions not Installed"..................................................................................................... 32
     I published but my web's not there!................................................................................................................................... 32
     My counter, bbs, guestbook, etc isn't working................................................................................................................... 32
     My forms won't work through the Secure Server. ............................................................................................................. 32
     My search bot doesn't return any results. ......................................................................................................................... 32
     FP starts the Web Publishing Wizard when I try to publish.............................................................................................. 32
     Why is my page renamed on the server when I publish?................................................................................................... 32
     Further Microsoft FrontPage Support .............................................................................................................................. 32
                ANONYMOUS FTP...................................................................................................................... 33
CHAPTER EIGHT - ANONYMOUS FTP
   ANONYMOUS FTP ACCESS .................................................................................................................................................... 33
   ANONYMOUS FTP WARNINGS:.............................................................................................................................................. 33
                    STATISTICS............................................................................................................................. 35
CHAPTER NINE - SITE STATISTICS
   INTRODUCTION ...................................................................................................................................................................... 35
   WHAT IS LOGGED? ................................................................................................................................................................. 36
   SPECIAL CASES ...................................................................................................................................................................... 37
     Caching in the browser:.................................................................................................................................................... 37
     Caching in a proxy server:................................................................................................................................................ 37
   DEFINITION OF TERMS ........................................................................................................................................................... 37
              PASSWORD           DIRECTORIES
CHAPTER TEN - PASSWORD PROTECTED DIRECTORIES ................................................................................ 40


CorpImages.net Online Hosting Manual                                                                                                                                                       iii
                                                                                                                                          Internet All Around Marketing

                                    ETC.
CHAPTER ELEVEN - CGI BIN, FORMMAIL, ETC................................................................................................... 41
   CGI-BIN APPLICATIONS ......................................................................................................................................................... 41
     Where to Put CGI-bin Scripts ........................................................................................................................................... 41
   PATHS TO DATE, MAIL, PERL, ETC. ....................................................................................................................................... 41
     Setting Permissions ........................................................................................................................................................... 41
   TROUBLESHOOTING CGI-BIN PROBLEMS ............................................................................................................................... 43
   CGIWRAP - SECURE SERVER CGI WRAPPER .......................................................................................................................... 44
   FORMMAIL.CGI....................................................................................................................................................................... 44
                    URE
                 SECUR
CHAPTER TWELVE - SECURE SOCKET LAYER (SSL) ........................................................................................... 48

                   CHANGING      PASSWORDS
CHAPTER THIRTEEN - CHANGING YOUR PASSWORDS .................................................................................. 49
   FOR CONTROL PANEL & FTP PASSWORD CHANGES: ............................................................................................................ 49
   FOR EMAIL PASSWORD CHANGES:......................................................................................................................................... 49
                   PGP
CHAPTER FOURTEEN - PGP & PGP MAIL .............................................................................................................. 50
   WHAT IS PGP?....................................................................................................................................................................... 50
   CREATING PGP MAIL KEY .................................................................................................................................................... 50
   USING PGP MAIL .................................................................................................................................................................. 50
     Required Fields ................................................................................................................................................................. 50
     Optional Form Fields: ...................................................................................................................................................... 51
                  REDIRECT
CHAPTER FIFTEEN - REDIRECT URL ......................................................................................................................... 55

                    SQL....................................................................................................................................... 56
                  MYSQL
CHAPTER SIXTEEN – MYSQL
   WHAT IS MYSQL – AN INTRODUCTION ................................................................................................................................. 56
   8 MYSQL TUTORIAL ............................................................................................................................................................. 56
     8.1 Connecting to and disconnecting from the server ....................................................................................................... 56
     8.2 Entering queries .......................................................................................................................................................... 57
     8.3 Examples of common queries ...................................................................................................................................... 59
     8.3.1 The maximum value for column ............................................................................................................................... 60
     8.3.2 The row holding the maximum of a certain column ................................................................................................. 60
     8.3.3 Maximum of column: per group: only the values..................................................................................................... 60
     8.3.4 The rows holding the group-wise maximum of a certain field ................................................................................. 61
     8.3.5 Using foreign keys.................................................................................................................................................... 61
     8.4 Creating and using a database.................................................................................................................................... 63
     8.4.1 Creating and selecting a database ........................................................................................................................... 63
     8.4.2 Creating a table........................................................................................................................................................ 64
     8.4.3 Loading data into a table ......................................................................................................................................... 65
     8.4.4 Retrieving information from a table......................................................................................................................... 65
     8.4.5 Using more than one table ....................................................................................................................................... 75
     8.5 Getting information about databases and tables......................................................................................................... 76
     8.6 Using mysql in batch mode ......................................................................................................................................... 77
     8.7 Queries from twin project ........................................................................................................................................... 78
     8.7.1 Find all non-distributed twins .................................................................................................................................. 78
     8.7.2 Show a table on twin pair status .............................................................................................................................. 80
                   MATTS                IPTS..................................................................................... 82
CHAPTER EIGHTEEN - MATTS ARCHIVE CGI SCRIPTS
                                     SCRIPTS
   CGIEMAIL.............................................................................................................................................................................. 82
   GUESTBOOK ........................................................................................................................................................................... 83
   FREE-FOR-ALL LINKS PAGE .................................................................................................................................................. 85
   RANDOM TEXT GENERATOR .................................................................................................................................................. 85


 iv                                                                                                                                                                                 Index
                                                                                                                                          Internet All Around Marketing

   WWW BOARD ....................................................................................................................................................................... 85
   SEARCH.CGI ........................................................................................................................................................................... 86
   SINGLE PAGE SHOPPING CART ............................................................................................................................................... 86
   QUICK GUIDELINES ON USING SSI'S ...................................................................................................................................... 86
   PERMISSION SETTINGS FOR SCRIPTS: ..................................................................................................................................... 87
                   REAL
CHAPTER NINETEEN - REAL AUDIO/REAL VIDEO ............................................................................................. 88

CHAPTER TWENTY - COUNTER .................................................................................................................................. 90
   HOW TO SETUP A COUNTER .................................................................................................................................................... 90
   HOW TO CHANGE THE APPEARANCE OF MY COUNTER ............................................................................................................ 90
    1. Change the digit style................................................................................................................................................ 90
    2. Change the border of the counter.............................................................................................................................. 90
    3. What if I want to use more than one counter?........................................................................................................... 91
    4. More documentation on the counter.......................................................................................................................... 91
APPENDIX............................................................................................................................................................................ 92
APPENDIX
   MAILING LISTS ...................................................................................................................................................................... 92




CorpImages.net Online Hosting Manual                                                                                                                                                      v
                                                                                          Internet All Around Marketing



CHAPTER ONE - GENERAL INFORMATION


About this Manual
Although every effort was made to provide accurate and relevant information to our Hosting customers, it is
feasible that some details in this Manual may have become dated. The Internet is a very fast changing medium,
and hence links, information, and concepts change rather quickly.

Please contact our Technical Support team at TechSupport@CorpImages.net if you have any comments or ideas to
improve this Manual. We do hope, however, that it is useful for your hosting needs.

Account Billing Support
For billing questions, please send an email to our Billing Department at Billing@CorpImages.net.

We accept MasterCard, Visa, and American Express. Hosting fees may be billed every three, six or twelve
months. CorpImages.net will billed you according to your selected preference on the Online Hosting Order Form.
For your convenience, we will automatically renew your hosting services unless you ask us in writing to cease
providing the service. Billing for Domain Registration will be done in one lump sum when submitting the Online
Domain Registration Order Form. Finally, payment for Marketing Consulting and Web Designing services will be
billed at 50% of the amount at the time the service is agreed upon, and 50% at the completion of the service.

Technical Support
For support questions, please contact our technical support team at TechSupport@CorpImages.net. We will answer
your email usually within a few hours, but always within 24 hours of your email. Believe us, e-mailing is the best
way to get things done.

We have added this manual to provide you with fast answers. Always refer to this site before contacting Technical
Support.

Down Servers
Well, it happens and there is little that can be done when it happens except to fix the problem. That is, if the
problem is on our side.

Once you've established an Internet connection through your PC, your dial up travels through several points
before it actually logs into our servers. If there are any problems, within or at any of those points, it will prevent
you from logging into your account. This obviously is out of our control.

However, in the event that one of our servers do go down, it simultaneously sets off an alarm, that sounds much
like a fog horn, and tends to cause people within our general area to head for storm shelter's due to their
loudness. Let us assure you that we are aware of a down server before you are. We truly do not mind you calling
us, but we would much prefer concentrating all our efforts on fixing the problem than answering the telephone.
Wouldn't you?

Our servers are configured to restart should there be a failure. The entire process takes approximately 10
minutes. If a server is down for more than 30 minutes, by all means call us!

When you do place a call for Technical Support you will often get our voicemail, especially after normal business

CorpImages.net Online Hosting Manual                                                                                     1
                                                                                        Internet All Around Marketing

hours. This should not alarm you, it is simply an indication that our hands are full at the moment, so please leave
a detailed message and your call will be handled promptly - either by a return telephone call or email, so PLEASE
leave your account name and email address.

Email support is 24 hours a day - and ALL email is answered and handled promptly.

Remember, email is the most efficient means for providing technical support to our customers. We ask that voice
support be reserved ONLY FOR EMERGENCY purposes! Thank you.


Your Site Directories and Files
Think of your site as a mini extension of your PC hard disk. You can access Directories and Files, which only you
can see and change. To learn how to go to your control panel, please see CHAPTER TWO - CONTROL PANEL.

Whenever you are ready to publish your site to the world, make sure you upload your site files within a folder
named yourdomain-www and to give the appropriate execution rights to owner, group and others as explained in
more detail in the Setting Permissions. For now, it will suffice to say that those folders that you wish for the world
to see (such as your yourdomain-www), must be chmod to 775. Please visit the Setting Permissions for more
information.

DO NOT DELETE or change any of the directories or files that are located in your account except to upload to
your www directory with pages of our own design. The initial page of your site will be named index.html, this way
when users type in the URL www.yourdomain.com, they are taken straight to the initial page of your site without
any further input.

When you connect to the root or "home" directory of your account via FTP (File Transfer Protocol), you will see
the following system files & directories/folders which are landmarks suggesting a successful connection:

File/Directory Name - Description

domain-anonftp:     this folder is used for your anonymous users to download public files.
domain-web-logs:    this folder contains all access logs of visitors to your site
domain-mail:        this folder holds all POP mail accounts for your domain
domain-www:         this folder stores all html files for your domain (same folder as the www folder)
www:                this is where we put all your html files and subdirectories (same folder as the domain-www
                    folder)
domain-secure:      this folder stores all secure html files (same folder as www folder and domain-www folder) this
                    is an aliases folder that is secure when the right URL path is called correctly. Example:
                    https://secure-server.net/domain_name/file.name

Of these directories, the most important one is named "www". Every account has its own separate "www"
subdirectory. Files placed in the "www" directory are visible to remote browsers over the Internet, so this is where
we will place all your HTML documents, graphics, sounds, files, etc. which you want people to be able to access
from the world wide web. For example, when a browser asks for URL http://yourdomain.com/page.html, Apache
looks for the file: /home/yourdomain.com/www/page.html and sends it out.

The system will automatically place any needed files in the other directories.

All your HTML files and subdirectories are placed in the www directory. Your CGI-BIN is also located in the www
directory.

REMEMBER - your initial page is always index.html.


2                                                                                      CorpImages.net Online Hosting Manual
                                                                                       Internet All Around Marketing

How do I create my own "404 Not found" error page?

Simply create a missing.html file directing visitors to where you want and place the file in your www directory.




CorpImages.net Online Hosting Manual                                                                               3
                                                                                       Internet All Around Marketing




CHAPTER TWO - CONTROL PANEL

When we host your domain, you will have access to your own Control Panel (similar to the one found in Windows‘
Start/Settings) which provides you with many features to manage your site. To access it, please go to
www.yourdomain.com/menu, and then type your userID and password (the ones we provided to you when
signing up for an hosting account).

This chapter gives a brief description of the different options available in your Control Panel. Note that not all of
the features may be available to you. Feature availability is dependent upon which account type you have. Please
go to our Hosting web page where you can see which options are available for your specific hosting plan.




Control Panel Entry Page
When you enter your Control Panel, you will notice that it is divided into three areas. The upper left-hand corner
shows your Account Glance, which gives you a detailed description of your Account Information. It includes your
username, package option, activation date, contract length, etc.

Underneath, your Resources Available describes your status, disk quota, how much disk space you have
utilized and how much is remaining in your plan, the number of e-mails and mailing lists set up and configured.

Finally, on your right, you will see a number of icons under the Options section. We will describe their functions
below, but under the Help Icon, you can access the same information. Whenever you want to return to your
Control Panel page, just click on the Administrative Suite letters on top.




4                                                                                     CorpImages.net Online Hosting Manual
                                                                                         Internet All Around Marketing


Options
Account Management:
he Account Management Option will give you a detailed description of your Account Information. It includes your
username, your package option, your activation date, contract length, etc.

AnonFTP:
This Option sets up anonymous FTP to allow users to upload and download files to and from your site. Please
refer to CHAPTER EIGHT - ANONYMOUS FTP of this Online Manual for more detailed information.

Archive Manager:
The Archive Manager will allow the user to backup and compress your files. For example, if you have a number of
files for which you wish to keep a backup, you can select all the files, then create a backup file that contains all of
them in compressed format. Please note that the compressed file will count against your disk quota.

Billing History:
This Option will show this account's entire billing history. It will also display your current payment balance.

Change Password:
This will allow the user to change their password. Note that this will change the FTP and Control Panel password,
but NOT the email password. To change the email password, use the Mail Manager. Please refer to CHAPTER
THIRTEEN - CHANGING YOUR PASSWORDS of this Online Manual for more detailed information.

Counters:
From this option, you can verify that the counter program is installed for your account. Also, you can find
directions for setting up a counter on one of your pages. Finally, after the counter has been installed on your
pages, you can set the value of the counter from here. Please refer to CHAPTER TWENTY - COUNTER for
more detailed information.

File Manager:
The File Manager is a very powerful feature. It allows you to manipulate all the files in your web site. You are able
to create, delete, and move your files. You can also upload files from your local PC to the server in File Manager.
Plus, you can edit the HTML in any of your files from this option. Everything you need to manage your site can be
found in this feature.

Formmail:
Formmail allows you to use a form to receive email from your users. Directions for using Formmail can be found
under this option. Please refer to CHAPTER ELEVEN - CGI BIN, FORMMAIL, ETC. for more detailed
information.

Help:
There are three options under the "Help" icon:


CorpImages.net Online Hosting Manual                                                                                    5
                                                                                     Internet All Around Marketing

♦   Getting Started: The Getting Started Page is the one that you are currently in. It gives a brief summary of all
    the features of the Control Panel.
♦   Knowledge Base: The Knowledge Base is a support database containing answers to many of the questions
    you may have in regards to managing your site.
♦   Support Forum: The Support Forum is a place in which you can ask support questions, and have them
    answered by other users.

Mail Manager:
The Mail Manager is where you can manage all aspects of your email accounts. You can add, edit, and delete
email accounts. You can also change the password on any of your email accounts. Plus, if you have Mailing Lists
installed, you would go here to set them up. Finally, this is where you go if you wish to set up email aliases.
Please refer to CHAPTER SIX - MAIL MANAGER & MAIL LISTS of this Online Manual for more detailed
information.

Mailing List:
This option allows you to install the Mailing List program. After it has been installed, you need to create and
maintain your mailing lists with the Mail Manager. You can also remove the mailing list program after it has been
installed if you do not wish to use it. Please refer to CHAPTER SIX - MAIL MANAGER & MAIL LISTS of this
Online Manual for more detailed information.

Mime Types:
MIME Types allows you to set certain programs to be used for specific extensions. For example, all files that end
in .ram would be set to use Real Player on the user's PC. Most users do not need to use this feature. Also, note
that you cannot use this feature if you have FrontPage Extensions installed. You would need to use FrontPage
itself to perform this function.

MS FrontPage:
The MS FrontPage option allows you to install FrontPage extensions - which are necessary in order to use
FrontPage with your site. You can also verify that the extensions are installed, or remove them if you do not wish
to use them anymore. Please refer to CHAPTER SEVEN - MICROSOFT FrontPage 98 of this Online Manual for
more detailed instructions.

MySQL Database:
MySQL is a database engine that you can use with your web site. This feature of the Control Panel will allow you
to create a new MySQL database, and manage it. You will be able to add/edit/delete tables, fields, and values.
You can also run queries on the database if you need to. We do not provide technical support in using MySQL
outside of what is provided on your control panel. Please refer to MySQL's Web Site for complete tutorials and
troubleshooting solutions and documentation. This is an excellent resource.

Network Trouble Shooter:
The Network Trouble Shooter allows you to perform a trace route from our server to your local PC. You may also
trace from your web site on our server to any other location on the Internet. A trace route shows the path that
information travels over the Internet to go from one location to another. If you are experiencing slowness or
problems when connecting to your web site, you can use this to see a snapshot of where the problem is
occurring.




6                                                                                    CorpImages.net Online Hosting Manual
                                                                                       Internet All Around Marketing

Newsletter:
This option will display the different issues of the company newsletter.

PGP:
This option will allow you to set up your PGP key on the server. This allows you to use PGP in your scripts or with
our PGPMail script. You must first have PGP installed on your local PC, and create a PGP key pair before
uploading the key to the server. Please refer to CHAPTER FOURTEEN - PGP & PGP MAIL of this Online
Manual for more detailed information.

PGPMail:
PGPMail is simply the Formmail script, except that it encrypts the email via PGP before it is sent to the client. This
option includes directions for using PGPMail. Note that you must upload your PGP key before you can use this
script. Please refer to CHAPTER SIX - MAIL MANAGER & MAIL LISTS of this Online Manual for more detailed
information.

Protect Directories:
Using this option, you can password-protect any directory you own. This will prevent users from viewing the
contents of a directory unless they have permission. You can set any number of users using this feature. Note
that you cannot use this feature if you have FrontPage Extensions installed. You would need to use FrontPage
itself to perform this function. Please refer to CHAPTER TEN - PASSWORD PROTECTED DIRECTORIES of the
Online Manual for more detailed information.

Redirect URL:
Redirect URL allows you to set up a redirection so that user that type in one URL will automatically be sent to
another URL. Note that you cannot use this feature if you have FrontPage Extensions installed. You would need
to use FrontPage itself to perform this function. Please refer to CHAPTER FIFTEEN - REDIRECT URL of this
Online Manual for more detailed information.

Search Engine:
This feature will allow you to install and manage the WebGlimpse Search Engine on your site. This Search
Engine will allow your users to perform searches on your web site.

Shopping Cart:
The Shopping Cart feature installs or removes the AlaCart Shopping Cart program on your site. After it is
installed, you are given directions for managing the Cart.

Site Creation Tool:
This is a graphical web-based program that gives you the ability to set up your web site from scratch, without any
knowledge of HTML, or the use of a program like MS FrontPage. After the site is created, you can make it your
main domain's page, or you can have it be a subdirectory under your main domain.

Site Statistics:
The Site Statistics feature gives you access to your site's web statistics, such as hits, transfers, etc. Remember


CorpImages.net Online Hosting Manual                                                                                  7
                                                                                    Internet All Around Marketing

that you can always view your statistics by going to http:/www.yourdomain.com/stats.

SSH:
If you need telnet access to our servers, it can only be done using SSH. We have it set up to use RSA
authentication. You will need to create a key using your PC's SSH software, then use this feature to upload the
key to our servers. Once it is uploaded, you will be able to connect to our servers using SSH. Please refer to
Chapter 16 of the Online Manual for more detailed information.




8                                                                                  CorpImages.net Online Hosting Manual
                                                                                      Internet All Around Marketing



CHAPTER THREE - FTP & FETCH INSTRUCTIONS (uploading and site
maintenance)

Introduction To FTP
All of your files and subdirectories go into your www directory. Please refer to CHAPTER ONE - GENERAL
INFORMATION to learn about all the different directories in your account. DO NOT DELETE ANY
DIRECTORIES OR FILES IN YOUR ACCOUNT. The files pertaining to your web site that you design should be
uploaded to your www directory and should be the only files you ever replace.

Now that we've distinguished where your files go, there are several ways depending on your computer system,
that you can transfer files to your account directory. The process by which files are transferred to the web server
is called "FTP" (File Transfer Protocol). You have unlimited access via FTP 24 hours a day. As such, you can
create and maintain your web pages on your own computer and upload files to your web site at your leisure.

In order to upload your files to your server, you may utilize a number of FTP software (some are shareware,
meaning you can use them for free for a limited time). For the Macintosh, a program called "Fetch" is used, and
for Microsoft Windows systems a program called "WS_FTP" is used. You can also connect to your account via
Telnet. All of these are described below.

Online services, which offer an Internet gateway, such as AOL, CompuServe, and Prodigy, may have a built-in
FTP interface. If you have a PPP Internet account, you need an FTP program. Visit http://www.wsftp.com/ to
download the newest version of WS_FTP for the PC, one of the most popular FTP programs on the web.

For PC Users (WS_FTP)
The following information is contained within your account activation notice and is needed to connect you to your
web site via FTP:

USERID                 (we provide you with this)
PASSWORD               (we provide you with this, but you may also change it. Please refer to CHAPTER THIRTEEN
                       - CHANGING YOUR PASSWORDS on this Manual)
FTP HOSTNAME            (your Domain Name, i.e., http://www.yourdomain.com)

Each time you run WS_FTP the Session Profile window will be displayed. A profile contains the information
needed to connect to your web site. Creating a profile now will eliminate the need for you to configure the
software each time you wish to connect to the web server via FTP. To create a profile, click the "New" button and
enter a generic profile name at the top of the Session Profile window, such as "My Web site." Next, enter your
Host Name/Address (yourdomain.com), User ID (yourdomain), and Password for your web site as illustrated
below.




CorpImages.net Online Hosting Manual                                                                                  9
                                                                                            Internet All Around Marketing




Next you need to click "OK" to continue. This will connect you to the web server, where you will connect directly to
the root ("home") directory of your account. WS_FTP will display a split screen where files on the left-hand side
are within your own computer. You will see several folders on the right-hand side such as www, and infobots
which are landmarks suggesting a successful connection to your web site, as illustrated below.




You need to double click on www to get to your web directory. This is where all your files will be downloaded,
and/or you will create sub-directories. The only system directory that you may need to use is cgi-bin; this directory
is reserved for custom scripts. To make your home page load automatically, name the HTML document
"index.htm" in lowercase and upload it to the www directory of your account. To upload a file or files, simply
highlight the file(s) on the left and click the right arrow button (->) in the center of the window. Be sure to upload
HTML documents and scripts in ASCII mode and images in Binary mode. To transfer a file to a subdirectory,
double-click the appropriate subdirectory to open it before transferring the desired file(s). To create a new
directory, click on the MkDir button when you are inside the www directory or subdirectory.

As soon as a file is uploaded to the web server, it is available for all to see. If, after uploading a file, you are still


 10                                                                                         CorpImages.net Online Hosting Manual
                                                                                            Internet All Around Marketing

unable to see the updated file via Netscape, try hitting the "Refresh" or "Reload" button. If that fails, you need to
clear both disk and browser cache. This function can be found by selecting Options>Network Preferences in
Netscape. Remember that you must first be connected to the Internet through your local Internet service provider
in order to connect to the web server.

For Mac Users (Fetch)
The following information is contained within your account activation notice and is needed to connect to your web site via
FTP:

USERID                 (we provide you with this)
PASSWORD               (we provide you with this, but you may also change it. Please refer to CHAPTER THIRTEEN
                       - CHANGING YOUR PASSWORDS on this Manual)
FTP HOSTNAME           (your Domain Name, i.e., http://www.yourdomain.com)

The hostname tells your FTP software to connect to the web server upon which your web site resides.

Each time you run Fetch, the New Connection window will be displayed. A profile contains the information needed to
connect to your web site. Creating a profile now will eliminate the need for you to configure the software each time you wish
to connect to the web server via FTP. To create a new profile, select "New Connection..." from the File menu. Next, enter the




Host (yourdomain.com), User ID (yourdomain), and password for your web site as illustrated below.

Don't worry about the Directory option right now. When you have your Host, User ID, and Password entered, click on the
OK button.

The next window that will pop up will look virtually the same as below, except that yourdomain will be in the pop-up
window.




CorpImages.net Online Hosting Manual                                                                                         11
                                                                                             Internet All Around Marketing




Bookmarking the Connection
You should take the time, now that you have established your connection, to make it easier for you to get here next time.
Under the Customize menu, select New Shortcut. A window will pop up called Bookmark Editor, as below. It will already
have your name, Host, and User ID filled in. Under Type, choose File from the pop-up menu. If you would like Fetch to
remember your password so you won't have to type it in each time, type in your password in the Password field. Now, under
the same Customize menu, choose Preferences, and under the General tab, make sure the connection you just entered is
selected as the default shortcut. Next time you open up Fetch, your shortcut will be opened automatically and all you'll have
to do is click the OK button!




 12                                                                                         CorpImages.net Online Hosting Manual
                                                                                                    Internet All Around Marketing

How to Transfer Files
Please refer again to the sample window above. You need to double-click on www to get to your web directory. This is where
all your files will be downloaded, and/or you will create sub-directories. The only system directory that you may need to use
is cgi-bin; this directory is reserved for custom scripts. To make your home page load automatically, name the HTML
document "index.htm" in lowercase and upload it to the www directory of your account. To upload a file or files, simply drag
them from your hard drive onto the Fetch window when you are in the appropriate directory or subdirectory. Be sure to
upload HTML documents and scripts in Text mode and images in BINARY mode. Or to make life easier, click on the
Automatic button as shown in the sample window above, and Fetch will decide the proper format. To transfer a file to a
subdirectory, double-click the appropriate subdirectory to open it before transferring the desired file(s).

To insure that the Automatic selection works properly, make sure the selections under the Upload tab in the Preferences
window looks the same as below.




As soon as a file is uploaded to the web server, it is available for all to see. If, after uploading a file, you are still unable to see
the updated file via Netscape, you need to hit the Reload button in the Netscape button bar. Remember that you must first be
connected to the Internet through your local Internet service provider in order to connect to the web server.




CorpImages.net Online Hosting Manual                                                                                                   13
                                                                                        Internet All Around Marketing



CHAPTER FOUR - TELNET ACCESS

Telnet Access has been restricted to experienced Telnet Users ONLY. We now requesting that all users wishing
to gain access using Telnet, contact Technical Support and provide us with your domain name, username,
password, and your dialup account name (i.e., aol.com, earthlink.net, erols.com, etc.) to gain access privileges.
This is due to the amount of server problems encountered from users with limited experience using Telnet.

CorpImages.net assumes that any user requesting such access is an experienced Telnet user. In the event that
such user causes any server crashes/damages, their Telnet Access privileges will be revoked and denied for any
future Telnet use.

If you need telnet access to our servers, it can only be done using SSH. We have it set up to use RSA
authentication. You will need to create a key using your PC's SSH software, then use this feature to upload the
key to our servers. Once it is uploaded, you will be able to connect to our servers using SSH. We do not provide a
SSH program for your use. However, as a courtesy only, you may visit http://www.vandyke.com and download their
SecureCRT software. This software is available on a 30-day trial basis after which it must be purchased. Below
we have provided instructions on setting up the software.

Setting up SecureCRT:
Each time you run SecureCRT the following box will appear on your screen.

Ensure that the Session List tab is selected and then click on the new button on the right hand side. This will
create the session that you will use each time you telnet into your account.




Following is a screen shot of the next screen you will see. (Instructions for this area follow this screen shot.)




14                                                                                     CorpImages.net Online Hosting Manual
                                                                                    Internet All Around Marketing




NAME - In the text box next to Name, input a name that SecureCRT can use to identify this session that you are
creating.

PROTOCOL - Select SSH from the drop down box.

As soon as you select SSH, additional boxes will appear below that selection as follows.




CorpImages.net Online Hosting Manual                                                                             15
                                                                                      Internet All Around Marketing




Connect via firewall - Leave this box unchecked.

HOST NAME OR IP - Enter your domain name or ip number in this text box. (ie. yourdomain.com)

PORT - Leave the default number that is there.

USERNAME - this is the username that you use to FTP to your account.

CIPHER - Select 3DES

AUTHENTICATION - Select Password from the drop down box.

PASSWORD - This is the password for your account, the same one you use to FTP to your account.

Next you will need to click the Advanced button as indicated in the screen shot below. Be sure to hit the Advance
button and not the Advance tab.




In the next screen (Advanced SSH) the Use Global radio button is selected by default, and the text box directly
beneath that will automatically be filled in with a file location.

Next locate and click on the Create Identity File button as indicated in the screen shot below. (Everything else on
that screen should remain as is.)




16                                                                                   CorpImages.net Online Hosting Manual
                                                                                         Internet All Around Marketing




The next step will generate the key that will identify to your sessions. This key will be uploaded the first time that
you Telnet to your account. Click on Next as indicated in the screen shot.




CorpImages.net Online Hosting Manual                                                                                     17
                                                                                      Internet All Around Marketing

In the next screen you are asked to insert a Passphrase, by providing this passphrase your key will be encrypted.
Next you are asked to Confirm that passphrase just as you are when you provide a password. Once you've
provided this information, click on Next as indicated in the screen shot below.




In the next screen you are asked for a length for your RSA pair, just accept the default and click Next as indicated
in the screen shot below.




18                                                                                   CorpImages.net Online Hosting Manual
                                                                                       Internet All Around Marketing



In the next screen your key is actually generated, move your mouse around until the status bars are complete and
then click on Next as indicated in the screen shot below.




In the next screen you are prompted for a location in which to save your Key and Key Pair. You can accept the
default, however if you want this information saved in a different location be sure to write down the location as it
will be needed when you Telnet to your account the first time. Also, you should save both files in the same
location. Click on the Finish button as indicated below when you have selected the location.




You are now returned to the Advanced SSH window. Just click on the OK button at the bottom of that window to
close that screen, as which point you are returned to the Session Preferences Window, again click on the OK
button at the bottom of that window to close that screen.

You are now ready to Telnet to your account by clicking on File and then on Connect or you can click on the
Connect icon (3rd icon from the left).

CorpImages.net Online Hosting Manual                                                                                   19
                                                                                    Internet All Around Marketing


When you have successfully connected to your account, you will be prompted to save the key that you just
generated. Follow the instructions on your screen and once you've done this you are ready to work within your
account. From here it's just like a normal Telnet session.

If you receive a Remote Site Disconnected message, don't be alarmed. Attempt to connect several more times
and then slip us an email with your account name, password, and your dial up account name so that we can track
your login so that we can capture the correct information from your dial up. This process can take up to 24 hours
to complete, so be patient and check your login status after 24 hours. If you are still unable to connect after 24
hours, contact Technical Support.




20                                                                                 CorpImages.net Online Hosting Manual
                                                                                      Internet All Around Marketing



CHAPTER FIVE - POP3 EMAIL SETTINGS (receiving and sending
Email)

Receiving your e-mail
In order for you to receive your mail, you must first configure your e-mail aliases (pseudo-names such as
Sales@yourdomain.com) and point them towards the PoP3 e-mail accounts where you want them to go. For
example, you may want to send all sales inquiries to your local ISP e-mail account. You can do this by going to
your Mail Manager:. (Please, refer to CHAPTER SIX - MAIL MANAGER & MAIL LISTS on this Manual for
more details).

You can access your Mail Manager by going to your Control Panel:

http://www.yourdomain.com/menu

Inside this area you can setup all of your email items...like auto-responders, forwarded mail, and pop accounts.

Once you've accessed your Control Panel, click on Mail Manager and then click on the email account you wish to
edit. This area is self-explanatory. However, if you have any questions, please contact us and we can guide you
through.

Depending on the type of hosting plan in which you are you may have at least 50 PoP3 e-mail accounts.

One final note. Although your account exists on our server, you won't be able to receive e-mails at
yourdomain@yourdomain.com until InterNIC has activated you in the domain name servers. Once registration
has been completed with InterNIC, you are ready to receive your mails.

Sending your e-mail
It is a simple process to set up your accounts to send e-mails. We've included instructions for the three most
popular e-mail clients below. Your default e-mail address is yourdomain@yourdomain.com, and that's where all
your e-mail will be sent to, unless other configurations take priority (such as autoresponders and redirects
mentioned in the previous page). Sending mail using yourdomain@yourdomain.com looks more professional and
provides a better image to your clients and visitors.

We do not have or use SMTP servers. If for some reason you feel you must have a SMTP server contact us
and we can help you. But it will add $180.00 per year to the account plan you are on. The reason we do not use
SMTP is that we know spammers relay through servers and send out millions of e-mails. Spamming is STRICTLY
prohibited on CorpImages.net servers. By running closed servers it is a lesser chance of the servers getting
knock down from spamming. Also since you must have a dial up to access the server anyway, you can utilize this
account for your outgoing mail. By this, the servers run better and faster without the SMTP servers open. 90% of
the hosts out there use this system, the ones who do not, charge you for it.


Eudora Lite Mail:
This is a mail program that runs under MS Windows and Macintosh OS. Eudora connects to the mail server over
the Winsock or Macintosh TCP/IP. Mail may be composed and read off line, but make sure that Winsock or
TCP/IP is running before attempting to send or receive email.

After Eudora has been installed, it must be configured to point to your server. To do this, start Eudora and select

CorpImages.net Online Hosting Manual                                                                                  21
                                                                                          Internet All Around Marketing

"Settings" from the menu bar. Most of the options are self-explanatory. Here are the steps you need to perform to
set up Eudora:

1. Install and start up the Eudora program
2. Select "Settings" from the "Special" menu
3. Select the "Getting Started" tab, then under Real Name, enter your Real Name. Under "POP Account" put
    yourdomain@yourdomain.com
4. Leave Return Address blank unless you want people to send return email to you at a different email account
5. If you use the Macintosh version, the radio button for TCP/IP connection should be highlighted
6. Click the "Personal Information" tab (also only for the Macintosh version)
7. Under POP account put yourdomain@yourdomain.com again
8. Fill out the "Real Name" and "Return Address" as you did before
9. Under "Dial up User Name" enter yourdomain (do not enter .com or .net here)
10. Click the "Hosts" tab then enter yourdomain@yourdomain.com again under POP Account, and put
    yourdomain.com under SMTP Server.
11. Go to the "Checking Mail" tab and make sure "Save Password" is checked.

That's pretty much all the configuration Eudora needs. Many of the configuration areas will be filled in when you
go to them, for instance it will usually fill in the POP account info where ever it needs it after you enter it the first
time. Now, when you select "Check Mail" under the File menu, a window will pop up asking for your password.
Enter in your password then click on the proceed button and Eudora will check to see if you have email. You can
now send a test email message to yourself and then check to see if it gets returned to you. If you checked "Save
Password" as in step 12, Eudora will not prompt you again for your password after the first time. If multiple users
have access to your computer, and you don't want them to have access to your email account, make sure "Save
Password" is unchecked.

Netscape Internet Mail:
The sample assumes a domain name of yourdomain.com.

Open Netscape and follow these steps:
1. Go to Edit
2. Click on Preferences...
3. Under “Category:“, double click on “Mail & Groups”
4. Click “Identity“
5. Under “Your Name” enter yourdomain or your real name (this is what people will see the mail being sent from)
6. Under “E-mail Address” enter yourdomain@yourdomain.com
7. Under “Reply-to address” enter wherever@yourdomain.com
8. Add the rest of the information as you wish
9. Go back to “Category:“ and click on “Mail Server”
10. Under “Mail Server user name” enter yourdomain
11. Under “Outgoing mail (SMTP) server” enter yourdomain.com
12. Under “Incoming mail server” enter yourdomain.com
13. When you send your first mail, please enter your password.

Microsoft Outlook:
The sample assumes a domain name of yourdomain.com.

Open Outlook and follow these steps:
1. Go to Tools and click on “Services...”
2. Click “Add...” , choose “Internet E-mail” and click “OK”
3. Under the “General” tab of the E-mail properties dialog box fill in your name (as you want people to see the
   mails)

22                                                                                       CorpImages.net Online Hosting Manual
                                                                                   Internet All Around Marketing

4. Under “E-mail address” type yourdomain@yourdomain.com and the same for your “Reply address” if you
   wish
5. Click the “Servers” tab and under “Outgoing mail (SMTP)” include your ISP information
6. Under “Incoming mail (PoP3)” type yourdomain.com
7. Under “Incoming mail server” click “Log on using” and type yourdomain.com to “Account name” and enter
   your password

Click on the “Connection” tab and specify the type of connection you have. If you are using a phone line, make
sure you choose the right dial-up connection under “Modem”




CorpImages.net Online Hosting Manual                                                                             23
                                                                                     Internet All Around Marketing



CHAPTER SIX - MAIL MANAGER & MAIL LISTS

Mail Manager:
You can access your Mail Manager by going to your Control Panel:

http://www.yourdomainname.com/menu

Inside this area you can setup all of your email items...like auto-responders, forwarded mail, and pop accounts.

Mail Manager Overview
Within your Mail Manager you are able to create new pop3 email accounts, change passwords for your email
accounts, delete a pop3 account, forward email, and create autoresponders. Below is a screen shot of what you
will see when you first enter your Mail Manager. You will initially see two email accounts, one named your
username and one named default, these were created by the system - DO NOT DELETE either of these or your
email will cease to function and simply recreating them will not fix the problem.




Creating New Pop3 Accounts
To create a new Pop3 Email account simply click on the "New Address" link located under your default accounts
and you will be taken to the following screen. (follow the instruction in red)




24                                                                                  CorpImages.net Online Hosting Manual
                                                                                     Internet All Around Marketing



Change Password
To change the password for an email account, simply click on the pop3 account you wish to change the password
for and you will be taken to the following screen. (follow the instructions in red)




Delete A Pop3 Email Account
To delete one of your Pop3 email accounts, simply click on the address you want to delete and then click on the
delete link as indicated in the screenshot below. You will be asked to confirm deletion, simply click yes and the
account will be removed.




CorpImages.net Online Hosting Manual                                                                                25
                                                                                    Internet All Around Marketing

Forwarding Email
You can forward email coming to any of your Pop3 accounts that you have created within your domain to another
account you have created. Or you can forward email to an account outside of your domain by simply clicking on
the email account that you want to forward and you will be taken to the same screen where you change the
password and delete the account. Below those areas you will see the following part of the screen and you will see
a list of the email accounts that you have created. Simply click on the account where you want to forward the
email to or you may scroll down the screen and type in the email address located outside of your domain where
you would like the email to be forwarded to.

Once you've made your choices, just be sure to scroll to the bottom of the screen and click the save button to
save your changes.




Create Autoresponders
You can create an autoresponder for any Pop3 email account that you have listed in your Mail Manager. Simply
click the email account that you want to create an autoresponder for and you will be taken to the same screen that
you Change Password, Delete, or choose Forwarding Options for that email account. Scroll to the bottom section
of that screen and you will see the following box. Click the box to indicate you are including an autoresponse
when this email address receives email and then type in your response for the autoresponder, you then click save
to save your changes.

About Email Aliases
You never have to create email aliases. Your default email account is setup as a "Catch All" account, meaning
that any email coming to anything@yourdomain.com is delivered to your default account.

Mail Lists
You may also go to the APPENDIX for more information



26                                                                                  CorpImages.net Online Hosting Manual
                                                                                      Internet All Around Marketing

To set up a new mailing list
1.   Go to your mail manager http://yourdomain.com/menu
2.   Create a list in Mail Manager by clicking on "New List".
3.   Add the name of the list. You'll get a message giving you instructions, repeated below.
4.   Click "edit list" and you're asked to add the maintainer, password, and max # e-mails archived.

•    The maintainer is the e-mail of the person in charge of the list
•    The password is the list password
•    Max # e-mails archived is the number of the most recent "back-issues" to be saved, and sent when someone
     requests the most recent e-mails sent to your mailing list.

From the Mail Manager, you have access to "Mailing List Manager," also called "Xcommand" (from the name of
the program in UNIX). This is a mailing list administration program.

How to subscribe to a list
From email:

To subscribe to the mailing list, simply send a message with the word "subscribe" in the Subject: field to the -
request address of that list.

To: testlist-request@domainname.com
Subject: subscribe

To subscribe to the digest:
A digest sends all messages at once, in one big message, rather than sending each one individually. To
subscribe the digest, simply send a message with the word "subscribe" in the Subject: field to the following
address.

To: testlist-d-request@domainname.com
Subject: subscribe

How to send an email to the list
To send email to the mailing list, write to the following address:

To: testlist@domainname.com

How to unsubscribe to a list
To unsubscribe from the mailing list, simply send a message with the word "unsubscribe" in the Subject: field to
the -request address of that list.

To: testlist-request@domainname.com
Subject: unsubscribe

To unsubscribe from the digest
To unsubscribe from the digest, write an e-mail like this.

To: testlist-d-request@domainname.com

CorpImages.net Online Hosting Manual                                                                               27
                                                                                                Internet All Around Marketing

Subject: unsubscribe

How to administer the list
The Mailing List Manager (Xcommand), available from the Mail Manager (domainname.com/menu), allows the
administrator of the list to:

•     Show List of Subscribers
•     Show List Log
•     Wipe List Log
•     Search list of subscribers for a near match
•     Directly subscribe/unsubscribe a user

You can get to the Mailing List Manager by selecting the list from under 'Edit List' in the Mail Manager, then
selecting 'Mailing List Manager'. You will need to know the Maintainer email and password to administer the list.
The results of the commands will be sent to the list maintainer's email address.

I would like to set up a newsletter. Can I get SmartList to do this?
Yes! When you use SmartList to send out an electronic newsletter, you limit the submissions accepted to yourself,
and tell SmartList not to accept "foreign" submissions. Anyone who signs up will still receive the list but now
cannot send to it. If you want all your lists to be newsletters, you can skip the delink step. If you're not sure, go
ahead and delink this one.

For the list "listname,"

* Edit the rc.custom file and the rc.init file.

vi /home/username/domainname-mail/listname/rc.custom
uncomment (delete the #s) foreign_submit
comment out (precede with a #) foreign_submit=yes

vi /home/username/domainname-mail/listname/rc.init
uncomment (delete #s) foreign_submit
comment out (precede with #) foreign_submit=yes

* Delink the accept file:

cd/home/username/domainname-mail
type
.bin/delink listname/accept

When these steps are completed, the owner may send to the list by e-mailing to listname@domainname.com. If
anyone else attempts to mail to the list, it will be sent to the owner rather than the link. Since the owner is now the
only address in the accept file for the list, no other submissions will be accepted. (You may want to type vi accept
to be sure no one else snuck in there).

NB: editing the rc.init file means that all lists created thereafter will also function as newsletters. The hard link
would have to be broken for rc.init for a particular list to change this without changing this for all other lists also.

I already have a list of addresses for my mailing list. How can I subscribe the entire list?
The 'dist' file is the distribution list -- the list of recipients. To add a pre-existing list of recipients, copy it into the

 28                                                                                            CorpImages.net Online Hosting Manual
                                                                                         Internet All Around Marketing

dist file:

/home/username/domainname-mail/listname/dist

You can add a short list by hand or by cut-and-paste. For a really long list, you may want to download the dist file,
edit it using a word processing program, save it as text or ASCII, and then upload the edited file.

The following conditions apply:

•    One subscriber per line
•    Empty lines are allowed
•    The mail address of the subscriber must be the first word on the line
•    Comments may follow the address (but separated from the address by at least one whitespace character)
•    Everything preceding the line containing: "Only addresses below this line can be automatically removed" is
     write-protected from changes (i.e. these addresses can never be automatically/accidentally unsubscribed)
•    If the line: "Only addresses below this line can be automatically removed" is not present at all, automatic
     unsubscriptions to this list are impossible
•    New subscribers will always appear on the line immediately following the last filled entry in the dist file.

Some sample entries (the preferred format):

joe@some.where joe@some.where (some comment) joe@some.where (some comment) (some more comments)
Depreciated, but allowed:

<joe@some.where>
<joe@some.where> some comment
<joe@some.where> (some comment)

Not allowed:

(some comment) joe@some.where
some comment <joe@some.where>

Note: adding to the dist file for a list automatically adds to the accept file as well, unless you have turned off
foreign submissions.

How to create a moderated list
A moderated list means that every submission to the list goes through your list maintainer before it actually gets
posted to the list.

1. First create a file named "moderators." It should contain the fully qualified mail addresses of all the
   moderators for this list (i.e. just local usernames are not sufficient, at least include an @host or host!)

2. Then uncomment the appropriate "moderated_flag" line in rc.custom

From then on all mail that does not contain an "Approved: the_address_of_one_of_the_moderators" field is
forwarded to all the moderators.

One of the moderators should then resend the mail to the list after adding an "Approved: his_own_address" field
to the header (and possibly editing the contents of the mail). It will be no problem if several moderators resubmit
the same submission concurrently, since the mailinglist will filter out duplicates anyway (i.e. only the first one will


CorpImages.net Online Hosting Manual                                                                                      29
                                                                                  Internet All Around Marketing

go out and be archived).

Where to get more information about SmartList
For more advanced uses, the author of SmartList has written a manual. You can download it in three parts by
clicking on the links below:

http://www.mindwell.com/smartlist/smartlist.txt

There is also a smartlist mailing list. Send in your subscription requests to:

SmartList-request@informatik.rwth-aachen.de




 30                                                                              CorpImages.net Online Hosting Manual
                                                                                     Internet All Around Marketing



CHAPTER SEVEN - MICROSOFT FrontPage 98

We do NOT provide Technical Support for your use of FrontPage 98 Software. We have provided the following
information as a courtesy. Should you need further assistance with FrontPage 98, Microsoft's FP Authoring Site.

The most common asked question users ask when using FrontPage is why does the default page still shows up
even after I have uploaded my index page.

SOLUTION: You MUST DELETE the default page before your index page will show up.

Publishing a Web
After you have built your html documents and are ready to upload them to our server:

1. Open the web you've created on your PC using FP Explorer.

2. Choose File > Publish

3. If your "Destination Web Server" doesn't appear in the Publish window (it won't the first time you publish to
   our server) CHOOSE "More Webs" and type the location of the web to publish to. Hit return. IMPORTANT:
   Use www.yourdomain.com as the Destination Web Server to publish to our server. Leave the "Destination
   Web Name" BLANK.

4. You will be asked for your USERNAME and PASSWORD. This is your domain's USERNAME and your
   FrontPage PASSWORD (which may be different than your regular telnet/ftp/POP password). If you're not
   sure what it is or if you aren't allowed past this point, you'll need to contact us for a new FP password.

5. You can watch the progression of the upload by looking at the bottom left corner of FP Explorer.

Opening an Existing Web
1. Open FP Explorer and choose File > Open Front Page Web.

2. You can now choose to open a previously created web on your PC or your web on our server.

3. Highlight the appropriate web or type in the web address (www.yourdomain.com) and click OK.

4. Enter your USERNAME and FP PASSWORD if required.

5. Make modifications and recalculate links if needed. (See FP help docs for info on when it's necessary to
   recalculate links.

Troubleshooting Common Problems with FP 98
Getting error - "Root Web Busy"
FTP or telnet to your site and remove the "service.lck" file in /www/_vti_pvt. This usually happens when a FP
session is interrupted before completion.




CorpImages.net Online Hosting Manual                                                                               31
                                                                                        Internet All Around Marketing

Server timing out when publishing large sites.
This difficulty arises when the uploading link times out in the process of copying the web to our server. The only
suggestion Microsoft has offered so far is to break the main web into a group of sub webs on your PC, then
upload these individually. If this problem persists for you, please contact support.

Getting Error - "Front Page Extensions not Installed"
We often see this error being reported even when the extensions have been installed. If you get this error, please
contact support and we'll make sure the extensions are installed and repair them if necessary. NOTE: The
extensions are easily corrupted. Please use only FP Explorer to update your web site on the server, not FTP.

I published but my web's not there!
This will happen when the "Destination Web Name" is filled in when publishing to our server.

This box should be left blank. If you put any other name in this box it will create a subdirectory off of your root web
and copy all of your files into it. Your site will exist under a subdirectory instead of at the top level /www where it
should be.

My counter, bbs, guestbook, etc isn't working.
These problems are generally due to incorrect permissions on either the directory, file(s) or cgi script(s) that are
associated with them. Please don't change the permissions of your files or directories unless you have a specific
reason for doing so and you know what effect it will have on your site.

My forms won't work through the Secure Server.
The call to a cgi script using the Secure Server must not be within a webbot. Use a normal cgi call in your html
script for Secure Server calls.

My search bot doesn't return any results.
The /www directory must be world readable AND you need to recalculate links BEFORE publishing (or after
editing directly on the server). If it still doesn't work: FTP to the server and go to the /www/_vti_txt/default.wti
directory.Delete any files that begin with "ALL.". Don't delete any other files. Then using Windows Explorer, do the
same thing on your PC. Recalculate links, test locally with your browser and publish.

FP starts the Web Publishing Wizard when I try to publish.
Cancel the operation and email support to have the FP extensions installed/repaired.

Why is my page renamed on the server when I publish?
The "Default Document" of your web is automatically renamed by the server to what is required by the
configuration of the server. For example, if you've named the main page "index.html", it may be renamed
"default.html". Just check the links to your main page to make sure they refer to it the same way.

Further Microsoft FrontPage Support
If you need further assistance using FrontPage, go to http://builder.com/Authoring/FrontPage98/



32                                                                                     CorpImages.net Online Hosting Manual
                                                                                     Internet All Around Marketing



CHAPTER EIGHT - ANONYMOUS FTP

Anonymous FTP Access
Virtual domain account users can allow anonymous FTP access to visitors wishing to download or upload files to
your web site as if you were running your own FTP server.

You can enable (and disable) ANON FTP access within Edit Account Information within your account Control
Panel. Just check (or uncheck) the check box labeled "Anonymous FTP Enabled". Once you enable ANON FTP
in Account Settings within your Control Panel, files can be accessed anonymously via FTP client.

Anonymous visitors wishing to access your site via FTP client (e.g. WS_FTP) must use your domain name as the
FTP hostname, userID of anonymous and password of guest. Your anonymous FTP site is completely different
from your web site.

When people FTP to your domain anonymously, they will see the following directories:

bin/
dev/
etc/
incoming/
lib/
pub/

"pub" is where you should put all your anonymously accessible files. "incoming" is for the anonymous users to
upload files.

To access the anonymous FTP site via the web, use the following address: ftp://yourdomain.com/pub/

Your HTML to download a file called something.exe from a web page would look like this:

<A HREF="ftp://yourdomain.com/pub/something.exe">Download Something Now</A>

You should tell your visitors that they may need to right-click on the link if they are PC users, or if they use a
Macintosh, they need to hold down the mouse button on the link, then select the appropriate option from the Pop-
up menu.

Anonymous FTP Warnings:
Security

Anonymous FTP will grant any and all users the ability to access your "upload" directory, or any directory on your
domain that has been set for "public" read/write permissions. Anonymous users will have access to upload or
download files to and from your domain. You must set the appropriate permissions for your directories to restrict
anonymous FTP access. This is needed to ensure that anonymous users will not be able to access any existing
files or directories. You can inhibit access to specific files and directories using the File Manager by disabling
public read and/or write access to the files or folders you don't want people to see (i.e., CGI-local).

For security the following applies:

•   Only the incoming directory can be written to anonymously

CorpImages.net Online Hosting Manual                                                                                 33
                                                                                       Internet All Around Marketing

•    Sub-directories cannot be created
•    The incoming directory is not readable by people dropping files there

You may ignore the other directories.

Responsibility

As the account owner, you are responsible for any and all files that are stored on your domain. This would include
files that were uploaded by you as well as by anonymous FTP users. With the use of anonymous FTP, your site is
susceptible of becoming a "warez" site. Typically, these are sites that are used by "hackers" to trade
(upload/download) illegally pirated copies of software programs with one another. As the account owner, the
complete content of your account is your responsibility. If your site becomes a trading post for "warez" programs,
you may face legal action that can be taken against you by the programmers/software companies of the
copyrighted software, in addition to your account being deleted from our servers.

You are responsible for any "pirated" software uploaded by the anonymous users. The anonymous FTP sites will
be periodically monitored for any abuses.

Data Transfer

Any and all FTP download transfers, anonymous FTP included, will be used in the calculation of the total data
transfer for your account. If this total data transfer amount exceeds the limit that is set for your plan, you will be
responsibility for any and all overage charges that occur. Please Note: There will be NO exceptions made for
these overage charges. Once anonymous FTP has been enabled, it will be your responsibility to monitor the
anonymous FTP activity for your account. All anonymous FTP activity is stored within the "xferlog" file. This file
contains entries for each and every anonymous FTP upload/download session. This file is located within the /stats
directory of your account. There is also a link provided off the "View your web usage statistics & logs" page of
your account control panel.

Disk Space

If you are going to allow people to upload files to your site, make sure you keep track of your disk space usage via
your Control Panel. Do not allow your disk space usage to get too close to your maximum disk space allocation or
you may experience problems accessing your site via FrontPage and/or be unable to upload or modify files.
Please contact Technical Support in regards to additional disk space.




34                                                                                    CorpImages.net Online Hosting Manual
                                                                                       Internet All Around Marketing



CHAPTER NINE - SITE STATISTICS

If your are serious about better marketing your site and grow your business or organization, this feature will
become invaluable. You will be able to measure not only the number of “sessions” to your site, but also from
where were users logging, which link they came from, what browser they were using (i.e. Netscape, MS Internet
Explorer). In addition, you can view statistics per current month or year to date. Plus, there are a number of other
features.

To access your site statistics, please go to:

http://www.yourdomain.com/stats

Or alternatively:

http://www.yourdomain.com/menu (this is your Control Panel)

And then click on Stats.

Introduction
Your account comes with HTTP-Analyze preinstalled and configured.

HTTP-Analyze is a log analyzer for web servers. It analyzes the logfile of a web server and creates a
comprehensive summary report from the information found there. http-analyze has been optimized to process
large logfiles as fast as possible.

In easier-to-understand terms, HTTP-Analyze is a very powerful traffic analyzer that quickly and efficiently
delivers you statistics on the traffic that your web pages have generated. It has a user-friendly graphical user
interface (GUI) that by a click of your mouse button will produce your traffic reports.

Below we explain in more detail how this powerful software works with your web site, as well as provide you with
definitions to the results you'll receive.

The web server is a program running on a networked machine, waiting for connections from the outside world to
serve certain documents on behalf of a request by a browser.

To communicate, the server and the browser use an asynchronous communication method called the HTTP
(hypertext transaction) protocol. It works as follows:

1. the user starts the browser and types in an URL
2. the browser connects to the given host and requests the specified document




3. The web server handles the request and sends out a response:

    i.    if this document exists, the web server delivers it,
    ii.   if it does not exist or if access is not permitted, the web server sends back an error message instead.

CorpImages.net Online Hosting Manual                                                                                   35
                                                                                       Internet All Around Marketing


The document delivered as an answer to this request may contain inline objects. Inline objects are simply URLs
pointing to another resource, either a document, an image, an applet, a video/audio stream, or any other
addressable HTML object.

                                                    The browser then requests all inline objects of the current page
                                                    from the server using the steps 2 and 3 above, before it can
                                                    display the content of that page.

                                                 This communication method is called asynchronous, because
                                                 the browser sends out many requests for inline documents at
                                                 once (without waiting for a response from the server before
sending the next request) using different communication channels:

                                                    Since the browser's requests are often handled by different
                                                    server processes or different threads of a server process, there
                                                    is absolutely no relationship between the logfile entries caused
                                                    by the responses from the server due to a request of a
                                                    document and it's inline objects.


For example, the order in which the server logs the successful transmission of the document itself and the inline
images contained therein is not predictable and depends on the type of documents, objects, server speed, system
and network load, and many other parameters.

What is logged?
Each and every response from the server - whether it indicates success, an error, or even a timeout (i.e. no
response) - gets logged in the server's logfile. Since the server was hit by a request, such a response is called a
Hit. In other words, the total number of hits must equal the total number of lines in the logfile minus the number of
corrupt and empty lines. A typical logfile entry in the Common Logfile Format looks like:


hostname-[01/Feb/1998:10:10:00 +0100]"GET/index.html HTTP/1.0"200 4839

The hostname field contains the full qualified domain name (FQDN) of the site accessing your server (see
»Special Cases« below). The next two fields usually contain a minus (`-') to indicate that those fields are empty.
The date is surrounded by square brackets ('[' and ']'). The next field contains the request. It contains the request
method ('GET' for example), the name of the requested document (URL), and the protocol specification
('HTTP/1.0').

The following field contains the servers response code ('200' stands for an 'OK', while '404' would mean
'Document not found', for example). The last field contains the size of the document (some servers log the
number of bytes transferred actually, while other servers log the size of the document, which makes a difference if
the user interrupts the transfer before the document could be transmitted completely.

There are two other logfile formats, the Combined or Extended Logfile Format. Those formats add the user-agent
(browser type) and the referrer URL (the page, which contains a link to the requested document if this request for
such document has been generated by following a link) to the logfile entry. Those Combined or Extended Logfile
Format append following two fields to the Common Logfile Format (CLF) in one of two usual ways:

CLF Mozilla/2.0 (X11; IRIX 6.3; IP22) http://foo/bar.html
CLF "http://foo/bar.html" "Mozilla/2.0 (X11; IRIX 6.3; IP22)"


36                                                                                    CorpImages.net Online Hosting Manual
                                                                                       Internet All Around Marketing

Note that in the second form, the user-agent and the referrer URL are surrounded by double quotes, which makes
them ambiguous in certain cases such as erroneous referrer URLs, which contain double quotes. Therefore, the
first form should be preferred if possible.

The entries shown above are the only information the server records in the logfile. There might be much more
information being transferred from the browser to the server, but although this additional information is available
through CGI-scripts running on your server, it gets not logged in the logfile. Therefore, http-analyze can only show
you a summary of the information in the logfile - nothing more, nothing less.

Special Cases
Caching in the browser:
As soon as a page has been saved in a browser's disk cache, the browser might send out conditional requests for
documents or inline objects. This conditional request ask the web server to only send a document/object if it has
been modified since the last time the page has been requested (if the page is still in the browser's cache). This
way, network traffic is reduced somewhat, since documents must be transferred only if they have changed
recently. If such a conditional request arrives, the server will respond with a Code 304 (Not Modified) status to
indicate that the document hasn't changed or with a Code 200 (OK) status if it has changed in the meantime.
Since the browser may be configured (and usually is so by default) to only send out such conditional requests
once per session and otherwise unconditionally use the copy from the cache, you may not even see a Code 304
response if this users visits your site again in the same session. Conditional requests are then sent out only if the
user terminates the browser session and later restarts the browser.

Caching in a proxy server:
Organizations with a large number of users - such as companies, universities, or online providers - often use a so-
called proxy server for mainly two reasons:
1. Often such organizations have a firewall to protect their internal network against intruders. This means, that
     their network is logically separated from the rest of the Internet and that they have to use such a proxy server,
     which is able to communicate with the inside and the outside of their local network.
2. To reduce network load somewhat, the proxy server acts as a local copy machine: As soon as a page is
     loaded into a browser through such a proxy server, the proxy saves a copy of this page in it's disk cache
     much like a browser does in the scenario above. This way, documents requested very often by users in the
     same local network need to be transferred to the proxy only once, which then answers future requests for the
     same page from it's local cache instead of connecting to the original web server the document originated
     from.
Both forms of caching make it technically impossible to count visitors or to track their way through your web site.
All you see in the logfile of your server is only a few initial hits from the proxy or browser and probably some Code
304 responses resulting from conditional requests sent out by the proxy or browser, depending on the
preferences settings of the proxy or browser.

Definition of Terms
The statistics report contains among others the following information:

•   the number of hits, 304's, files, pageviews, sessions, data sent (in KB)
•   the amount of data requested, transferred, and saved by cache (in KB)
•   the number of unique URLs, sites, and sessions per month
•   the number of all response codes other than 200 (OK)
•   the average hits per weekday and for last week
•   the maximum/average hits per day and per hour


CorpImages.net Online Hosting Manual                                                                                 37
                                                                                                       Internet All Around Marketing

•      the number of hits, files, 304's, sites, data sent by day
•      the top 5 days, 24 hours, 5 minutes and 5 seconds of the summary period
•      the top 30 most commonly accessed URLs (hits, 304's, data sent)
•      the 10 least frequently accessed URLs (hits, 304's, data sent)
•      the top 30 client domains accessing your server most often
•      the top 30 browser types
•      the top 30 referrer hosts
•      the overview/detailed list of all files requested
•      the overview/detailed list of all sites by domain and reverse domain
•      the overview/detailed list of all browser types
•      the overview/detailed list of all referrer URLs

The following table summarizes the meaning of all terms in the statistics report which are not self-explaining:

       Term        Color                                                     Meaning
Hits                        A hit is any response from the server on behalf of a request sent from a browser. This includes any
                            response from the server, not only text files or documents. If, for example, a HTML page has two images
                            embedded, the server generates three hits if this page is requested: one hit for the HTML page itself and
                            two hits for the two inline images.
Files                       If the user requests a document and the server successfully sends back a file for this request, this is
                            counted as a Code 200 (OK) response. Any such response is counted for as a file. Again, "file" here
                            means any kind of a file.
Code 304                    A Code 304 (Not Modified) response is generated by the server if a document hasn't been updated since
                            the last time it was requested by the user and therefore there was no need to actually send the files for
                            this document. This happens if the browser (or a caching proxy server between the browser and your web
                            server) still has an up-to-date copy of the page in it's local storage (cache) and therefore can display the
                            page without requesting the actual content. This technique is used to reduce network traffic, but it also
                            causes an inaccuracy in the statistics reports regarding the number of visitors, because the browser or
                            proxy usually sends only one such a conditional request per user session if it still holds an up-to-date copy
                            of the file. However, the ratio between files and 304's reflects the efficiency of overall caching mechanisms
                            for at least those hits which made it's way to the server.
Pageviews                   Pageviews are all files which either have a text file suffix (.html, .text) or which are directory index files.
                            This number allows to estimate the number of "real" documents transmitted by your server. If defined
                            correctly, the analyzer rates text files (documents) as pageviews. Those pageviews do not include images,
                            CGI scripts, Java applets or any other HTML objects except all files ending with one of the pre-defined
                            pageview suffixes, such as .html or .text.
Other                  ¹    There are much more responses than only Code 200 (OK) and Code 304 (Not Modified) responses,
                            especially in the coming standard, the HTTP 1.1 protocol specification. For example, the server could
responses                   generate a Code 302 (Redirected) response if a page has moved, a Code 401 (Unauthorized Request)
                            response if access to the document is denied or a Code 404 (Not Found) response if the requested page
                            does not exist on this server.
KBytes                      This is the amount of data sent during the whole summary period as reported by the server. Note that
                            some servers log the size of a document instead of the actual number of bytes transferred. While in most
transferred
                            cases this is the same, if a user interrupts the transmission by pressing the browser's stop button before
                            the page has been received completely, some servers (for example all Netscape web servers) do not log
                            the amount of data transferred but the amount of data which would have been transferred if the user would
                            have completely loaded the page.
KBytes                 ¹    This is the amount of data requested during the whole summary period. http-analyze computes this
                            number by summing up the values of KBytes transferred and KBytes saved by cache (see below).
requested
KBytes saved           ¹    The amount of data saved by various caching mechanisms such as in proxy servers or in browsers. This
                            value is computed by multiplying the number of Code 304 (Not Modified) requests per file with the size of
by cache                    the corresponding file. Note: Because http-analyze can determine the size of a file only if the file has been
                            requested at least once in the same summary period, the values for KBytes saved by cache and KBytes
                            requested are just approximations of the real values.
Unique URLs                 Unique URLs are the number of all different, valid URLs requested in a given summary period. This shows
                            you the number of all different files requested at least once in the corresponding summary period.
Unique sites                This is the sum of all unique hosts accessing the server during a given time-window . The time-window is
                            hardwired to the length of the current month. This means that if a host accesses your server very often, it
                            gets counted only once during the whole month. Only the sum of the unique hosts per month is listed in
                            the statistics report.
Sessions                    Similar to unique sites, this is the number of unique hosts accessing the server during a given time-
                            window. This time-window is one day by default for backward compatibility, but it can be changed with the

38                                                                                                    CorpImages.net Online Hosting Manual
                                                                                                         Internet All Around Marketing

                              option -u or the Session directive in the configuration file. For example, if the time-window is two hours, all
                              accesses from a certain host in less than 2 hours after the first access from this host are lumped together
                              into one session. All following accesses more than 2 hours apart from the first access will be counted as a
                              new session. This way you may get an estimated number of how many sessions are started on different
                              sites to access your server.



¹ shown only on the total summary page.

You can access your statistics often as you would like. Just make sure you include your user name and password
when asked to do so.




CorpImages.net Online Hosting Manual                                                                                                            39
                                                                                     Internet All Around Marketing



CHAPTER TEN - PASSWORD PROTECTED DIRECTORIES

When you host your site with us, we give you the ability to set up passwords to some of your web site directories.
In this way, you can protect them from unwanted visitors. It is an easy process to protect your sensitive
directories. Just go to www.yourdomain.com/menu, enter your userID and password, and click on Password
Protected Directories and follow instructions. Select the directories in which you want to password protect from
the drop down menu then select load. In the next screen you can add/modify users you want to have access to
that area of your web site, as well as apply passwords.

You even have the option to protect your main www directory (the directory that will hold your public web site) in
case you want subscribers to view it, for example. However, if you wish your site to be accessible to all those who
type your domain address (i.e., www.yourdomain.com), DO NOT protect your www directory.

Also, DO NOT USE the Password Protect option in your Control Panel if you are using Front Page. Please refer
to FrontPage for instructions to password protect your directories.




40                                                                                  CorpImages.net Online Hosting Manual
                                                                                        Internet All Around Marketing



CHAPTER ELEVEN - CGI BIN, FORMMAIL, ETC.

CGI-bin Applications
CGI stands for "Common Gateway Interface," a fancy name meaning computer programs running on the web
server that can be invoked from a www page at the browser. The "bin" part alludes to the binary executables that
result from compiled or assembled programs. It is a bit misleading because CGIs can also be Unix shell scripts or
interpreted languages like Perl. CGI scripts need to be saved in ASCII format and uploaded to your server's CGI-
bin in ASCII or text format. This is very important.

We do not provide Technical Support for CGI scripts. So if you are not already familiar with CGI scripting, you
may want to read a book on the subject or find places on the Internet with CGI scripting information. There are
many good resources for CGI scripts found on the web. The scripts at Matt's Script Archive found at
http://www.worldwidemart.com/scripts/ are very good. You'll find many scripts free of charge and with detailed
configuration information. Another excellent resource is The CGI Resource Index found at http://www.cgi-perl.com/
-- if you are not an expert, look for scripts that are very well documented and come with step-by-step instructions.

Where to Put CGI-bin Scripts
Put your CGI-bin scripts in the www subdirectory named "CGI-bin".

Paths to Date, Mail, Perl, etc.
Here are your paths to the common server resources that CGI scripts often require:

Sendmail: /usr/sbin/sendmail
Perl5: #!/usr/bin/perl
Serverpath: /home/username/domain-www/CGI-bin
Domain path: /www/yourdomain (puts you in your web directory)
CGI-bin path: /www/yourdomain/cgi-bin (puts you in your CGI-bin)

Setting Permissions
The following is a simple explanation of file permissions in Unix. To list the access permissions of a file or
directory, telnet to your server, then:

cd directoryname

To change the directory until you are either in the directory above the file you are interested in, or above the
directory you are checking.

Type: ls -l filename

and you will see what the current permission settings are for that file, along with a bunch of other stuff.

Examples of using (change mode):

People:                                           Permissions:
u = the file's user (you)                         r = read access
g = the file's group                              x = execute access
o = others                                        w = write access

CorpImages.net Online Hosting Manual                                                                                   41
                                                                                       Internet All Around Marketing

a = the user, the group, and others

To change permissions for a file named filename.CGI, you need to chmod the file. For example, when you type
this:

chmod u=rwx,g=rx,o=rx filename.CGI

by typing this you have given:

read, execute, and write access to the user (that's you)
read and execute access to the group and;
read and execute access to others

Some scripts will tell you to chmod 775 (for example). Doing the above is the same thing as typing chmod 775.
You can use either method with our Unix servers. Let me explain:

When using the numeric system, the code for permissions is as follows:

r = 4 w = 2 x = 1 rwx = 7

The first 7 of our chmod 775 tells Unix to change the user's permissions to rxw (because r=4 + w=2 + x=1 adds
up to 7. The second 7 applies to the group, and the last number 5, refers to others (4+1=5).

When doing an ls -l on the file, telnet always shows the permissions this way:

-rwxr-xr-x

Ignore the first dash, then break up the above into three groups of letters. If there's a dash where a letter should
be, it means that there is no permission for those people.

Remember: the first 3 apply to user, the second 3 apply to group, and the third 3 apply to others.

Some FTP clients support changing permissions in a more graphical way.If you have Fetch for the Mac, you
have an easy way to change permissions. Go to the file you want to change the permissions on, and highlight it.
Under the Remote menu, select Change Permissions. A window will pop up showing the current permissions for
the file you had highlighted, as in the figure below. Click on the boxes to change permissions as needed.




42                                                                                    CorpImages.net Online Hosting Manual
                                                                                            Internet All Around Marketing



WS_FTP accomplishes the same task as above. Just highlight the file you want to check, and right-click on it. A
menu will pop up, then select CHMOD. You will see the window below, as in the figure below.




Troubleshooting CGI-bin Problems
Below are solutions to some of the more common CGI script problems, in question and answer format. You will
find a list of proper permission settings for the scripts we provide at the end.

When I activate my CGI program, I get back a page that says "Internal Server Error. The server
encountered an internal error or mis-configuration and was unable to complete your request."

This is generally caused by a problem within the script. Log in via Telnet and test your script in local mode to get a
better idea of what the problem is. To do this, go into the directory in which your script is located, then execute the
script. To execute the script, you can do it by two ways:

1. Type "perl myscript.pl" (Perl being the language interpreter in this case).
2. Or simply type "myscript.pl" alone, that will work if the first line is well written to indicate the location of Perl.

The first one is useful to see if there's any error IN your script. The second one is useful to test if your "calling line"
(the first line of the script) is okay, i.e. if you entered the right location of Perl.

I am being told "File Not Found," or "No Such File or Directory."

Upload your Perl or CGI script in ASCII mode, not binary mode.

When I test my Perl script in local mode (by Telnet), I have the following error: "Literal @domain now requires a
back slash at myscript.pl line 3, within string. Execution of myscript.pl aborted due to compilation errors."

This is caused by a misinterpretation by Perl. You see, the "@" sign has a special meaning in Perl; it identifies an
array (a table of elements). Since it cannot find the array named domain, it generates an error. You should place
a back slash (\) before the "@" symbol to tell Perl to see it as a regular symbol, as in an email address.

I am getting the message "POST not implemented."

You are probably using the wrong reference for cgiemail. Use the reference /cgi-bin/cgiemail/mail.txt. Another
possibility is that you are pointing to a cgi-bin script that you have not put in your cgi-bin directory. In general, this
message really means that the web server is not recognizing the cgi-bin script you are calling as a program. It
thinks it is a regular text file.

CorpImages.net Online Hosting Manual                                                                                         43
                                                                                       Internet All Around Marketing


It's saying I don't have permission to access /

This error message means that you are missing your index.htm file. Note that files that start with a "." are hidden
files. To see them, type ls -al. If you wish to FTP this file in, go to the home/yourdomain directory.

Cgiwrap - Secure Server CGI Wrapper
We now have a cgi wrapper for the secure server called cgiwrap. We have configured it to be automatically
invoked when you make a call containing "cgi-domain", like this:

https://secureservername/cgi-domain/script.cgi

You can call cgiwrap explicitly with this call, which does the same thing as the above call:

https://secureservername/cgi-bin/cgiwrap/domain/script.cgi

This assumes script.cgi is in your cgi-bin. You can also use cgiwrapd in place of cgiwrap to get extra debugging
information if there is a problem. For nph-style scripts, use nph-cgiwrap or nph-cgiwrapd instead.

Formmail.cgi
FormMail is a generic www form to e-mail gateway, which will parse the results of any form and send them to the
specified user. This script has many formatting and operational options, most of which can be specified through
the form, meaning you don't need any programming knowledge or multiple scripts for multiple forms. This also
makes FormMail the perfect system-wise solution for allowing form-based user feedback capabilities without the
risks of allowing freedom of CGI access.

There is only one form field that you must have in your form, for FormMail to work correctly. This is the recipient
field. Other hidden configuration fields can also be used to enhance the operation of FormMail on your site. The
action of your form needs to point towards this script (obviously), and the method must be POST in capital letters.

Here's an example of the form fields to put in your form:

<FORM ACTION = "/cgi-sys/formmail.pl" METHOD = "POST">
<input type=hidden name="recipient" value="ANYONE@YOURDOMAIN.COM">
<input type=hidden name="subject" value="SUBJECT">
<input type=hidden name="return_link_title" value="TITLE">
<input type=hidden name="redirect" value="http://YOURDOMAIN.COM/PAGE.HTML">

The following are descriptions and proper syntax for fields you can use with FormMail.

Recipient Field:

Description: This form field allows you to specify to whom you wish for your form results to be mailed. Most likely
you will want to configure this option as a hidden form field with a value equal to that of your email address.

Syntax: <input type=hidden name="recipient" value="email@yourdomain.com">

Subject Field:




44                                                                                    CorpImages.net Online Hosting Manual
                                                                                            Internet All Around Marketing

Description: The subject field will allow you to specify the subject that you wish to appear in the email that is sent
to you after this form has been filled out. If you do not have this option turned on, then the script will default to a
message subject: "WWW Form Submission".

Syntax: If you wish to choose what the subject is:

<input type=hidden name="subject" value="Your Subject">

To allow the user to choose a subject:

<input type=text name="subject">

Email Field:

Description: This form field will allow the user to specify their return email address. If you want to be able to return
e-mail to your user, I strongly suggest that you include this form field and allow them to fill it in. This will be put
into the From: field of the message you receive. If you want to require an email address with valid syntax, add this
field name to the 'required' field.

Syntax: <input type=text name="email">

Realname Field:

Description: The realname form field will allow the user to input their real name. This field is useful for
identification purposes and will also be put into the From: line of your message header.

Syntax: <input type=text name="realname">

Redirect Field:

Description: If you wish to redirect the user to a different URL, rather than having them see the default response
to the fill-out form, you can use this hidden variable to send them to a pre-made HTML page.

Syntax: To choose the URL they will end up at:

<input type=hidden name="redirect" value="http://yourdomain.com/to/file.html">

To allow them to specify a URL they wish to travel to once the form is filled out:

<input type=text name="redirect">

Required Field:

Description: You can require certain fields in your form to be filled in before the user can successfully submit the
form. Simply place all field names that you want to be mandatory into this field, separated by commas. If the
required fields are not filled in, the user will be notified of what they need to fill in, and a link back to the form they
just submitted will be provided.

To use a customized error page, see "missing_fields_redirect"

Syntax: If you want to require that they fill in the email and phone fields in your form, so that you can reach them
once you have received the mail, use the syntax like:

<input type=hidden name="required" value="email,phone">

CorpImages.net Online Hosting Manual                                                                                          45
                                                                                        Internet All Around Marketing


Env_report Field:

Description: Allows you to have Environment variables included in the email message you receive after a user
has filled out your form. Useful if you wish to know what browser they were using, what domain they were coming
from or any other attributes associated with environment variables. The following is a short list of valid
environment variables that might be useful:

REMOTE_HOST:     Sends the host name making the request.
REMOTE_ADDR:     Sends the IP address of the remote host.
HTTP_USER_AGENT: The browser the client is using.

(Note: In our case, both REMOTE_HOST and REMOTE_ADDR are the same, since our servers don't do the
reverse DNS look up needed to generate the true REMOTE_HOST string).

Syntax: If you wanted to find all the above variables, you would put the following into your form:

<input type=hidden name="env_report" value="REMOTE_HOST,REMOTE_ADDR,HTTP_USER_AGENT">

Sort Field:

Description: This field allows you to choose the order in which you wish for your variables to appear in the email
form that FormMail generates. You can choose to have the field sorted alphabetically or specify a set order in
which you want the fields to appear in your mail message. By leaving this field out, the order will simply default to
the order in which the browsers send the information to the script (which is usually the exact same order as they
appeared in the form).

When sorting by a set order of fields, you should include the phrase "order:" as the first part of your value for the
sort field, and then follow that with the field names you want to be listed in the email message, separated by
commas.

Syntax: To sort alphabetically:

<input type=hidden name="sort" value="alphabetic">

To sort by a set field order:

<input type=hidden name="sort" value="order:name1,name2,etc...">

Print_config Field:

Description: print_config allows you to specify which of the config variables you would like to have printed in your
e-mail message. By default, no config fields are printed to your email. This is because the important form fields,
like email, subject, etc. are included in the header of the message. However some users have asked for this
option so they can have these fields printed in the body of the message. The config fields that you wish to have
printed should be in the value attribute of your input tag separated by commas.

Syntax: If you want to print the email and subject fields in the body of your message, you would place the
following form tag:

<input type=hidden name="print config" value="email, subject">

Print_blank_fields Field:


46                                                                                     CorpImages.net Online Hosting Manual
                                                                                           Internet All Around Marketing

Description: print_blank_fields allows you to request that all form fields are printed in the return HTML, regardless
of whether or not they were filled in. FormMail defaults to turning this off, so that unused form fields aren't
emailed.

Syntax: <input type=hidden name="print_blank_fields" value="1">

Title Field:

Description: This form field allows you to specify the title and header that will appear on the resulting page if you
do not specify a redirect URL.

Syntax: If you wanted a title of 'Feedback Form Results':

<input type=hidden name="title" value="Feedback Form Results">

Return_link_url Field:

Description: This field allows you to specify a URL that will appear, as return_link_title, on the following report
page. This field will not be used if you have the redirect field set, but it is useful if you allow the user to receive the
report on the following page, but want to offer them a way to get back to your main page.

Syntax: <input type=hidden name="return_link_url" value="http://yourdomain.com/index.htm">

Return_link_title:

Description: This is the title that will be used to link the user back to the page you specify with return_link_url. The
two fields will be shown on the resulting form page as:

Back to Main Page

Syntax: <input type=hidden name="return_link_title" value="Back to Main Page">




CorpImages.net Online Hosting Manual                                                                                          47
                                                                                       Internet All Around Marketing



CHAPTER TWELVE - SECURE SOCKET LAYER (SSL)

Normally, any text (such as your credit card number) that is sent from your browser to the web server is sent as
plain text. This means that a hacker could potentially intercept (however unlikely) the information sent from your
browser and read it. Therefore, by using the secure server, the information is encrypted before it is sent from your
browser. It would be practically impossible for anyone to decrypt it without knowing the key.

The following example uses yourdomain as the name of your domain and any page as the name of the order form
or the page you wish to be secured.

Use the following URL to call your pages via the secure server.

https://secureservername/yourdomain/anypage.html

The above page would be accessed from the normal web server as:

http://example.com/anypage.html

SPECIAL NOTE FOR FORMMAIL.CGI

If you are calling the formmail through the secure server, your action line and other code will look like the
following:

<FORM METHOD=POST ACTION="https://4ua.com/yourdomain/cgi-bin/formmail.pl">
<input type=hidden name="recipient" value="emailaccount@yourdomain.com">
<input type=hidden name="subject" value="Order">
<input type=hidden name="return_link_url" value="https://4ua.com/yourdomain/yourpage">
<input type=hidden name="return_link_title" value="Back to Your Page">


NOTE: do not put the .com, .net, etc. extension after yourdomain.

The last two lines allow a link back to your main page - thus they get a report of what they ordered and a link.

It's important that you call your order page through a secure URL (HTTPS) in order for it to work properly

Example:

https://4ua.com/yourdomain/yourorderform.htm




48                                                                                     CorpImages.net Online Hosting Manual
                                                                                        Internet All Around Marketing



CHAPTER THIRTEEN - CHANGING YOUR PASSWORDS

For Control Panel & FTP Password Changes:
Go to your Control Panel at http://www.yourdomain.com/menu and click on Password Change and follow the instructions.
Once completed it will take approximately 10 minutes for the changes to take effect.

For Email Password Changes:
Go to your Control Panel at http://www.yourdomain.com/menu and click on Mail Manager and then click on the Email
account you are wishing to change the password for and then follow instructions.




CorpImages.net Online Hosting Manual                                                                                   49
                                                                                      Internet All Around Marketing



CHAPTER FOURTEEN - PGP & PGP MAIL

What is PGP?
PGP allows people to exchange email with both privacy and authentication.

Visit the PGP (Pretty Good TM Privacy) web site for information not provided here.

Creating PGP Mail Key
Before using PGPMail, you will need to create a public key using your email software. Your email software should
have instructions to create the key. Once the key is created, you enter the PGP option inside your control panel
and paste the PGP Key text into the box provided and then click add.

The key code should look similar to the following:

-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: PGPfreeware 5.0i for non-commercial use
mQGiBDZiwWERBADgftCC3ZrT1JHcK5gvSA7Tuw5CmU2c8NWrFzAywkARHh7niTFJ
sg1VfEi5ExsNDBVvmvr+vZD6Zq9eYtodkx1E41gJFZegGHzqya+WaiGknQ6zUVEm
gw9NGpIA2+iyR3FrGPG8Fq3MvF+8qNm9LGUVR6jjBwdERpRDkmnShg/QSQCg/87M
................................................................
tbzYRdmHzvGpR/Hvo7NKKhF0Z3Xu+5KeXsI8iQA+AwUYNmLBgGAlch3jE84DEQLI
IgCg5wk8RciT6SL5/hdg5QMb6h/n8e0Ali0k3+TFSGtLwdn+YOn6hkYnfSU=
=jZZO
-----END PGP PUBLIC KEY BLOCK-----



Using PGP Mail
To use PGPMail, you need to create a form on one of your web pages.

Required Fields
The form action line should be as following:

<FORM ACTION = "http:yourdomain.com/cgi-sys/pgpmail.pl" METHOD = "POST">

pgpmail.pl will do all the programming work for you. You alter the behavior of pgpmail by using hidden fields in
your form.

There are three form fields that you must have in your form for PGPMail to work correctly. This is the recipient,
username, and keyname fields.

Field: recipient

Description: This form field allows you to specify to whom you wish for your form results to be mailed. Most likely
you will want to configure this option as a hidden form field with a value equal to that of your e-mail address.

Syntax: <input type=hidden name="recipient" value="your_username@localnet.com">

Field: username

 50                                                                                  CorpImages.net Online Hosting Manual
                                                                                           Internet All Around Marketing



Description: This form field allows you to specify your username in the system. This allows PGPMail to look for
the configuration files to encypt the mail to be sent to you. You should replace "yourusername" with your main
username on the system.

Syntax: <input type=hidden name="username" value="yourusername">

Field: keyname

Description: This form field allows you to specify the name of your public key. This will be the public key that
PGPMail uses to encrypt your mail. You must possess the private key in order to decrypt the email that is sent.
You can get your publickeyname by going to the PGP Manager. It is typically just your email address.

Syntax: <input type=hidden name="keyname" value="publickeyname">

Optional Form Fields:
Field: subject

Description: The subject field will allow you to specify the subject that you wish to appear in the e-mail that is sent
to you after this form has been filled out. If you do not have this option turned on, then the script will default to a
message subject. WWW Form Submission:

Syntax:

If you wish to choose what the subject is:

<input type=hidden name="subject" value="Your Subject">

To allow the user to choose a subject:

<input type=text name="subject">

Field: email

Description: This form field will allow the user to specify their return e-mail address. If you want to be able to
return e-mail to your user, I strongly suggest that you include this form field and allow them to fill it in. This will be
put into t he From: field of the message you receive.

Syntax: <input type=text name="email">

Field: realname

Description: The realname form field will allow the user to input their real name. This field is useful for
identification purposes and will also be put into the From: line of your message header.

Syntax: <input type=text name="realname">

Field: sort

Description: This field allows you to choose the order in which you wish for your variables to appear in the e-mail
that PGPMail generates. You can choose to have the field sorted alphabetically or specify a set order in which
you want the fields to appear in your mail message. By leaving this field out, the order will simply default to the
order in which the browsers sends the information to the script (which isn't always the exact same order they

CorpImages.net Online Hosting Manual                                                                                         51
                                                                                           Internet All Around Marketing

appeared in the form.) When sorting by a set order of fields, you should include the phrase "order:" as the first
part of your value for the sort field, and then follow that with the field names you want to be listed in the e-mail
message, separated by commas.

Syntax:

To sort alphabetically:
<input type=hidden name="sort" value="alphabetic">

To sort by a set field order:
<input type=hidden name="sort" value="order:name1,name2,etc.">

Field: redirect

Description: If you wish to redirect the user to a different URL, rather than having them see the default response
to the fill-out form, you can use this hidden variable to send them to a pre-made HTML page.

Syntax:

To choose the URL the user will end up at:

<input type=hidden name="redirect" value="http://your.address/to/file.html">

To allow the user to specify a URL he wishes to travel to once the form is filled out:

<input type=text name="redirect">

Field: required

Description: You can now require for certain fields in your form to be filled in before the user can successfully
submit the form. Simply place all field names that you want to be mandatory into this field. If the required fields
are not filled in, the user will be notified of what they need to fill in, and a link back to the form they just submitted
will be provided.

Syntax:

If you want to require that the user fill in the email and phone fields in your form, so that you can reach them once
you have received the mail, use a syntax like:

<input type=hidden name="required" value="email,phone">

Field: env_report

Description: Allows you to have Environment variables included in the e-mail message you receive after a user
has filled out your form. Useful if you wish to know what browser they were using, what domain they were coming
from or any other attribute is associated with environment variables.

The following is a short list of valid environment variables that might be useful:

REMOTE_HOST:               Sends the hostname making a request.
REMOTE_ADDR:               Sends the IP address of the remote host making the request.
HTTP_USER_AGENT:           The browser the client is using to send the request.



 52                                                                                       CorpImages.net Online Hosting Manual
                                                                                           Internet All Around Marketing

Syntax:

If you wanted to find the remote host and browser sending the request, you would put the following into your form:

<input type=hidden name="env_report" value="REMOTE_HOST,HTTP_USER_AGENT">

Field: title

Description: This form field allows you to specify the title and header that will appear on the resulting page if you
do not specify a redirect URL.

Syntax:

If you wanted a title of 'Feedback Form Results':

<input type=hidden name="title" value="Feedback Form Results">

Field: return_link_url

Description: This field allows you to specify a URL that will appear as return_link_title, on the following report
page. This field will not be used if you have the redirect field set, but it is useful if you allow the user to receive the
report on the following page, but want to offer them a way to get back to your main page.

Syntax: <input type=hidden name="return_link_url" value="http://your.host.xxx/main.html">

Field: return_link_title

Description: This is the title that will be used to link the user back to the page you specify with return_link_url. The
two fields will be shown on the resulting form page as:

<ul> <li><a href="return_link_url">return_link_title</a> </ul>

Syntax: <input type=hidden name="return_link_title" value="Back to Main Page">

Field: background

Description: This form field allow you to specify a background image that will appear if you do not have the
redirect field set. This image will appear as the background to the form results page.

Syntax: <input type=hidden name="background" value="http://yourdomain.com/image.gif">

Field: bgcolor

Description: This form field allow you to specify a bgcolor for the form results page in much the way you specify a
background image. This field should not be set if the redirect field is.

Syntax:

For a background color of White:

<input type=hidden name="bgcolor" value="#FFFFFF">

Field: text_color


CorpImages.net Online Hosting Manual                                                                                          53
                                                                                       Internet All Around Marketing

Description: This field works in the same way as bgcolor, except that it will change the color of your text.

Syntax:

For a text color of Black:

<input type=hidden name="text_color" value="#000000">

Field: link_color

Description: Changes the color of links on the resulting page. Works in the same way as text_color. Should not be
defined if redirect is.

Syntax:

For a link color of Red:

<input type=hidden name="link_color" value="#FF0000">

Field: vlink_color

Description: Changes the color of visited links on the resulting page. Works exactly the same as link_color.
Should not be set if redirect is.

Syntax:

For a visited link color of Blue:

<input type=hidden name="vlink_color" value="#0000FF">

Field: alink_color

Description: Changes the color of active links on the resulting page. Works exactly the same as link_color. Should
not be set if redirect is.

Syntax:

For a visited link color of Blue:

<input type=hidden name="alink_color" value="#0000FF">

Any other form fields that appear in your script will be mailed back to you and displayed on the resulting page if
you do not have the redirect field set.




 54                                                                                   CorpImages.net Online Hosting Manual
                                                                                       Internet All Around Marketing



CHAPTER FIFTEEN - REDIRECT URL

This option allows you to redirect visitors visiting one page to another page automatically. This option in your
control panel is pretty self-explanatory, and has complete instructions.




CorpImages.net Online Hosting Manual                                                                               55
                                                                                              Internet All Around Marketing



CHAPTER SIXTEEN – MySQL

What is MySQL – An introduction
The MySQL option in your control panel automates MySQL.

MySQL is a true multi-user, multi-threaded SQL database server. SQL is the most popular database language in
the world. MySQL is a client/server implementation that consists of a server daemon mysqld and many different
client programs and libraries.

SQL is a standardized language that makes it easy to store, update and access information. For example, you
can use SQL to retrieve product information and store customer information for a web site. MySQL is also fast
and flexible enough to allow you to store logs and pictures in it.

The official way to pronounce MySQL is “My Ess Que Ell” (Not MY-SEQUEL).

This database engine can be used with your web site. The feature of the Control Panel allows you to create a new
MySQL database, and manage it. You will be able to add/edit/delete tables, fields, and values. You will also be
able to run queries on the database if you need to. We do not provide technical support in using MySQL outside
of what will be available on the control panel. Please refer to MySQL's Web Site for complete tutorials and
troubleshooting solutions and documentation. This is an excellent resource.

Below, there is an excerpt of the Manual found in MYSQL Web Site for your reference.


8 MySQL Tutorial
This chapter provides a tutorial introduction to MySQL by showing how to use the mysql client program to create and use a
simple database. mysql (sometimes referred to as the ``terminal monitor'' or just ``monitor'') is an interactive program that
allows you to connect to a MySQL server, run queries and view the results. mysql may also be used in batch mode: you
place your queries in a file beforehand, then tell mysql to execute the contents of the file. Both ways of using mysql are
covered here.
To see a list of options provided by mysql, invoke it with the --help option:
shell> mysql --help
This chapter assumes that mysql is installed on your machine, and that a MySQL server is available to which you can
connect. If this is not true, contact your MySQL administrator. (If you are the administrator, you will need to consult other
sections of this manual.)
The chapter describes the entire process of setting up and using a database. If you are interested only in accessing an already-
existing database, you may want to skip over the sections that describe how to create the database and the tables it contains.
Since this chapter is tutorial in nature, many details are necessarily left out. Consult the relevant sections of the manual for
more information on the topics covered here.
8.1 Connecting to and disconnecting from the server
To connect to the server, you'll usually need to provide a MySQL user name when you invoke mysql and, most likely, a
password. If the server runs on a machine other than the one where you log in, you'll also need to specify a hostname. Contact
your administrator to find out what connection parameters you should use to connect (i.e., what host, user name and
password to use). Once you know the proper parameters, you should be able to connect like this:
shell> mysql -h host -u user -p
Enter password: ********
The ******** represents your password; enter it when mysql displays the Enter password: prompt.
If that works, you should see some introductory information followed by a mysql> prompt:
shell> mysql -h host -u user -p

 56                                                                                          CorpImages.net Online Hosting Manual
                                                                                              Internet All Around Marketing

Enter password: ********
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 459 to server version: 3.22.20a-log

Type 'help' for help.

mysql>
The prompt tells you that mysql is ready for you to enter commands.
Some MySQL installations allow users to connect as the ``anonymous'' (unnamed) user to the server running on the local
host. If this is the case on your machine, you should be able to connect to that server by invoking mysql without any
options:
shell> mysql
After you have connected successfully, you can disconnect any time by typing QUIT at the mysql> prompt:
mysql> QUIT
Bye
You can also disconnect by typing control-D.
Most examples in the following sections assume you are connected to the server. They indicate this by the mysql> prompt.
8.2 Entering queries
Make sure you are connected to the server, as discussed in the previous section. Doing so will not in itself select any database
to work with, but that's okay. At this point, it's more important to find out a little about how to issue queries than to jump
right in creating tables, loading data into them and retrieving data from them. This section describes the basic principles of
entering commands, using several queries you can try out to familiarize yourself with how mysql works.
Here's a simple command that asks the server to tell you its version number and the current date. Type it in as shown below
following the mysql> prompt and hit the RETURN key:
mysql> SELECT VERSION(), CURRENT_DATE;
+--------------+--------------+
| version()               | CURRENT_DATE |
+--------------+--------------+
| 3.22.20a-log | 1999-03-19                      |
+--------------+--------------+
1 row in set (0.01 sec)
mysql>
This query illustrates several things about mysql:
     • A command normally consists of a SQL statement followed by a semicolon. (There are some exceptions where a
          semicolon is not needed. QUIT, mentioned earlier, is one of them. We'll get to others later.)
     • When you issue a command, mysql sends it to the server for execution and displays the results, then prints another
          mysql> to indicate that it is ready for another command.
     • mysql displays query output as a table (rows and columns). The first row contains labels for the columns. The rows
          following are the query results. Normally, column labels are the names of the columns you fetch from database
          tables. If you're retrieving the value of an expression rather than a table column (as in the example just shown),
          mysql labels the column using the expression itself.
     • mysql shows how many rows were returned, and how long the query took to execute, which gives you a rough idea
          of server performance. These values are imprecise because they represent wall clock time (not CPU or machine
          time), and because they are affected by factors such as server load and network latency. (For brevity, the ``rows in
          set'' line is not shown in the remaining examples in this chapter.)
Keywords may be entered in any lettercase. The following queries are equivalent:
mysql> SELECT VERSION(), CURRENT_DATE;
mysql> select version(), current_date;
mysql> SeLeCt vErSiOn(), current_DATE;
Here's another query. It demonstrates that you can use mysql as a simple calculator:
mysql> SELECT SIN(PI()/4), (4+1)*5;
+-------------+---------+

CorpImages.net Online Hosting Manual                                                                                           57
                                                                                            Internet All Around Marketing

| SIN(PI()/4) | (4+1)*5 |
+-------------+---------+
|       0.707107 |              25 |
+-------------+---------+
The commands shown thus far have been relatively short, single-line statements. You can even enter multiple statements on a
single line. Just end each one with a semicolon:
mysql> SELECT VERSION(); SELECT NOW();
+--------------+
| version()             |
+--------------+
| 3.22.20a-log |
+--------------+

+---------------------+
| NOW()                            |
+---------------------+
| 1999-03-19 00:15:33 |
+---------------------+
A command need not be given all on a single line, so lengthy commands that require several lines are not a problem. mysql
determines where your statement ends by looking for the terminating semicolon, not by looking for the end of the input line.
(In other words, mysql accepts free-format input: it collects input lines but does not execute them until it sees the
semicolon.)
Here's a simple multiple-line statement:
mysql> SELECT
       -> USER()
       -> ,
       -> CURRENT_DATE;
+--------------------+--------------+
| USER()                         | CURRENT_DATE |
+--------------------+--------------+
| joesmith@localhost | 1999-03-18                        |
+--------------------+--------------+
In this example, notice how the prompt changes from mysql> to -> after you enter the first line of a multiple-line query.
This is how mysql indicates that it hasn't seen a complete statement and is waiting for the rest. The prompt is your friend,
because it provides valuable feedback. If you use that feedback, you will always be aware of what mysql is waiting for.
If you decide you don't want to execute a command that you are in the process of entering, cancel it by typing \c:
mysql> SELECT
       -> USER()
       -> \c
mysql>
Here, too, notice the prompt. It switches back to mysql> after you type \c, providing feedback to indicate that mysql is
ready for a new command.
The following table shows each of the prompts you may see and summarizes what they mean about the state that mysql is
in:
Prompt Meaning
mysql> Ready for new command
->         Waiting for next line of multiple-line command
'>         Waiting for next line, collecting a string that begins with a single quote (`'')
">         Waiting for next line, collecting a string that begins with a double quote (`"')
Multiple-line statements commonly occur ``by accident'' when you intend to issue a command on a single line, but forget the
terminating semicolon. In this case, mysql waits for more input:
mysql> SELECT USER()


 58                                                                                        CorpImages.net Online Hosting Manual
                                                                                              Internet All Around Marketing

       ->
If this happens to you (you think you've entered a statement but the only response is a -> prompt), most likely mysql is
waiting for the semicolon. If you don't notice what the prompt is telling you, you might sit there for a while before realizing
what you need to do. Enter a semicolon to complete the statement, and mysql will execute it:
mysql> SELECT USER()
       -> ;
+--------------------+
| USER()                         |
+--------------------+
| joesmith@localhost |
+--------------------+
The '> and "> prompts occur during string collection. In MySQL, you can write strings surrounded by either `'' or `"'
characters (for example, 'hello' or "goodbye"), and mysql lets you enter strings that span multiple lines. When you
see a '> or "> prompt, it means that you've entered a line containing a string that begins with a `'' or `"' quote character,
but have not yet entered the matching quote that terminates the string. That's fine if you really are entering a multiple-line
string, but how likely is that? Not very. More often, the '> and "> prompts indicate that you've inadvertantly left out a quote
character. For example:
mysql> SELECT * FROM my_table WHERE name = "Smith AND age < 30;
       ">
If you enter this SELECT statement, then hit RETURN and wait for the result, nothing will happen. Instead of wondering,
``why does this query take so long?,'' notice the clue provided by the "> prompt. It tells you that mysql expects to see the
rest of an unterminated string. (Do you see the error in the statement? The string "Smith is missing the second quote.)
At this point, what do you do? The simplest thing is to cancel the command. However, you cannot just type \c in this case,
because mysql interprets it as part of the string that it is collecting! Instead, enter the closing quote character (so mysql
knows you've finished the string), then type \c:
mysql> SELECT * FROM my_table WHERE name = "Smith AND age < 30;
       "> "\c
mysql>
The prompt changes back to mysql>, indicating that mysql is ready for a new command.
It's important to know what the '> and "> prompts signify, because if you mistakenly enter an unterminated string, any
further lines you type will appear to be ignored by mysql -- including a line containing QUIT! This can be quite confusing,
especially if you don't know that you need to supply the terminating quote before you can cancel the current command.
8.3 Examples of common queries
Here follows examples of how to solve some common problems with MySQL.
Some of the examples uses the table 'shop' holds the prices of each article (item number) for certain traders. Supposing that
each trader has a single fixed price per article, then (item, trader) is a primary key for the records.
You can create the example table as:
CREATE TABLE shop (
 article INT(4) UNSIGNED ZEROFILL DEFAULT '0000' NOT NULL,
 dealer CHAR(20)                                      DEFAULT ''               NOT NULL,
 price        DOUBLE(16,2)                            DEFAULT '0.00' NOT NULL,
 PRIMARY KEY(article, dealer));

INSERT INTO shop VALUES
(1,'A',3.45),(1,'B',3.99),(2,'A',10.99),(3,'B',1.45),(3,'C',1.69),
(3,'D',1.25),(4,'D',19.95);
Okay, so the example data is:
SELECT * FROM shop

+---------+--------+-------+
| article | dealer | price |
+---------+--------+-------+

CorpImages.net Online Hosting Manual                                                                                              59
                                                                                           Internet All Around Marketing

|    0001 | A      | 3.45 |
|    0001 | B      | 3.99 |
|    0002 | A      | 10.99 |
|    0003 | B      | 1.45 |
|    0003 | C      | 1.69 |
|    0003 | D      | 1.25 |
|    0004 | D      | 19.95 |
+---------+--------+-------+
8.3.1 The maximum value for column
"What's the highest item number?"
SELECT MAX(article) AS article FROM shop

+---------+
| article |
+---------+
|       4 |
+---------+
8.3.2 The row holding the maximum of a certain column
"Find number, dealer, and price of the most expensive article"
In ANSI-SQL this is easily done with a sub-query:
SELECT article, dealer, price
FROM       shop
WHERE price=(SELECT MAX(price) FROM shop)
In MySQL (not having sub-selects yet) just do it in two steps:
    1. Get the maximum value from the table with a SELECT statment.
    2. Using this value compile the actual query:
          SELECT article, dealer, price
          FROM       shop
          WHERE price=19.95
Another solution is to sort all rows descending by price and only get the first row using the MySQL specific LIMIT clause:
SELECT article, dealer, price
FROM       shop
ORDER BY price DESC
LIMIT 1
Note: If there are several most expensive articles (e.g. each 19.95) the LIMIT solution does only show one of them!
8.3.3 Maximum of column: per group: only the values
"What's the highest price per article?"
SELECT article, MAX(price) AS price
FROM      shop
GROUP BY article

+---------+-------+
| article | price |
+---------+-------+
|    0001 | 3.99 |
|    0002 | 10.99 |
|    0003 | 1.69 |
|    0004 | 19.95 |
+---------+-------+



 60                                                                                       CorpImages.net Online Hosting Manual
                                                                                              Internet All Around Marketing

8.3.4 The rows holding the group-wise maximum of a certain field
"For each article find the dealer(s) with the most expensive price."
In ANSI SQL I'd do it with a sub-query like this:
SELECT article, dealer, price
FROM      shop s1
WHERE price=(SELECT MAX(s2.price)
                      FROM shop s2
                      WHERE s1.article = s2.article)
In MySQL it's best do it in several steps:
    1. Get the list of (article,maxprice). See section 8.3.4 The rows holding the group-wise maximum of a certain field.
    2. For each article get the corresponding rows which have the stored maximum price.
This can easily be done with a temporary table:
CREATE TEMPORARY TABLE tmp (
            article INT(4) UNSIGNED ZEROFILL DEFAULT '0000' NOT NULL,
            price        DOUBLE(16,2)                          DEFAULT '0.00' NOT NULL);

LOCK TABLES article read;

INSERT INTO tmp SELECT article, MAX(price) FROM shop GROUP BY article;

SELECT article, dealer, price FROM shop, tmp
WHERE shop.article=tmp.articel AND shop.price=tmp.price;

UNLOCK TABLES;

DROP TABLE tmp;
If you don't use a TEMPORARY table, you must also lock the 'tmp' table.
"Can it be done with a single query?"
Yes, but only by using a quite inefficient trick that I call the "MAX-CONCAT trick":
SELECT article,
           SUBSTRING( MAX( CONCAT(LPAD(price,6,'0'),dealer) ), 7) AS dealer,
    0.00+LEFT(             MAX( CONCAT(LPAD(price,6,'0'),dealer) ), 6) AS price
FROM       shop
GROUP BY article;

+---------+--------+-------+
| article | dealer | price |
+---------+--------+-------+
|      0001 | B             | 3.99 |
|      0002 | A             | 10.99 |
|      0003 | C             | 1.69 |
|      0004 | D             | 19.95 |
+---------+--------+-------+
The last example can of course be made a bit more efficient by doing the splitting of the concatenated column in the client.
8.3.5 Using foreign keys
One doesn't need foreign keys to join 2 tables.
The only thing MySQL doesn't do is CHECK to make sure that the keys you use really exist in the table(s) you're referencing
and it doesn't automatically delete rows from table with a foreign key definition. If you use your keys like normal, and it'll
work just fine!
CREATE TABLE persons (
       id SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT,
       name CHAR(60) NOT NULL,

CorpImages.net Online Hosting Manual                                                                                             61
                                                             Internet All Around Marketing

     PRIMARY KEY (id)
);

CREATE TABLE shirts (
    id SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT,
    style ENUM('t-shirt', 'polo', 'dress') NOT NULL,
    color ENUM('red', 'blue', 'orange', 'white', 'black') NOT NULL,
    owner SMALLINT UNSIGNED NOT NULL REFERENCES persons,
    PRIMARY KEY (id)
);

INSERT INTO persons VALUES (NULL, 'Antonio Paz');

INSERT   INTO shirts VALUES
(NULL,   'polo', 'blue', LAST_INSERT_ID()),
(NULL,   'dress', 'white', LAST_INSERT_ID()),
(NULL,   't-shirt', 'blue', LAST_INSERT_ID());

INSERT INTO persons VALUES (NULL, 'Lilliana Angelovska');

INSERT   INTO shirts VALUES
(NULL,   'dress', 'orange', LAST_INSERT_ID()),
(NULL,   'polo', 'red', LAST_INSERT_ID()),
(NULL,   'dress', 'blue', LAST_INSERT_ID()),
(NULL,   't-shirt', 'white', LAST_INSERT_ID());

SELECT * FROM persons;
+----+---------------------+
| id | name                |
+----+---------------------+
| 1 | Antonio Paz          |
| 2 | Lilliana Angelovska |
+----+---------------------+

SELECT * FROM shirts;
+----+---------+--------+-------+
| id | style   | color | owner |
+----+---------+--------+-------+
| 1 | polo     | blue   |     1 |
| 2 | dress    | white |      1 |
| 3 | t-shirt | blue    |     1 |
| 4 | dress    | orange |     2 |
| 5 | polo     | red    |     2 |
| 6 | dress    | blue   |     2 |
| 7 | t-shirt | white |       2 |
+----+---------+--------+-------+

SELECT   s.* FROM persons p, shirts s
 WHERE   p.name LIKE 'Lilliana%'
   AND   s.owner = p.id
   AND   s.color &lt;&gt; 'white';

+----+-------+--------+-------+
| id | style | color | owner |
+----+-------+--------+-------+

62                                                           CorpImages.net Online Hosting Manual
                                                                                                Internet All Around Marketing

| 4 | dress | orange |      2 |
| 5 | polo | red      |     2 |
| 6 | dress | blue    |     2 |
+----+-------+--------+-------+
8.4 Creating and using a database
Now that you know how to enter commands, it's time to access a database.
Suppose you have several pets in your home (your ``menagerie'') and you'd like to keep track of various types of information
about them. You can do so by creating tables to hold your data and loading them with the desired information. Then you can
answer different sorts of questions about your animals by retrieving data from the tables. This section shows how to do all
that:
      • How to create a database
      • How to create a table
      • How to load data into the table
      • How to retrieve data from the table in various ways
      • How to use multiple tables
The menagerie database will be simple (deliberately), but it is not difficult to think of real-world situations in which a similar
type of database might be used. For example, a database like this could be used by a farmer to keep track of livestock, or by a
veterinarian to keep track of patient records.
Use the SHOW statement to find out what databases currently exist on the server:
mysql> SHOW DATABASES;
+----------+
| Database |
+----------+
| mysql          |
| test           |
| tmp            |
+----------+
The list of databases is probably different on your machine, but the mysql and test databases are likely to be among them.
The mysql database is required because it describes user access privileges. The test database is often provided as a
workspace for users to try things out.
If the test database exists, try to access it:
mysql> USE test
Database changed
Note that USE, like QUIT, does not require a semicolon. (You can terminate such statements with a semicolon if you like; it
does no harm.) The USE statement is special in another way, too: it must be given on a single line.
You can use the test database (if you have access to it) for the examples that follow, but anything you create in that
database can be removed by anyone else with access to it. For this reason, you should probably ask your MySQL
administrator for permission to use a database of your own. Suppose you want to call yours menagerie. The administrator
needs to execute a command like this:
mysql> GRANT ALL ON menagerie.* TO your_mysql_name;
where your_mysql_name is the MySQL user name assigned to you.
8.4.1 Creating and selecting a database
If the administrator creates your database for you when setting up your permissions, you can begin using it. Otherwise, you
need to create it yourself:
mysql> CREATE DATABASE menagerie;
Under Unix, database names are case sensitive (unlike SQL keywords), so you must always refer to your database as
menagerie, not as Menagerie, MENAGERIE or some other variant. This is also true for table names. (Under Windows,
this restriction does not apply, although you must refer to databases and tables using the same lettercase throughout a given
query.)
Creating a database does not select it for use, you must do that explicitly. To make menagerie the current database, use
this command:

CorpImages.net Online Hosting Manual                                                                                             63
                                                                                               Internet All Around Marketing

mysql> USE menagerie
Database changed
Your database needs to be created only once, but you must select it for use each time you begin a mysql session. You can do
this by issuing a USE statement as shown above. Alternatively, you can select the database on the command line when you
invoke mysql. Just specify its name after any connection parameters that you might need to provide. For example:
shell> mysql -h host -u user -p menagerie
Enter password: ********
Note that menagerie is not your password on the command just shown. If you want to supply your password on the
command line after the -p option, you must do so with no intervening space (e.g., as -pmypassword, not as -p
mypassword). However, putting your password on the command line is not recommended, because doing so exposes it to
snooping by other users logged in on your machine.
8.4.2 Creating a table
Creating the database is the easy part, but at this point it's empty, as SHOW TABLES will tell you:
mysql> SHOW TABLES;
Empty set (0.00 sec)
The harder part is deciding what the structure of your database should be: what tables you will need, and what columns will
be in each of them.
You'll want a table that contains a record for each of your pets. This can be called the pet table, and it should contain, as a
bare minimum, each animal's name. Since the name by itself is not very interesting, the table should contain other
information. For example, if more than one person in your family keeps pets, you might want to list each animal's owner.
You might also want to record some basic descriptive information such as species and sex.
How about age? That might be of interest, but it's not a good thing to store in a database. Age changes as time passes, which
means you'd have to update your records often. Instead, it's better to store a fixed value such as date of birth. Then, whenever
you need age, you can calculate it as the difference between the current date and the birth date. MySQL provides functions
for doing date arithmetic, so this is not difficult. Storing birth date rather than age has other advantages, too:
     • You can use the database for tasks such as generating reminders for upcoming pet birthdays. (If you think this type
          of query is somewhat silly, note that it is the same question you might ask in the context of a business database to
          identify clients to whom you'll soon need to send out birthday greetings, for that computer-assisted personal touch.)
     • You can calculate age in relation to dates other than the current date. For example, if you store death date in the
          database, you can easily calculate how old a pet was when it died.
You can probably think of other types of information that would be useful in the pet table, but the ones identified so far are
sufficient for now: name, owner, species, sex, birth and death.
Use a CREATE TABLE statement to specify the layout of your table:
mysql> CREATE TABLE pet (name VARCHAR(20), owner VARCHAR(20),
       -> species VARCHAR(20), sex CHAR(1), birth DATE, death DATE);
VARCHAR is a good choice for the name, owner and species columns since the column values will vary in length. The
lengths of those columns need not all be the same, and need not be 20. You can pick any length from 1 to 255, whatever
seems most reasonable to you. (If you make a poor choice and it turns out later that you need a longer field, MySQL
provides an ALTER TABLE statement.)
Animal sex can be represented in a variety of ways, for example, "m" and "f", or perhaps "male" and "female". It's
simplest to use the single characters "m" and "f".
The use of the DATE data type for the birth and death columns is a fairly obvious choice.
Now that you have created a table, SHOW TABLES should produce some output:
mysql> SHOW TABLES;
+---------------------+
| Tables in menagerie |
+---------------------+
| pet                              |
+---------------------+
To verify that your table was created the way you expected, use a DESCRIBE statement:
mysql> DESCRIBE pet;
+---------+-------------+------+-----+---------+-------+

 64                                                                                           CorpImages.net Online Hosting Manual
                                                                                               Internet All Around Marketing

| Field      | Type             | Null | Key | Default | Extra |
+---------+-------------+------+-----+---------+-------+
| name       | varchar(20) | YES |                  | NULL        |            |
| owner      | varchar(20) | YES |                  | NULL        |            |
| species | varchar(20) | YES |                     | NULL        |            |
| sex        | char(1)          | YES |             | NULL        |            |
| birth      | date             | YES |             | NULL        |            |
| death      | date             | YES |             | NULL        |            |
+---------+-------------+------+-----+---------+-------+
You can use DESCRIBE any time, for example, if you forget the names of the columns in your table or what types they are.
8.4.3 Loading data into a table
After creating your table, you need to populate it. The LOAD DATA and INSERT statements are useful for this.
Suppose your pet records can be described as shown below. (Observe that MySQL expects dates in YYYY-MM-DD format;
this may be different than what you are used to.)
name                   owner              species           sex      birth                     death
Fluffy                 Harold             cat               f        1993-02-04
Claws                  Gwen               cat               m        1994-03-17
Buffy                  Harold             dog               f        1989-05-13
Fang                   Benny              dog               m        1990-08-27
Bowser                 Diane              dog               m        1998-08-31                1995-07-29
Chirpy                 Gwen               bird              f        1998-09-11
Whistler               Gwen               bird                       1997-12-09
Slim                   Benny              snake             m        1996-04-29
Since you are beginning with an empty table, an easy way to populate it is to create a text file containing a row for each of
your animals, then load the contents of the file into the table with a single statement.
You could create a text file `pet.txt' containing one record per line, with values separated by tabs, and given in the order
in which the columns were listed in the CREATE TABLE statement. For missing values (such as unknown sexes, or death
dates for animals that are still living), you can use NULL values. To represent these in your text file, use \N. For example, the
record for Whistler the bird would look like this (where the whitespace between values is a single tab character):
Whistler                    Gwen               bird             \N             1997-12-09                    \N
To load the text file `pet.txt' into the pet table, use this command:
mysql> LOAD DATA LOCAL INFILE "pet.txt" INTO TABLE pet;
You can specify the column value separator and end of line marker explicitly in the LOAD DATA statement if you wish, but
the defaults are tab and linefeed. These are sufficient for the statement to read the file `pet.txt' properly.
When you want to add new records one at a time, the INSERT statement is useful. In its simplest form, you supply values for
each column, in the order in which the columns were listed in the CREATE TABLE statement. Suppose Diane gets a new
hamster named Puffball. You could add a new record using an INSERT statement like this:
mysql> INSERT INTO pet
      -> VALUES ('Puffball','Diane','hamster','f','1999-03-30',NULL);
Note that string and date values are specified as quoted strings here. Also, with INSERT, you can insert NULL directly to
represent a missing value. You do not use \N like you do with LOAD DATA.
From this example, you should be able to see that there would be a lot more typing involved to load your records initially
using several INSERT statements rather than a single LOAD DATA statement.
8.4.4 Retrieving information from a table
The SELECT statement is used to pull information from a table. The general form of the statement is:
SELECT what_to_select
FROM which_table
WHERE conditions_to_satisfy

CorpImages.net Online Hosting Manual                                                                                            65
                                                                                               Internet All Around Marketing

what_to_select indicates what you want to see. This can be a list of columns, or * to to indicate ``all columns.''
which_table indicates the table from which you want to retrieve data. The WHERE clause is optional. If it's present,
conditions_to_satisfy specifies conditions that rows must satisfy to qualify for retrieval.
8.4.4.1 Selecting all data
The simplest form of SELECT retrieves everything from a table:
mysql> SELECT * FROM pet;
+----------+--------+---------+------+------------+------------+
| name            | owner | species | sex | birth                              | death             |
+----------+--------+---------+------+------------+------------+
| Fluffy          | Harold | cat                 | f      | 1993-02-04 | NULL                      |
| Claws           | Gwen         | cat           | m      | 1994-03-17 | NULL                      |
| Buffy           | Harold | dog                 | f      | 1989-05-13 | NULL                      |
| Fang            | Benny | dog                  | m      | 1990-08-27 | NULL                      |
| Bowser          | Diane | dog                  | m      | 1998-08-31 | 1995-07-29 |
| Chirpy          | Gwen         | bird          | f      | 1998-09-11 | NULL                      |
| Whistler | Gwen                | bird          | NULL | 1997-12-09 | NULL                        |
| Slim            | Benny | snake                | m      | 1996-04-29 | NULL                      |
| Puffball | Diane | hamster | f                          | 1999-03-30 | NULL                      |
+----------+--------+---------+------+------------+------------+
This form of SELECT is useful if you want to review your entire table, for instance, after you've just loaded it with your
initial dataset. As it happens, the output just shown reveals an error in your data file: Bowser appears to have been born after
he died! Consulting your original pedigree papers, you find that the correct birth year is 1989, not 1998.
There are are least a couple of ways to fix this:
     • Edit the file `pet.txt' to correct the error, then empty the table and reload it using DELETE and LOAD DATA:
          mysql> DELETE FROM pet;
          mysql> LOAD DATA LOCAL INFILE "pet.txt" INTO TABLE pet;
          However, if you do this, you must also re-enter the record for Puffball.
     • Fix only the erroneous record with an UPDATE statement:
          mysql> UPDATE pet SET birth = "1989-08-31" WHERE name = "Bowser";
As shown above, it is easy to retrieve an entire table. But typically you don't want to do that, particularly when the table
becomes large. Instead, you're usually more interested in answering a particular question, in which case you specify some
constraints on the information you want. Let's look at some selection queries in terms of questions about your pets that they
answer.
8.4.4.2 Selecting particular rows
You can select only particular rows from your table. For example, if you want to verify the change that you made to Bowser's
birth date, select Bowser's record like this:
mysql> SELECT * FROM pet WHERE name = "Bowser";
+--------+-------+---------+------+------------+------------+
| name         | owner | species | sex | birth                         | death             |
+--------+-------+---------+------+------------+------------+
| Bowser | Diane | dog                     | m      | 1989-08-31 | 1995-07-29 |
+--------+-------+---------+------+------------+------------+
The output confirms that the year is correctly recorded now as 1989, not 1998.
String comparisons are normally case-insensitive, so you can specify the name as "bowser", "BOWSER", etc. The query
result will be the same.
You can specify conditions on any column, not just name. For example, if you want to know which animals were born after
1998, test the birth column:
mysql> SELECT * FROM pet WHERE birth >= "1998-1-1";
+----------+-------+---------+------+------------+-------+
| name            | owner | species | sex | birth                         | death |
+----------+-------+---------+------+------------+-------+

 66                                                                                           CorpImages.net Online Hosting Manual
                                                                                            Internet All Around Marketing

| Chirpy       | Gwen | bird              | f         | 1998-09-11 | NULL |
| Puffball | Diane | hamster | f                      | 1999-03-30 | NULL |
+----------+-------+---------+------+------------+-------+
You can combine conditions, for example, to locate female dogs:
mysql> SELECT * FROM pet WHERE species = "dog" AND sex = "f";
+-------+--------+---------+------+------------+-------+
| name | owner | species | sex | birth                                 | death |
+-------+--------+---------+------+------------+-------+
| Buffy | Harold | dog                 | f         | 1989-05-13 | NULL |
+-------+--------+---------+------+------------+-------+
The preceding query uses the AND logical operator. There is also an OR operator:
mysql> SELECT * FROM pet WHERE species = "snake" OR species = "bird";
+----------+-------+---------+------+------------+-------+
| name         | owner | species | sex | birth                            | death |
+----------+-------+---------+------+------------+-------+
| Chirpy       | Gwen | bird              | f         | 1998-09-11 | NULL |
| Whistler | Gwen | bird                  | NULL | 1997-12-09 | NULL |
| Slim         | Benny | snake            | m         | 1996-04-29 | NULL |
+----------+-------+---------+------+------------+-------+
AND and OR may be intermixed. If you do that, it's a good idea to use parentheses to indicate how conditions should be
grouped:
mysql> SELECT * FROM pet WHERE (species = "cat" AND sex = "m")
     -> OR (species = "dog" AND sex = "f");
+-------+--------+---------+------+------------+-------+
| name | owner | species | sex | birth                                 | death |
+-------+--------+---------+------+------------+-------+
| Claws | Gwen          | cat          | m         | 1994-03-17 | NULL |
| Buffy | Harold | dog                 | f         | 1989-05-13 | NULL |
+-------+--------+---------+------+------------+-------+
8.4.4.3 Selecting particular columns
If you don't want to see entire rows from your table, just name the columns in which you're interested, separated by commas.
For example, if you want to know when your animals were born, select the name and birth columns:
mysql> SELECT name, birth FROM pet;
+----------+------------+
| name          | birth              |
+----------+------------+
| Fluffy        | 1993-02-04 |
| Claws         | 1994-03-17 |
| Buffy         | 1989-05-13 |
| Fang          | 1990-08-27 |
| Bowser        | 1989-08-31 |
| Chirpy        | 1998-09-11 |
| Whistler | 1997-12-09 |
| Slim          | 1996-04-29 |
| Puffball | 1999-03-30 |
+----------+------------+
To find out who owns pets, use this query:
mysql> SELECT owner FROM pet;
+--------+
| owner |
+--------+
| Harold |
| Gwen        |

CorpImages.net Online Hosting Manual                                                                                           67
                                                                                            Internet All Around Marketing

| Harold |
| Benny |
| Diane |
| Gwen        |
| Gwen        |
| Benny |
| Diane |
+--------+
However, notice that the query simply retrieves the owner field from each record, and some of them appear more than once.
To minimize the output, retrieve each unique output record just once by adding the keyword DISTINCT:
mysql> SELECT DISTINCT owner FROM pet;
+--------+
| owner |
+--------+
| Benny |
| Diane |
| Gwen        |
| Harold |
+--------+
You can use a WHERE clause to combine row selection with column selection. For example, to get birth dates for dogs and
cats only, use this query:
mysql> SELECT name, species, birth FROM pet
      -> WHERE species = "dog" OR species = "cat";
+--------+---------+------------+
| name        | species | birth                 |
+--------+---------+------------+
| Fluffy | cat              | 1993-02-04 |
| Claws | cat               | 1994-03-17 |
| Buffy | dog               | 1989-05-13 |
| Fang        | dog         | 1990-08-27 |
| Bowser | dog              | 1989-08-31 |
+--------+---------+------------+
8.4.4.4 Sorting rows
You may have noticed in the preceding examples that the result rows are displayed in no particular order. However, it's often
easier to examine query output when the rows are sorted in some meaningful way. To sort a result, use an ORDER BY clause.
Here are animal birthdays, sorted by date:
mysql> SELECT name, birth FROM pet ORDER BY birth;
+----------+------------+
| name           | birth            |
+----------+------------+
| Buffy          | 1989-05-13 |
| Bowser         | 1989-08-31 |
| Fang           | 1990-08-27 |
| Fluffy         | 1993-02-04 |
| Claws          | 1994-03-17 |
| Slim           | 1996-04-29 |
| Whistler | 1997-12-09 |
| Chirpy         | 1998-09-11 |
| Puffball | 1999-03-30 |
+----------+------------+
To sort in reverse order, add the DESC (descending) keyword to the name of the column you are sorting by:
mysql> SELECT name, birth FROM pet ORDER BY birth DESC;
+----------+------------+

 68                                                                                        CorpImages.net Online Hosting Manual
                                                                                              Internet All Around Marketing

| name           | birth             |
+----------+------------+
| Puffball | 1999-03-30 |
| Chirpy         | 1998-09-11 |
| Whistler | 1997-12-09 |
| Slim           | 1996-04-29 |
| Claws          | 1994-03-17 |
| Fluffy         | 1993-02-04 |
| Fang           | 1990-08-27 |
| Bowser         | 1989-08-31 |
| Buffy          | 1989-05-13 |
+----------+------------+
You can sort on multiple columns. For example, to sort by type of animal, then by birth date within animal type with
youngest animals first, use the following query:
mysql> SELECT name, species, birth FROM pet ORDER BY species, birth DESC;
+----------+---------+------------+
| name           | species | birth               |
+----------+---------+------------+
| Chirpy         | bird          | 1998-09-11 |
| Whistler | bird                | 1997-12-09 |
| Claws          | cat           | 1994-03-17 |
| Fluffy         | cat           | 1993-02-04 |
| Fang           | dog           | 1990-08-27 |
| Bowser         | dog           | 1989-08-31 |
| Buffy          | dog           | 1989-05-13 |
| Puffball | hamster | 1999-03-30 |
| Slim           | snake         | 1996-04-29 |
+----------+---------+------------+
Note that the DESC keyword applies only to the column name immediately preceding it (birth); species values are still
sorted in ascending order.
8.4.4.5 Date calculations
MySQL provides several functions that you can use to perform calculations on dates, for example, to calculate ages or
extract parts of dates.
To determine how many years old each of your pets is, compute age as the difference between the birth date and the current
date. Do this by converting the two dates to days, take the difference, and divide by 365 (the number of days in a year):
mysql> SELECT name, (TO_DAYS(NOW())-TO_DAYS(birth))/365 FROM pet;
+----------+-------------------------------------+
| name            | (TO_DAYS(NOW())-TO_DAYS(birth))/365 |
+----------+-------------------------------------+
| Fluffy          |                                                 6.15 |
| Claws           |                                                 5.04 |
| Buffy           |                                                 9.88 |
| Fang            |                                                 8.59 |
| Bowser          |                                                 9.58 |
| Chirpy          |                                                 0.55 |
| Whistler |                                                        1.30 |
| Slim            |                                                 2.92 |
| Puffball |                                                        0.00 |
+----------+-------------------------------------+
Although the query works, there are some things about it that could be improved. First, the result could be scanned more
easily if the rows were presented in some order. Second, the heading for the age column isn't very meaningful.
The first problem can be handled by adding an ORDER BY name clause to sort the output by name. To deal with the
column heading, provide a name for the column so that a different label appears in the output (this is called a column alias):

CorpImages.net Online Hosting Manual                                                                                             69
                                                                                            Internet All Around Marketing

mysql> SELECT name, (TO_DAYS(NOW())-TO_DAYS(birth))/365 AS age
       -> FROM pet ORDER BY name;
+----------+------+
| name            | age |
+----------+------+
| Bowser          | 9.58 |
| Buffy           | 9.88 |
| Chirpy          | 0.55 |
| Claws           | 5.04 |
| Fang            | 8.59 |
| Fluffy          | 6.15 |
| Puffball | 0.00 |
| Slim            | 2.92 |
| Whistler | 1.30 |
+----------+------+
To sort the output by age rather than name, just use a different ORDER BY clause:
mysql> SELECT name, (TO_DAYS(NOW())-TO_DAYS(birth))/365 AS age
       -> FROM pet ORDER BY age;
+----------+------+
| name            | age |
+----------+------+
| Puffball | 0.00 |
| Chirpy          | 0.55 |
| Whistler | 1.30 |
| Slim            | 2.92 |
| Claws           | 5.04 |
| Fluffy          | 6.15 |
| Fang            | 8.59 |
| Bowser          | 9.58 |
| Buffy           | 9.88 |
+----------+------+
A similar query can be used to determine age at death for animals that have died. You determine which animals these are by
checking whether or not the death value is NULL. Then, for those with non-NULL values, compute the difference between
the death and birth values:
mysql> SELECT name, birth, death, (TO_DAYS(death)-TO_DAYS(birth))/365 AS age
       -> FROM pet WHERE death IS NOT NULL ORDER BY age;
+--------+------------+------------+------+
| name         | birth            | death           | age |
+--------+------------+------------+------+
| Bowser | 1989-08-31 | 1995-07-29 | 5.91 |
+--------+------------+------------+------+
The query uses death IS NOT NULL rather than death != NULL because NULL is a special value. This is explained
later. See section 8.4.4.6 Working with NULL values.
What if you want to know which animals have birthdays next month? For this type of calculation, year and day are irrelevant,
you simply want to extract the month part of the birth column. MySQL provides several date-part extraction functions,
such as YEAR(), MONTH() and DAYOFMONTH(). MONTH() is the appropriate function here. To see how it works, run a
simple query that displays the value of both birth and MONTH(birth):
mysql> SELECT name, birth, MONTH(birth) FROM pet;
+----------+------------+--------------+
| name            | birth            | MONTH(birth) |
+----------+------------+--------------+
| Fluffy          | 1993-02-04 |                       2 |
| Claws           | 1994-03-17 |                       3 |
| Buffy           | 1989-05-13 |                       5 |

 70                                                                                        CorpImages.net Online Hosting Manual
                                                                                           Internet All Around Marketing

| Fang           | 1990-08-27 |                         8 |
| Bowser         | 1989-08-31 |                         8 |
| Chirpy         | 1998-09-11 |                         9 |
| Whistler | 1997-12-09 |                              12 |
| Slim           | 1996-04-29 |                         4 |
| Puffball | 1999-03-30 |                               3 |
+----------+------------+--------------+
Finding animals with birthdays in the upcoming month is easy, too. Suppose the current month is April. Then the month
value is 4 and you look for animals born in May (month 5) like this:
mysql> SELECT name, birth FROM pet WHERE MONTH(birth) = 5;
+-------+------------+
| name | birth                  |
+-------+------------+
| Buffy | 1989-05-13 |
+-------+------------+
There is a small complication if the current month is December, of course. You don't just add one to the month number (12)
and look for animals born in month 13, because there is no such month. Instead, you look for animals born in January (month
1).
You can even write the query so that it works no matter what the current month is. That way you don't have to use a
particular month number in the query. DATE_ADD() allows you to add a time interval to a given date. If you add a month to
the value of NOW(), then extract the month part with MONTH(), the result produces the month in which to look for
birthdays:
mysql> SELECT name, birth FROM pet
      -> WHERE MONTH(birth) = MONTH(DATE_ADD(NOW(), INTERVAL 1 MONTH));
A different way to accomplish the same task is to add 1 to get the next month after the current one (after using the modulo
function (MOD) to ``wrap around'' the month value to 0 if it is currently 12):
mysql> SELECT name, birth FROM pet
      -> WHERE MONTH(birth) = MOD(MONTH(NOW()),12) + 1;
8.4.4.6 Working with NULL values
The NULL value can be surprising until you get used to it. Conceptually, NULL means ``missing value'' or ``unknown value''
and it is treated somewhat differently than other values. To test for NULL, you cannot use the arithmetic comparison
operators such as =, < or !=. To demonstrate this for yourself, try the following query:
mysql> SELECT 1 = NULL, 1 != NULL, 1 < NULL, 1 > NULL;
+----------+-----------+----------+----------+
| 1 = NULL | 1 != NULL | 1 < NULL | 1 > NULL |
+----------+-----------+----------+----------+
|          NULL |          NULL |            NULL |           NULL |
+----------+-----------+----------+----------+
Clearly you get no meaningful results from these comparisons. Use the IS NULL and IS NOT NULL operators instead:
mysql> SELECT 1 IS NULL, 1 IS NOT NULL;
+-----------+---------------+
| 1 IS NULL | 1 IS NOT NULL |
+-----------+---------------+
|                0 |                     1 |
+-----------+---------------+
In MySQL, 0 means false and 1 means true.
This special treatment of NULL is why, in the previous section, it was necessary to determine which animals are no longer
alive using death IS NOT NULL instead of death != NULL.
8.4.4.7 Pattern matching
MySQL provides standard SQL pattern matching as well as a form of pattern matching based on extended regular
expressions similar to those used by Unix utilities such as vi, grep and sed.

CorpImages.net Online Hosting Manual                                                                                         71
                                                                                           Internet All Around Marketing

SQL pattern matching allows you to use `_' to match any single character, and `%' to match an arbitrary number of
characters (including zero characters). SQL patterns are case insensitive. Some examples are shown below. Note that you do
not use = or != when you use SQL patterns; use the LIKE or NOT LIKE comparison operators instead.
To find names beginning with `b':
mysql> SELECT * FROM pet WHERE name LIKE "b%";
+--------+--------+---------+------+------------+------------+
| name         | owner | species | sex | birth                           | death           |
+--------+--------+---------+------+------------+------------+
| Buffy | Harold | dog                    | f        | 1989-05-13 | NULL                   |
| Bowser | Diane | dog                    | m        | 1989-08-31 | 1995-07-29 |
+--------+--------+---------+------+------------+------------+
To find names ending with `fy':
mysql> SELECT * FROM pet WHERE name LIKE "%fy";
+--------+--------+---------+------+------------+-------+
| name         | owner | species | sex | birth                           | death |
+--------+--------+---------+------+------------+-------+
| Fluffy | Harold | cat                   | f        | 1993-02-04 | NULL |
| Buffy | Harold | dog                    | f        | 1989-05-13 | NULL |
+--------+--------+---------+------+------------+-------+
To find names containing a `w':
mysql> SELECT * FROM pet WHERE name LIKE "%w%";
+----------+-------+---------+------+------------+------------+
| name            | owner | species | sex | birth                          | death           |
+----------+-------+---------+------+------------+------------+
| Claws           | Gwen | cat             | m         | 1994-03-17 | NULL                   |
| Bowser          | Diane | dog            | m         | 1989-08-31 | 1995-07-29 |
| Whistler | Gwen | bird                   | NULL | 1997-12-09 | NULL                        |
+----------+-------+---------+------+------------+------------+
To find names containing exactly five characters, use the `_' pattern character:
mysql> SELECT * FROM pet WHERE name LIKE "_____";
+-------+--------+---------+------+------------+-------+
| name | owner | species | sex | birth                                  | death |
+-------+--------+---------+------+------------+-------+
| Claws | Gwen              | cat        | m       | 1994-03-17 | NULL |
| Buffy | Harold | dog                   | f       | 1989-05-13 | NULL |
+-------+--------+---------+------+------------+-------+
The other type of pattern matching provided by MySQL uses extended regular expressions. When you test for a match for
this type of pattern, use the REGEXP and NOT REGEXP operators (or RLIKE and NOT RLIKE, which are synonyms).
Some characteristics of extended regular expressions are:
     • `.' matches any single character.
     • A character class `[...]' matches any character within the brackets. For example, `[abc]' matches `a', `b'
          or `c'. To name a range of characters, use a dash. `[a-z]' matches any lowercase letter, whereas `[0-9]'
          matches any digit.
     • `*' matches zero or more instances of the thing preceding it. For example, `x*' matches any number of `x'
          characters, `[0-9]*' matches any number of digits, and `.*' matches any number of anything.
     • Regular expressions are case sensitive, but you can use a character class to match both lettercases if you wish. For
          example, `[aA]' matches lowercase or uppercase `a' and `[a-zA-Z]' matches any letter in either case.
     • The pattern matches if it occurs anywhere in the value being tested (SQL patterns match only if they match the
          entire value).
     • To anchor a pattern so that it must match the beginning or end of the value being tested, use `^' at the beginning or
          `$' at the end of the pattern.
To demonstrate how extended regular expressions work, the LIKE queries shown above are rewritten below to use REGEXP:


 72                                                                                        CorpImages.net Online Hosting Manual
                                                                                               Internet All Around Marketing

To find names beginning with `b', use `^' to match the beginning of the name and `[bB]' to match either lowercase or
uppercase `b':
mysql> SELECT * FROM pet WHERE name REGEXP "^[bB]";
+--------+--------+---------+------+------------+------------+
| name        | owner | species | sex | birth                                | death             |
+--------+--------+---------+------+------------+------------+
| Buffy | Harold | dog                      | f         | 1989-05-13 | NULL                      |
| Bowser | Diane | dog                      | m         | 1989-08-31 | 1995-07-29 |
+--------+--------+---------+------+------------+------------+
To find names ending with `fy', use `$' to match the end of the name:
mysql> SELECT * FROM pet WHERE name REGEXP "fy$";
+--------+--------+---------+------+------------+-------+
| name        | owner | species | sex | birth                                | death |
+--------+--------+---------+------+------------+-------+
| Fluffy | Harold | cat                     | f         | 1993-02-04 | NULL |
| Buffy | Harold | dog                      | f         | 1989-05-13 | NULL |
+--------+--------+---------+------+------------+-------+
To find names containing a `w', use `[wW]' to match either lowercase or uppercase `w':
mysql> SELECT * FROM pet WHERE name REGEXP "[wW]";
+----------+-------+---------+------+------------+------------+
| name           | owner | species | sex | birth                              | death              |
+----------+-------+---------+------+------------+------------+
| Claws          | Gwen | cat                 | m        | 1994-03-17 | NULL                       |
| Bowser         | Diane | dog                | m        | 1989-08-31 | 1995-07-29 |
| Whistler | Gwen | bird                      | NULL | 1997-12-09 | NULL                           |
+----------+-------+---------+------+------------+------------+
Since a regular expression pattern matches if it occurs anywhere in the value, it is not necessary in the previous query to put a
wildcard on either side of the pattern to get it to match the entire value like it would be if you used an SQL pattern.
To find names containing exactly five characters, use `^' and `$' to match the beginning and end of the name, and five
instances of `.' in between:
mysql> SELECT * FROM pet WHERE name REGEXP "^.....$";
+-------+--------+---------+------+------------+-------+
| name | owner | species | sex | birth                                     | death |
+-------+--------+---------+------+------------+-------+
| Claws | Gwen            | cat           | m         | 1994-03-17 | NULL |
| Buffy | Harold | dog                    | f         | 1989-05-13 | NULL |
+-------+--------+---------+------+------------+-------+
You could also write the previous query using the `{n}' ``repeat-n-times'' operator:
mysql> SELECT * FROM pet WHERE name REGEXP "^.{5}$";
+-------+--------+---------+------+------------+-------+
| name | owner | species | sex | birth                                     | death |
+-------+--------+---------+------+------------+-------+
| Claws | Gwen            | cat           | m         | 1994-03-17 | NULL |
| Buffy | Harold | dog                    | f         | 1989-05-13 | NULL |
+-------+--------+---------+------+------------+-------+
8.4.4.8 Counting rows
Databases are often used to answer the question, ``how often does a certain type of data occur in a table?'' For example, you
might want to know how many pets you have, or how many pets each owner has, or you might want to perform various kinds
of censuses on your animals.
Counting the total number of animals you have is the same question as ``how many rows are in the pet table?,'' since there is
one record per pet. The COUNT() function counts the number of non-NULL results, so the query to count your animals looks
like this:


CorpImages.net Online Hosting Manual                                                                                            73
                                                                                       Internet All Around Marketing

mysql> SELECT COUNT(*) FROM pet;
+----------+
| COUNT(*) |
+----------+
|             9 |
+----------+
Earlier, you retrieved the names of the people who owned pets. You can use COUNT() if you want to find out how many
pets each owner has:
mysql> SELECT owner, COUNT(*) FROM pet GROUP BY owner;
+--------+----------+
| owner | COUNT(*) |
+--------+----------+
| Benny |                    2 |
| Diane |                    2 |
| Gwen        |              3 |
| Harold |                   2 |
+--------+----------+
Note the use of GROUP BY to group together all records for each owner. Without it, all you get is an error message:
mysql> SELECT owner, COUNT(owner) FROM pet;
ERROR 1140 at line 1: Mixing of GROUP columns (MIN(),MAX(),COUNT()...)
with no GROUP columns is illegal if there is no GROUP BY clause
COUNT() and GROUP BY are useful for characterizing your data in various ways. The following examples show different
ways to perform animal census operations.
Number of animals per species:
mysql> SELECT species, COUNT(*) FROM pet GROUP BY species;
+---------+----------+
| species | COUNT(*) |
+---------+----------+
| bird          |             2 |
| cat           |             2 |
| dog           |             3 |
| hamster |                   1 |
| snake         |             1 |
+---------+----------+
Number of animals per sex:
mysql> SELECT sex, COUNT(*) FROM pet GROUP BY sex;
+------+----------+
| sex | COUNT(*) |
+------+----------+
| NULL |                 1 |
| f        |             4 |
| m        |             4 |
+------+----------+
(In this output, NULL indicates ``sex unknown.'')
Number of animals per combination of species and sex:
mysql> SELECT species, sex, COUNT(*) FROM pet GROUP BY species, sex;
+---------+------+----------+
| species | sex | COUNT(*) |
+---------+------+----------+
| bird          | NULL |                1 |
| bird          | f        |            1 |
| cat           | f        |            1 |
| cat           | m        |            1 |
| dog           | f        |            1 |

74                                                                                    CorpImages.net Online Hosting Manual
                                                                                               Internet All Around Marketing

| dog          | m         |           2 |
| hamster | f              |           1 |
| snake        | m         |           1 |
+---------+------+----------+
You need not retrieve an entire table when you use COUNT(). For example, the previous query, when performed just on
dogs and cats, looks like this:
mysql> SELECT species, sex, COUNT(*) FROM pet
       -> WHERE species = "dog" OR species = "cat"
       -> GROUP BY species, sex;
+---------+------+----------+
| species | sex | COUNT(*) |
+---------+------+----------+
| cat          | f         |           1 |
| cat          | m         |           1 |
| dog          | f         |           1 |
| dog          | m         |           2 |
+---------+------+----------+
Or, if you wanted the number of animals per sex only for known-sex animals:
mysql> SELECT species, sex, COUNT(*) FROM pet
       -> WHERE sex IS NOT NULL
       -> GROUP BY species, sex;
+---------+------+----------+
| species | sex | COUNT(*) |
+---------+------+----------+
| bird         | f         |           1 |
| cat          | f         |           1 |
| cat          | m         |           1 |
| dog          | f         |           1 |
| dog          | m         |           2 |
| hamster | f              |           1 |
| snake        | m         |           1 |
+---------+------+----------+
8.4.5 Using more than one table
The pet table keeps track of which pets you have. If you want to record other information about them, such as events in their
lives like visits to the vet or when litters are born, you need another table. What should this table look like?
     • It needs to contain the pet name so you know which animal each event pertains to.
     • It needs a date so you know when the event occurred.
     • It needs a field to describe the event.
     • If you want to be able to categorize events, it would be useful to have an event type field.
Given these considerations, the CREATE TABLE statement for the event table might look like this:
mysql> CREATE TABLE event (name VARCHAR(20), date DATE,
       -> type VARCHAR(15), remark VARCHAR(255));
As with the pet table, it's easiest to load the initial records by creating a tab-delimited text file containing the information:
Fluffy                1995-05-15              litter            4 kittens, 3 female, 1 male
Buffy                 1993-06-23              litter            5 puppies, 2 female, 3 male
Buffy                 1994-06-19              litter            3 puppies, 3 female
Chirpy                1999-03-21              vet               needed beak straightened
Slim                  1997-08-03              vet               broken rib
Bowser                1991-10-12              kennel
Fang                  1991-10-12              kennel
Fang                  1998-08-28              birthday          Gave him a new chew toy

CorpImages.net Online Hosting Manual                                                                                            75
                                                                                                Internet All Around Marketing

Claws               1998-03-17              birthday           Gave him a new flea collar
Whistler            1998-12-09              birthday           First birthday
Load the records like this:
mysql> LOAD DATA LOCAL INFILE "event.txt" INTO TABLE event;
Based on what you've learned from the queries you've run on the pet table, you should be able to perform retrievals on the
records in the event table; the principles are the same. But when is the event table by itself insufficient to answer
questions you might ask?
Suppose you want to find out the ages of each pet when they had their litters. The event table indicates when this occurred,
but to calculate age of the mother, you need her birth date. Since that is stored in the pet table, you need both tables for the
query:
mysql> SELECT pet.name, (TO_DAYS(date) - TO_DAYS(birth))/365 AS age, remark
       -> FROM pet, event
       -> WHERE pet.name = event.name AND type = "litter";
+--------+------+-----------------------------+
| name         | age | remark                                            |
+--------+------+-----------------------------+
| Fluffy | 2.27 | 4 kittens, 3 female, 1 male |
| Buffy | 4.12 | 5 puppies, 2 female, 3 male |
| Buffy | 5.10 | 3 puppies, 3 female                                     |
+--------+------+-----------------------------+
There are several things to note about this query:
     • The FROM clause lists two tables since the query needs to pull information from both of them.
     • When combining information from multiple tables, you need to specify how records in one table can be matched to
          records in the other. This is easy since they both have a name column. The query uses WHERE clause to match up
          records in the two tables based on the name values.
     • Since the name column occurs in both tables, you must be specific about which table you mean when referring to
          the column. This is done by prepending the table name to the column name.
You need not have two different tables to perform a join. Sometimes it is useful to join a table to itself, if you want to
compare records in a table to other records in that same table. For example, to find breeding pairs among your pets, you can
join the pet table with itself to pair up males and females of like species:
mysql> SELECT p1.name, p1.sex, p2.name, p2.sex, p1.species
       -> FROM pet AS p1, pet AS p2
       -> WHERE p1.species = p2.species AND p1.sex = "f" AND p2.sex = "m";
+--------+------+--------+------+---------+
| name         | sex | name             | sex | species |
+--------+------+--------+------+---------+
| Fluffy | f              | Claws | m              | cat          |
| Buffy | f               | Fang        | m        | dog          |
| Buffy | f               | Bowser | m             | dog          |
+--------+------+--------+------+---------+
In this query, we specify aliases for the table name in order to be able to refer to the columns and keep straight which instance
of the table each column reference is associated with.
8.5 Getting information about databases and tables
What if you forget the name of a database or table, or what the structure of a given table is (e.g., what its columns are called)?
MySQL addresses this problem through several statements that provide information about the databases and tables it
supports.
You have already seen SHOW DATABASES, which lists the databases managed by the server. To find out which database is
currently selected, use the DATABASE() function:
mysql> SELECT DATABASE();
+------------+
| DATABASE() |
+------------+

 76                                                                                            CorpImages.net Online Hosting Manual
                                                                                              Internet All Around Marketing

| menagerie |
+------------+
If you haven't selected any database yet, the result is blank.
To find out what tables the current database contains (for example, when you're not sure about the name of a table), use this
command:
mysql> SHOW TABLES;
+---------------------+
| Tables in menagerie |
+---------------------+
| event                           |
| pet                             |
+---------------------+
If you want to find out about the structure of a table, the DESCRIBE command is useful; it displays information about each
of a table's columns:
mysql> DESCRIBE pet;
+---------+-------------+------+-----+---------+-------+
| Field          | Type               | Null | Key | Default | Extra |
+---------+-------------+------+-----+---------+-------+
| name           | varchar(20) | YES |                     | NULL     |           |
| owner          | varchar(20) | YES |                     | NULL     |           |
| species | varchar(20) | YES |                            | NULL     |           |
| sex            | char(1)            | YES |              | NULL     |           |
| birth          | date               | YES |              | NULL     |           |
| death          | date               | YES |              | NULL     |           |
+---------+-------------+------+-----+---------+-------+
Field indicates the column name, Type is the data type for the column, Null indicates whether or not the column can
contain NULL values, Key indicates whether or not the column is indexed and Default specifies the column's default
value.
If you have indexes on a table, SHOW INDEX FROM tbl_name produces information about them.
8.6 Using mysql in batch mode
In the previous sections, you used mysql interactively to enter queries and view the results. You can also run mysql in
batch mode. To do this, put the commands you want to run in a file, then tell mysql to read its input from the file:
shell> mysql < batch-file
If you need to specify connection parameters on the command line, the command might look like this:
shell> mysql -h host -u user -p < batch-file
Enter password: ********
When you use mysql this way, you are creating a script file, then executing the script.
Why use a script? Here are a few reasons:
     • If you run a query repeatedly (say, every day or every week), making it a script allows you to avoid retyping it each
         time you execute it.
     • You can generate new queries from existing ones that are similar by copying and editing script files.
     • Batch mode can also be useful while you're developing a query, particularly for multiple-line commands or
         multiple-statement sequences of commands. If you make a mistake, you don't have to retype everything. Just edit
         your script to correct the error, then tell mysql to execute it again.
     • If you have a query that produces a lot of output, you can run the output through a pager rather than watching it
         scroll off the top of your screen:
         shell> mysql < batch-file | more
     • You can catch the output in a file for further processing:
         shell> mysql < batch-file > mysql.out
     • You can distribute your script to other people so they can run the commands, too.
     • Some situations do not allow for interactive use, for example, when you run a query from a cron job. In this case,
         you must use batch mode.

CorpImages.net Online Hosting Manual                                                                                            77
                                                                                           Internet All Around Marketing

The default output format is different (more concise) when you run mysql in batch mode than when you use it interactively.
For example, the output of SELECT DISTINCT species FROM pet looks like this when run interactively:
+---------+
| species |
+---------+
| bird         |
| cat          |
| dog          |
| hamster |
| snake        |
+---------+
But like this when run in batch mode:
species
bird
cat
dog
hamster
snake
If you want to get the interactive output format in batch mode, use mysql -t. To echo to the output the commands that are
executed, use mysql -vvv.
8.7 Queries from twin project
At Analytikerna and Lentus, we have been doing the systems and field work for a big research project. This project is a
collaboration between the Institute of Environmental Medicine at Karolinska Institutet Stockholm and the Section on Clinical
Research in Aging and Psychology at the University of Southern California.
The project involves a screening part where all twins in Sweden older than 65 years are interviewed by telephone. Twins who
meet certain criteria are passed on to the next stage. In this latter stage, twins who want to participate are visited by a
doctor/nurse team. Some of the examinations include physical and neuropsychological examination, laboratory testing,
neuroimaging, psychological status assessment, and family history collection. In addition, data are collected on medical and
environmental risk factors.
More information about Twin studies can be found at:
http://www.imm.ki.se/TWIN/TWINUKW.HTM
The latter part of the project is administered with a web interface written using Perl and MySQL.
Each night all data from the interviews are moved into a MySQL database.
8.7.1 Find all non-distributed twins
The following query is used to determine who goes into the second part of the project:
select
           concat(p1.id, p1.tvab) + 0 as tvid,
           concat(p1.christian_name, " ", p1.surname) as Name,
           p1.postal_code as Code,
           p1.city as City,
           pg.abrev as Area,
           if(td.participation = "Aborted", "A", " ") as A,
           p1.dead as dead1,
           l.event as event1,
           td.suspect as tsuspect1,
           id.suspect as isuspect1,
           td.severe as tsevere1,
           id.severe as isevere1,
           p2.dead as dead2,
           l2.event as event2,
           h2.nurse as nurse2,
           h2.doctor as doctor2,

 78                                                                                       CorpImages.net Online Hosting Manual
                                                                 Internet All Around Marketing

            td2.suspect as tsuspect2,
            id2.suspect as isuspect2,
            td2.severe as tsevere2,
            id2.severe as isevere2,
            l.finish_date
from
            twin_project as tp
            /* For Twin 1 */
            left join twin_data as td on tp.id = td.id and tp.tvab = td.tvab
            left join informant_data as id on tp.id = id.id and tp.tvab = id.tvab
            left join harmony as h on tp.id = h.id and tp.tvab = h.tvab
            left join lentus as l on tp.id = l.id and tp.tvab = l.tvab
            /* For Twin 2 */
            left join twin_data as td2 on p2.id = td2.id and p2.tvab = td2.tvab
            left join informant_data as id2 on p2.id = id2.id and p2.tvab = id2.tvab
            left join harmony as h2 on p2.id = h2.id and p2.tvab = h2.tvab
            left join lentus as l2 on p2.id = l2.id and p2.tvab = l2.tvab,
            person_data as p1,
            person_data as p2,
            postal_groups as pg
where
            /* p1 gets main twin and p2 gets his/her twin. */
            /* ptvab is a field inverted from tvab */
            p1.id = tp.id and p1.tvab = tp.tvab and
            p2.id = p1.id and p2.ptvab = p1.tvab and
            /* Just the sceening survey */
            tp.survey_no = 5 and
            /* Skip if partner died before 65 but allow emigration (dead=9) */
            (p2.dead = 0 or p2.dead = 9 or
              (p2.dead = 1 and
               (p2.death_date = 0 or
                (((to_days(p2.death_date) - to_days(p2.birthday)) / 365)
                 >= 65))))
            and
            (
            /* Twin is suspect */
            (td.future_contact = 'Yes' and td.suspect = 2) or
            /* Twin is suspect - Informant is Blessed */
            (td.future_contact = 'Yes' and td.suspect = 1 and id.suspect = 1) or
            /* No twin - Informant is Blessed */
            (ISNULL(td.suspect) and id.suspect = 1 and id.future_contact = 'Yes') or
            /* Twin broken off - Informant is Blessed */
            (td.participation = 'Aborted'
              and id.suspect = 1 and id.future_contact = 'Yes') or
            /* Twin broken off - No inform - Have partner */
            (td.participation = 'Aborted' and ISNULL(id.suspect) and p2.dead = 0))
            and
            l.event = 'Finished'
            /* Get at area code */
            and substring(p1.postal_code, 1, 2) = pg.code
            /* Not already distributed */
            and (h.nurse is NULL or h.nurse=00 or h.doctor=00)
            /* Has not refused or been aborted */
            and not (h.status = 'Refused' or h.status = 'Aborted'


CorpImages.net Online Hosting Manual                                                        79
                                                                                           Internet All Around Marketing

            or h.status = 'Died' or h.status = 'Other')
order by
          tvid;
Some explanations:
concat(p1.id, p1.tvab) + 0 as tvid

      We want to sort on the concatenated id and tvab in numerical order. Adding 0 to the result causes
      MySQL to treat the result as a number.

column id
      This identifies a pair of twins. It is a key in all tables.

column tvab

      This identifies a twin in a pair. It has a value of 1 or 2.

column ptvab

      This is an inverse of tvab. When tvab is 1 this is 2, and vice versa. It exists to save typing and to
      make it easier for MySQL to optimize the query.
This query demonstrates, among other things, how to do lookups on a table from the same table with a join (p1 and p2). In
the example, this is used to check whether a twin's partner died before the age of 65. If so, the row is not returned.
All of the above exist in all tables with twin-related information. We have a key on both id,tvab (all tables) and
id,ptvab (person_data) to make queries faster.
On our production machine (A 200MHz UltraSPARC), this query returns about 150-200 rows and takes less than one second.
The current number of records in the tables used above:
Table                                                                Rows
person_data                                                          71074
lentus                                                               5291
twin_project                                                         5286
twin_data                                                            2012
informant_data                                                       663
harmony                                                              381
postal_groups                                                        100

8.7.2 Show a table on twin pair status
Each interview ends with a status code called event. The query shown below is used to display a table over all twin pairs
combined by event. This indicates in how many pairs both twins are finished, in how many pairs one twin is finished and the
other refused, and so on.
select
            t1.event,
            t2.event,
            count(*)
from
            lentus as t1,
            lentus as t2,
            twin_project as tp
where
            /* We are looking at one pair at a time */

 80                                                                                        CorpImages.net Online Hosting Manual
                                                          Internet All Around Marketing

            t1.id = tp.id
            and t1.tvab=tp.tvab
            and t1.id = t2.id
            /* Just the sceening survey */
            and tp.survey_no = 5
            /* This makes each pair only appear once */
            and t1.tvab='1' and t2.tvab='2'
group by
            t1.event, t2.event;




CorpImages.net Online Hosting Manual                                                 81
                                                                                            Internet All Around Marketing



CHAPTER EIGHTEEN - MATTS ARCHIVE CGI SCRIPTS

We DO NOT provide technical support for these scripts. We have included some general information regarding
these scripts. If you need additional support outside of what we have provided, please refer to Matt's Archives for
more detailed information. We will not reply to support questions sent to us regarding these scripts, however, we
will provide you the necessary server information that is required in these scripts. Contact Technical Support for this
information.

CGIemail
Cgiemail is another form processing script you can find at Matt's, totally different than FormMail. It is a program
written in the C language that takes the contents of fill-in boxes on a form and emails them to a specified location.
In addition to the form specification in the .html file, a mail specification in a .txt file is required to format the
resulting email message.

This script should be placed in the cgi-bin directory of your server. And then have an action in your order.htm file
to call it. It should look like this:

<form method=post action="http://www.yourdomain.com/cgi-bin/cgiemail/order.txt">

Details are provided below. While there are a number of subsections below this one, they all work together and
are meant to be read from start to finish.

order.htm:

Look for a file in your www directory called order.htm. This is our example form we put on your site that shows
how a form should be configured to work with Cgiemail. Look at it in a browser, and download it to your hard-drive
using FTP so you can see how it works. If you've never dealt with HTML forms before, don't worry, they're easy to
create and understand.

The form prompts the user for data that is sent to the server as simple key-value pairs. Each <input> tag specifies
a record. The key is given by the name attribute, and the value is given by the value attribute. The type attribute
tells the browser what kind of data to expect. Now, try looking at the example.

Please note that the hidden items are used to transmit critical info to Cgiemail. They provide the location of the
success file, the name of the person the results should be sent to, and the subject of the form. When making your
own forms, you may want to change the email address in the "required-to" field, and likely the subject in the
"subject" field. The first item tells Cgiemail what to show the user after successfully completing the form. You can,
but don't need to customize this.

After that come the items that are actually presented to the user. You'll want to use type=text input items with
cgiemail: it's a simple tool. The size=60 tells the browser how big to make the box. The name=something is
required in each input tag, otherwise the browser wouldn't know how to send the data to the server. The value=" "
attribute is correct in most cases, unless you want a default value in the form.

Note that if a field begins with required-, cgiemail will require that the user enter a value for this field. This is
particularly useful if you want to require a user to submit their email address.

When the user presses the Submit button, the data goes to our machine where cgiemail starts doing something
with it. What is does is controlled by the order.txt file discussed below.

By the way, you can name your HTML form anything you want to.

 82                                                                                        CorpImages.net Online Hosting Manual
                                                                                           Internet All Around Marketing



order.txt:

Now that we have all this data, what do we do with it? Mail it, of course! But for flexibility, cgiemail requires that
you create a mail.txt file to show it what to send. (If you didn't want flexibility you'd use a mailto link.) The program
will read this file, perform substitutions, and pass it to the mail system.

Make sure that you upload mail.txt in ASCII mode. Failure to upload mail.txt in ASCII mode will generate the
message:

"Server Error: The server encountered an internal error or mis-configuration and was unable to complete your
request."

There is already an example order.txt document in the forms directory in your www directory.

By the way, there's nothing magical about the name order.txt. Feel free to call it mail1.txt or form1.mail, or
whatever suits you, as long as the form has the correct name for what you uploaded.

Note that the first several lines are mail headers. You probably shouldn't change that part, or the corresponding
parts in your form. In particular, there must be a To: header or the mail won't go anywhere!

What cgiemail does is simply replace every string that looks like [key] with the value the user typed into the field
with name=key. That's all. You can lay out your form as is best for your users, but lay out your mail.txt as is best
for you to read. You can even insert gobs of text to help format the output. Only the [key] parts will be replaced by
cgiemail.

Cgiemail does not report environmental variables like FormMail will, but other than that, it is an excellent program,
allowing you more flexibility in the way you want your data returned by the form.

Guestbook
Guestbook allows you to set up your own comment page. From there, visitors can add entries to your guestbook
and they will be displayed with the most recent at the top and scrolling down, or vice versa. Other options include
the ability to limit HTML in the entry, link to e-mail address with mailto tag, use a log to log entries, redirect to a
different page after signing, emailing whenever a new entry is added, and much more.

You can obtain the guestbook script and its other necessary files from Matt's CGI Archives site as well.

You can change several of the configuration options by downloading the guestbook.cgi file from Matt's to your
hard drive. Create a copy of the file and give it the same name, then edit the options as specified below. Keep
your backup of the original guestbook.cgi in case you run into problems.

Option 1: $mail:

This option will allow you to be notified via an E-mail address when a new entry arrives in your guestbook. The
entry will be mailed to you as a notification. If you should choose to turn this variable on you will need to fill in the
2 variables that go along with it:

$recipient - Your email address, so that the mailing program will know who to mail the entry to.

$mailprog - The location of your sendmail program on your host machine.

Option 2: $uselog:

CorpImages.net Online Hosting Manual                                                                                        83
                                                                                           Internet All Around Marketing


This will allow you the ability to use the short log feature. It is already turned on so you will have to change it to 0 if
you do not wish to use it. It has been implemented since there are probably many people who feel no need to
have a log when people are making entries to a file anyway. Keep in mind that it will show errors which is one
nice aspect about it.

Option 3: $linkmail:

Turning this option on will make the address links in your guestbook become hyperlinked. So instead of simply
having (name@some.host) it will put <a href="mailto:name@some.host">name@somehost</a> so that anyone
can simply click on the address to email them.

Option 4: $separator:

This allows you to choose whether you want guestbook entries to be separated by a Paragraph Separator <p>, or
a Horizontal Rule <hr>. By changing the 0 in the script to a 1, you will turn on the <hr> separator and turn off the
<p> separator. The 0 option will do the reverse of that; turn on the <p> and turn off the <hr>.

Option 5: $redirection:

By choosing 1 you will enable auto redirection and 0 will return a page to the user telling them their entry has
been received and click here to get back to the guestbook.

Option 6: $entry_order:

Set this option to 0 and the newest entries will be added below the rest of the entries. Keep this option at 1 and
the guestbook will add the newest entries at the top.

Option 7: $remote_mail:

Many users of the guestbook have requested that a form letter be automatically sent to the remote user when
they fill in the guestbook. Turning this option on will tell the script to automatically mail any user who leaves an
email address. You can specify the contents of the mail message by editing the section of the script that sends
mail to the remote user. By default it sends a message that says, "Thank you for adding to my guestbook." and
then shows them their entry. If you should choose to turn this variable on, you will need to fill in the 2 variables
that go along with it:

$recipient - Your email address so that the mailing program will know who to mail the entry to.

$mailprog - The location of your sendmail program on your host machine.

Option 8: $allow_html:

This option allows you to turn on or off the use of HTML tags by users of your guestbook. Setting this variable to 1
allows users to embed html tags such as <b> or <H1> or <a href=" "></a> into your html document. Setting this
variable to 0 will not allow them to use any html syntax in their comments or any other field. You can still link to
their comments or any other field. You can still link to their email address by turning $link_mail to 1.

There is also the ability for users to add their own URL and then their name is referenced to their URL in the
guestbook.html file. This helps to eliminate the need for allow_html to be turned on, and lets users point you to a
spot that will tell you more about them. Several users of the guestbook script have asked for this option. If you
wish to disable the option, simply delete the following line from your addguest.html file:

URL: <input type=text name=url size=50>

 84                                                                                       CorpImages.net Online Hosting Manual
                                                                                          Internet All Around Marketing



The other file included with the guestbook is called:

guestbook.html:

This is the file that you will link to that will contain the Guestbook Entries. You may want to edit the title and
heading spaces and customize the look any way you desire. Do not delete the line <!--begin--> from this
guestbook, or else the script will have no way of knowing where to begin the editing. The <!--begin--> line is the
only necessary line in your guestbook.html file, but the link to the addguest.html file is also a good idea. :-)

Free-For-All Links Page
Free For All Link Page allows you to set up a web page which your users can then add links to in specified
categories. Newest links are added to the top of each category. A running total of the number of links present as
well as the time when the last link was added is shown at the top of the page.br>

Random Text Generator
Just download this file to your hard drive and edit it with any random text you would like placed in an html
document. Remember to keep the %% separator between quotes. You can use any html formatting tags you want
to, including <href> tags so you can configure it as a random link generator.

You can put in as many quotes as you wish. Upload the random.txt file to your server in the same location you
found it, remembering to upload it in ASCII or text mode.

The script uses SSI (Server Side Includes) so the page you want to use random text on must have the .sht, .shtm,
or .shtml extension. On your page, just put this tag wherever you want the random text to appear:

<!--#exec cgi="/cgi-bin/randomtext.cgi"-->

That's all there is to it!

WWW Board
WWW Board is a threaded World Wide Web discussion forum and message board, which allows users to post
new messages, follow-up to existing ones and more.

There are several options you may want to configure. First of all, the index.sht file in the bbs directory can be
customized any way you wish as long as you leave the method and input tags the way they are.

Additionally, here are some options contained in the wwwboard.pl script itself which you may want to change,
depending on your needs:

$show_faq = 1;

This option allows you to choose whether or not you want to display a link to the FAQ on every individual
message page or not. It defaults to 1 and the link will be put in at the top of the message along with links to
Follow-ups, Post Follow-up and Back to $title. Setting this to 0 will turn it off, and keeping it at 1 will keep the link.
You need to create a faq.html file and put it inside the bbs directory. The FAQ can contain any information you
want to give your visitors about how the board works, your organization, types of postings that will be allowed, etc.

$allow_html = 1;


CorpImages.net Online Hosting Manual                                                                                     85
                                                                                         Internet All Around Marketing

This option lets you choose whether or not you want to allow HTML mark-up in your posts. If you do not want to
allow it, then everything that a user submits that has <>'s around it will be cut out of the message. Setting this
option to 1 will allow HTML in the posts and you can turn this option off by setting it to 0.

$quote_text = 1;

By keeping this option set to 1, the previous message will be quoted in the follow-up text input box. The quoted
text will have a ':' placed in front of it so you can distinguish what had been said in the previous posts from what
the current poster is trying to get across. Setting this option to 0 will leave the follow-up text box empty for the new
poster.

$subject_line = 0;

There are three options for the way that you can display the subject line for the user posting a follow-up. Leaving
this option at 0 which is the default value, will put the previous subject line into the follow-up form and allow users
to edit the subject however they like. Setting this option to 1, however, will quote the subject, but simply display it
to the user, not allowing him or her to edit the subject line. The third and final option can be achieved by setting
the $subject_line variable to 2. If it is set to 2, the subject will not be quoted and instead the user will be prompted
with an empty subject block in their follow-up subject line.

$use_time = 1;

This option allows you to choose whether or not you want to use the hour:minute:second time with the
day/month/year time on the main page. Day/Month/Year will automatically be placed on the main wwwboard.html
page when a new entry is added, but if you leave this variable at 1, the hour:minute:second time will also be put
there. This is very useful for message boards that get a lot of posts, but if you would like to save space on your
main page, you can set this to 0, causing the hour:minute:second display not to be added.

Search.cgi
Search will look at all your html pages for words you enter, and return all pages on a list with links. This script
should be uploaded to your cgi-bin, and for Search.cgi to return a response, it needs to be activated. This is easily
done by logging in via telnet and at the prompt after login type the following command:

chmod +r /www/yourdomain

Now you can access search.cgi with the following URL:

http://yourdomain.com/cgi-bin/search.cgi.

There is a configuration file called search_define.pl which accompanies search.cgi and sets up the variables for it.
You can customize which files you wish to exclude from searches, and also the cosmetics of the search and
results pages.

Single Page Shopping Cart
You can obtain a Single Page Shopping Cart from Matt's Archives as well. The configuration process is rather
long and complicated and unless you are familiar with the language we recommend that you refer to Matt's
Archive and download all the referring materials for this script.

Quick Guidelines on Using SSI's
Your domain is capable of supporting use of SSI's, support is limited to the exec cgi command and in order for the

86                                                                                      CorpImages.net Online Hosting Manual
                                                                                     Internet All Around Marketing

system to process the include you must save the page with a .shtml or .sht rather than .htm or .html.

Sample SSI:

<!--#exec cgi="/cgi-bin/count.cgi"-->
Please note as shown in the example above, the URL must be relative and not a full call, this would not work:

<!--#exec cgi="http://yourdomain.com/cgi-bin/count.cgi"-->

Permission Settings for Scripts:
Type:                                           Normal Site:     Frontpage Site:
WWWBoard:
bbs dir                                         chmod777         chmod777
bbs/messages                                    chmod777         chmod777
bbs/index.sht                                   chmod666         chmod666
bbs/data                                        chmod666         chmod666
cgi-bin/wwwboard.pl                             chmod755         chmod755

Guestbook:
Guestbook dir                                   chmod755         chmod755
Guestbook/guestbook.cgi                         chmod755         chmod777
Guestbook/guestbook.setup                       chmod666         chmod666
Guestbook/guestbook.html                        chmod666         chmod666

Free For All Links:
links dir                                       chmod755         chmod777
links/links.htm                                 chmod666         chmod666
cgi-bin/links.pl                                chmod755         chmod755

Graphic Counter:
counter dir                                     chmod775         chmod777
counter/logs                                    chmod777         chmod777
counter/ all other files                        chmod666         chmod666
cgi-bin/counter                                 chmod755         chmod755

Cgi-bin always chmod 755 all
scripts chmod 755 in main bin

cgi-bin/counters (text counter)                 chmod755         chmod777

Random Text:
random dir                                      chmod775         chmod777
random/random.txt                               chmod666         chmod666

Password Admin:
password dir                                    chmod755         chmod777
All password files                              chmod666         chmod666




CorpImages.net Online Hosting Manual                                                                            87
                                                                                           Internet All Around Marketing



CHAPTER NINETEEN - REAL AUDIO/REAL VIDEO

NOTE: We no longer support RealAudio and RealVideo. However, if you know how to install it yourself you are
more than welcome to do so. It is very easy to install and you can obtain full instructions on downloading it and
implementing it at Real Networks Site. We have provided the following information as a courtesy.

RealAudio and RealVideo technology utilizes an interactive system between the RealVideo Server and the
RealPlayer to enable real-time audio and video delivery over the Internet. When the user clicks on a link on a
Web page, the clip buffers and then begins to play, all within a few seconds. This gives the deceiving impression
that the file is linked directly to the Web page. In reality, information is passing between the Web server
supporting the Web page, the RealVideo Server supporting the file, and the RealPlayer.

How does streaming audio/video work?

The file itself is not linked through the web page, contrary to general belief. Information actually passes between
the web server, the RealServer, and the RealPlayer. The RealPlayer can only retrieve RealAudio and Video. If
you have a link to the actual file on your server, the file will be downloaded completely before the RealPlayer can
play it. There needs to be a go between the web server and the Real Server. This go between is a metafile. This
metafile provides the URL of the file to be played to the RealPlayer.

What is a Metafile and how does it work?

Metafiles are text files that contain the URL location of a RealAudio or RealVideo file. Remember that RealAudio
and RealVideo files cannot be referenced directly by the Web page because this would cause them to be
downloaded in their entirety before playback. In order for the files to be played in real-time, they must be played
through a RealPlayer, and served by a RealVideo Server. Therefore there must be a link between the Web server
and the RealVideo Server. The link is contained in the metafile.

You will need to create a .ram file that calls your real audio/video file. The .ram file is a text file with an absolute
URL. This URL will need to be:

http://yourdomain.com/filename.rm

Typically you'll create a realaudio file subdirectory under yourdomain-www, and put all your audiofiles there.

Then your .ram file, a.k.a., metafile, will contain an address with this format:

http://yourdomain.com/subdirectory/filename.rm

The "subdirectory" is a subdirectory of your domain-www directory.

For example: http://yourdomain.com/musicfiles/music.rm

The above address goes in the .ram/metafile, not in your HTML code. Your HTML code calls the .ram/metafile.
Then the .ram/metafile is used to call up the .rm/realmedia file. So for example, your HTML code would look
something like this:

<a href="http://musicforyou.com/ra/music.ram">Click here to listen to music.</a>

I've got RealAudio installed on my site, but it's not streaming. It's downloading the file and then playing it.
I didn't want it to do this!



 88                                                                                       CorpImages.net Online Hosting Manual
                                                                                     Internet All Around Marketing

You need to have a metafile call the file itself.

How do I make a metafile?

Let's say you want to play the RealAudio file that is named hello.rm

You make a text file with the following line:

pnm://servername/username/domain-www/file.rm

and save the file as hello.ram

(Email Technical Support if you do not know your servername and we will provide you with this information).

You then call the hello.ram in your HTML code as you would any html document.

Where can I get more information about creating Real Audio/Video files?

You can find this information at Real Networks Site.




CorpImages.net Online Hosting Manual                                                                            89
                                                                                       Internet All Around Marketing



CHAPTER TWENTY - COUNTER

How to setup a counter
There are different types of counters you can setup on any of your web pages. Below are a few examples. To
create the counter image, you need to do the following two things. Decide what type of counter you would like to
use, and place the corresponding code in your web page (example code is under "HTML Code" below).

You can place this code in your HTML page by using the File Manager in the control panel to edit your pages.
Note: Input your site specific data in place of "YourDomain.com-PageName.html" in the HTML tag below.
Please be sure not to use strange characters like "/" in the name of your data file.

Counter Examples:

         Image                                                HTML Code
                         <img src="/cgi-sys/Count.cgi?df=YourDomain.com-PageName.html">

                         <img src="/cgi-sys/Count.cgi?df=YourDomain.com-PageName.html&display=date">

                         <img src="/cgi-sys/Count.cgi?df=YourDomain.com-PageName.html&display=clock">




How to change the appearance of my counter
1. Change the digit style
We have five (5) different styles of digits installed on our server. You can change the style of your counter by
simply adding dd=(A,B,C,D,or E) to the img tag. For example:

                          <img src="/cgi-sys/Count.cgi?df=YourDomain.com-PageName.html&dd=C">


Below are the five styles of digits included on our server:
                                                  <img src="/cgi-sys/Count.cgi?df=YourDomain.com-
                                       Style A    PageName.html&dd=A">
                                                  <img src="/cgi-sys/Count.cgi?df=YourDomain.com-
                                       Style B    PageName.html&dd=B">
                                                  <img src="/cgi-sys/Count.cgi?df=YourDomain.com-
                                       Style C    PageName.html&dd=C">
                                                  <img src="/cgi-sys/Count.cgi?df=YourDomain.com-
                                       Style D    PageName.html&dd=D">
                                                  <img src="/cgi-sys/Count.cgi?df=YourDomain.com-
                                       Style E    PageName.html&dd=E">



2. Change the border of the counter
You can change the width of the border on your counter by adding ft=X (where X is the number of pixels). For
example:


90                                                                                    CorpImages.net Online Hosting Manual
                                                                                              Internet All Around Marketing




                     <img src="/cgi-sys/Count.cgi?df=YourDomain.com-PageName.html&dd=C&ft=0">



3. What if I want to use more than one counter?
No problem, all you need to do is simply change the data file (df) to yourdomain.com-whatever. Make sure you include your
domain name or sub-directory name in the name of the data file. Just be sure not to use strange characters like "/" in the name
of your data file.

4. More documentation on the counter
The author of count.cgi explains this much better than we do in his faq.




CorpImages.net Online Hosting Manual                                                                                          91
                                                                                  Internet All Around Marketing



APPENDIX

Mailing Lists

Summary of what SmartList provides

•    The overseeable management of an arbitrary number of mailinglists
•    Convenient and simple creation of new mailinglists
•    Convenient and simple removal of existing mailinglists
•    Fully automated subscription/unsubscription/help-request processing (no operator intervention needed)
•    Enough intelligence to overcome the ignorance of some subscribers (will direct subscribe and unsubscribe
     requests away from the regular list and automatically onto the -request address)
•    No hardwired format for (un)subscribe requests (i.e. new subscribers need not be educated, unsubscribing
     users do not need to remember any particular syntax)
•    *Intelligent* autoremoval of addresses from the list that cause too many bounces
•    Submissions can be limited to people on the accept list (which could be the current list of subscribers)
•    The fully automated subscription mechanism allows for a reject list of unwanted subscribers and a general
     address screening mechanism which allows you to control exactly who is allowed to subscribe
•    Optional implicit subscription upon first submission to the list
•    MIME-compliant auto-digest-generation (configurable per list)
•    Joint management of several mailinglists possible
•    Customisation per mailinglist or mailinglist group possible (simply remove or create the desired links)
•    A listmaintainer can be assigned per list; miscellaneous requests that couldn't be handled by the list
     automatically are then forwarded to his mail address (instead of being accumulated in a file)
•    Allows for remote maintenance of any mailinglist by a listmaintainer
•    Integrated archiving service
•    Integrated diagnostic aid to give hints to the maintainer about possible problems
•    Moderated mailinglists with an arbitrary number of moderators
•    Automatically eliminates duplicate submissions
•    You can set up a mailinglist to function as a standalone mail archive server
•    Extended MIME support (autorecognition, encapsulation and suitable encoding of well known (and unknown)
     file formats)
•    The archive server can send arbitrarily long (even binary) files in MIME-multipart mails


$Id: INTRO,v 1.10 1995/10/30 02:09:08 srb Exp $

How to set up mailing lists

Copyright (c) 1993-1995, Stephen R. van den Berg, The Netherlands. <srb@cuci.nl>

This document mainly describes a sendmail environment, much of it applies to non-sendmail mail agents as well.


Contents:

     1.   Intro
     2.   Bouncing mail
     3.   The disadvantages
     4.   How to circumvent these disadvantages

92                                                                               CorpImages.net Online Hosting Manual
                                                                                          Internet All Around Marketing

    5. Why use procmail to filter the mailinglist mail?
    6. How do I use procmail to filter the mailinglist mail?


1. Introduction

The simplest and most direct way to setup a mailinglist is by inserting a line in the /usr/lib/aliases file looking like:

mylist: fred,john, wilma, barney@bedrock, pebbles

Now all the mail arriving at your machine for "mylist" (either local or mylist@your.domain) will be automatically
forwarded to all the mentioned addresses (fred, john, etc.).

The address mylist@your.domain is intended for submissions to the list that are supposed to be forwarded to all
the subscribers. For the administrative tasks like removals from the list, new subscriptions to the list, or address
changes of subscribers, it is common practice to create a second entry in the /usr/lib/aliases file:

mylist-request: your_login_name@your.domain


2. Bouncing mail

In order to deal with bouncing mail gracefully, an extra precaution should be taken. If for example mail to wilma
bounces (user non-existent, mail filesystem full, etc.), it will bounce back to the original sender. Now, the only
person that should be concerned with distribution failures should be the mylist-request holder. Therefore you
should be using a sendmail special alias like:

owner-mylist: mylist-request@your.domain

This way local mail will bounce back to mylist-request@your.domain.


3. The disadvantages

If you are using the above methods, some obvious disadvantages come to mind however:

a. The subscriber list cannot exceed 1000 bytes (on many sendmails).
b. The subscriber list cannot be changed on-the-fly (/usr/lib/aliases needs to be edited, and newaliases has to
   be run).
c. People cannot be prevented from submitting messages like "Please remove me from this mailinglist" to mylist
   (and thereby annoying all subscribers).
d. People cannot be guarded from themselves in case they insert "Return-Receipt-To:" fields in their headers (if
   they are particularly unlucky, they will receive an acknowledge mail from *every* subscriber's sendmail).
e. People including "Errors-To:" or "Sender:" fields can cause the bounce messages to bypass owner-mylist
   anyway.
f. There is no way of limiting the number of submitters, i.e. every person who knows the name of the mailing list
   and who can send mail to your.domain is able to submit messages to the list. This means, for example, that
   you
   cannot limit a mailing list to local users (i.e. only local users can submit).
g. You are unable to insert a "Reply-To: mylist@your.domain" in case you would want to (this makes replying
   to the list easier, too easy as some people say).




CorpImages.net Online Hosting Manual                                                                                        93
                                                                                       Internet All Around Marketing


4. How to circumvent these disadvantages

a. Can be circumvented by using nested aliases such as:
   mylist: mylist1, mylist2
   mylist1: fred,john
   mylist2: wilma,barney@bedrock,pebbles
   This can however, become extremely messy to maintain.

b. This can be avoided if you use aliases such as:
   mylist: :include:/path/to/the/memberfile
   The memberfile should contain:
   fred,john,wilma,barney@bedrock,pebbles
   This will also take care of the upper limit on aliases expansions and newaliases need not be run again every
   time you change the file.

c.    Can only be taken care of by using a mailfilter like procmail.

d. Can only be taken care of by using a mailfilter like procmail.

e. Can only be taken care of by using a mailfilter like procmail.

f.    Can only be taken care of by using a mailfilter like procmail.

g. Can only be taken care of by using a mailfilter like procmail.


5. Why use procmail to filter the mailinglist mail?

Instead of using a mailfilter you could also take care of most of the problems three till seven by editing the
sendmail.cf file. I would strongly recommend against this approach however, since this will be too much of a
customising operation and surely will not be a trivial task (in all cases). As a general rule: don't mess with a
sendmail.cf file once it works :-).

Now, you could, instead of procmail, simply use immediate VNIX commands like grep, sed or awk to do the mail
filtering. Again, there are some obvious disadvantages with this approach:

a. In case any system resources go out (no more file descriptors, no more swap space, process table full, file
   system full (for temporary files)) your awk or shell script will fail generously (i.e. several bad things could
   happen: mail munged, truncated, lost, hanging awk or sh programs, etc., you get the picture).

b. All mail headers (including From: and Reply-To:) could very well be multi-line headers; it will be very difficult
   to make it understandable to awk that somehow the header line could continue on the next line (in case you
   want to remove a header, or do some complicated substitution).

c.    Another hairy problem will be determining the end of the header, of course that is solvable, but you have to
      make some extra precautions in your awk script to ensure that any substitutions/changes will not occur in the
      body of the message (further degrading performance and increasing the load on your machine).

d. Starting programs directly from within aliases or .forward files can get extremely messy, since the
   environment the program starts in is potentially hostile.

Procmail does not *directly* allow you to change any headers, but that feature is not really necessary since you
can tell procmail to send ONLY the header through some filter of your choice.

 94                                                                                   CorpImages.net Online Hosting Manual
                                                                                            Internet All Around Marketing



To comment on the previously mentioned three disadvantages:

a. Procmail takes care of that. Should the filter have problems anyway, procmail will graciously notice that the
   filter was in some kind of trouble, and will try something else with the original unmunged mail (you can specify
   what it should do of course, obvious choices: try the same filter again, drop the mail in a file and send you a
   notice, forward the mail to you instead (unfiltered), etc.)

b. In order to make consistent scanning of the header possible using the egrep regular expressions built in to
   procmail, procmail will internally concatenate any headers that were continued according to the RCF 822
   recommendations, in order for external filters to benefit from this, you would use the formail program to pre-
   filter the mail.

c.   Procmail can be told to send the header, the body or both through the filter, hence your filter need not watch
     out to avoid doing any substitutions in the body, and the filter can therefore be a lot simpler.

d. Procmail makes no assumptions about the environment it is started in, it assumes that everything is hostile
   and fights its way back to the civilised world by initialising *everything* to sane and expected default values.
   Thereby providing a warm bed for any program started from within procmail.

But procmail has some additional advantages as well:

•    It will probably all go a bit faster, since only the header of the mail is being piped through the filter. Also,
     procmail reads in the mail in 16KB chunks, not line by line as sed does.

•    You could use procmail to filter out any messages to the normal mailing list that should have gone to the
     mylist-request and remail them to mylist-request.


Well, anyway, as you see, procmail does not give you everything you would want, but this was intentional in
accordance to the true VNIX spirit (modularity). What procmail does provide is a *very* reliable hook (you might
say it provides an anchor :-) for any mail processing you might do. For the more complex things you still have to
use shell scripts or call other programs from within procmail, but then again, that saves you from learning any
particular syntax procmail would have had to do the same.

As it happens, the accompanying formail program is able to cater to most (if not all) of your needs regarding mail
munging.


6. How do I use procmail to filter the mailinglist mail?

In order to cater for most wishes regarding mailinglist setup, I took the liberty to write some rcfiles for procmail that
can readily be used to create any number of mailinglists in a comfortable and simple way. They are called the
"SmartList" mailinglist package.

See the FEATURES file in this directory for more information on what the SmartList mailinglist scripts will do for
you.

If the scripts do not exactly do what you would have liked, you are invited to edit them to taste. Perhaps you could
send your changes to the SmartList mailinglist if you feel that they could be useful to others.

To get started I suggest you read the INSTALL file in this directory.

For operating instructions you should read the Manual file in this directory.

CorpImages.net Online Hosting Manual                                                                                    95
                                                                              Internet All Around Marketing




P.S. Any suggestions/corrections/improvements on this document are welcome.




96                                                                            CorpImages.net Online Hosting Manual

								
To top