Hallo!
Ja ihr seht richtig! Ich bin es schon wieder ^^
Nun habe ich ein problem mit meinem Gästebuch. Es lief alles Wunderbar bis ich die MySQL Tabelle "GB" gelöscht habe, um eine neue Tabelle, ebenfalls GB, anzulegen.
Ich habe das gemacht, weil ich vorher 3 Sachen vergessen hatte(HP/Email/ICQ).
Ich kann ohne Probleme Texte eingeben, aber dann werden die Daten entweder nicht in die Tabelle eingetragen, oder es läuft was mit der Ausgabe schief.
Hier mal der Code von der Eingabe:
Und hier de Code von der Ausgabe:
Und ich hätte da noch eine frage.
Wie kann ich es machen, das nur ein Bild angezeigt wird wenn auch ein Link angegeben wurde?
so etwa?
Ich hoffe es kann mir jemand helfen! Danke schonmal im Vorraus.
Gruss Rambo51
Ja ihr seht richtig! Ich bin es schon wieder ^^
Nun habe ich ein problem mit meinem Gästebuch. Es lief alles Wunderbar bis ich die MySQL Tabelle "GB" gelöscht habe, um eine neue Tabelle, ebenfalls GB, anzulegen.
Ich habe das gemacht, weil ich vorher 3 Sachen vergessen hatte(HP/Email/ICQ).
Ich kann ohne Probleme Texte eingeben, aber dann werden die Daten entweder nicht in die Tabelle eingetragen, oder es läuft was mit der Ausgabe schief.
Hier mal der Code von der Eingabe:
PHP:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script src="functions.js" type="text/javascript"></script>
<title>Unbenanntes Dokument</title>
</head>
<body>
<?php include("gbaddconfig.php");?>
<?php
$conn_id = mysql_connect($host,$nick,$pw);
mysql_select_db($database,$conn_id);
if(!empty($_POST))
{
$datum = date("Y-m-d H:i:s");
$sql = "insert into $table (autor,hp,email,icq,titel,text,datum) VALUES ('$autor','$hp','$email','$icq','$titel','$text','$datum')" ;
mysql_query($sql) OR die(mysql_error());
}
?>
<table align="center" bgcolor="#000000" width="562" border="0" cellpadding="0" cellspacing="1">
<!--DWLayoutTable-->
<form name="textarea" action=<?php echo $PHP_SELF; ?> method=post>
<tr>
<td class=newsunten width="200" height="25">Autor</td>
<td width="397" class=newstext><input type=text name="autor"></td>
</tr>
<tr>
<td class=newsunten height="25">Homepage</td>
<td class=newstext><input type=text name="hp"></td>
</tr>
<tr>
<td class=newsunten height="25">E-Mail</td>
<td class=newstext><input type=text name="email"></td>
</tr>
<tr>
<td class=newsunten height="25">ICQ</td>
<td class=newstext><input type=text name="icq"></td>
</tr>
<tr>
<td class=newsunten height="25">Titel</td>
<td class=newstext><input type=text name="titel"></td>
</tr>
<tr>
<td height="158" valign="top" class=newsunten>Text</td>
<td valign="top" class=newstext>
<button type="button" onclick="javascript:edit('fett');"><b>B</b></button>
<button type="button" onclick="javascript:edit('kursiv');"><i>I</i></button>
<button type="button" onclick="javascript:edit('underline');"><u>U</u></button>
<button type="button" onclick="javascript:urltext();">URL</button>
<button type="button" onclick="javascript:edit('bild');">Pic</button>
<button type="button" onclick="javascript:edit('rot');"><font color="red">R</font></button>
<button type="button" onclick="javascript:edit('gruen');"><font color="green">G</font></button>
<button type="button" onclick="javascript:edit('blau');"><font color="blue">B</font></button>
<button type="button" onclick="javascript:edit('white');"><font color="white">B</font></button>
<button type="button" onclick="javascript:edit('gelb');"><font color="yellow">B</font></button>
<button type="button" onclick="javascript:edit('qoute');">Q</button>
<button type="button" onclick="window.open('smilies.php','popup','width=430,height=460,left=0,top=0,scrollbars=no');return false;">Smilies</button>
<textarea cols="50" name="text" rows="8"></textarea></td>
</tr>
<tr>
<td class=newsunten height="24"><!--DWLayoutEmptyCell--> </td>
<TD class=newsunten height="24"><input type=submit value="ADD your Message">
</form>
</td>
</table>
</body>
</html>
Und hier de Code von der Ausgabe:
PHP:
<html>
<head>
<title>xxx</title>
<link rel="STYLESHEET" type="text/css" href="style.css">
</head>
<body bgcolor="#000000">
<table width="100%" border="0" cellspacing="0" cellpadding="10" align="center">
<tr>
<td>
<?php
function bbcodes($text)
{
$neuertext = stripslashes($text);
$neuertext = preg_replace("/\[img\](.*)\[\/img\]/isU", "<img src=\"$1\" border='0' />", $neuertext);
$neuertext = preg_replace("/\[center\](.*)\[\/center\]/isU", "<center>$1</center>", $neuertext);
$neuertext = preg_replace("/\[b\](.*)\[\/b\]/isU", "<b>$1</b>", $neuertext);
$neuertext = preg_replace("/\[i\](.*)\[\/i\]/isU", "<i>$1</i>", $neuertext);
$neuertext = preg_replace("/\[u\](.*)\[\/u\]/isU", "<u>$1</u>", $neuertext);
$neuertext = eregi_replace("([ \r\n])www\\.([^ ,\r\n]*)","\\1http://www.\\2",$neuertext);
$neuertext = eregi_replace("([ \r\n])http\:\/\/www\\.([^ ,\r\n]*)","\\1http://www.\\2",$neuertext);
$neuertext = preg_replace("/\[url\]www.(.*)\[\/url\]/isU", "http://www.$1", $neuertext);
$neuertext = preg_replace("/\[url=(.*?)\](.*?)\[\/url\]/", "<a href=\"\\1\" target='_blank'>\\2</a>", $neuertext);
$neuertext = preg_replace("/\[url\](.*)\[\/url\]/isU", "<a href='$1' target='_blank'>$1</a>", $neuertext);
$neuertext = preg_replace("/\[red\](.*)\[\/red\]/isU", "<font color='red'>$1</font>", $neuertext);
$neuertext = preg_replace("/\[blue\](.*)\[\/blue\]/isU", "<font color='blue'>$1</font>", $neuertext);
$neuertext = preg_replace("/\[yellow\](.*)\[\/yellow\]/isU", "<font color='yellow'>$1</font>", $neuertext);
$neuertext = preg_replace("/\[green\](.*)\[\/green\]/isU", "<font color='green'>$1</font>", $neuertext);
$neuertext = preg_replace("/\[size=(.*)\](.*)\[\/size\]/isU", "<font size='$1'>$2</font>", $neuertext);
$neuertext = preg_replace("/\[quote\](.*)\[\/quote\]/isU", "<table border='1' cellspacing='0' cellpadding='2' bgcolor='EFEFEF' width='95%' align='center'><tr><td>$1</tr></td></table>", $neuertext);
$neuertext = preg_replace("/\[quote=(.*)\](.*)\[\/quote\]/isU", "<table border='1' cellspacing='0' cellpadding='2' bgcolor='EFEFEF' width='95%' align='center'><tr><td><i>Orginal von $1:</i><br><br>$2</tr></td></table>", $neuertext);
$neuertext = str_replace(":(", "<img src=\"smilies/angry.gif\" alt=\":-)\" width=\"15\" height=\"15\" />", $neuertext);
$neuertext = str_replace(":D", "<img src=\"smilies/biggrin.gif\" alt=\":-D\" width=\"15\" height=\"15\" />", $neuertext);
$neuertext = str_replace(":crazy:", "<img src=\"smilies/confused.gif\" alt=\";-)\" width=\"15\" height=\"15\" />", $neuertext);
$neuertext = str_replace("8)", "<img src=\"smilies/cool.gif\" alt=\":-(\" width=\"15\" height=\"15\" />", $neuertext);
$neuertext = str_replace(":-(", "<img src=\"smilies/cry.gif\" alt=\":-P\" width=\"15\" height=\"15\" />", $neuertext);
$neuertext = str_replace(">)", "<img src=\"smilies/evil.gif\" alt=\"8-)\" width=\"15\" height=\"15\" />", $neuertext);
$neuertext = str_replace(":((", "<img src=\"smilies/frown.gif\" alt=\":bll:\" width=\"15\" height=\"15\" />", $neuertext);
$neuertext = str_replace(":lol:", "<img src=\"smilies/laugh.gif\" alt=\":blumen:\" width=\"15\" height=\"15\" />", $neuertext);
$neuertext = str_replace(":rolleyes:", "<img src=\"smilies/rolleyes.gif\" alt=\":boxer:\" width=\"15\" height=\"15\" />", $neuertext);
$neuertext = str_replace(":)", "<img src=\"smilies/smilie.gif\" alt=\":bussi:\" width=\"15\" height=\"15\" />", $neuertext);
$neuertext = str_replace(":surprised:", "<img src=\"smilies/surprised.gif\" alt=\":bussi:\" width=\"15\" height=\"15\" />", $neuertext);
$neuertext = str_replace(":P", "<img src=\"smilies/tongue.gif\" alt=\":bussi:\" width=\"15\" height=\"15\" />", $neuertext);
$neuertext = str_replace(";)", "<img src=\"smilies/wink.gif\" alt=\":bussi:\" width=\"15\" height=\"15\" />", $neuertext);
$neuertext = str_replace("\n", "<br>", $neuertext);
return $neuertext;
}
$conn_id = mysql_connect($host,$id,$pw);
mysql_select_db($database,$conn_id);
?>
<?php
$result = mysql_query("select * from $table ORDER BY datum DESC LIMIT 0, 8");
if ($num = mysql_num_rows($result)) {
for($i=0;$i < $num; $i++) {
$titel = mysql_result($result,$i,"titel");
$autor = mysql_result($result,$i,"autor");
$hp = mysql_result($result,$i,"hp");
$email = mysql_result($result,$i,"email");
$icq = mysql_result($result,$i,"icq");
$datum = mysql_result($result,$i,"datum");
$text = mysql_result($result,$i,"text");
$neuertext = bbcodes($text);
echo "
<table align=\"center\" bgcolor=\"000000\" width=\"562\" border=\"0\" cellpadding=\"0\" cellspacing=\"1\">
<!--DWLayoutTable-->
<tr>
<td width=\"169\" height=\"28\" class=newsunten><strong>$autor</strong></td>
<td width=\"428\" valign=\"top\"><table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">
<!--DWLayoutTable-->
<tr>
<td width=\"426\" height=\"28\" class=newsunten><strong>$titel</strong></td>
</tr>
</table></td>
</tr>
<tr>
<td class=newsunten rowspan=\"2\" valign=\"top\">geschrieben am:
<p class=Stil1>$datum</p></td>
<td height=\"153\" valign=\"top\" class=newstext>$neuertext</td>
<br>
</tr>
<tr>
<td class=newsunten height=\"19\" valign=\"top\">$hp $email $icq</td>
</tr>
</table>
<br>
";
}
} else echo "<div align=\"center\">No Messages</div>";
?>
</td>
</tr>
</table>
</body>
</html>
Und ich hätte da noch eine frage.
Wie kann ich es machen, das nur ein Bild angezeigt wird wenn auch ein Link angegeben wurde?
so etwa?
PHP:
<? if ($hp == "0")
{ echo "" }
else
{ echo "ausgeben des Linkes" }
?>
Ich hoffe es kann mir jemand helfen! Danke schonmal im Vorraus.
Gruss Rambo51