Autor Beitrag
sourcehunter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 482

Win XP | Suse 10.1
Delphi 2005 Pers.
BeitragVerfasst: Sa 22.01.05 18:49 
ich habe folgenes PHP-Script zusammengeschustert:

ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
<?
$msg=$_POST[message];
if ($msg!="") {
   $msg=str_replace("\r\n","",$msg);
   $name=$_POST[name];
   $eintrag="<hr />\r\n$name:\r\n\r\n$msg\r\n";

   if ($fp=@fopen("posts.html","r")) {
      $oldmessages=@fread($fp,filesize("posts.html"));
      @fclose(fp);
   }

   $fp=fopen("posts.html","w");
   fwrite($fp,$eintrag);
   fwrite($fp,$oldmessages);
   fclose($fp);

   echo("<meta http-equiv=\"refresh\" content=\"0; URL=index.shtml\">");
}
?>


Leider funktioniert der Code nicht. Wenn ich auf den Formularbutton klicke, dann passiert nichts. Kann mir jemand helfen?

Das Formular:
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
<from action="post.php" method="post">
<label for="name">Name:</label>
<input type="text" name="name" id="name" />
<label for="message">Nachricht:</label>
<textarea cols="30" rows="10" name="message" wrap="off" id="message"></textarea>
<input name="submit" type="submit" value="Abschicken" />
</from>

_________________
Linux und OpenSource rulez!
matze
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 4613
Erhaltene Danke: 24

XP home, prof
Delphi 2009 Prof,
BeitragVerfasst: Sa 22.01.05 18:52 
bist du sicher, dass das so geht ??
ich denke du musst bei PHP $msg=$_POST["message"];schreiben.

_________________
In the beginning was the word.
And the word was content-type: text/plain.
sourcehunter Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 482

Win XP | Suse 10.1
Delphi 2005 Pers.
BeitragVerfasst: Sa 22.01.05 20:18 
Das ahb ich schon alles durchprobiert. Ich hab das Problem inzwischen gelöst. Trozdem danke für deine Hilfe.

_________________
Linux und OpenSource rulez!
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: Sa 22.01.05 20:23 
sourcehunter hat folgendes geschrieben:
Das ahb ich schon alles durchprobiert. Ich hab das Problem inzwischen gelöst. Trozdem danke für deine Hilfe.
Dann verrate doch bitte auch, wie! :evil:

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".
JayEff
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2971

Windows Vista Ultimate
D7 Enterprise
BeitragVerfasst: Sa 22.01.05 20:54 
matze hat folgendes geschrieben:
bist du sicher, dass das so geht ??
ich denke du musst bei PHP $msg=$_POST["message"];schreiben.


Bei PHP kann man sich entscheiden welche von beiden man benutzt... so schein mir. Ist mir schon aufgefallen. versuchts mal mit nem Syntaxhighlighter und der wird alles zwischen zwei " als String highlighten, und auch alles zwischen zwei ' wobei sich beide zeichen nicht in die Quere kommen: "hallo 'blub' blah" ist also nur EIN string... kann mich auch täuschen :D

_________________
>+++[>+++[>++++++++<-]<-]<++++[>++++[>>>+++++++<<<-]<-]<<++
[>++[>++[>>++++<<-]<-]<-]>>>>>++++++++++++++++++.+++++++.>++.-.<<.>>--.<+++++..<+.
sourcehunter Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 482

Win XP | Suse 10.1
Delphi 2005 Pers.
BeitragVerfasst: Sa 22.01.05 20:55 
Ich dachte das sei neicht von Interesse. Aber wenn du mich sooo lieb drum bittest...

post.php:
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
<?php
$name=$HTTP_POST_VARS[name];
$text=$HTTP_POST_VARS[text];
if($name AND $text){
$name=trim($name);
$text=trim($text);
$text=nl2br($text);
$open=fopen("posts.html","r");
$filesize=filesize("posts.html");
$inhalt=fread($open,$filesize);
fclose($open);
$ausgabe="<hr />\r\n".$name."\r\n".$text."\r\n".$inhalt;
$open=fopen("posts.html","w");
fputs($open,$ausgabe);
fclose($open);
echo("<meta http-equiv=\"refresh\" content=\"0; URL=index.shtml\">"); 
}
?>


index.shtml:
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
<html>

<head>
<meta http-equiv="Content-Language" content="de">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta http-equiv="refresh" content="300; URL=index.shtml">

<title>Clanleader-Messageboard</title>
</head>

<body>
<form method="post" action="post.php">
Name:<input type="text" name="name" size="30">
Text:<textarea rows="8" name="text" cols="30"></textarea>
<input type="submit" value="Abschicken" name="B1">
</form>
<!--#include virtual="posts.html"-->

</body>

</html>


Zugegeben, der Code stammt nicht von mir. Er ist aus nem Tutorial, aber ich musste ihn noch ein bisschen modifizieren. Das einzige Poblem, dass ich habe ist, dass der Browser die Seite nicht aktualisiert, nachdem er das Skript abgearbeitet hat.

Viel Spass damit!

//Edit: Ich hab unter gauss.euv-frankfurt-...licboard/index.shtml mal eine Bord zum testen eingerichtet.

_________________
Linux und OpenSource rulez!
JayEff
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2971

Windows Vista Ultimate
D7 Enterprise
BeitragVerfasst: Sa 22.01.05 21:19 
das selbe problem hatte ich auch... ich hab eine art kommentar oder newsscript geschrieben..
man findet mein Tutorial dazu wahrscheinlich wenn der Link funkt HIER:
www.clanscripte.net/...amp;id=54&show=0

_________________
>+++[>+++[>++++++++<-]<-]<++++[>++++[>>>+++++++<<<-]<-]<<++
[>++[>++[>>++++<<-]<-]<-]>>>>>++++++++++++++++++.+++++++.>++.-.<<.>>--.<+++++..<+.
wulfskin
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1349
Erhaltene Danke: 1

Win XP
D5 Pers (SSL), D2005 Pro, C, C#
BeitragVerfasst: Sa 22.01.05 22:05 
Das Aktualisieren kannst du auch durch PHP erzwingen: function Header().

Gruß Hape!

_________________
Manche antworten um ihren Beitragszähler zu erhöhen, andere um zu Helfen.