Location: PHPKode > projects > phpWebEd > phpwebed/phpwebed/setup.php
<? include "config.inc.php";?>
<html>
<head>
<title>Setup phpWebEd</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
body { margin-left:0px; margin-right:0px; margin-top:0px; margin-bottom:0px }
</style>
</head>
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="100%" border="0" cellspacing="0" cellpadding="0" height="100%">
  <tr align="center" bgcolor="#DDDDDD"> 
    <td height="30"><font face="Verdana, Arial, Helvetica, sans-serif" size="+1"> 
      <i>Edit</i> your Website <i>Online</i> with <b>phpWebEd/axWebEd</b> </font></td>
  </tr>
  <tr> 
    <td align="center" valign="top"> 
      <p><font face="Verdana, Arial, Helvetica, sans-serif" size="3"><b><br>
        phpWebEd  <? echo $phpWebEd_version;?> Setup</b></font></p>
      <form method="post" action="<? echo $PHP_SELF;?>">
<?
if ($name == $phpWebEd_username && $pass == $phpWebEd_userpass) {
    if ($save != "") {
          if (!($fp = @fopen("config.inc.php", 'r'))) {
              echo "<br><b>Error reading file &quot;config.inc.php&quot;.<br><br>Setup could not be finished!</b>";
          } 
          else {
              $buf = fread($fp,filesize("config.inc.php"));
              fclose($fp);
              $url = trim($url);
              $dir = trim($dir);
              if (substr($url, -1) == "/") $url = substr($url, 0, strlen($url)-1);
              if (substr($dir, -1) == "/") $dir = substr($dir, 0, strlen($dir)-1);
              $buf = ereg_replace("(phpWebEd_url = \")([^\"]*)(\";)", "\\1$url\\3", $buf);
              $buf = ereg_replace("(phpWebEd_dir = \")([^\"]*)(\";)", "\\1$dir\\3", $buf);
              $buf = ereg_replace("(homepage_url = \")([^\"]*)(\";)", "\\1" . trim($homepage) . "\\3", $buf);
              $buf = ereg_replace("(phpWebEd_username = \")([^\"]*)(\";)", "\\1" . trim($username) . "\\3", $buf);
              $buf = ereg_replace("(phpWebEd_userpass = \")([^\"]*)(\";)", "\\1" . trim($userpass) . "\\3", $buf);
              $buf = ereg_replace("(phpWebEd_language = \")([^\"]*)(\";)", "\\1$language\\3", $buf);
              $buf = ereg_replace("(only_trusted_tags = )([01])(;)", "\\1" . (int)$safe_tags . "\\3", $buf);
              $axopt2 = "";
              if (isset($axopt)) {
                 while (list(, $value) = each ($axopt)) {
                     $axopt2 .= "$value ";
                 }
              }
              $buf = ereg_replace("(axWebEd_options = \")([^\"]*)(\";)", "\\1" . trim($axopt2) . "\\3", $buf);
              if (!($fp = @fopen("config.inc.php", 'w'))) {
                 echo "<br><b>Error writing file &quot;config.inc.php&quot;.<br><br>Setup could not be finished!</b>";
              } 
              else {
                 fwrite($fp, $buf);
                 fclose($fp);
                 ?>
                <table border="0" width="100%">
                <tr>
                  <td width="40">&nbsp;</td>
                  <td>
                      <p>Setup has finished.</p>
                      <p>You can now prepare your web pages for editing with phpWebEd 
                        or axWebEd. Add the following PHP code to every page you want 
                        to edit:</p>
                      <p><font color="#000066">&lt;html&gt;<br>
                        &lt;head&gt;<br>
                        ...<br>
                        &lt;body&gt;<br>
                        ...</font><br>
                        <font color="#660000">&lt;?<br>
                        include(&quot;<i>&lt;path_to_phpwebed&gt;</i>/config.inc.php&quot;);<br>
                        content(&quot;<i>&lt;unique_title&gt;</i>&quot;);<br>
                        ?&gt;</font><br>
                        <font color="#000066">...</font><br>
                        <font color="#660000">&lt;? content(&quot;<i>&lt;unique_title&gt;</i>&quot;);?&gt;</font><br>
                        <font color="#000066">...<br>
                        &lt;/body&gt;<br>
                        &lt;/html&gt; </font></p>
                      
              <p>For more information see <a href="readme.html">readme.html</a>, 
                <a href="../example1.php">example1.php</a> or <a href="../example2.php">example2.php</a></p>
                      <p>&nbsp;</p>
                     </td>
                  <td width="40">&nbsp;</td>
                </tr></table>
              <? 
              } 
          }
    
       }    
    
    else {
        ?>
        <table border="0" width="100%">
          <tr> 
            <td align="right" rowspan="17" width="40">&nbsp;</td>
            <td colspan="2"><font color="#990000">Important Note:</font> To setup 
              and use phpWebEd, the &quot;contents&quot; directory must have the 
              permission rwxrwxrwx (777), the files &quot;config.inc.php&quot;, 
              &quot;logins.txt&quot; and all files within &quot;contents&quot; 
              must have the permissions rw-rw-rw- (666). If you have not set them, 
              please do so now. <i>The permissions must be set before setup can 
              continue!</i></td>
            <td align="right" rowspan="17" width="40">&nbsp;</td>
          </tr>
          <tr> 
            <td colspan="2"><br>
              The following two settings were determined automatically. You should 
              change them only if it seems to be wrong or if you know what you 
              are doing.</td>
          </tr>
          <tr> 
            <td align="right" nowrap><b>URL to phpWebEd:</b></td>
            <td> 
              <input type="text" name="url" size="50" value="<? echo "http://" . $HTTP_SERVER_VARS["HTTP_HOST"] . str_replace("setup.php", "", $HTTP_SERVER_VARS["REQUEST_URI"]);?>">
            </td>
          </tr>
          <tr> 
            <td align="right" nowrap><b>Full server path:</b></td>
            <td> 
              <input type="text" name="dir" size="50" value="<? echo str_replace("setup.php", "", $HTTP_SERVER_VARS["PATH_TRANSLATED"]);?>">
            </td>
          </tr>
          <tr> 
            <td colspan="2"><br>
              The next setting indicates the page where you want to start after 
              login. From this page you can navigate through your site and edit 
              all pages you have prepared for phpWebEd.</td>
          </tr>
          <tr> 
            <td align="right"><b>Homepage:</b></td>
            <td> 
              <input type="text" name="homepage" size="50" value="<? 
                if ($homepage_url == "") echo "http://" . $HTTP_SERVER_VARS["HTTP_HOST"] . "/";
                else echo $homepage_url;?>">
            </td>
          </tr>
          <tr> 
            <td colspan="2"><br>
              Choose the language for phpWebEd.</td>
          </tr>
          <tr> 
            <td align="right"><b>Language:</b></td>
            <td> 
              <select name="language">
                <option <? if ($phpWebEd_language == "dutch") echo "selected";?>>dutch</option>
                <option <? if ($phpWebEd_language == "english") echo "selected";?>>english</option>
                <option <? if ($phpWebEd_language == "french") echo "selected";?>>french</option>
                <option <? if ($phpWebEd_language == "german") echo "selected";?>>german</option>
                <option <? if ($phpWebEd_language == "italian") echo "selected";?>>italian</option>
                <option <? if ($phpWebEd_language == "spanish") echo "selected";?>>spanish</option>
                <option <? if ($phpWebEd_language == "slovak") echo "selected";?>>slovak</option>
                <option <? if ($phpWebEd_language == "danish") echo "selected";?>>danish</option>
              </select>
            </td>
          </tr>
          <tr> 
            <td colspan="2"><br>
              The next setting is for security reasons only. If disabled, users 
              may enter dangerous Javascript or PHP instructions. For a list of 
              &quot;trusted&quot; tags see &quot;config.inc.php&quot;.</td>
          </tr>
          <tr> 
            <td align="right" nowrap><b>Only trusted HTML:</b></td>
            <td> 
              <input type="checkbox" name="safe_tags" value="1" <? if ($only_trusted_tags == 1) echo "checked";?>>
            </td>
          </tr>
          <tr> 
            <td colspan="2"><br>
              If you have <a href="http://www.m-tecs.net/axwebed/" target="_blank">axWebEd</a> (Version 2.1 or higher) installed, you may disable 
              some of its features. </td>
          </tr>
          <tr> 
            <td align="right" nowrap><b>axWebEd options:</b></td>
            <td>
                <nobr><input type="checkbox" name="axopt[]" value="nohtml" <? if (strstr($axWebEd_options, "nohtml")) echo "checked";?>>
                disable &quot;HTML&quot; tab</nobr> 
                <nobr><input type="checkbox" name="axopt[]" value="noimage" <? if (strstr($axWebEd_options, "noimage")) echo "checked";?>>
                disable &quot;Image&quot; button</nobr>
                <nobr><input type="checkbox" name="axopt[]" value="notable" <? if (strstr($axWebEd_options, "notable")) echo "checked";?>>
                disable &quot;Insert Table&quot; button</nobr>
                <nobr><input type="checkbox" name="axopt[]" value="nostyle" <? if (strstr($axWebEd_options, "nostyle")) echo "checked";?>>
                disable &quot;Styles&quot; dropdown</nobr>
                <nobr><input type="checkbox" name="axopt[]" value="nofont" <? if (strstr($axWebEd_options, "nofont")) echo "checked";?>>
                disable &quot;Font&quot; button</nobr>
                </td>
          </tr>
          <tr> 
            <td colspan="2"><br>
              Now choose your username and password. Remember both!</td>
          </tr>
          <tr> 
            <td align="right"><b>Username:</b></td>
            <td> 
              <input type="text" name="username" size="20" value="<?=$phpWebEd_username?>">
            </td>
          </tr>
          <tr> 
            <td align="right"><b>Password:</b></td>
            <td> 
              <input type="text" name="userpass" size="20" value="<?=$phpWebEd_userpass?>">
            </td>
          </tr>
          <tr> 
            <td colspan="2">&nbsp;</td>
          </tr>
          <tr> 
            <td colspan="2" align="center"> 
              <input type="hidden" name="name" value="<?=$name?>">
              <input type="hidden" name="pass" value="<?=$pass?>">
              <input type="submit" name="save" value="Save settings">
            </td>
          </tr>
        </table>        
    <?
    }
} else {
    if ($login != "" || $save != "") $errstr = "Access Denied!";
    ?>
       <table border="0" cellspacing="0" cellpadding="2" bgcolor="#CCCCCC">
          <tr> 
            <td> 
              <table border="0" cellspacing="0" cellpadding="10" bgcolor="#FFFFFF">
                <tr align="center"> 
                  <td colspan="2"><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b><font size="3">Login</font></b></font></td>
                </tr>
                <? if (isset($errstr)) echo "<tr align=\"center\"><td colspan=\"2\">
                   <font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"2\"><b>$errstr</b></font></td></tr>";?>
                <tr> 
                  <td align="right"><font face="Verdana, Arial, Helvetica, sans-serif" size="2"> 
                    <b> Username</b></font></td>
                  <td>
                    <input type="text" name="name">
                  </td>
                </tr>
                <tr> 
                  <td align="right"><font face="Verdana, Arial, Helvetica, sans-serif" size="2"> 
                    <b>Password</b></font></td>
                  <td>
                    <input type="password" name="pass">
                  </td>
                </tr>
                <tr align="center"> 
                  <td colspan="2">
                    <input type="submit" name="login" value="Login">
                  </td>
                </tr>
              </table>
            </td>
          </tr>
        </table>
<?
}
?>
      </form>      
      <p>&nbsp;</p>
    </td>
  </tr>
  <tr bgcolor="#DDDDDD" align="center"> 
    <td height="20"><font face="Verdana, Arial, Helvetica, sans-serif" size="2">phpWebEd 
      <? echo "$phpWebEd_version";?>
      - Copyright &copy; 2001-2002 Holger Mauermann - <a href="http://www.m-tecs.net/">www.m-tecs.net</a></font> 
    </td>
  </tr>
</table>
</body>
</html>
Return current item: phpWebEd