root/branches/licq/rms-web/settings.php

Revision 4149, 2.1 kB (checked in by emostar, 3 years ago)

Initial revision

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