In principle it is possible to access the server from outside of the laboratory. However, you may find it more convenient to be physically present in the lab. Hence, let us assume that you are sitting in the laboratory.
Power on one or more computers. Choose LINUX as your operating system. Wait for the system to boot up and log in. Start the graphical environment with
startx
You want to edit files on the server. There are two ways of doing that:
ssh -X yourusername@leibniz.sfb504.uni-mannheim.deFrom now on, everything you type in this terminal will be executed on the server (until you type
exit). The first thing you want to do is open an editor.
xemacs &(Notice the ampersand at the end of the line - this means that you `get your shell back' even before xemacs is finished).
If you are not yet familiar with xemacs you may want to look at the
xemacs-tutorial first. The tutoral can be invoced from within xemacs
by pressing Control h and than the single key
t (On german keyboards Control is sometimes
called Strg). It will take you about 30 minutes to get
used to the basic functions of xemacs. There are lots of functions
that you will learn later, but for the time being the basics are
sufficient.
Now let us assume that you plan to write a php script. To be executed
by the httpd the script must be located in ~/public_html/
Now say C-x f and then
public_html/somename.php3 to create a new file
~/public_html/somename.php3 If the directory
public_html does not exist yet xemacs will ask you
whether to create it.
Now you can edit your file. The following code may give you some ideas for a simple questionnaire (more examples can be found at http://www.kirchkamp.de/webexp.html:
<HTML> <BODY> <?php // the following file collects
all the data // make sure that your httpd may write to this file
$outfilename="test.out";
// the function scale implements a scale of radio-buttons
function scale ($varname,$comment) {
echo "<TABLE><TR><TD WIDTH=250>$comment</TD><TD>";
echo " (is not the case) ";
for ($i=1;$i<7;++$i) {
echo $i;
echo "<INPUT TYPE=RADIO VALUE=$i NAME=$varname> ";
}
echo "(is the case)</TD></TR></TABLE>";
}
function ship ($varname) {
global $outfile;
global $$varname;
fwrite ($outfile,$varname);
fwrite ($outfile,"=\"");
fwrite ($outfile,${$varname});
fwrite ($outfile,"\", ");
}
echo "<FORM METHOD=POST ACTION=$SCRIPT_NAME>";
// we first check whether the form was invoked for the first time:
if ($Ready == "") {
echo "Please fill in your age here: <INPUT TYPE=TEXT NAME=AGE><BR>";
scale ("RATEA","How do you rate A?");
scale ("RATEB","How do you rate B?");
echo "<P><INPUT TYPE=SUBMIT NAME=Ready VALUE=\"This is a useless button\">";
} else {
$outfile = fopen($outfilename,"a");
ship ("AGE");
ship ("RATEA");
ship ("RATEB");
fwrite ($outfile,"\n");
fclose($outfile);
echo "Thank you very much!";
}
?>
</FORM>
</BODY>
</HTML>
The above script will generate the following form and also evaluate it:
C-x w
Start netscape (on this or some other machine) and open URL http://leibniz/~yourusername/samename.php3
If it works, fine. If it doesn't, go back to your xemacs and debug your program ;-)
test.out Enter the directory
cd public_htmlcreate the file manually with
touch test.outand allow everybody to write to that file with
chmod a+w test.out
test.in
Since it already exists you do not have to touch it. Still you have to
make it world-readable with chmod a+w test.inIn the case of a directory you have to say
chmod a+wx ...