root/trunk/rms-web/settings.php

Revision 4570, 2.2 kB (checked in by erijo, 2 years ago)

Undo r4567 since rms-web has not been replaced by licqweb.
Also fixed most of the images (they were broken) by copying them from
licqweb.

  • Property svn:eol-style set to native
Line 
1<?php
2include "config.php";
3
4global $server, $port, $showonlyonline, $listrefresh;
5
6$fc = array();
7
8function setVariable($strKey, $strVal, $isString)
9{
10    $fc = file("config.php");
11    $f = fopen("config.php", "w");
12    if (!$f)
13    {
14        echo "config.php not writable";
15        exit();
16    }
17   
18    foreach($fc as $line)
19    {
20      if (strncmp($line, "$" . $strKey, strlen($strKey) + 1) == 0)
21      {
22        $output = "$" . $strKey . "=";
23        if ($isString == true)
24          $output = $output . "\"";
25        $output = $output . $strVal;
26        if ($isString == true)
27          $output = $output . "\"";
28        $output= $output . ";\n";
29     
30        fputs($f, $output);
31      }
32      else
33      {
34        fputs($f, $line);
35      }
36    }
37   
38    fclose($f);
39    $fc = array();
40}
41
42  $newserver = $_POST["server"];
43  $newport = $_POST["port"];
44  $newshowonlyonline = $_POST["showoffline"];
45  $newlistrefresh = $_POST["listrefresh"];
46 
47  // Did we receive any input?
48  if ($newserver)
49  {
50    $server = $newserver;
51    if ($newport)
52      $port = $newport;
53    if ($newlistrefresh)
54      $listrefresh = $newlistrefresh;
55    if (!$newshowonlyonline)
56      $showonlyonline = 1;
57    else
58      $showonlyonline = 0;
59   
60    // Save in the config file now
61    setVariable("server", $server, true);
62    setVariable("port", $port, false);
63    setVariable("listrefresh", $listrefresh, false);
64    setVariable("showonlyonline", $showonlyonline, false);
65   
66    echo "<FONT color=\"red\">Settings Saved</FONT><BR><BR>";
67  }
68?>
69
70<HTML>
71<TITLE>Licq RMS Web Settings</TITLE>
72<BODY>
73<CENTER>
74
75<FORM action="settings.php" method="POST">
76<TABLE cellpadding="2" cellspacing="0" border="0">
77<TR>
78<TD>Server</TD>
79<TD><INPUT type="text" name="server" size="20" value="<? echo $server ?>"></TD></TR>
80<TR><TD>Port</TD>
81<TD><INPUT type="text" name="port" size="6" value="<? echo $port ?>"></TD></TR>
82<TR><TD>List Refresh</TD>
83<TD><INPUT type="text" name="listrefresh" size="6" value="<? echo $listrefresh ?>"></TD></TR>
84<TR><TD>Show Offline Users</TD>
85<TD><INPUT type="checkbox" value=1 name="showoffline"
86 <? if (!$showonlyonline) echo "CHECKED"; ?>></TD></TR>
87<TR><TD><INPUT type="submit" name="Save" value="Save">
88</TABLE>
89</FORM>
90
91</CENTER>
92</BODY>
93</HTML>
Note: See TracBrowser for help on using the browser.