Friday, January 14, 2011

How do I connect to my MySQL database?

Applies to: Grid System
Before you can use MySQL at all, you need to create a database for yourself on your Control Panel. Once you have created a database, there are a few ways you can connect to it:
  • At a shell prompt you type all one 1 single line:

    mysql -u DBUSERNAME -h DBSERVER -p DBNAME


    with the following replacements of the bolded terms above:


    Example:

    mysql -u joe -h db.joesmith.com -p joeydb


    If you don't know your MySQL Username or MySQL Databasename, go here.

    You will then be prompted for your MySQL password. If you don't know what that is, go here to set it to something that you will remember.

    If you use preferences set in a .my.cnf file, the connection command would be much shorter, just:

    mysql


    Once at the MySQL prompt, you can then issue SQL commands directly to the MySQL server. For correct SQL syntax, see the MySQL Manual.
  • To connect from a PHP script, just put this in your file:
    mysql_connect("DBSERVER", "DBUSERNAME", "DBPASSWORD");
    mysql_select_db("DBNAME");
    ?>
    using the same substitutions for the bold terms as above, plus substituting DBPASSWORD with your own mysql password.

    Example:

    mysql_connect("db2.modwest.com", "joe", "secret");
    mysql_select_db("joeydb");
  • To connect from a perl script, put this in your file:

    #!/usr/bin/perl
    use DBI;

    $database = "DBNAME";
    $hostname = "DBSERVER";
    $port = "3306";
    $username = "DBUSERNAME";
    $password = 'DBPASSWORD';

    $dsn = "DBI:mysql:database=$database;host=$hostname;port=$port";

    $dbh = DBI->connect($dsn, $username, $password) or die("Could not connect!");

    $sql = "SELECT * FROM mytable";

    $sth = $dbh->prepare($sql);
    $sth->execute;


    while(($column1, $column2) = $sth->fetchrow_array)
    {
    print "C1 = $column1, C2 = $column2n";
    }


    $dbh->disconnect;


    where DBNAME, DBUSERNAME, and DBPASSWORD are your database name, database username and database password, and where DBSERVER is your database server.
source : http://support.modwest.com/content/6/60/en/how-do-i-connect-to-my-mysql-database.html

Visually Enhancing Pages (And Sound Too!)

The Web has come a long way since 1992. Now graphics are very common (and sometimes a bit annoying). With the release of Netscape, server-push animation became possible, although it was slow and awkward. This server-push animation is not practical for animations of any significant length and has never really been used for much other than novelty purposes. But with Java, the possibility for real-time animations is a reality.

Visual enhancements are some of the simplest applets to program and use. Often these applets are simply variations of image viewers, but you can create surprisingly different applets using the techniques required to make an image viewer. For example, the following applets can be created by displaying and manipulating images:
  • A clock
  • A applet to create an interactive demonstration
  • An interactive animation
  • A photo viewer
All these types of applets use image techniques; the clock moves hands to display the time, a demonstration applet shows diagrams, an animator flips a series of images for motion, and a photo viewer cycles through snapshots. All these applets contain a lot of similar code, yet all accomplish different tasks. The following sections examine some of these applets and how they enhance the appearance of Web pages.

Clock Applets

The Web is global entity and is certainly not limited to any specific geographic area or time zone. In fact, the global aspect of the Web is one of its most appealing factors. Java applets can help enhance the global nature of the Web.
Many Web pages have begun to incorporate snapshots of the weather outside or other forms of local information. Silly as it may seem, the local time is one of the most basic forms of local information and can be a very useful navigation device. The following Java clocks can be used to show time information on your Web page:


Clock
Written by Nils Hedström
http://www.webbasedprogramming.com/Creating-Web-Applets-with-Java/tppmsgs/msgs0.htm#21
WorldClock
Written by Vijay Vaidy
http://www.webbasedprogramming.com/Creating-Web-Applets-with-Java/tppmsgs/msgs0.htm#22


The first clock uses graphic images to draw the hands of an analog clock (see Figure 4.1). The second clock has no graphical enhancements and displays the time and date information using text (see Figure 4.2).
Figure 4.1. A clock is an example of an informative applet.
Figure 4.2. A simple clock applet showing times at various locations around the world.
Listing 4.1 shows some of the Java code used to produce the clock in Figure 4.1.
    Listing 4.1. Partial code for the Clock applet.
public class Clock extends java.applet.Applet implements Runnable
{
  int width,height,num_lines,sleep,timezone,backgroundType;
  Polygon clockBackground;
  URL homepage;
  private Needle hour,minute,second;
  double pi=3.1415926535f;
  Color clockBackground_col,clockBackgroundBorder_col,backgroundBorder_col,background_col;
  Thread animate=null;
  Image backBuffer;
  Image backgroundImage;
  Graphics backGC;
public void run() //Run the applet
    {
      while (true) 
        {
          updateNeedles();
          repaint();
          try {Thread.sleep(sleep);} catch (InterruptedException e){}
      
        }
    }
public void makeClockBackground() // Creates a polygon-background with num_lines-corners
    {
      double add,count;
      clockBackground=new Polygon();
      add=2.*pi/num_lines;
      for(count=0;count<=2.*pi;count+=add)
        {
          clockBackground.addPoint(size().width/2+(int)(size().width*Math.cos(count)/2.),
                          size().height/2+(int)(size().height*Math.sin(count)/2.));
        }
    }
   
  public void drawClockBackground(Graphics g) // Draws the background of the Clock
    {
      if(backgroundType!=1)
        {
          g.setColor(clockBackground_col);
          g.fillPolygon(clockBackground);
          g.setColor(clockBackgroundBorder_col);
          g.drawPolygon(clockBackground);
        }
      if(backgroundType!=0)
        {
          int img_width=backgroundImage.getWidth(null);
          int img_height=backgroundImage.getHeight(null);
          int x=(size().width-img_width)/2;
          int y=(size().height-img_height)/2;
          if (x<0) x=0;
          if(y<0) y=0;
          if((img_width!=-1) && (img_height!=-1))
            g.drawImage(backgroundImage,x,y,null);
        }
    }
  public void start()  // When the applet is started

    {
      if (animate == null) {
        animate = new Thread(this);
        animate.start();
      }
    }
      
  public void stop() // When the applet is stopped
    {
      if (animate != null) {
        animate.stop();
        animate=null;
      }
    }
A clock applet requires quite a bit of code. Listing 4.1 shows only a third of the code needed to produce the entire clock shown in Figure 4.1. The applet developer must also provide the images used to make up the clock face and hands and the animation that keeps the hands moving and keeping accurate time. The code shown in Listing 4.1 should give you an idea about what's involved in creating Java applets. Java applets are full-fledged programs, and as such, they require some time and planning to create them.

Juggling Applet

Applets can also be used for educational purposes or to inform users about how to accomplish tasks by means of demonstration. Rather than just listing a number of steps, applets can visually demonstrate how to do something. For some topics, a visual demonstration is far more effective than a verbal explanation. The following applet is an example of how you can use graphics and animation to demonstrate concepts (see Figure 4.3):


Juggling Applet
Written by Christopher Sequin
http://www.webbasedprogramming.com/Creating-Web-Applets-with-Java/tppmsgs/msgs0.htm#23


Figure 4.3. The Juggling Applet is an example of how applets can be used for interactive educational purposes.
Listing 4.2 shows the code for the Juggling Applet. Keep in mind that this code does quite a bit. It lets the user configure the number of balls used in the demonstration, it animates the hands, and it animates the balls along the correct paths. Don't worry about compiling this code, the applet is included on the CD-ROM. The listing is just provided to give you an example of some real Java code.
    Listing 4.2. Code for the Juggling Applet.
/*
 * @(#)Juggling.java                          1.0f 95/05/01 Chris Seguin
 * E-mail:  seguin@uiuc.edu
 *
 * Copyright  1995 University of Illinois (UIUC)
 */
import java.io.InputStream;
import java.awt.*;
import java.net.*;
/**
 * JugglingImages class. This is a container for a list
 * of images that are animated.
 *
 * @author      Chris Seguin
 * @version     1.0f, May 1, 1995
 */
class JugglingImages {
    /**
     * The images.
     */
    Image imgs[];
    /**
     * The number of images actually loaded.
     */
    int nImagesCount = 0;
    /**
     * Load the images, from dir. The images are assumed to be
     * named T1.gif, T2.gif...
     */
    JugglingImages(URL context, String dir, Juggling parent) {
        nImagesCount = 0;
        imgs = new Image[10];
        int nWidth = 0;
        for (int i = 1; i < imgs.length; i++) {
            Image im = parent.getImage(parent.getDocumentBase(), 
                                       dir + "/T" + i + ".gif");
          
            imgs[nImagesCount++] = im;
        }
    }
}
/**
 * BallPaths class. This is a container for a path
* of juggling balls
 *
 * @author      Chris Seguin
 * @version     1.0f, May 1, 1995
 */
class BallPaths {
    /**
     * Arrays containing the path of the balls
     */
    int pnX[] = {0};
    int pnY[] = {0};
    int nLength = 1;
    /**
     * LookupX - looks up the appropriate value of X
     */
    public int LookupX (int nIndex) 
    {
    if ((nIndex > nLength) || (nIndex < 0))
        return 0;
    return pnX[nIndex];
    }

    /**
     * LookupY - looks up the appropriate value of Y
     */
    public int LookupY (int nIndex) 
    {
    if ((nIndex > nLength) || (nIndex < 0))
        return 0;
    return pnY[nIndex];
    }
    /**
     * Length - the number of data points stored in the path
     */
    public int Length ()
    {
    return nLength;
    } 
}
/**
 * CascadeBallPaths class. This is a container for a path
* of juggling balls, the balls are moving in a standard 
 * cascade pattern
*

 * @author      Chris Seguin
 * @version     1.0f, May 1, 1995
 */
class CascadeBallPaths extends BallPaths {
  
    /**
     * Arrays containing the path of the balls
     */
    int pnX[] = {     20,   24,   27,   31,   35, 
                      40,   45,   50,   55,   60, 
                      65,   70,   75,   80,   85, 
                      90,   95,  100,  105,  110, 
                     115,  120,  125,  130,  135, 
                     143,  144,  141,  138,  134, 
                     130,  126,  123,  119,  115, 
                     110,  105,  100,   95,   90, 
                      85,   80,   75,   70,   65, 
                      60,   55,   50,   45,   40, 
                      35,   30,   25,   20,   15, 
                       7,    6,    9,   12,   16
                     };
    int pnY[] = {     76,   78,   76,   70,   60, 
                      60,   50,   42,   34,   28, 
                      22,   18,   14,   12,   10, 
                      10,   10,   12,   14,   18, 
                      22,   28,   34,   42,   50, 
                      66,   68,   70,   72,   74, 
                      76,   78,   76,   70,   60, 
                      60,   50,   42,   34,   28, 
                      22,   18,   14,   12,   10, 
                      10,   10,   12,   14,   18, 
                      22,   28,   34,   42,   50, 
                      66,   68,   70,   72,   74
                     };
    /**
     *  The length of the arrays
     */
    int nLength = 60;
    /**
     * LookupX - looks up the appropriate value of X
     */
    public int LookupX (int nIndex) 
    {
    if ((nIndex >= nLength) || (nIndex < 0))
        return 0;
    return pnX[nIndex];
    }
    /**
     * LookupY - looks up the appropriate value of Y
     */
    public int LookupY (int nIndex) 
    {
    if ((nIndex >= nLength) || (nIndex < 0))
        return 0;
    return pnY[nIndex];
    }
    /**
     * Length - the number of data points stored in the path

     */
    public int Length ()
    {
    return nLength;
    } 
}
/**
 * ReverseCascadeBallPaths class. This is a container 
 * for a path of juggling balls, the balls are moving 
 * in a reverse cascade pattern
 *
 * @author      Chris Seguin
 * @version     1.0f, May 1, 1995
 */
class ReverseCascadeBallPaths extends BallPaths {
 
    /**
     * Arrays containing the path of the balls
     */
    int pnX[] = {     12,    9,    6,    3,    0, 
                       0,    5,   10,   15,   20, 
                      25,   30,   35,   40,   45, 
                      50,   55,   60,   65,   70, 
                      75,   80,   85,   90,   95, 
                     100,  103,  106,  109,  112, 
                     115,  118,  121,  124,  127, 
                     130,  125,  120,  115,  110, 
                     105,  100,   95,   90,   85, 
                      80,   75,   70,   65,   60, 
                      55,   50,   45,   40,   35, 
                      27,   24,   21,   18,   15  };
    int pnY[] = {     60,   60,   60,   60,   60, 
                      60,   51,   42,   35,   28, 
                      23,   18,   15,   12,   11, 
                      10,   11,   12,   15,   18, 
                      23,   28,   35,   42,   51, 
                      60,   60,   60,   60,   60, 
                      60,   60,   60,   60,   60, 
                      60,   51,   42,   35,   28, 
                      23,   18,   15,   12,   11, 
                      10,   11,   12,   15,   18, 
                      23,   28,   35,   42,   51, 
                      60,   60,   60,   60,   60 };
    /**
     *  The length of the arrays
     */
    int nLength = 60;
    /**
     * LookupX - looks up the appropriate value of X
     */
    public int LookupX (int nIndex) 
    {
    if ((nIndex >= nLength) || (nIndex < 0))
        return 0;
    return pnX[nIndex];
    }
    /**
     * LookupY - looks up the appropriate value of Y
     */
    public int LookupY (int nIndex) 
    {
    if ((nIndex >= nLength) || (nIndex < 0))
        return 0;
    return pnY[nIndex];
    }
    /**
     * Length - the number of data points stored in the path
     */
    public int Length ()
    {
    return nLength;
    } 
}
/**
 * JugglingBall class. This is a juggling ball
 *
 * @author      Chris Seguin
 * @version     1.0f, May 1, 1995
 */
class JugglingBall {
    /**
     * The location on the ball's path
     */
    int nCycleSlot;
    /**
     * The color of the ball - specified by an index into the ball array
     */
    int nBallColor;
    /**
     * The current location of the ball
     */
    int nX;
    int nY;
    /**
     * The path to follow
     */
    BallPaths ptbpPath;
    /**
     * JugglingBall - creates a juggling ball
     */
    public JugglingBall (int nStartPos, int nStartColor, BallPaths ptbpThePath)
    {
    nCycleSlot = nStartPos;
    nBallColor = nStartColor;
    ptbpPath = ptbpThePath;
    nX = ptbpPath.LookupX(nStartPos);
    nY = ptbpPath.LookupY(nStartPos);
    }
    /**
     * Move - moves the ball to the next location
     */
    public void Move ()
    {
    nCycleSlot++;
    if ((nCycleSlot >= ptbpPath.Length ()) || (nCycleSlot <= 0)) {
        nCycleSlot = 0;
        }
    nX = ptbpPath.LookupX(nCycleSlot);
    nY = ptbpPath.LookupY(nCycleSlot);
    }
    /**
     * XLoc - returns the x location
*/
    public int XLoc ()
    {
    return nX;
    }
    /**
     * YLoc - returns the Y location
     */
    public int YLoc ()
    {
    return nY;
    }
    /**
     * Color - returns the color
     */
    public int Color ()
    {
    return nBallColor;
    }
}
/**
 * HandPath class. This is a container for the paths of the hands
 *
 * @author      Chris Seguin
 * @version     1.0f, May 3, 1995
 */
class HandPath {
  
    /**
     * Arrays containing the path of the hands
     */
    int pnLeftHandX[] = {
                       7,    6,    9,   12,   16, 
                      20,   24,   27,   31,   35, 
                      35,   31,   27,   24,   20, 
                      16,   12,    9,    6,    7
                     };
    int pnRightHandX[] = {
                     143,  144,  141,  138,  134, 
                     130,  126,  123,  119,  115, 
                     115,  119,  123,  126,  130, 
                     134,  138,  141,  144,  143
                     };
    int pnHandY[] = {
                      73,   75,   77,   79,   81, 
                      83,   85,   83,   77,   67, 
                      67,   57,   51,   49,   51, 
                      53,   55,   57,   59,   61
                     };
    /**
     *  The length of the arrays
     */
    int nLength = 60;
    int nBalls = 0;
    /**
     * HandPath - creates a hand path
     */
    public HandPath (int nStartBalls) 
    {
    nBalls = nStartBalls;
    }
    /**
     * LookupX - looks up the appropriate value of X
     */
    public int LookupX (int nIndex, boolean bLeft) 
    {
    if ((nIndex >= nLength) || (nIndex < 0))
        return 0;
    //  Limit the lookup to the range
    if (nIndex >= 20 * nBalls)
         nIndex = 19;
    while (nIndex >= 20)
         nIndex -= 20;
    //  Look up the value
    if (bLeft)
        return pnLeftHandX[nIndex];
    else
        return pnRightHandX[nIndex];
    }
    /**
     * LookupY - looks up the appropriate value of Y
     */
    public int LookupY (int nIndex) 
    {
    if ((nIndex >= nLength) || (nIndex < 0))
        return 0;
    //  Limit the lookup to the range
    if (nIndex >= 20 * nBalls)
         nIndex = 19;
    while (nIndex >= 20)
         nIndex -= 20;
    //  Look up the value
    return pnHandY[nIndex];
    }
    /**
     * Length - the number of data points stored in the path
     */
    public int Length ()
    {
    return nLength;
    } 
}
/**
 * Hand class. This is a hand 
 *
 * @author      Chris Seguin
 * @version     1.0f, May 3, 1995
 */
class Hand {
    /**
     * The location on the ball's path
     */
    int nCycleSlot;
    /**
     * Whether this is the left hand
     */
    boolean bLeft;
    /**
     * The current location of the ball
     */
    int nX;
    int nY;
    /**
     * The path to follow
     */
    HandPath phPath;
    /**
     * Hand - creates a hand
     */
    public Hand (int nStartPos, HandPath phThePath, boolean bStartLeft)
    {
    nCycleSlot = nStartPos;
    bLeft = bStartLeft;
    phPath = phThePath;
    nX = phPath.LookupX(nStartPos, bLeft);
    nY = phPath.LookupY(nStartPos);
    }
    /**
     * Move - moves the ball to the next location
     */
    public void Move ()
    {
    nCycleSlot++;
    if ((nCycleSlot >= phPath.Length ()) || (nCycleSlot <= 0)) {
        nCycleSlot = 0;
        }
    nX = phPath.LookupX(nCycleSlot, bLeft);
    nY = phPath.LookupY(nCycleSlot);
    }
    /**
     * XLoc - returns the x location
*/
    public int XLoc ()
    {
    return nX;
    }
    /**
     * YLoc - returns the Y location
     */
    public int YLoc ()
    {
    return nY;
    }
}
/**
 * A juggling demonstration program
 *
 * @author      Chris Seguin
 * @version     1.0f, May 1, 1995
 */
public class Juggling extends java.applet.Applet implements Runnable {
    /**
     * The path of the juggling balls
     */
    BallPaths pjbPaths;
    /**
     * The juggling balls
     */
    JugglingBall pjbBalls[] = {null, null, null};
    /**
     * The paths that the hands trace out
     */
    HandPath phHandPaths;
    /**
     * The hands
     */
    Hand phLeft;
    Hand phRight;
    /**
     * The directory or URL from which the images are loaded
     */
    String dir;
    /**
     * The images used.
     */
    JugglingImages jbiImages;
    /**
     * The thread animating the images.
     */
    Thread kicker = null;
    /**
     * The delay between animation frames
     */
    int nSpeed;
    /**
     * Shape of the window
     */
    int nHeight = 0;
    int nWidth = 0;
    /**
     * The number of balls in the demonstration
     */
    int nBalls = 0;
    /**
     * Parameter info.
     */
    public String[][] getParameterInfo() {
        String[][] info = {
            {"balls",  "int",  "the number of balls to animate"},
            {"speed",  "int",  "the speed the balls move at"},
            {"img",    "urls", "the directory where the images are located"},
        };
        return info;
    }
    /**
     * Initialize the applet.  Get attributes.
     */
    public void init() {
        //  Load the parameters from the HTML file
        String at = getParameter("img");
        dir = (at != null) ? at : "images";
        at = getParameter("speed");
        nSpeed = (at != null) ? Integer.valueOf (at).intValue() : 20;
        at = getParameter("height");
        nHeight = (at != null) ? Integer.valueOf (at).intValue() : 100;
        at = getParameter("width");
        nWidth = (at != null) ? Integer.valueOf (at).intValue() : 170;
        at = getParameter("balls");
        nBalls = (at != null) ? Integer.valueOf (at).intValue() : 3;
        //  Initialize the Ball variables
        pjbPaths = new CascadeBallPaths ();
        pjbBalls[0] = new JugglingBall ( 0, 0, pjbPaths);
        pjbBalls[1] = new JugglingBall (40, 2, pjbPaths);
        pjbBalls[2] = new JugglingBall (20, 4, pjbPaths);
      
        //  Initialize the hand variables
        phHandPaths = new HandPath (nBalls);
        phLeft = new Hand (5, phHandPaths, true);
        phRight = new Hand (35, phHandPaths, false);
        resize(nWidth, nHeight);
    }
    /**
     * Run the image loop. This method is called by class Thread.
* @see java.lang.Thread
     */
    public void run() {
        //  Create the thread
        Thread.currentThread().setPriority(Thread.MIN_PRIORITY);
        //  Load the images
        jbiImages = new JugglingImages(getDocumentBase(), dir, this);
       
        //  Do the animation
        int ndx = 0;
        while (size().width > 0 && size().height > 0 && kicker != null) {
            for (ndx = 0; ndx < nBalls; ndx++) {
                 (pjbBalls[ndx]).Move();
            }
           
            phLeft.Move();
            phRight.Move();
           
            repaint();
            try {Thread.sleep(nSpeed);} catch (InterruptedException e){}
        }
    }
   
   /**
     * Paint the current frame.
     */
    public void paint(Graphics g) {
        update ;
    }
    public void update(Graphics g) {
        if ((jbiImages != null) && (jbiImages.imgs != null)) {
            //  Erase the background
            g.setColor(java.awt.Color.lightGray);
            g.fillRect(0, 0, nWidth, nHeight);
            int ndx = 0;
            for (ndx = 0; ndx < nBalls; ndx++) {
                if (jbiImages.imgs[pjbBalls[ndx].Color ()] == null) {
                    System.out.print ("ERROR::No Image ");
                    System.out.println (ndx);
                }
                g.drawImage(jbiImages.imgs[pjbBalls[ndx].Color ()], 
                      (pjbBalls[ndx]).XLoc(), (pjbBalls[ndx]).YLoc(), this);
            }
           
            //  Draw the hands
            g.drawImage(jbiImages.imgs[7], 
                        phLeft.XLoc(), phLeft.YLoc(), this);
            g.drawImage(jbiImages.imgs[7], 
                        phRight.XLoc(), phRight.YLoc(), this);
        }
    }
    /**
     * Start the applet by forking an animation thread.
     */
    public void start() {
        if (kicker == null) {
            kicker = new Thread(this);
            kicker.start();
        }
    }
    /**
     * Stop the applet. The thread will exit because kicker is set to null.
     */
    public void stop() {
        kicker = null;
    }
}

source : http://www.webbasedprogramming.com/Creating-Web-Applets-with-Java/cwa04fi.htm#I1

 

Creating and Using Classes with Visual FoxPro

In Chapter 13, "Introduction to Object-Oriented Programming," you briefly learned some of the issues related to creating classes in Visual FoxPro. All the work was done in code, which is a good way to look at creating classes because it provides a clear view of what you can do when you create classes.
The following sections provide a definitive look at the syntax of creating and using classes in Visual FoxPro.

Defining Classes

You define classes using the DEFINE CLASS/ENDDEFINE construct. Here is an example:
DEFINE CLASS <classname> AS <baseclass>
    *-- Declaration Code Here
    PROTECTED <list of member variables>

    PROCEDURE <methodproc> (param1, param2 ....)
        LOCAL <list of local variables>
        *-- Procedure Code Here
    ENDPROC

    FUNCTION <methodfunc> (param1, param2 ....)
        LOCAL <list of local variables>
        *-- Function code here
        RETURN <returnval>
    ENDFUNC
ENDDEFINE
In the following sections you read about each portion of the construct separately.

DEFINE CLASS <classname> AS <superclass>

This line of code tells Visual FoxPro that you are creating a class. All code between DEFINE and ENDDEFINE relates to this class. <classname> is the name of the class and <superclass> is the name of the class upon which the class is based. This can be a built-in class provided with Visual FoxPro 6 or one that you create or purchase.
The term superclass used here is in line with terminology used in most texts that discuss object orientation. Unfortunately, Microsoft uses the term parentclass to mean the same thing. Don't let the terminology throw you.
By definition, every class created in Visual FoxPro is a subclass of another class. At the highest level, classes created in Visual FoxPro are subclasses of what Microsoft calls base classes, the classes that ship with Visual FoxPro. Visual FoxPro 6 comes with the base classes shown in Table 14.1.


Table 14.1  Visual FoxPro 6 Base Classes

Class Name

Description

Visual

Form Control Toolbar

SubclassOnly
ActiveDocAn active document object that can be hosted in a host browser such as Internet Explorer.  
CheckBoxA standard check box control similar to the check box created in FoxPro 2.x.  
ColumnA column on a grid control.  
ComboBoxA combo box similar to the pop-up control in FoxPro 2.x.  
CommandButtonEquivalent to a pushbutton in FoxPro 2.x.  
CommandGroupA group of command buttons that operate together. Equivalent to a group of pushbuttons in FoxPro 2.x controlled by one variable.  
ContainerA generic object designed to hold other objects. This is useful when you are creating a class that has more than one object on it.  
ControlThe same as the container class with one major difference: When the object in a container class is instantiated from the class, you can address all objects within the container. The Control class hides all internal objects and only allows communication with the control class.  
CursorA cursor definition in a data environment.  
CustomPrimarily used for objects that are not visual but might contain visual objects as members.  
DataA collection of cursors Environment and relations to open or close as a unit.  
EditBoxThe equivalent of a FoxPro 2.6 edit region.  
FormA single "screen." This is a container object in that it can (and usually does) contain other objects. The equivalent of a FoxPro 2.x screen.  
FormSetA container-type object that has one or more forms as members. This is the equivalent of a FoxPro 2.x screen set.  
GridA container-type object that allows display and editing of information in browse-type format.  
HeaderThe header of a grid column.  
Hyperlink ObjectProvides button, image, or label object that when clicked, launches a Web browser and navigates to a hyperlink.  
ImageA picture. 
LabelThe equivalent of placing text on a screen in FoxPro 2.x.  
LineA drawn line.  
ListBoxThe equivalent of the FoxPro 2.x scrolling list control.  
OleControlA control based on an OLE 2 object.  
OptionButtonA single radio button-type object.  
OptionGroupMultiple radio buttons that operate as a single control. This is the equivalent of a FoxPro 2.x radio button object.  
PageA single page within a page frame.  
PageFrameA tabbed control. Each tab within a tab control is a separate page. The page frame control is a container-type control because it can (and usually does) contain many objects.  
ProjectHookCreates instance of opened project that enables programmatic access to project events.  
RelationA definition of a relation between two cursors in a data environment.  
SeparatorObject that puts blank spaces between controls on a toolbar.  
ShapeA shape (such as a circle or a box).  
SpinnerThe equivalent of the FoxPro 2.x spinner control.  
TextBoxThe equivalent of a FoxPro 2.x "plain" GET control.  
TimerA visual object that does not display on a form. This control is designed to allow for actions at certain timed intervals.  
ToolBarA toolbar, which is a group of objects that can be docked at the top, bottom, or sides of the desktop. When not docked, a toolbar looks something like a form.  

As Table 14.1 indicates, classes can be categorized in three ways: "Visual," "Form Control Toolbar," and "Visual Class Designer Only." Classes can be visual or nonvisual. A visual class "displays," whereas a nonvisual class does not have a display component attached to it. In addition, some classes are not available from the Form Control toolbar. Finally, some classes are available only in the Visual Class Designer for subclassing, not for use as controls.
The Visual column specifies whether a base class is visual or nonvisual. Form Controls Toolbar specifies whether the base class is available on that toolbar. Subclass Only specifies those base classes that are intended for subclassing and provide little functionality on their own (for example, the Container class).
Most classes are available in the Form Designer from the Form Controls toolbar, but others are not. Some of those unavailable classes (such as Page, Header, and OptionButton) are unavailable because they are members of other objects. For example, Page is a member of PageFrame, Header is a member of Grid, and OptionButton is a member of OptionGroup. FormSet is not a control per se but a container of forms; it is created by combining multiple forms.
Finally, some classes are specifically designed for subclassing and are only available either in code or through the Visual Class Designer. You learn about the Visual Class Designer in the section "The Visual Class Designer" later in this chapter.
The classes that are controls available within the Form Designer are discussed in Chapter 9 "Creating Forms." In addition to the base classes included with Visual FoxPro 6, you can base classes on your own classes. Finally, the DEFINE CLASS/ENDCLASS structure must live on its own and cannot be nested within a loop or a decision structure (such as IF/ENDIF). Think of each class definition construct as its own "procedure" and you'll be fine.
*--Declaration Code Here/PROTECTED <list of member variables>  Declaration code declares your class member variables. Only the member variables listed here are properties of objects instantiated from this class (with the exception of member objects, which are discussed later in this chapter in the section "Creating Composite Classes"). If a member variable is an array, you would declare the array in this section of code.
Another important piece in this section is the declaration of protected members. A protected member is a member variable that is not visible outside the class. In other words, methods within the class can access and modify that variable, but the variable does not exist as far as the outside world (anything that is not a method of the class) is concerned.
You declare member variables protected by using the keyword PROTECTED and then listing the member variables that you want protected. The following example creates a protected member variable called cProtected:
PROTECTED cProtected
You must declare a property protected within the declaration section of the DEFINE CLASS construct.
An example of a member variable that would be declared PROTECTED? is a member that saves the state of the environment when the object is instantiated. The variable can be used to reset the environment when the object is released, but it serves no purpose to programs instantiating the object and interacting with it. As a matter of fact, you would not want this member variable to be changed by the outside world. Hence, you would protect it in the declaration section of code.
PROCEDURE <methodproc> (param1, param2....)/ENDPROC FUNCTION <methodfunc> (param1, param2....)/ENDFUNC  This line of code defines a method. <methodproc> and <methodfunc> refer to the name of the method. Note that you can call a method a FUNCTION or a FUNCTION-both syntaxes are equivalent. I like to use the FUNCTION syntax if the method is intended to return a value; otherwise I use PROCEDURE.
Parameters sent to a method can be accepted with a PARAMETERS statement (more typically LPARAMETERS), or the parameters can be accepted in parentheses after the name of the method. For example, if a method called ShowVals were to accept two parameters (Parm1 and Parm2), the code to accept these parameters would look like this:
PROCEDURE ShowVals
LPARAMETERS Parm1, Parm2
it might also look like this:
PROCEDURE ShowVals(Parm1, Parm2)
Of the two, I prefer the second syntax because I think it reads better. You can choose either one.
Be aware that parameters sent through to methods, whether the parameters are called as a procedure (such as loObject.Method(Parm1)) or a function (such as lcVar = loObject.Method(Parm1)), are treated like parameters sent through to a user-defined function: They are sent through by VALUE unless either SET UDFPARMS has been set to REFERENCE (I don't recommend changing the setting of SET UDFPARMS) or the name of the parameter is sent through with the @ sign.
For example, note the TSTPROC.PRG test procedure presented in Listing 14.1. The return values quoted assume the default setting of SET UDFPARMS.


Listing 14.1  14CODE01.PRG-Test Procedure That Illustrates the SET UDFPARMS Command Settings
lcText = "Menachem"
loX = CREATEOBJECT("test")

*-- Call testfunc first as a procedure and then as a method
*-- without specificying by reference.

loX.testfunc(lcText)    && "Proc" Syntax
? lcText                && Shows "Menachem"

=loX.testfunc(lcText)    && Func Syntax
? lcText                && Shows "Menachem"

loX.testfunc(@lcText)    && "Proc" Syntax
? lcText                && Shows 10
lcText = "Menachem"        && Reset for next test

=loX.testfunc(@lcText)    && Func Syntax
? lcText                && Shows 10
lcText = "Menachem"        && Reset for next test

loX.testproc(lcText)    && "Proc" Syntax
? lcText                && Shows "Menachem"

=loX.testproc(lcText)    && Func Syntax
? lcText                && Shows "Menachem"

loX.testproc(@lcText)    && "Proc" Syntax
? lcText                && Shows 10
lcText = "Menachem"        && Reset for next test

=loX.testproc(@lcText)    && Func Syntax
? lcText                && Shows 10
lcText = "Menachem"        && Reset for next test

DEFINE CLASS test AS custom
    FUNCTION testfunc (Parm1)
        Parm1 = 10
    ENDFUNC

    PROCEDURE testproc (Parm1)
        Parm1 = 10
    ENDPROC
ENDDEFINE

Methods can be protected like member variables-that is, they can only be called from other methods in the class-by adding the keyword PROTECTED before PROCEDURE or FUNCTION (PROTECTED PROCEDURE <methodproc>). Methods that are protected do not exist outside the class, and an error is generated if an attempt is made to call them.
As a general rule, methods should be protected if they are not intended for the "outside world." This saves you a lot of trouble down the road. For example, a method that is intended only to be called by other methods in the class would be protected.
If a method has to return a value, a RETURN statement precedes the ENDPROC/ENDFUNC statement as shown in the following example:
PROCEDURE ShowDate
    RETURN date()
ENDPROC

FUNCTION FuncShowDate
    RETURN date()
ENDFUNC
Methods are closed with the ENDPROC or ENDFUNC command; the command you use depends on the command used to start the method definition.

Instantiating Objects

Objects are instantiated from their classes with the CREATEOBJECT function. Here's the syntax:
loObject = CREATEOBJECT(<classname> [, <Parameter list>])
The CREATEOBJECT function returns an object reference that is stored in loObject. <classname> is a string indicating the class to be used for instantiation. Parameters follow in the CREATEOBJECT function; they appear one at a time and are separated by commas. Parameters are accepted in the object's Init method. (You learn the Init method and sending parameters later in this chapter in the section "A Technical Tip-Sending Parameters to an Object.")
In order to instantiate an object with CREATEOBJECT, the class definition has to be available when the CREATEOBJECT function is used. If you have manually coded your classes as opposed to using the Visual Class Designer (as shown in Chapter 15, "Creating Classes with Visual FoxPro"), the program that has the class definitions must be available. The program is made available with SET PROCEDURE or by placing the class definitions in a program that is higher in the calling chain.
You can release the procedure file once the object is instantiated if you use SET PROCEDURE. Visual FoxPro loads all the methods into memory when the object is instantiated.
Always remember that an instance is just a memory variable and follows almost all of the same rules as regular memory variables. Objects can be made local, public, or private and will lose or keep scope like any other memory variable.
There is one significant difference between an object (known as an instance variable) and other Visual FoxPro variables: Variables can be thought of as holding values, whereas instance variables do not hold values-they hold references to an object, which in turn holds the values.
This has three implications. First, an instance variable is always passed to procedures and functions by reference. Second, if an instance variable is copied into another variable, all changes in the second variable affect the same object. Finally, an object is not released until all references to it have been released. Here is an example:
loInstance = CREATEOBJECT("Form")
loInstance.Show()                                && Show the form
loVar = loInstance                                && loVar points to the form
      too, now.
loInstance.Caption = "Hello"                && Caption changes
loVar.Caption = "There"                        && Caption changes again
RELEASE loInstance                                && Form does not disappear
RELEASE loVar                                        && Now it disappears

Calling Methods

You always call methods by specifying the name of the instance variable, then a period, and then the name of the method. Here is an example:
loClass.MyMethod
Parameters are sent through to a method by listing them in parentheses after the method name. Here is an example:
loClass.MyMethod(Parm1, "StringParm2")
There is no DO syntax for a method. To call a method and get a return value, the syntax is almost identical. You specify a variable to accept the value:
lcRetVal = loClass.MyMethod(Parm1, "StringParm2")
If no parameters are sent through to the method, you can still use parentheses after the method name. Here is an example:
loClass.MyMethod
I use this syntax exclusively because it is much clearer that the member you are accessing is a method, not a property.

Base Events, Methods, and Properties

As you know from reading Chapter 9 different controls have different events, methods, and properties. For example, the Label control has a Caption property, whereas the TextBox control has a Value property.
Each control shown in the default Form Controls toolbar is a base class in Visual FoxPro and can be used as the basis for your own classes.
In addition to the classes shown in the Form Controls toolbar, there are four classes specifically designed to be used as the basis for user-defined classes. They do not show up on the Form Controls toolbar nor are they part of other classes (such as an OptionButton, which is part of an OptionGroup control). These classes are Container, Control, Custom, and ToolBar.
Although each base class supports its own set of events, properties, and methods, there is a common set of events, methods, and properties that apply to all base classes in Visual FoxPro.

Base Properties

The following list shows the properties that are common to all of Visual FoxPro's base classes.
Property Description
Class The name of the object's class
BaseClass The name of the object's base class
ClassLibrary The full path of the class library where this class is defined
ParentClass The name of the class upon which this class is based

Base Events and Methods

The following list shows the events and methods that are common to all of Visual FoxPro's base classes.
Event Description
Init Invoked when the object is created. Accepts parameters sent through to the object. Returning .F. aborts object instantiation.
Destroy Invoked when the object is released.
Error Invoked when an error occurs inside one of the object's methods.

In the next chapter you learn the properties and methods of the four special base classes just mentioned.

The Error Method

The Error method is important and worthy of special note. The Error method is called in the event an ON ERROR-type error occurs in a class. The Error method takes precedence over the setting of ON ERROR, which is important because this enables you to encapsulate error handling where it belongs-within the class itself. You see examples of the Error method and its uses in the next chapter.

Creating Composite Classes

A composite class is a class that has members that are themselves instances of other classes. A perfect example of this is a class based on a container-type class, such as a form. When you think of it, a form itself is a class, yet the objects in it are classes, too. Therefore, you have one object that has other objects contained in it (hence the name container class).
When you work with code you can add object members in one of two ways. The first way uses the ADD OBJECT command and is called within the declaration section of code. Here is the syntax:
ADD OBJECT <ObjectName> AS <ClassName> ;
    [ WITH <membervar> = <value>, <membervar> = <value> ... ]
<ObjectName> is the name you want to give to the instance variable being added to the class. <ClassName> is the class upon which <ObjectName> is based. You can specify special settings for member variables of the added object by setting them after a WITH clause. Here is an example:
DEFINE CLASS Foo AS FORM
    ADD OBJECT myCommandButton AS CommandButton ;
        WITH    caption = "Hello", ;
                height = 50
ENDDEFINE
When class Foo is instantiated, a member variable called myCommandButton is added to the form with a height of 50 pixels and a caption of "Hello." When the form is shown, the command button will be happily waiting for you to click it.
The second syntax is the AddObject method. This method can be called from either inside the class or outside the class. This means that you can add objects to container-type objects on-the-fly. Here is the AddObject method's syntax:
<object>.AddObject(<Member Name>,<Class Name>[, Parameters])
To mimic the prior example (note that I do not even define a class for this one), I could do this:
loFoo = CREATEOBJECT("Form")
loFoo.AddObject("myCommandButton", "CommandButton")
loFoo.MyCommandButton.Caption = "Hello"
loFoo.MyCommandButton.Height = 50
loFoo.MyCommandButton.Visible = .T.
loFoo.Show

Accessing Child Member Variables and Methods

As far as Visual FoxPro is concerned, using the object names from the previous example, loFoo is a parent object and MyCommandButton is a child object. As you just saw, the properties of the child object, MyCommandButton, can only be accessed by going through its parent.


TIP
Composite objects can have members that are themselves composite objects. This can lead to a very long "path" to get to a member variable. If you want to cut through the keystrokes, copy a reference-to another memory variable-to the object you're trying to get to and work with it that way. For example, assume you have an object with the following hierarchy and you want to work with the text box for a little while: MyForm.MyPageFrame.myContainer.myTextBox
Just use this code:
loMyObj = MyForm.MyPageFrame.myContainer.myTextBox
From here on you can access all the properties and methods of MyTextBox through loMyObj. This can save you a lot of typing. Remember, though, that you will not be able to get rid of any parent objects of myTextBox without first releasing loMyObj.

Differences Between ADD OBJECT and AddObject

A review of the code examples for ADD OBJECT and AddObject show some differences. First of all, ADD OBJECT enables you to set properties on the calling line, whereas AddObject does not. You have to access the member variables individually. Secondly, when a visual object is added to a container with AddObject, the object is hidden by default (its Visible property is set to .F.), which enables you to set the display characteristics before showing the control. AddObject enables you to send parameters to the object's Init method, whereas ADD OBJECT does not. Finally, ADD OBJECT enables you to turn off the Init method when you instantiate the member object with the NOINIT clause; AddObject does not have this capability.

THIS Revisited

In the previous chapter you learned a special keyword called THIS. Its purpose is to enable a class to refer to itself. There are three additional keywords along this line that are applicable for composite classes only. Here is a list of these keywords:

THISFORM This keyword is special for members of Form-based classes. It refers to the form on which an object lies.
THISFORMSET This keyword is special for members of a form that is part of FormSet. It refers to the FormSet object of which the current object is a member.
PARENT This keyword refers to the parent of the current object.

Note that you can move up the hierarchy with this.parent.parent.parent (you get the idea).

Adding Objects with CreateObject

Can you add an object to another object with CreateObject? In effect, can you do this:
DEFINE CLASS test AS custom
    oForm = .NULL.

    PROCEDURE INIT
        this.oForm = CREATEOBJECT("form")
    ENDPROC
ENDDEFINE
The short answer is yes and no. Sound confusing? Let me explain. The code snippet shown here does indeed create an object with a member called oForm that is an object. However, oForm is not a child of the object. oForm is a member variable that is an object. This might sound as if I'm splitting hairs, but there are some very important differences.
First, the PARENT keyword will not work with oForm. Second, because the member object is not a child object, you can do some interesting things. Take a look at this bit of code:
DEFINE CLASS foo AS form
    ADD OBJECT myForm AS Form ;
        WITH    caption = "Hello", ;
                height = 50
ENDDEFINE

DEFINE CLASS bar AS form
    PROCEDURE init
        this.addobject("myForm", "Form")
    ENDPROC
ENDDEFINE

DEFINE CLASS foobar AS Form
    oForm = .NULL.

    PROCEDURE init
        this.oForm = CREATEOBJECT("form")
    ENDPROC
ENDDEFINE
Neither class Foo nor Bar works. If you try to instantiate them, you get an error because you cannot add an object based on any descendant of the Form class to a form-based object. The last iteration, class FooBar, works just fine. You'll see a more practical example of this capability in Chapter 17, "Advanced Object-Oriented Programming."

How Classes are Created in Visual FoxPro

So far, all the examples you have seen for creating classes in Visual FoxPro deal with code. In fact, as shown in Table 14.1 and further detailed in Chapter 15, there are some classes that can only be created via a coded program.
For the most part, however, creating classes is much more efficient using the Visual Class Designer-the tool provided with Visual FoxPro to make the job of creating classes easier.

Why a Visual Class Designer?

Why do you need a Visual Class Designer when you can easily create classes with code? There are three reasons the Visual Class Designer is integral to class development. The first reason is that it insulates you from the intricacies of code. Although you have learned the syntax for creating classes, you should not have to remember and type in the constructs and keywords related to the structure of a defined class. The Visual Class Designer handles this for you.
The second reason is that some classes can get complex rather quickly. This is especially true of some visual classes, such as forms (where the placement of the objects within the container are critical). Creating complex classes is best done visually.
Finally, only classes created with the Visual Class Designer can be managed with the Class Browser, a wonderful tool provided with the product. The Class Browser is discussed in Chapter 16, "Managing Classes with Visual FoxPro."
All three reasons are valid for using the Visual Class Designer. That's why I recommend that you use it whenever you can for developing classes.
\source : http://www.webbasedprogramming.com/Special-Edition-Using-Visual-FoxPro-6/ch14/ch14.htm

PHP

Preface

source : http://www.webbasedprogramming.com/PHP/


PHP, which stands for "PHP: Hypertext Preprocessor" is a widely-used Open Source general-purpose scripting language that is especially suited for Web development and can be embedded into HTML. Its syntax draws upon C, Java, and Perl, and is easy to learn. The main goal of the language is to allow web developers to write dynamically generated webpages quickly, but you can do much more with PHP.


This manual consists primarily of a function reference, but also contains a language reference, explanations of some of PHP's major features, and other supplemental information.

You can download this manual in several formats at http://www.php.net/docs.php. The downloads are updated as the content changes. More information about how this manual is developed can be found in the 'About the manual' appendix.

See also PHP History
Chapter 1. Introduction
Table of Contents
What is PHP?
What can PHP do?
What is PHP?
PHP (recursive acronym for "PHP: Hypertext Preprocessor") is a widely-used Open Source general-purpose scripting language that is especially suited for Web development and can be embedded into HTML.

Simple answer, but what does that mean? An example:

Example 1-1. An introductory example

<html>
<head>
<title>Example</title>
</head>
<body>

<?php
echo "Hi, I'm a PHP script!";
?>

</body>
</html>




Notice how this is different from a script written in other languages like Perl or C -- instead of writing a program with lots of commands to output HTML, you write an HTML script with some embedded code to do something (in this case, output some text). The PHP code is enclosed in special start and end tags that allow you to jump into and out of "PHP mode".

What distinguishes PHP from something like client-side JavaScript is that the code is executed on the server. If you were to have a script similar to the above on your server, the client would receive the results of running that script, with no way of determining what the underlying code may be. You can even configure your web server to process all your HTML files with PHP, and then there's really no way that users can tell what you have up your sleeve.

The best things in using PHP are that it is extremely simple for a newcomer, but offers many advanced features for a professional programmer. Don't be afraid reading the long list of PHP's features. You can jump in, in a short time, and start writing simple scripts in a few hours.

Although PHP's development is focused on server-side scripting, you can do much more with it. Read on, and see more in the What can PHP do? section.

What can PHP do?
Anything. PHP is mainly focused on server-side scripting, so you can do anything any other CGI program can do, such as collect form data, generate dynamic page content, or send and receive cookies. But PHP can do much more.

There are three main fields where PHP scripts are used.


Server-side scripting. This is the most traditional and main target field for PHP. You need three things to make this work. The PHP parser (CGI or server module), a webserver and a web browser. You need to run the webserver, with a connected PHP installation. You can access the PHP program output with a web browser, viewing the PHP page through the server. See the installation instructions section for more information.

Command line scripting. You can make a PHP script to run it without any server or browser. You only need the PHP parser to use it this way. This type of usage is ideal for scripts regularly executed using cron (on *nix or Linux) or Task Scheduler (on Windows). These scripts can also be used for simple text processing tasks. See the section about Command line usage of PHP for more information.

Writing client-side GUI applications. PHP is probably not the very best language to write windowing applications, but if you know PHP very well, and would like to use some advanced PHP features in your client-side applications you can also use PHP-GTK to write such programs. You also have the ability to write cross-platform applications this way. PHP-GTK is an extension to PHP, not available in the main distribution. If you are interested in PHP-GTK, visit its own website.


PHP can be used on all major operating systems, including Linux, many Unix variants (including HP-UX, Solaris and OpenBSD), Microsoft Windows, Mac OS X, RISC OS, and probably others. PHP has also support for most of the web servers today. This includes Apache, Microsoft Internet Information Server, Personal Web Server, Netscape and iPlanet servers, Oreilly Website Pro server, Caudium, Xitami, OmniHTTPd, and many others. For the majority of the servers PHP has a module, for the others supporting the CGI standard, PHP can work as a CGI processor.

So with PHP, you have the freedom of choosing an operating system and a web server. Furthermore, you also have the choice of using procedural programming or object oriented programming, or a mixture of them. Although not every standard OOP feature is realized in the current version of PHP, many code libraries and large applications (including the PEAR library) are written only using OOP code.

With PHP you are not limited to output HTML. PHP's abilities includes outputting images, PDF files and even Flash movies (using libswf and Ming) generated on the fly. You can also output easily any text, such as XHTML and any other XML file. PHP can autogenerate these files, and save them in the file system, instead of printing it out, forming a server-side cache for your dynamic content.

One of the strongest and most significant feature in PHP is its support for a wide range of databases. Writing a database-enabled web page is incredibly simple. The following databases are currently supported:


Adabas D Ingres Oracle (OCI7 and OCI8)
dBase InterBase Ovrimos
Empress FrontBase PostgreSQL
FilePro (read-only) mSQL Solid
Hyperwave Direct MS-SQL Sybase
IBM DB2 MySQL Velocis
Informix ODBC Unix dbm


We also have a DBX database abstraction extension allowing you to transparently use any database supported by that extension. Additionally PHP supports ODBC, the Open Database Connection standard, so you can connect to any other database supporting this world standard.

PHP also has support for talking to other services using protocols such as LDAP, IMAP, SNMP, NNTP, POP3, HTTP, COM (on Windows) and countless others. You can also open raw network sockets and interact using any other protocol. PHP has support for the WDDX complex data exchange between virtually all Web programming languages. Talking about interconnection, PHP has support for instantiation of Java objects and using them transparently as PHP objects. You can also use our CORBA extension to access remote objects.

PHP has extremely useful text processing features, from the POSIX Extended or Perl regular expressions to parsing XML documents. For parsing and accessing XML documents, we support the SAX and DOM standards. You can use our XSLT extension to transform XML documents.

While using PHP in the ecommerce field, you'll find the Cybercash payment, CyberMUT, VeriSign Payflow Pro and CCVS functions useful for your online payment programs.

At last but not least, we have many other interesting extensions, the mnoGoSearch search engine functions, the IRC Gateway functions, many compression utilities (gzip, bz2), calendar conversion, translation...

As you can see this page is not enough to list all the features and benefits PHP can offer. Read on in the sections about installing PHP, and see the function reference part for explanation of the extensions mentioned here.

Why does my website just say "Error 403 Forbidden"?

Applies to: Grid System
Several scenarios can cause a 403 error response from our webservers. When a 403 response is generated, access to the requested file is not allowed for one or more reasons.

Some potential reasons for this response are:


  • The CGI script requested does not have executable permissions set. If this is the problem, here's the solution.

  • A directory index has been requested in a directory for which such requests have been specifically disallowed. If this is the problem, you'll need to change the filename of your home page, change the default home page setting, or undo the disallow setting for directories


  • source : http://support.modwest.com/content/1/144/en/why-does-my-website-just-say-error-403-forbidden.html