Available Scripts
The Central Web Server provides several special purpose scripts to help you build your web site:
Redirection
The redirection script allows your web site to redirect users to different web pages depending upon the link they arrived from. For example, your web site might have two different virtual host names: welcome.uconn.edu and mysite.uconn.edu
You might prefer the first virtual host name to send users to web.uconn.edu/mysite/welcome.html and the second virtual host name to send users to web.uconn.edu/mysite/allaboutme.html. To do this you could substitute the two lines in the script linked above to the following text:
$redirect_url["welcome.uconn.edu"] = "http://web.uconn.edu/welcome.html";$redirect_url["mysite.uconn.edu"] = "http://www.uconn.edu/allaboutme.html";
To learn more about Virtual Host Names, please see our Web Site Address page.
File List
Sometimes webmasters want users to use their web site like a file respository, and give users the ability to search the web site like a directory tree. You can accomplish this by using the script filelist.php. Simply copy this script to a directory of your web site and name it index.php. The users will see something like this. Users will be able to click up and down the directory tree by clicking on the folders, and view files by clicking on the file icons. They will not be able to view files outside the directory - only files in and below the directory.
If you only want authorized people to view your files, you can secure your directories using the Online Webmaster Utility. If you secure the directory that holds index.php, then unauthorized people will not be able to view your directory tree. If you secure a directory under the directory which holds index.php, then unauthorized users will be able to view the filenames of the secured files, but they will not be able to read the files.
File Share
Sometimes users want to share files among themselves. You can provide this capability with the script fileshare.php. Simply copy this script to a secure directory of your web site and name it index.php. (We'll talk more about the need for a secure directory below). The users will see something like this.
Users will be able to upload and download files to and from the server. The maximum allowed size per file is 4 megabytes. Users can upload files by entering the file name in the text box or clicking the Browse... button. Users can download files by clicking the file icons.
You must place this script in a secure directory, it will refuse to run otherwise. You can use the Online Webmaster Utility to secure a directory and identify users (by their netid) who are authorized to use it.
This script cannot be run in an unsecured directory because anyone on the Internet could use it to share files. Experience shows that this kind of vulnerability will eventually be found and exploited and consume large amounts of disk space. We reserve the right to remove file sharing scripts which are not properly secured.
Formmail
A common task performed on web sites is gathering information from visitors. One way to do this is to include a form in your web page using the HTML <form> tag, and configuring the form so that when the user clicks the enter button, the form sends the data to a formmail script. The formmail script in turn mails the information to an adminstrator.
The formmail script is a customized version of a program provided by Matt's Script Archive. The original version has been locally customized to prevent it from being used to send spam, and to allow the form user to specify a recipient(s) in addition to the those recipients that the form writer coded into the HTML.
Here is the HTML code example of a form which uses the formmail script:
<b>SEND AN EMAIL MESSAGE</b>
<form method="post" name="mail" action="http://web.uconn.edu/cgi-bin/formmail.pl">
<input type="hidden" name="recipient" value="admin@mymail.uconn.edu">
<input type="hidden" name="required" value="email,subject,message">
<b>Enter Optional Mail Recipient</b><br>
<input type="text" name="recipient1" value="" size="64">
<b>Enter Your Email Address</b><br>
<input type="text" name="email" value="" size="64">
<b>Enter Your Subject</b><br>
<input type="text" name="subject" value="" size="64">
<b>Enter Your Message</b><br>
<textarea name="message" cols="64" rows="3"></textarea>
<br>
<input type="submit" value="Submit">
</form>
this is what it will look like to the user:
SEND
AN EMAIL MESSAGE
The field recipient1 is a local customization that allows you (the form writer) to specify recipeints in two fields: the standard recipient field in the original formmail.pl script, and the custom recipient1 field.
The hidden field required is to make certain fields (email, subject, and message in the above example) on the form to be required, i.e., people can't submit the form when these required fields are empty.
In order to use the formmail script, you must include (copy) the html source code [seen above] into your web page. You can copy the formmail script, and paste it in any page you wish.
For more information on the formmail.pl script and the standard fields, see the the original formmail documentation.
Cron Script
You can designate one or more scripts on your web site to be cron scripts. Cron scripts are typically used to perform some chronic maintenance on your website. If you register your cron script with the Web Development Lab, they will automatically be run every hour on the hour. It is up to you to make sure the scripts perform correctly. For example, if you would like your cron script to run once a day, you will need to write your script so even though it's called 24 times a day, it only performs your required action once a day.
For your convenience, here is a portion of PHP code that you can place at the start of your script. This code will check that it's being called at the proper time, and will terminate the script otherwise.
University of
Connecticut