Training, Open Source Programming Languages

This is page http://www.wellho.net/resources/ex.php

Our email: info@wellho.net • Phone: 01144 1225 708225

 
For 2023 (and 2024 ...) - we are now fully retired from IT training.
We have made many, many friends over 25 years of teaching about Python, Tcl, Perl, PHP, Lua, Java, C and C++ - and MySQL, Linux and Solaris/SunOS too. Our training notes are now very much out of date, but due to upward compatability most of our examples remain operational and even relevant ad you are welcome to make us if them "as seen" and at your own risk.

Lisa and I (Graham) now live in what was our training centre in Melksham - happy to meet with former delegates here - but do check ahead before coming round. We are far from inactive - rather, enjoying the times that we are retired but still healthy enough in mind and body to be active!

I am also active in many other area and still look after a lot of web sites - you can find an index ((here))
Slide Show - single file example
Maps, Graphics and Geographics example from a Well House Consultants training course
More on Maps, Graphics and Geographics [link]

This example is described in the following article(s):
   • A Presentation about our company - web and PHP - [link]
   • Dynamic / changing images on your web page - [link]

If you're searching for a page where you can try this code, select here

This example references the following resources:
http://www.wellho.net/course/phfull.html
http://www.wellho.net/course/ptfull.html
http://www.wellhousemanor.co.uk/

Source code: showmanor.php Module: H309
<?php

/* This is a "show how it all fits together " example, with a PHP
program, a MySQL database, Style sheets, HTML including image maps,
and more combined into a single demonstration to tell you more about
Well House Consultants and Well House Manor. */

$order "0123456789abcdefghijklmnopqrstuvxyz";

# Has the image been clicked on?
$impos 0;
if (
preg_match('/(\d+),(\d+)/',$_SERVER[QUERY_STRING],$gotten)) {
        
$column floor($gotten[1] / 450. 7);
        
$row floor($gotten[2] / 368. 5);
        
$impos $row $column;
        }

# Have we got a particular image being requested?
if (preg_match('/(\d+)/',$_REQUEST[move],$gotten)) {
        
$impos $gotten[1];
        }

# Work out next and previous
$imnext $impos+1;
if (
$imnext >= strlen($order)) $imnext=0;
$imprev $impos-1;
if (
$imprev $imprevstrlen($order)-1;

$result ""// To prevent injection attacks on old versions
if ($impos >= 0) {
        
$imletter substr($order,$impos,1);
        
$result "<img src=/pix/stim".$imletter.".jpg align=left hspace=8>";

# Is the image described in the database?
        
mysql_connect("[host]","[user]","[password]");
        
mysql_select_db("wellho");
        
$qv mysql_query(
  
"select descriptor from im_library where filename = \"stim$imletter.jpg\"");
        if (
$row mysql_fetch_assoc($qv)) {
        if (
$row[descriptor] != "" ) {
                
$about $row[descriptor];
        } else {
                
$about "Image untitled";
        }} else {
                
$about "Image not in database";
        }

# First visit / image not clicked on

} else {
        
$result "Slideshow Window";
}
# --------------------------------------------------------
?>
<html>
<head>
<style type="text/css">
<!--
h1 {
        font-family: Arial, Helvetica, sans-serif;
        font-size: 36;
        font-weight: bold;
        color: #444488;
        border-bottom-width: thin;
        border-bottom-style: solid;
        border-bottom-color: #FF0000;
}
body {
        font-family: Arial, Helvetica, sans-serif;
        font-size: 16px;
        color: #444488;
}
.about {
        font-family: Arial, Helvetica, sans-serif;
        font-size: 16px;
        color: #CC4444;
        font-style: italic;
}
-->
</style>
<?php if (! $_REQUEST[freeze]) { ?>
<meta http-equiv="Refresh" content="60; URL=/demo/showmanor.php?move=<?= $imnext ?>">
<?php ?>
<title>Well House Consultants and Well House Manor</title>
</head>
<body><h1>Well House Consultants and Well House Manor</h1>
<table width=100% cellspacing=5><tr valign=top><td width=470>
<a href=/demo/showmanor.php><img src=/pix/pansmall.jpg ISMAP></a><br><br>
You may click on any of the small images above and you will see a larger copy of that
image on the right.  Every minute, that image will change to the next one so that you
can see all the pictures, and read about them, in 35 minutes. We teach the technology
used for this demonstration on our <a href=http://www.wellho.net/course/phfull.html>PHP
Programming course</a> and our <a href=http://www.wellho.net/course/ptfull.html>PHP
technology Workshop</a>.
</td><td>
<?= $result ?><b><?= $about ?></b><br><br>
<?php

switch ($imletter) {

case 
"0":
print <<< ZERO
Graham Ellis, our main tutor, gives a presentation in our "Wilts" training room. The Wilts can
comfortably seat 40 for a presentation such as this one, but we limit the number of delegates on
our public courses to just eight so that all students get plenty of workspace, and all students
get plenty of personal tuition from the lecturer during question and answer sessions.
ZERO;
        break;

case 
"1":
print <<< ZERO
We are keen members of local business groups such as the Chamber of Commerce and the Federation
of Small Businesses.  You may sometimes find meetings of both organisations taking place at
Well House Manor and you may find us (the team who run Well House Consultants) attending other
events arranged by the organisations at other venues.  This picture was taken at such an event
which was organised in Swindon - a town with a population of around 200,000 that is about 25
miles from us.
ZERO;
        break;

case 
"2":
print <<< ZERO
Well House Consultants moved to Melksham, Wiltshire, England in 1999, and has its headquarters
in this building which is about 200 years old.  Until 2006, we ran all of our training courses
here, but we have now expanded and we only have our offices at this building, with our courses
running 800 yards up the road at our hotel - Well House Manor.
ZERO;
        break;

case 
"3":
print <<< ZERO
Our training centre at hotel at <a href=http://www.wellhousemanor.co.uk/>Well House Manor</a> is
located in a quiet area of the town of Melksham, in the county of Wiltshire.  The town has a
population of around 24,000, with plenty of shops and places to eat.  This picture is taken from
the rooftop of Well House Manor (somewhere we cannot allow our guests) and shows you the sort
of area that we are based in.
ZERO;
        break;

case 
"4":
print <<< ZERO
If you are attending a course, or visiting the area for other reasons, there are plenty of things
to see nearby.   This picture was taken about 4 miles from our training centre, near the town of
Devizes, where the canal steps up the hillside through a unique series of locks, which are open
to the public and everyone is welcome to look at. You can drive to see the locks if you wish, or
take the bus.
ZERO;
        break;

case 
"5":
print <<< ZERO
Courses at Well House Consultants are illustrated by the tutor drawing diagrams on the whiteboard,
so that you see not only the final diagram but also <b>how it was reached</b>. In this example,
Graham has illustrated how data entered onto forms on web pages is manipulated by PHP so that it
can be safely stored in a MySQL database, then read back from that database later on and safely
displayed on the browser.
ZERO;
        break;

case 
"6":
print <<< ZERO
Well House Consultants is based in the market town of Melksham, where every year we hold a
"Party in the Park" and Carnival - a chance for everyone to enjoy themselves in the summer
sunshine, to take rides, and to listen to music.  All sorts of different people make up the
Melksham community, but they share some things in common ... they're all very welcoming to our
customers, and they're all very friendly.
ZERO;
        break;

case 
"7":
print <<< ZERO
Within a few miles of Melksham are a number of other towns of similiar size - linked by car, by
bus and by train - and there's a network of footpaths too. There's Chippenham and Calne and
Devizes and Trowbridge and (in this picture) Bradford-on-Avon.
ZERO;
        break;

case 
"8":
print <<< ZERO
This is <a href=http://www.wellhousemanor.co.uk>Well House Manor</a>.   It's our hotel and
training centre, located a few hundred yards from the centre of Melksham, Wiltshire. We have
five bedrooms, and take a maximum of 8 delegates on our courses, in subjects such as Perl, PHP
and Python.  When there is not a course running, the hotel is open for visitors to other
local businesses, and at the weekend we often take reservations from people who are touring
the area, or are in the town to visit their friends and relatives.
ZERO;
        break;

case 
"9":
print <<< ZERO
As well as our own courses, our training centre is used by other local companies and organsations,
as pictured here.  A local group is helping themselves to a buffet lunch in our marquee, which is
available in summer.  We are very happy to provide a quiet learning environment for other people
who wish to run classes in Melksham, but we do not provide a party venue, a venue for very
large meetings, gourmet meals - there are other hotels nearby who specialise in that, and we
always keep our facilities tuned for those who want to learn Apache, MySQL, PHP ...
ZERO;
        break;

case 
"a":
print <<< ZERO
Every delegate who attends a course at Well House Manor has sole use of a laptop for the
duration of his course - with a choice of Windows, Linux, or OS X.  For system administration
courses, delegates may use more than one computer, allowing them to set up separate servers
and even to try balancing loads between servers for web sites that are too busy to run on a
single machine.
ZERO;
        break;

case 
"b":
print <<< ZERO
There's plenty of space for everyone. Each delegate gets at least a metre of table space -
enough for their computer, and for their notes, and for a notepad and pen and cup of coffee
too. There's natural light, controllable via shutters, as well as other lighting - fully
controlled - for evening events. Seating is comfortable, the environment is quiet - everything
is a arranged to give you the best possible learning experience.
ZERO;
        break;

case 
"c":
print <<< ZERO
Well House Manor is located in Melksham - just five miles from the county town of Trowbridge,
where this picture was taken.  There is plenty to see in the area after your course has
finished for the day - buses run to the Roman City of Bath (just 30 minutes away) from right
outside, with services back late into the evening.  But you don't need to go more that 200
yards to find a friendly restaurant in Melksham itself if you're tired at the end of a long
day of learning.
ZERO;
        break;

case 
"d":
print <<< ZERO
As well as writing practical examples themselves, delegates on programming course have the
opportunity to watch the tutor write programs from beginning to end, projecting them as he
does so, and they can follow along if they wish.   We currently have two projector systems,
one of which we use in our smaller room which you see picture here, when we have a course
with just two or three delegates.   The larger room is used for courses from 3 to 8 delegates
(or for larger courses run for single company groups).
ZERO;
        break;

case 
"e":
print <<< ZERO
This is Canon Square in Melksham - less than a mile from our training centre, and an easy
walk.   Melksham is a very old town, with a history that goes back nearly 1000 years, and
many of the buildings (including our headquarters) are of architectural interest to
visitors to the town.  This memorial in Canon Square commemorates those who gave their
lives in various wars in the last century - which now seems a very long time ago to this
quiet town.
ZERO;
        break;

case 
"f":
print <<< ZERO
Our hotel - Well House Manor - has five bedrooms.  All beds are double, and king sized,
such as this one you see pictured (this is bedroom 4). All rooms are let during courses
for use by one person, and have a private bath or shower, a TV, a fridge, tea and
coffee making facilities, and much more.   Access to your room is via a private keycard
for your security, and your keycard also allows you to come and go from the hotel as you
please at any time, day or night.
ZERO;
        break;

case 
"g":
print <<< ZERO
Many of our delegates (and other business visitors) need to keep in touch with their
office, and need to work in the morning before breakfast and in the evening.  And some
of our delegates like to try out what they have learned, even after classes have finished
for the day.  So all rooms are provided with a large workdesk, plenty of power outlets,
and internet access.  Delegates and other hotel guests are welcome to use their training
machines, or their own computers, in their rooms or other public areas of the hotel.
ZERO;
        break;

case 
"h":
print <<< ZERO
Each delegate is give printed notes to accompany his course. There's about 60 pages of
notes for each day of training, and the tutor will project up some of them as a part of
his lectures.  You won't want to spend the whole course taking notes, so you have these
to give you a good start.  We write the notes ourselves, update them regularly and print
them only just before the start of each course to ensure that they're right up to date.
Our wire binding system ensure that they'll lay flat for your easy use.
ZERO;
        break;

case 
"i":
print <<< ZERO
Here's a picture of "The Wilts" training room, in use for a business networking event
organised by Well House Manor. This is the room in which we'll run our training courses
if there are between 3 and 8 delegates booked on them, so you can see how you get plenty
of space.
ZERO;
        break;

case 
"j":
print <<< ZERO
As well as running courses at Well House Manor, we will run private courses for you on
your own site. Here, Graham Ellis (our tutor) is travelling on the train into Central
London to present a course there.  If you want us to provide a computer for each delegate
to use during the course, we can do so - though we drive rather than using the train or
a plane if that is the case.
ZERO;
        break;

case 
"k":
print <<< ZERO
Delegates come on our courses from far and wide, and arrive in our area by car, by
train, by bus and by car.  We can also arrange for them to be met at the airport by
a taxi.  If you let us know when and where your train is arriving (Melksham,
Chippenham or Trowbridge stations), we are more than happy to meet you off your train
and take you the final short distance to the hotel and training centre.
ZERO;
        break;

case 
"l":
print <<< ZERO
We can run onsite courses almost anywhere - here is a picture that we took on a private
Perl course that was run in an airport hotel, a long way from home.  For distant courses,
we cannot provide one computer for each delegate but we do bring our own training system
and manuals for all the delegates. All courses are presented in English, though.  We can
arrange the time and days of the training to meet local custom and requirements.
ZERO;
        break;

case 
"m":
print <<< ZERO
Well House Manor, in the Spring.  We are set in 3/4 of an acre of garderns, which you are
welcome to walk around during breaks in the course, and in the evening too.  And we have
plenty of free car parking too if you wish to drive.
ZERO;
        break;

case 
"n":
print <<< ZERO
Our current 'fleet' comprises 12 laptops for delegate use - you only see a part of the fleet
here - in addition to our own servers and staff / tutor machines. The average age of the fleet
is only just over a year, and all systems are rebuilt from time to time to upgrade them as
appropriate to the vey latest software.
ZERO;
        break;

case 
"o":
print <<< ZERO
We provide course lunch.  Sometimes, we'll provide baguettes or Pizza at Well House Manor,
but on other days you'll welcome a break and we will go to one of a wide variety of local
restaurants and cafes.  Delegates often have some dietary requirements, and we can arrange
breakfast and lunch to be suitable for almost any needs and tastes.
ZERO;
        break;

case 
"p":
print <<< ZERO
Here's the setup of a desk, awaiting a course delegate on his first morning.  There's a
set of notes to cover the course, notepad and pen, and a laptop computer for use through
teh course.  We also provide a mouse, though some delegates prefer to use the tracker pad
which is also standard on each laptop.
ZERO;
        break;

case 
"q":
print <<< ZERO
During some weeks, we have delegates who have never visited this part of England before,
and we are happy to take them around so show them a little of what there is to see after
the course has been completed for the day.  Here are two delegates who came from Cyprus,
looking at the ancient earthwork at Silbury Hill which is about 20 minutes from our
training centre.  There are also stone circles at Avebury and Stonehenge, old villages
like Lacock and Castle Combe, the city of Bath, the Westbury White Horse, and much more.
ZERO;
        break;

case 
"r":
print <<< ZERO
Projecting from a laptop for all the delegates in the class to see.  This is actually a
student rather than the lecturer, explaining some of the data that he needs to handling
and talking with the group who are helping him work out his best solution.
ZERO;
        break;

case 
"s":
print <<< ZERO
At Well House Manor, all rooms are provided with large screen TVs with at least 50 channels
available ... however, we also provide more traditional entertainments such as board games.
In this picture, delegates who only met each other a few hours ago enjoy themselves playing
Scrabble in our breakfast room.
ZERO;
        break;

case 
"t":
print <<< ZERO
We run courses at different levels ... courses for newcomers to programming, courses for
delegates who can already program, and advanced courses too. Pictured here to see Paddy
and Roy - good friends who have both come back several times for additional training, at
what we call "Geekmas" - a special day that we hold every year of two where past delegates
can get together and can update everyone about what they have been doing - and learn from
others too.
ZERO;
        break;

case 
"u":
print <<< ZERO
These delegates represent the United Kingdom, the United States of Amercia and Russia.
It's on days like this that we've come to realise just how truly universal the world of
Computer Science is.  This is a picture taken in our main "Wilts" training room at
Well House Manor.
ZERO;
        break;

case 
"v":
print <<< ZERO
The English Countryside near Melksham is lovely - this picture taken from a public path
in Potterne Woods, about six miles from our centre.  The scene changes with the time of
year, but the fields are always green and it is always lovely and safe to go out for a
walk.
ZERO;
        break;

case 
"x":
print <<< ZERO
There are some 700 technical books (plus more non-technical) on the shelves at Well House
manor for delegates to use during their courses.  We don't stock and sell books to delegates
because we couldn't keep our supplies up to date, but rather we encourage them to browse
and decide what suits them, then order on line, or buy the book that they want from a
bookshop such as Foyles in London, or one of the closer bookshops to us in Bath (12 miles)
or Bristol
ZERO;
        break;

case 
"y":
print <<< ZERO
One side of "The Wilts" - our larger training room - showing about a half of the class. The
U shaped arrangement of our room ensures that everyone can get in and our easily, and gets
a good view of the tutor and of other students, without the formality of classroom desks; we
encourage our delegates to learn from each other and find that it works very well this way.
ZERO;
        break;

case 
"z":
print <<< ZERO
This is the road outside our training centre, and the bus to Bath.   It takes just 30 minutes
to reach that ancient city if you want to do 'the tourist thing', but you need not go that
far to find a shop. You might just spot the edge of a sign in this picture which shows where
the local shop is - just three doors up from the hotel, with a wide range of good for sale
from 6 every morning until 10 every night.
ZERO;
        break;

default:
print <<< ZERO
Page from <a href=http://www.wellho.net>http://www.wellho.net</a>
ZERO;
        break;
        }

?><br clear=all><br>
<br>
<center>
<a href=/demo/showmanor.php?move=<?=$imprev?>>Previous</a> -
<?php if (! $_REQUEST[freeze]) { ?>
<a href=/demo/showmanor.php?freeze=1&move=<?=$impos?>>Freeze</a> -
<?php } else { ?>
<a href=/demo/showmanor.php?move=<?=$impos?>>Thaw</a> -
<?php ?>
<a href=/demo/showmanor.php?move=<?=$imnext?>>Next</a>

<?php for ($k=$impos$k<$impos+2$k++) {
if (
$k%2) { ?>

<br><br>
<a href=http://www.wellhousemanor.co.uk>Well House Manor</a><br>
48, Spa Road, Melksham, Wiltshire, SN12 7NY / 01225 709638<br>
<span class=about>Business Hotel in Melksham and Training Centre</span>

<?php } else { ?>

<br><br>
<a href=http://www.wellho.net>Well House Consultants</a><br>
404, The Spa, Melksham, Wiltshire, SN12 6QL / 01225 708225<br>
<span class=about>Open Source Training - Perl, PHP, Python, Ruby, Lua, MySQL, Linux ...</span>

<?php }}  ?>

</center>

</td></tr></table>
</body>
</html>

Learn about this subject
This module and example are covered on our public PHP Techniques course. If you have a group of three or more trainees who need to learn the subject, we can also arrange a private or on site course for you.

Books covering this topic
Yes. We have over 700 books in our library. Books covering PHP are listed here and when you've selected a relevant book we'll link you on to Amazon to order.

Other Examples
This example comes from our "Maps, Graphics and Geographics" training module. You'll find a description of the topic and some other closely related examples on the "Maps, Graphics and Geographics" module index page.

Full description of the source code
You can learn more about this example on the training courses listed on this page, on which you'll be given a full set of training notes.

Many other training modules are available for download (for limited use) from our download centre under an Open Training Notes License.

Other resources
• Our Solutions centre provides a number of longer technical articles.
• Our Opentalk forum archive provides a question and answer centre.
The Horse's mouth provides a daily tip or thought.
• Further resources are available via the resources centre.
• All of these resources can be searched through through our search engine
• And there's a global index here.

Web site author
This web site is written and maintained by Well House Consultants.

Purpose of this website
This is a sample program, class demonstration or answer from a training course. It's main purpose is to provide an after-course service to customers who have attended our public private or on site courses, but the examples are made generally available under conditions described below.

Conditions of use
Past attendees on our training courses are welcome to use individual examples in the course of their programming, but must check the examples they use to ensure that they are suitable for their job. Remember that some of our examples show you how not to do things - check in your notes. Well House Consultants take no responsibility for the suitability of these example programs to customer's needs.

This program is copyright Well House Consultants Ltd. You are forbidden from using it for running your own training courses without our prior written permission. See our page on courseware provision for more details.

Any of our images within this code may NOT be reused on a public URL without our prior permission. For Bona Fide personal use, we will often grant you permission provided that you provide a link back. Commercial use on a website will incur a license fee for each image used - details on request.

© WELL HOUSE CONSULTANTS LTD., 2024: 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho

PAGE: http://www.wellho.net/resources/ex.php • PAGE BUILT: Sun Oct 11 14:50:09 2020 • BUILD SYSTEM: JelliaJamb