jones88
Goto Top

Hyperlink in Gästebuch erstellen?

Hyperlink im Gästebuch erstellen?

Hallo Zusammen,
Ich habe eine Frage.
Die User sollen in meinem PHP-Gästebuch die Möglichkeit haben, beim posten einer neuen Nachricht Einen Hyperlink in den Text einzufügen, welcher nachher im Gästebuch angezeigt wird. Ist das mit PHP möglich?
Habe bis jetzt noch nichts zu diesem Thema gefunden.

Danke,

Gruss Jonas

Content-Key: 54902

Url: https://administrator.de/contentid/54902

Printed on: April 26, 2024 at 15:04 o'clock

Member: cat
cat Mar 23, 2007 at 15:37:23 (UTC)
Goto Top
Wenn ich deine Frage richtig verstehe, dann schau dir doch mal das an

http://www.w3schools.com/php/php_post.asp
Mitglied: 4515
4515 Apr 03, 2007 at 13:07:03 (UTC)
Goto Top
Hallo Jonas,

die Möglichkeit besteht sicher. Interessant wäre jedoch zu wissen, welches PHP-Gästebuch Du verwendest.

lg Levis24
Member: tantetoni2
tantetoni2 Apr 03, 2007 at 19:35:17 (UTC)
Goto Top
mach es so wenn du bb-code meinst, das ist jetzt nur eine wert übergabe besser wäre es natürlich alles in eine datenbank zuschreiben

zum testen http://tantetoni2.ta.funpic.de/formular_test


formular.html

<!-- javascript for BB code !-->
<script language="JavaScript" type="text/javascript">  
function cur_ins(field, startTag, endTag, offset) {
 field.focus();
 if (document.getSelection) {
   selStart = field.selectionStart;
   selEnd = field.selectionEnd;
   text = field.value.substring(selStart, selEnd);
   field.value = field.value.substring(0, selStart) + startTag + text + endTag + 

field.value.substring(selEnd);
   if (text.length > 0) {
     if (offset != 0) {
       field.selectionStart = selStart + startTag.length + text.length - offset;
     } else {
       field.selectionStart = selStart + startTag.length + text.length + endTag.length;
     }
   } else {
      field.selectionStart = selStart + startTag.length;
   }
   field.selectionEnd = field.selectionStart;
 } else
 if (document.selection) {
     marker = document.selection.createRange();
     text = marker.text;
     marker.text = startTag+text+endTag;
     marker = document.selection.createRange();
     if (text.length > 0) {
       if (offset != 0) {
         marker.move('character', startTag.length + text.length - offset);  
       } else {
         marker.move('character', startTag.length + text.length + endTag.length + offset);  
       }
     } else {
       marker.move('character', -(endTag.length));  
     }
     marker.select();
  }
}
</script>

<form name="gb" action="formular_ausgabe.php" method="post">  
<table>
<tr>
<td> Name:</td>
<td><input type="text" name="name" size="30"></td>  
</tr>

<tr>
<td>Nachricht:</td>
<td><textarea class="text" name="post" cols="48" rows="12" ></textarea></td></tr>  

</table>
<table>
<tr><td>

<input type="button" style="color:#ffffe0; background-color:#5A8196" onmouseover="this.style.color='336699';   
this.style.backgroundColor='ffffe0';" onmouseout="this.style.color='ffffe0';   
this.style.backgroundColor='5A8196';"   value="F" onclick="cur_ins(this.form.post, '[b]', '[/b]', 0);"   
name="bold" /> </a>  


<input type="button" style="color:#ffffe0; background-color:#5A8196" onmouseover="this.style.color='336699';   
this.style.backgroundColor='ffffe0';" onmouseout="this.style.color='ffffe0';   
this.style.backgroundColor='5A8196';"  value="K" onclick="cur_ins(this.form.post, '[i]', '[/i]', 0);"   
name="italic" />  


<input type="button" style="color:#ffffe0; background-color:#5A8196" onmouseover="this.style.color='336699';   
this.style.backgroundColor='ffffe0';" onmouseout="this.style.color='ffffe0';   
this.style.backgroundColor='5A8196';"  value="U" onclick="cur_ins(this.form.post, ' [u]', '[/u]', 0);"   
name="underlined" />  

<input type="button" style="color:#ffffe0; background-color:#5A8196" onmouseover="this.style.color='336699';   
this.style.backgroundColor='ffffe0';" onmouseout="this.style.color='ffffe0';   
this.style.backgroundColor='5A8196';"  value="Z" onclick="cur_ins(this.form.post, '[z]','',  0);"   
name="umbruch" /> </a>  

<input type="button" style="color:#ffffe0; background-color:#5A8196" onmouseover="this.style.color='336699';   
this.style.backgroundColor='ffffe0';" onmouseout="this.style.color='ffffe0';   
this.style.backgroundColor='5A8196';"  value="Center" onclick="cur_ins(this.form.post, '[center]',   
'[/center]', 0);" name="Center" />   

<input type="button" style="color:#ffffe0; background-color:#5A8196" onmouseover="this.style.color='336699';   
this.style.backgroundColor='ffffe0';" onmouseout="this.style.color='ffffe0';   
this.style.backgroundColor='5A8196';"  value="IMG" onclick="cur_ins(this.form.post, '[img]', '[/img]', 0);"   
name="image" />   

<input type="button" style="color:#ffffe0; background-color:#5A8196" onmouseover="this.style.color='336699';   
this.style.backgroundColor='ffffe0';" onmouseout="this.style.color='ffffe0';   
this.style.backgroundColor='5A8196';" value="URL"  onclick="cur_ins(this.form.post, '[url]', '[/url]', 0);"   
name="hyperlink" />  

<input type="button" style="color:#ffffe0; background-color:#5A8196" onmouseover="this.style.color='336699';   
this.style.backgroundColor='ffffe0';" onmouseout="this.style.color='ffffe0';   
this.style.backgroundColor='5A8196';" value="E-Mail"  onclick="cur_ins(this.form.post, '[email]', '[/email]',   
0);" name="email" />  

<input type="button" style="color:#ffffe0; background-color:#5A8196" onmouseover="this.style.color='336699';   
this.style.backgroundColor='ffffe0';" onmouseout="this.style.color='ffffe0';   
this.style.backgroundColor='5A8196';" value="Zitat"  onclick="cur_ins(this.form.post, '[quote]', '[/quote]',   
0);" name="zitat" />  


<select  name='color'  onchange="cur_ins(this.form.post, value,   '[/color]')">  
<option value='0'>------ Farbe -------</option>  
<option style="BACKGROUND-COLOR: black" value=" [color=Black]">Black</option>  
<option style="BACKGROUND-COLOR: sienna" value=" [color=Sienna]">Sienna</option>  
<option style="BACKGROUND-COLOR: darkolivegreen" value=" [color=DarkOliveGreen]">Dark Olive Green</option>  
<option style="BACKGROUND-COLOR: darkgreen" value=" [color=DarkGreen]">Dark Green</option>  
<option style="BACKGROUND-COLOR: darkslateblue" value=" [color=DarkSlateBlue]">Dark Slate Blue</option>  
<option style="BACKGROUND-COLOR: navy" value=" [color=Navy]">Navy</option>  
<option style="BACKGROUND-COLOR: indigo" value=" [color=Indigo]">Indigo</option>  
<option style="BACKGROUND-COLOR: darkslategray" value=" [color=DarkSlateGray]">Dark Slate Gray</option>  
<option style="BACKGROUND-COLOR: darkred" value=" [color=DarkRed]">Dark Red</option>  
<option style="BACKGROUND-COLOR: darkorange" value=" [color=DarkOrange]">Dark Orange</option>  
<option style="BACKGROUND-COLOR: olive" value=" [color=Olive]">Olive</option>  
<option style="BACKGROUND-COLOR: green" value=" [color=Green]">Green</option>  
<option style="BACKGROUND-COLOR: teal" value=" [color=Teal]">Teal</option>  
<option style="BACKGROUND-COLOR: blue" value=" [color=Blue]">Blue</option>  
<option style="BACKGROUND-COLOR: slategray" value=" [color=SlateGray]">Slate Gray</option>  
<option style="BACKGROUND-COLOR: dimgray" value=" [color=DimGray]">Dim Gray</option>  
<option style="BACKGROUND-COLOR: red" value=" [color=Red]">Red</option>  
<option style="BACKGROUND-COLOR: sandybrown" value=" [color=SandyBrown]">Sandy Brown</option>  
<option style="BACKGROUND-COLOR: yellowgreen" value=" [color=YellowGreen]">Yellow Green</option>  
<option style="BACKGROUND-COLOR: seagreen" value=" [color=SeaGreen]">Sea Green</option>  
<option style="BACKGROUND-COLOR: mediumturquoise" value=" [color=MediumTurquoise]">Medium Turquoise</option>  
<option style="BACKGROUND-COLOR: royalblue" value=" [color=RoyalBlue]">Royal Blue</option>  
<option style="BACKGROUND-COLOR: purple" value=" [color=Purple]">Purple</option>  
<option style="BACKGROUND-COLOR: gray" value=" [color=Gray]">Gray</option>  
<option style="BACKGROUND-COLOR: magenta" value=" [color=Magenta]">Magenta</option>  
<option style="BACKGROUND-COLOR: orange" value=" [color=Orange]">Orange</option>  
<option style="BACKGROUND-COLOR: yellow" value=" [color=Yellow]">Yellow</option>  
<option style="BACKGROUND-COLOR: lime" value=" [color=Lime]">Lime</option>  
<option style="BACKGROUND-COLOR: cyan" value=" [color=Cyan]">Cyan</option>  
<option style="BACKGROUND-COLOR: deepskyblue" value=" [color=DeepSkyBlue]">Deep Sky Blue</option>  
<option style="BACKGROUND-COLOR: darkorchid" value=" [color=DarkOrchid]">Dark Orchid</option>  
<option style="BACKGROUND-COLOR: silver" value=" [color=Silver]">Silver</option>  
<option style="BACKGROUND-COLOR: pink" value=" [color=Pink]">Pink</option>  
<option style="BACKGROUND-COLOR: wheat" value=" [color=Wheat]">Wheat</option>  
<option style="BACKGROUND-COLOR: lemonchiffon" value=" [color=LemonChiffon]">Lemon Chiffon</option>  
<option style="BACKGROUND-COLOR: palegreen" value=" [color=PaleGreen]">Pale Green</option>  
<option style="BACKGROUND-COLOR: paleturquoise" value=" [color=PaleTurquoise]">Pale Turquoise</option>  
<option style="BACKGROUND-COLOR: lightblue" value=" [color=LightBlue]">Light Blue</option>  
<option style="BACKGROUND-COLOR: plum" value=" [color=Plum]">Plum</option>  
<option style="BACKGROUND-COLOR: white" value=" [color=White]">White</option>  
</select>


<select name='size'  onchange="cur_ins(this.form.post, value,   '[/size]')">  
<option value='0'>- Grösse -</option>  
<option value=" [size=1]">1</option>  
<option value=" [size=2]">2</option>  
<option value=" [size=3]">3</option>  
<option value=" [size=4]">4</option>  
<option value=" [size=5]">5</option>  
<option value=" [size=6]">6</option>  
<option value=" [size=7]">7</option>  
</select>

<select  name='font'  onchange="cur_ins(this.form.post, value,   '[/font]')">  
<option value='0'>--- Schrift ---</option>  
<option value=" [font=Arial]">Arial</option>  
<option value=" [font=Fixedsys]">Fixedsys</option>  
<option value=" [font=Garamond]">Garamond</option>  
<option value=" [font=Georgia]">Georgia</option>  
<option value=" [font=Impact]">Impact</option>  
<option value=" [font=System]">System</option>  
<option value=" [font=Tahoma]">Tahoma</option>  
<option value=" [font=Verdana]">Verdana</option>  
</select>



<input type="submit"  style="color:#ffffe0; background-color:#5A8196" onmouseover="this.style.color='336699';   
this.style.backgroundColor='ffffe0';" onmouseout="this.style.color='ffffe0';   
this.style.backgroundColor='5A8196';" name="submit" value="eintragen">  
</form></td></tr>

formular_ausgabe.php

<code type="php"><?php

$autor = $name;
$content = $post;
$content = nl2br($content);
$content = strip_tags($content);
$content = str_replace("\n", "
", $content);
$content = nl2br(stripslashes($content));

echo "<table>";

$content = str_replace ("ü", "ü", $content);
$content = str_replace ("Ãœ", "Ü", $content);
$content = str_replace ("ö", "ö", $content);
$content = str_replace ("Ö", "Ö", $content);
$content = str_replace ("ä", "ä", $content);
$content = str_replace ("Ä", "Ä", $content);
$content = str_replace ("ß", "ß", $content);
$content = str_replace ("â?¬", "€", $content);


$content = str_replace("[z]", "
", $content);

$content = str_replace("[b]", "", $content);
$content = str_replace("[/b]", "
", $content);

$content = str_replace("[i]", "", $content);
$content = str_replace("[/i]", "
", $content);

$content = str_replace("[u]", "", $content);
$content = str_replace("[/u]", "
", $content);

$content = str_replace("[p]", "<p>", $content);
$content = str_replace("[/p]", "</p>", $content);

$content = str_replace("[img]", "<img src=\"", $content);
$content = str_replace("[/img]", "\">", $content);

$content = str_replace("[link]", "<a target=\"_blank\" href=\"", $content);
$content = str_replace("[/link]", "\">Externer Hyperlink</a>", $content);

$content = str_replace("[center]", "<center>", $content);
$content = str_replace("[/center]", "</center>", $content);

$content = eregi_replace("\[email\]([^\[]+)\[/email\]","<a href=\"mailto:\\1\">\\1</a>",$content);
$content = eregi_replace("\[email=([^\[]+)\]([^\[]+)\[/email\]","<a

href=\"mailto:\\1\">\\2</a>",$content);


$content = eregi_replace("\[url=([^\[]+)\]([^\[]+)\[/url\]","<a href=\"\\1\"

target=\"_blank\">\\2</a>",$content);

$content = eregi_replace("\[url\]([^\[]+)\[/url\]","<a href=\"\\1\"

target=\"_blank\">\\1</a>",$content);

$content = preg_replace("/\[quote\](.*?)\[\/quote\]/si", "<table border=1 bordercolor=black

bgcolor=silver><tr><blockquote><th>Zitat:<font

color=black>\\1</font></th></blockquote></tr></table>", $content);

$content = eregi_replace("(\[size=)(([a-zA-Z0-9]*|\#)*)(\])","<font size=\\2>",$content);
$content = str_replace("[/size]", "</font>", $content);

$content = eregi_replace("(\[color=)(([a-zA-Z0-9]*|\#)*)(\])","<font color=\\2>",$content);
$content = str_replace("[/color]", "</font color>", $content);

$content = eregi_replace("(\[font=)(([a-zA-Z0-9]*|\#)*)(\])","<font face=\\2>",$content);
$content = str_replace("[/font]", "</font face>", $content);


echo <<<BCD
<td bgcolor="#4E6F81" bordercolor="black">Name</td><td bgcolor="#4E6F81" bordercolor="black">Eintrag</td>

<tr>
<td align="left" bgcolor="#89a9b8" valign="top">
$autor
</td>

<td width="80%" align="left" bordercolor="black" valign="top" bgcolor="#89a9b8">$content

</td>
</tr>

BCD;
?>