Students doing Internet modules in Cardiff School of Computer Science & Informatics can use the School's Project web server. Pages placed there are visible only from the School's Intranet. This Note tells you how to create pages for the Project Server.
All students in the School of Computer Science & Informatics have a web site on the School's Project web server http://project.cs.cf.ac.uk/.
The site is visible within the School's Intranet only and is intended for activity associated with internet modules or other coursework.
Initially, your web site is empty. This Note will tell you how to add pages to the site by creating web page files and uploading them to the server.
The School's Intranet includes all local computers those with Internet addresses in domain .cs.cf.ac.uk and any computer on the Internet using an authorised secure connection. An authorised secure connection is one using https protocols which has been logged in with a School user name and password.
In practice, this means that you can see your Project web site from any computer in Cardiff School of Computer Science & Informatics. If you try to access the site from a remote computer, the browser will be redirected to use
https protocols and you will be prompted for your user name and password.
Students and staff in the School may also create a site on the School's Users web server. Pages on the Users server are visible to the whole Internet. The Users server should not be used for coursework. See Uploading and Publishing Your Own Web Site on the Users Web Server
There are three types of HTML Web page which you can use to create your Project web site.
Files containing HTML text, images etc which are formatted and displayed by the browser (such as Firefox, Google chrome, Konqueror, Safari or Internet Explorer). You may write such documents directly — in a simple text editor, for example — or you may use a web authoring program. On the server, HTML files are named something.html.
Pages generated on the fly by the server. The server understands the PHP scripting language (see http://uk.php.net/). When you write a page in PHP, the server executes the contents of the page and produces HTML which it sends to the browser. Again, you can write these yourself or use an authoring package to create them. PHP files are named something.php. The file often consists of portions of HTML and PHP mixed together. Any PHP program portions in the file must begin with <?php and end with ?>. Raw HTML portions are sent to the browser literally, as if they came from a .html file.
Linux programs which produce HTML as their output when they run. These may be written in any computer language available on the Linux server (e.g. Perl, Shell, C, Java etc). These may be written in any computer language available on the Linux server (e.g. Perl, Shell, C, Java etc). CGI scripts follow a special protocol. In particular, the first thing they output must by a header which defines the sort of output that will be produced. CGI scripts should be placed in directory cgi-bin, or sub-directories of it, within your web file space.
The Project web server looks at the names of files in your web site. File names consist of a name-part and a terminating extension (after a dot) for example page1.html, page2.php etc. The server uses the extension to decide whether a file is, say, an HTML page or a PHP page. This tells the server whether it should just deliver the page, or interpret it first.
The server knows that all files in the cgi-bin directory are CGI scripts and it runs the script to produce output to send to the browser. The scripts need to follow CGI scripting rules and produce a header describing their content (e.g. a header which says that the output is HTML text).
Web servers sometimes send pages which are not HTML to the browser. For example, they may send PDF file, Word documents, Java applets etc. Web browsers are often equipped to deal with these. Sometimes a browser has built-in functions to handle a non-HTML page, or it may run a so-called plugin or external application. In some cases, it may just download the file and ask the user if he wants to save the file on the local computer.
You can prepare your own documents simply by writing valid HTML in a text editor. Alternatively you can use an authoring package such as Dreamweaver.
Whichever method you choose, you should end up with one or more .html or .htm files in your file space.
In order for your HTML documents to appear on the Project web site, you must first upload them to your Project web site file space.
Your Project web site file space is accessible by connecting to file server websites.cs.cf.ac.uk. You can connect and upload files in the following ways:
Another way to upload is to use the web site administration web application. This is an application you can use from any web browser. Simply direct your browser to https://siteadm.cs.cf.ac.uk/.
The web site administration application lets you upload or delete page and script files, create directories, change file access modes and upload and extract zip or tar archives.
The web site administration program is described more fully in Administering Your Websites from a Web Browser with the Website Administration Application.
Once you have connected to websites.cs.cf.ac.uk using SFTP or CIFS/SMB, navigate to sub-directory project to access your Project web site.
Create and upload your "front" document (home page) as a file called index.html. This document will be the one displayed by default when someone accesses your project pages.
Here is an example of an simple HTML file and the web page it produces.
More complicated pages can be written using the Web scripting language PHP. See http://www.uk.php.net/ for documentation. PHP files must be named with extension .php.
Project web sites are on the Project web server at http://project.cs.cf.ac.uk/. Your own site is http://project.cs.cf.ac.uk/SurnameAB/ where SurnameAB is your University mailname.
You can supply CGI scripts to the server by placing them in a sub-directory called cgi-bin in your web file space directory. This directory should already have been created for you when your account was set up. Executable files in that directory can be accessed using URL http://project.cs.cf.ac.uk/SurnameAB/cgi-bin/ followed by the file name, where SurnameAB is your University mail name. The file must be executable. You may need to set the executable property of the file explicitly. You can do this, for example, by right-clicking on the file in an WinSCP window.
There is a maximum CPU time of 30 seconds allocated to scripts executing from your cgi-bin directory. At the end of 30 seconds, the program is terminated. Any HTML which it has produced is flushed to the client browser but no error message or indication of termination is given.
CGI scripts and scripted web pages can access files in the file system on the Project web server. From the web server's perspective, files in your Project web space are in directory /usr/local/www/project/SurnameAB/. So if you create a file in your web space called data, say, you can refer to is a /usr/local/www/project/SurnameAB/data, where MailName is your University mail name.
If you want to write to a file from a web script, you must first create a group writable file or directory. For example, using WinSCP create a directory mydir, say, and right-click on it to change its properties and make it writeable by all. Now web pages can write to /usr/local/www/project/SurnameAB/mydir.
One web page can refer to another using a HREF link. For example, if you have a web page file called other.html your Project web site directory, you can reference it from your index.html document as:
<a href="http://project.cs.cf.ac.uk/SurnameAB/other.html">My Other Page</a>
However, it is better to use a relative URL instead of the absolute one. When a URL is on the same server, e.g. http://project.cs.cf.ac.uk, you can miss it out because that will automatically assumed by the web browser.
Similarly, you can miss out the directory path if the document you want is in the same directory as the one being read. So the reference becomes:
<a href="other.html">My Other Page</a>
This is preferable because it makes it easier for you to move whole sites from one web server to another, or to move directory hierarchies around on the same server.
It is possible to include directives inside your documents which cause a program to be run on the server. This is similar to using a CGI script except that the HTML which it outputs is included in the currently displayed document instead of creating a separate Web page.
The program or script to be run can be in your cgi-bin directory, or other accessible document directory.
For example, suppose you want to include the CGI script count.cgi which is in your project_html/cgi-bin directory. Put the directive:
in your document.
For efficiency reasons, the server will not look in a web page file for the directive unless the file's protection modes are set to be executable.
You can send mail from PHP pages and from CGI scripts. However, the mail will be sent under the user identity of the web server process owner, not your own.
This has two implications: first, it is a violation of University Regulations to send mail under an identity other than your own. Secondly, there are restrictions imposed on mail from the web process owner by the School's mail server. In particluar, mail can be sent only to local addresses and not to Internet addresses outside the School of Computer Science & Informatics.
You should ensure that the mail ‘From:’ header is changed to show your mail identity. In PHP, for example, you can do this by using a headers argument to the mail function. For example:
This will send an email to us with SurnameAB@cardiff.ac.uk in the From: header. You should put your Cardiff mail address in the From: header for all mail sent by your pages and scripts.
Note that you should use @cs.cardiff.ac.uk as the domain of the recipient's address. The mail will be forwarded to the @cardiff.ac.uk address.