hjælp til at gemme dokument online
Jeg har brug for noget hjælp. Jeg ved ikke så meget om php. Jeg har fundet en online editor. Jeg skal have den til åbne et bestemt dokument hver gang. (har fået den del til at virke), herefter skulle den også gerne kunne gemme filen igen det er så der jeg har problemerne. er der nogen der kan hjælpe.Her er de to filer der bruges:
første side:
<?
include 'include.php';
$userId = authenticate($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']);
initlocale();
$index = $HTTP_GET_VARS['index'];
$page = $HTTP_GET_VARS['page'];
$lang = $HTTP_GET_VARS['lang'];
$place = $HTTP_GET_VARS['place'];
?>
<HTML>
<HEAD>
<TITLE>Ret hjemmeside</TITLE>
<script>
function submitform(){
if (document.theform.frm_tekst.value==""){
alert("Kan det passe at du mangler at skrive noget tekst??");
return;
}
document.theform.submit();
}
</script>
<script type="text/javascript">
_editor_url = "/htmlarea/";
_editor_lang = "en";
</script>
<script type="text/javascript" src="/htmlarea/htmlarea.js"></script>
<script type="text/javascript">
var editor = null;
function initEditor() {
editor = new HTMLArea("ta");
var cfg = editor.config; // this is the default configuration
cfg.toolbar = [
[ "fontname", "space",
"fontsize", "space",
"formatblock", "space",
"bold", "italic", "underline", "strikethrough", "separator",
"subscript", "superscript", "separator",
"copy", "cut", "paste", "space", "undo", "redo" ],
[ "justifyleft", "justifycenter", "justifyright", "justifyfull", "separator",
"separator",
"insertorderedlist", "insertunorderedlist", "outdent", "indent", "separator",
"about" ]
];
editor.generate();
}
</script>
</HEAD>
<BODY bgcolor="#9a9ff0" text="#000000" link="#000066" vlink="#000000" onload="initEditor()">
<table width="100%" align="center">
<tr>
<td width="15%" align="center"></td><td width="100%">
<textarea id="ta" name="ta" style="width:100%" rows="50" cols="80">
<? createInputFieldText($index); ?><br>
</textarea>
<input type="submit" name="ok" value=" -= Gem rettelse =- " />
<input type="Hidden" name="index" value="<?= $index ?>">
<input type="Hidden" name="page" value="<?= $page ?>">
<input type="Hidden" name="lang" value="<?= $lang ?>">
<input type="Hidden" name="place" value="<?= $place ?>">
</td><td width="15%" align="left" valign="top">
<br><br>
</tr></table>
</BODY>
</HTML>
----------------------------------------------------------------
anden side:
<?php
function askAuthentication(){
header("WWW-Authenticate: Basic realm=\"Indtast dit brugernavn og password, tak.\"");
header("HTTP/1.0 401 Unauthorized");
print("You must enter a valid login username and password to access this resource.\n");
exit;
}
function authenticate($PHP_AUTH_USER, $PHP_AUTH_PW) {
initlocale();
if(!isset($PHP_AUTH_USER)){ askAuthentication(); }
if ($PHP_AUTH_USER == "gitte" &&
$PHP_AUTH_PW == "juliemaj")
return "hejsa";
else
askAuthentication();
}
if(!function_exists('file_put_contents')) {
function file_put_contents($filename, $data, $file_append = false) {
$fp = fopen($filename, (!$file_append ? 'w+' : 'a+'));
if(!$fp) {
trigger_error('file_put_contents cannot write in file.', E_USER_ERROR);
return;
}
fputs($fp, $data);
fclose($fp);
}
}
function initlocale(){
if (!setlocale (LC_ALL, 'danish')) {
//printf("locale not set");
}
}
function insertblock($page, $lang, $place, $number, $edit) {
if ($place == "sandvig")
$pgname = $page . "_" . $lang . "_" . $number . ".include";
else
$pgname = $page . "_" . $place . "_" . $lang . "_" . $number . ".include";
if ($edit == "1") {
printf("<a href=\"edit.php?place=" . $place . "&page=" . $page . "&lang=" . $lang . "&index=" . $pgname . "\">Ret tekst</a><br><table border=\"1\" width=\"100%%\" height=\"100%%\"><tr><td>");
}
readfile ("include/prislistedueodde.htm" . $pgname);
if ($edit == "1") {
printf("</td></tr></table>");
}
}
function createInputFieldText($index){
readfile("include/prislistedueodde.htm" . $index);
}
function outputJavascriptInclude($HTTP_USER_AGENT){
}
?>
