PHP Scripting Essentials
Freeola Internet Get Dotted Domains Chat & Gaming
Freeola.com The UK Internet Free Service Provider
Talk to Your Visitors - Add a Chat Forum to Your Site
 
Browse Support:
 Support Home Broadband Guides Dial-up Guides E-mail Guides Web Space Guides Domain Names Guides Misc Help Network Status Online Support System
 
 
Get Dotted Domain Portfolio Discounts
PHP Scripting Essentials


Welcome to the Freeola Internet customer support pages. This guide is designed to give some general information about PHP scripting. For more internet help topics please visit our main Support Page.

Below is some essential information for using PHP on Freeola's hosting services, and also some examples of more advanced features such as hit counters & php includes.

As you'd expect from the UK's best free Internet package, Freeola enables users to take advantage of the superior web scripting and programming language - PHP.

PHP, which stands for PHP: Hypertext Preprocessor, is an HTML-embedded scripting language which will allow you to create an interactive website without the use of CGI. Guestbooks, 'formmail' and hit counters are just a few things that PHP can handle. To see some examples of what PHP elements you can use, please click here.

Like standard HTML pages, all files are uploaded into your htdocs directory on the Freeola server.

Freeola's standard hosting servers currently support both PHP 4 and 5. The VIP Hosting servers support PHP version 5.2.6. For a full list of PHP versions and modules on each of the Freeola web servers please visit the PHP Configuration and Modules page.

PHP File and Folder Permissions

Following a server upgrade last year, a change has been made to our PHP configuration which means that permissions on PHP scripts need to be set more securely than they did previously. To change any permissions of any web file or folder Freeola recommends you use an FTP client such as Filezilla, for example.

In order to comply with the new security requirements you must ensure that you follow the guidelines below :

1. PHP scripts cannot be in a folder that is writable by anyone other than the user.

The usual permissions for your htdocs folder would be to set them to 755 not 777.

2. PHP scripts cannot have their permissions set so that they are writable by anyone other than the user.

The usual permissions for your PHP files would be to set them to 755 not 777.

3. PHP script files cannot have their permissions set so that they are writable by anyone other than the user.

The usual permissions for your PHP files would be to set them to 644 not 777.

4. Some commands such as exec, shell_exec,system and passthru are no longer available.

5. PHP5 support is now available on all standard and VIP Freeola Servers.

In order to make use of PHP5 rather the standard PHP4 you simply have to name any of your PHP files with the extension .php5, rather than the usual .php extension (eg. index.php5 rather than index.php).

6. Following this upgrade, a change has been made to our PHP configuration to switch register_globals OFF. This basically means that statements such as:

echo $my_variable_name;

will no longer function correctly. There is a simple resolution to this problem in the form of some code that should be inserted into the top of your page. Here are some examples:

If the variable you are trying to access is passed via the URL string:

$my_variable_name=$_GET['my_variable_name'];

If the variable you are trying to access is passed via a form post operation:

$my_variable_name=$_POST['my_variable_name'];

If the variable you are trying to access is a server environment variable:

$my_variable_name=$_SERVER['HTTP_HOST'];


Displaying the Date and Time:

You can display the local date and time on your webpage using PHP. Simply copy and paste the following red PHP code into your webpage where you would like the date and time to be displayed:

<?php echo date('D M d, Y H:i:s'); ?>

The date will display like this:
Sat Nov 07, 2009 23:01:24

Don't forget that you must give the page a .php ending for PHP to work correctly (e.g. 'mypage.php').


Including Another File Into Your Web Page

An 'include' is a way of embedding information from a single file into another file. This is particularly useful for multiple web pages which need to show the same piece of information. Once set up you then only need to change one file to change that information across all of your pages.

A PHP 'include' statement looks like this:

<?php include('pagename.php'); ?>

You simply insert this code into your web page(s) exactly where you want the information from the source page to appear. Lets say you have a web site and on every page you show a 'quote of the day'. The quote would be saved in a separate file (say 'quote.php') as plain text and then you could use the following code on every web page where you want the quote to appear. Example:

Today's quote is: <?php include('quote.php'); ?>

The source file can even contain HTML code if required. Includes can save you time and effort when it comes to updating your web site so it's well worth a look for anybody wanting similar content on more than a few pages on their web site.

The file that contains the PHP 'include' statement must have a .php extension. The source file can have any name with or without a file extension (e.g. filename.php', 'filename.html', 'filename.txt' or just 'filename').


Random Image Generator

This useful piece of code allows you to display random images on your web site. The images need to be stored in your web space and the code will randomly pick one to display, it is similar to the way that some companies display random adverts on their web pages. All you need to do is edit the PHP file to match your situation, upload it to your web space and then place the line:

<?php include "randomimage.php"; ?>

where you would like the images to occur.

Download the zip


Password protect a webpage

This code allows you to password protect content on a webpage so that the user must enter the correct details before he can view it. All you need to do is name the page (keeping the .php extension) and then edit it in a text editor putting in your chosen username and password in the relevant places. Put the content you want to protect inside the page and then upload. Your page will now be protected.

Download the zip

Password protecting pages within your Freeola hosted website is done quickly and simply if you are signed up for our VIP+ Hosting service. Enabling this service will allow the protecting of any web page within your site via your MyFreeola account.


To report a fault or get help, contact our support team Sales and support: 0871 210 9977 Email us a support request
Support lines open Monday to Friday 8:30am-8pm, & 9am-5.30pm weekends & Bank Holidays.
Calls cost 10p/minute for BT customers. Charges may vary from other networks/mobiles.
Go back to the Web Space & FTP page
MyFreeola Internet Settings Control Panel
Login or take a free look around.
Forgotten your password?
Free Account Sign-Up
 
Fantastic FREE Unlimited Services for every freeola internet
customer in the UK!
 
Register Domain Names. Buy from £2.99
e.g. yourcompany.com
or just yourcompany.
MORE ABOUT DOMAIN NAMES