vil ikke printe ud da database
heysan allesammenjeg har haft dette spørgsmål herinde tidligere...
jeg har et tagwall / gæstebog script som ikke vil vise udtrækket fra databasen :(
jo den vil gerne vise det hvis jeg bruger bbcode og indsætter et smiley til at starte med. men hvis jeg bare skriver ren tekst så viser den nada, men sætter det ind i databasen...
<?
session_start();
include("inc/config.php");
if($_POST["opret"]){
if(empty($_POST["navn"]) OR empty($_POST["email"]) OR empty($_POST["besked"])){
header("location: tagwall.php?error=tom");
} else {
if($_SESSION["admin"]){
$admin = "ja";
}else{
$admin = "nej";
}
$navn = htmlspecialchars($_POST["navn"]);
$email = htmlspecialchars($_POST["email"]);
$www = htmlspecialchars($_POST["www"]);
$besked = htmlspecialchars($_POST["besked"]);
$dato = date("d/m/Y - H:i");
$ip = $_SERVER["REMOTE_ADDR"];
mysql_query("INSERT INTO tagwall (navn, email, www, besked, dato, ip, admin) VALUES ('".$navn."', '".$email."', '".$www."', '".$besked."', '".$dato."', '".$ip."', '".$admin."')") or die (mysql_error());
header("location: tagwall.php");
}
}
if($_GET["section"] == "logud"){
echo "<br><center><font color=\"#FF0000\"><b>du er nu loggede ud af systemet</b></font></center><br>";
unset($_SESSION["admin"]);
session_destroy();
header("location: tagwall.php");
}
if($_GET["section"] == "toem"){
if(!$_SESSION["admin"]){
header("location: http://google.dk");
}else{
mysql_query("TRUNCATE tagwall") or die (mysql_error());
header("location: tagwall.php");
}
}
if($_POST["ret"]){
if(!$_SESSION["admin"]){
header("location: http://google.dk");
}else{
$navn = htmlspecialchars($_POST["navn"]);
$email = htmlspecialchars($_POST["email"]);
$www = htmlspecialchars($_POST["www"]);
$besked = htmlspecialchars($_POST["besked"]);
mysql_query("UPDATE tagwall SET navn = '".$navn."', email = '".$email."', www = '".$www."', besked = '".$besked."' WHERE id = '".$_POST["id"]."'") or die (mysql_error());
header("location: tagwall.php");
}
}
if($_GET["section"] == "ban"){
if(!$_SESSION["admin"]){
header("location: http://google.dk");
}else{
mysql_query("INSERT INTO banned (ip) VALUES ('".$_GET["ip"]."')") or die (mysql_error());
header("location: tagwall.php");
}
}
if($_GET["section"] == "unban"){
if(!$_SESSION["admin"]){
header("location: http://google.dk");
}else{
mysql_query("DELETE FROM banned WHERE ip = '".$_GET["ip"]."'") or die (mysql_error());
header("location: tagwall.php");
}
}
if($_GET["section"] == "slet"){
if(!$_SESSION["admin"]){
header("location: http://google.dk");
}else{
mysql_query("DELETE FROM tagwall WHERE id = '".$_GET["id"]."'") or die (mysql_error());
header("location: tagwall.php");
}
}
if($_POST["l"]){
if(empty($_POST["b"]) OR empty($_POST["p"])){
header("location: tagwall.php?section=admin&error=tomt");
} else {
if(md5($_POST["p"]) == md5($pass) && $_POST["b"] == $user){
$_SESSION["admin"] = $user;
header("location: tagwall.php");
} else{
header("location: tagwall.php?section=admin&error=skrid");
}
}
}
?>
<? include ("inc/online.php") ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>AliasFM - We play day and night</title>
<link rel="stylesheet" href="style/style.css" type="text/css">
</head>
<body>
<div align="center">
<table width="1100" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="15" height="74" rowspan="5" background="images/side_left.jpg"> </td>
<td colspan="3"><img src="images/top.jpg" width="1069" height="45"></td>
<td width="15" rowspan="5" background="images/side_right.jpg"> </td>
</tr>
<tr>
<td height="1" background="images/pixel.jpg"></td>
</tr>
<tr>
<td width="1" height="54" align="center" valign="top" background="images/pixel.jpg"><br><br></td>
<td width="1068" align="center" valign="top" background="images/bg.jpg"><div align="right"><br />
<table width="893" border="0">
<tr>
<td width="785"><table width="564" border="0" align="left" cellpadding="0" cellspacing="0">
<tr>
<td colspan="3"><img src="images/content_smssystem.jpg" width="700" height="18" /></td>
</tr>
<tr>
<td width="1" background="images/pixel.jpg"></td>
<td width: 564px;background: FFFFFF"><iframe width="100%" height="60" allowTransparency src="http://tools.comsms.dk/smsbox3.php?id=8392" scrolling="no" frameborder="0" align="top"></iframe></td>
<td width="1" background="images/pixel.jpg"></td>
</tr>
<tr>
<td colspan="3"><img src="images/content_bottom.jpg" width="700" height="12" /></td>
</tr>
</table></td>
<td width="30"><a target="_blank" href="http://stream.aliasfm.net:9352/listen.pls"><img src="images/winamp.gif" width="26" height="26" border="0"/></a></td>
<td width="28"><a target="_blank" href="http://aliasfm.net/108/aliasfm.asx"><img src="images/wmp2.gif" width="26" height="26" border="0"/></a></td>
<td width="32"><a target="_blank" href="http://aliasfm.net/108/webplayer/index.php"><img src="images/wmp.gif" width="26" height="26" border="0"/></a></td>
</tr>
</table>
<iframe src="http://193.164.133.198/inc/radio2.php" scrolling="no" name="I1" border="0" frameborder="0" align="center" width="157" height="25"></iframe>
</div>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="17%" align="left" valign="top">
<?php include ("menu/mainmenu.php"); ?>
<br>
<?php include ("menu/pollsystem.php"); ?>
<br>
<?php include ("menu/partner.php"); ?>
<br>
<?php include ("menu/stats.php") ?>
<br>
</td>
<td width="83%" align="center" valign="top"><table width="564" border="0" align="left" cellpadding="0" cellspacing="0">
<tr>
<td colspan="3"><img src="images/content_online.jpg" width="700" height="18"></td>
</tr>
<tr>
<td width="1" background="images/pixel.jpg"></td>
<td width="698" width: 564px;background: FFFFFF"><table width="536" border="0" align="center">
<a href="test.php">tagwall</a>
<?
if($_SESSION["admin"]){
echo " # <a href=\"test.php?section=logud\">logud</a><br><br>";
echo "<b>ADMIN</b><br>";
echo "<a href=\"test.php?section=toem\">Tøm tagwall</a>";
}else{
?>
# <a href="test.php?section=admin">Admin</a>
# <a href="java script:winop();">Smileys</a>
<?
}
?><br><br>
<script type="text/javascript">
function winop()
{
windop = window.open("moresmiles.php","mywin","height=400,width=450,resizable=yes,scrollbars=yes");
}
function addSmilie(text) {
text=''+text+'';
if ( document.getElementById('txt').createTextRange && document.getElementById('txt').caretPos) {
var caretPos=document.getElementById('txt').caretPos;
caretPos.text=caretPos.text.charAt(caretPos.text.length-1)==''?text+'':text;
document.getElementById('txt').focus();
} else {
document.getElementById('txt').value+=text;
document.getElementById('txt').focus();
}
}</script>
<?
if($_GET["section"] == "admin"){
?>
<?
if($_GET["error"] == "tomt"){
echo "<font color=\"red\">Udfyld alle felter!<br><br></font>";
} elseif($_GET["error"] == "skrid"){
echo "<font color=\"red\">Skrid!</font><br><br>";
}
?>
<form action="test.php" method="post">
Brugernavn:<br>
<input type="text" name="b"><br>
Password:<br>
<input type="password" name="p"><br>
<input type="submit" value="login" name="l"></form>
<?
}
?>
<?
if($_GET["section"] == "ret") {
if(!$_SESSION["admin"]){
echo "DOH!";
}else{
$tag = mysql_query("SELECT * FROM tagwall WHERE id = '".$_GET["id"]."'") or die (mysql_error());
$ro = mysql_fetch_array($tag);
?>
<form action="test.php" method="post">
<input type="hidden" value="<?=$_GET["id"];?>" name="id">
Navn: *<br>
<input type="text" name="navn" value="<?=$row["navn"];?>"><br>
Email: *<br />
<input type="text" name="email" value="<?=$row["email"];?>"><br>
Http://(husk <font color="#FF0000"><b>http://</font></b>)<br>
<input type="text" name="www" value="<?=$row["www"];?>"><br>
<input type="button" value="B" style="font-weight:bold;" onclick="addSmilie('');">
<input type="button" value="I" style="font-style:italic;" onclick="addSmilie('');">
<input type="button" value="U" style="text-decoration:underline;" onclick="addSmilie('');">
<input type="button" value="Email" onclick="addSmilie('');">
<input type="button" value="Link" onclick="addSmilie('[link][/link]');">
<input type="button" value="Kode" onclick="addSmilie('[kode][/kode]');">
<br>
<textarea name="besked" rows="9" cols="30" id="txt"><?=$row["besked"];?></textarea><br>
<input type="submit" value="Ret besked" name="ret"></form>
<?
}
}
?>
<?
if(!$_GET["section"]){
?>
<form action="test.php" method="post">
<?
if($_GET["error"] == "tom"){
echo "<font color=\"red\">Du skal udfylde felterne med *</font><br><br>";
}
?>
<?
if($_SESSION["admin"]){
?>
<input type="hidden" name="navn" value="<?=$navn;?>">
<input type="hidden" name="email" value="<?=$email;?>">
<input type="hidden" name="www" value="<?=$www;?>">
<input type="button" value="B" style="font-weight:bold;" onclick="addSmilie('');">
<input type="button" value="I" style="font-style:italic;" onclick="addSmilie('');">
<input type="button" value="U" style="text-decoration:underline;" onclick="addSmilie('');">
<input type="button" value="Email" onclick="addSmilie('');">
<input type="button" value="Link" onclick="addSmilie('[link][/link]');">
<input type="button" value="Kode" onclick="addSmilie('[kode][/kode]');">
<br>
<textarea name="besked" rows="9" cols="30" id="txt"></textarea><br>
<input type="submit" value="Opret besked" name="opret"></form>
<?
}else{
?>
Navn: *<br>
<input type="text" name="navn"><br>
Email: *<br />
<input type="text" name="email"><br>
Http://(husk <font color="#FF0000"><b>http://</b></font>)<br>
<input type="text" name="www"><br>
<input type="button" value="B" style="font-weight:bold;" onclick="addSmilie('');">
<input type="button" value="I" style="font-style:italic;" onclick="addSmilie('');">
<input type="button" value="U" style="text-decoration:underline;" onclick="addSmilie('');">
<input type="button" value="Email" onclick="addSmilie('');">
<input type="button" value="Link" onclick="addSmilie('[link][/link]');">
<input type="button" value="Kode" onclick="addSmilie('[kode][/kode]');">
<br>
<textarea name="besked" rows="9" cols="37" id="txt"></textarea><br>
<input type="submit" value="Opret besked" name="opret"></form>
<?
}
?>
<hr class="linje">
<?
$t = mysql_query("SELECT * FROM tagwall") or die (mysql_error());
$antal = mysql_num_rows($t);
$vis_fra = (isset($_GET["offset"]) AND is_numeric($_GET["offset"]) AND $antal > $_GET["offset"]) ? $_GET["offset"] : 0;
$tags = mysql_query ("SELECT * FROM tagwall ORDER BY id ".$rakke." LIMIT ".$vis_fra.", ".$per_side."") or die(mysql_error());
if(mysql_num_rows($tags) == 0){
echo " Ingen beskeder!";
} else {
while($row=mysql_fetch_array($tags)){
echo " <b><a href=\"mailto: ".$row["email"]."\">";
if($row["admin"] == "ja"){
echo "<span id=\"admin\">".$row["navn"]." (admin)</span>";
} else {
echo "".$row["navn"]."";
}
echo "</a></b>";
if(empty($row["www"])){
echo" <br>";
}else{
echo " <b># <a href=\"".$row["www"]."\" target=\"_blank\">www</a></b><br />";
}
echo "<center";
echo nl2br(bb($row["besked"]));
echo "</center>";
echo "<br><br>";
echo " Skrevet den ".$row["dato"]."";
if($_SESSION["admin"]){
echo " <a href=\"test.php?section=slet&id=".$row["id"]."\"><font color=\"red\">[slet]</font></a> ";
if($row["admin"] == "ja"){
echo "";
} else{
$ban = mysql_query("SELECT * FROM banned WHERE ip = '".$row["ip"]."'") or die (mysql_error());
if(mysql_num_rows($ban) == 1) {
echo " | <a href=\"test.php?section=unban&ip=".$row["ip"]."\"><font color=\"black\">[unban]</font></a> ";
}else{
echo " | <a href=\"test.php?section=ban&ip=".$row["ip"]."\"><font color=\"blue\">[ban]</font></a> ";
}
}
echo " | <a href=\"test.php?section=ret&id=".$row["id"]."\"><font color=\"green\">[ret]</font></a> ";
}else{
echo"";
}
echo "<hr class=\"linje\">";
if($vis_fra > 0){
$back = $vis_fra - $per_side;
echo " <a href=\"".$_SERVER["PHP_SELF"]."?offset=".$back."\">Forrige</a> ";
}else{
echo"";
}
if($vis_fra < $antal - $per_side){
$next = $vis_fra + $per_side;
echo " <a href=\"".$_SERVER["PHP_SELF"]."?offset=".$next."\">Næste</a> ";
}else{
echo"";
}
}
}
?>
<?
}
?>
<br></tr>
</table>
</td>
<td width="1" background="images/pixel.jpg"></td>
</tr>
<tr>
<td colspan="3"><img src="images/content_bottom.jpg" width="700" height="12"></td>
</tr>
</table>
<? include ("menu/top5.php"); ?>
</td>
</tr>
</table>
<br></td>
<tr>
<td height="34" colspan="3"><img src="images/bottom.jpg" width="1069" height="34"></td>
</tr>
</tr>
</table>
</div>
<center>
Copyright AliasFM
<?php
$year = date("Y"); //defines the year
echo("© $year "); //the echoing
echo("<br>");
putenv("TZ=America/Los_Angeles");
echo "Last modified: " . date( "F d Y.", getlastmod() );
?>
<br>
This Station is authorized by: STIM/NCB
</center>