I am running an Apache web server under Linux.
The Java script below suppose to write a file
named servertype.conf to a web server under
the directory /var/apache/.
The Java script responded properly but it did not create a file.
This Java script is embedded within a Python script, and the
Pyhton script does run.
There is an error. Error 'File is undefined'
The code var mysummary = new File("/var/apache/servertype.conf")
is a server-side script.
How do I get this server-side script to work in Apache ?
This code is also shown on line number 10 below.
===========================
Alternatively, I could use a Server Side Include (SSI) feature to
write to a file in a web server with the statement as showned
on line number 9 below.
The code AddHandler server-parsed .conf
would then be added to the file /etc/httpd/conf/httpd.conf
So far I could not get either of the two methods to work.
I am running Apache version 1.3.26
===========================
Code:
1) <SCRIPT LANGUAGE="Javascript">
2) <!--
//Javascript added by Linh on 7-13-2004 for switching between
//master iserver and secondary iserver
3) function select_button (form)
4) {
5) if (form.defms[1].checked)
6) if (confirm ("You are changing from a master iserver
to a secondary iserver. Is this what you want ?
To complete this process, you must
1) Enter Iserver IP address.
2) Enter the Iserver Registration Password.
3) and finally click the button
'Apply Changes to System'") )
7) {
8) alert ("Clicked Yes");
9) <!--#exec echo "ServerType=Secondary" > /var/apache/servertype.conf -->
10) var mysummary = new File("/var/apache/servertype.conf");
mysummary.open("w");
mysummary.write('ServerType=Secondary');
mysummary.flush();
mysummary.close();
}
else
{
form.defms[1].checked = false
form.defms[0].checked = true
alert ("Clicked No");
}
}
//-->
</SCRIPT>
<input type=radio name="defms" value="ms" onClick="select_button (this.form)" %s></td>
<input type=radio name="defms" value="ss" onClick="select_button (this.form)" %s></td>