Tilføj smiles
Hejsa EksperterJeg har en tagwall som jeg ikke har lavet med vil gerne udvide den med smiles.
Jeg har prøvet at tilføje smiles men uden held
Orginale script:
<?
include "top.php";
?>
<?
$host = "host"; // Her defineres host til mysql serveren altså ip'en. Dette er normalt localhost.
$bruger = "bruger"; // Brugernavnet til mysql serveren.
$kode = "kode"; // Koden til mysql serveren.
$database = "database"; // Navnet på databasen, som tabellen "tagwall" ligger i.
// Ændringer herunder sker på eget ansvar!
$conn = mysql_connect("$host", "$bruger", "$kode");
mysql_select_db("$database");
// Modtagning af tag data og indsættelse i mysql databasen
if ($_REQUEST['mode'] == "ins") {
$tag = ereg_replace("<","<",$tag);
$tag = ereg_replace(">",">",$tag);
$tid = date("d/m-y H:i");
$navn = $_POST['navn'];
$email = $_POST['email'];
$tag = $_POST['tag'];
$tagfinal = "<tr align=\"left\"><td valign=\"top\"><a href=\"mailto:$email\" style=\"text-decoration:none\"><font face=\"arial\" size=\"2\" color=\"#808080\"><b>$navn</a> <br> </b></font><font face=\"$face\" size=\"2\" color=\"$farve\" valign=\"top\">$tag</i></b></font> <font face=\"$face\" size=\"1\" color=\"#666666\"><br>[$tid]<br></font></td></tr>-<br>\n";
$brugerip = $_SERVER['REMOTE_ADDR'];
$insertSQL = "insert into tagwall (tag, ip) values ('$tagfinal', '$brugerip')";
mysql_query($insertSQL);
echo '<script language=javascript>document.URL="tagwall.php";</script>';
}
// Slet-tag modulet
if ($_GET['mode'] == 'del') {
session_start();
if (isset($_SESSION["s_name"]))
{
$num = $_GET['nummer'];
$query = mysql_query("DELETE FROM tagwall WHERE id='$num'");
echo "<script langauge=javascript>document.URL='tagwall.php?admin=1';</script>";
}
echo "<script language=javascript>document.URL='tagwall.php';</script>"; // Hvis der ikke er admin adgang
}
else
{ // Hvis der ikke er lavet nogen request til ovenstående
?>
<html>
<head>
<title>Tagwall</title>
</head
<body>
<div align="left"><br>
<table align="center" cellpadding="0" cellspacing="0" border="0" align="center">
<form action="tagwall.php?mode=ins" method="POST" name="form">
<tr>
<td colspan="2" align="center"><p><b>Tilføj tag</b></p></td>
</tr>
<tr>
<td align="right"><p>Navn: </p></td>
<td><INPUT TYPE="text" NAME="navn" class="css" size="21" font-family: Verdana; font-size: 8 pt; border: 1 solid white" maxlength="15"></td>
</tr>
<tr>
<td align="right"><p>Email: </p></td>
<td><INPUT TYPE="text" NAME="email" class="css" size="21" font-family: Verdana; font-size: 8 pt; border: 1 solid white" maxlength="15"></td>
</tr>
<tr>
<td valign="top" align="right"><p>Tag: </p></td>
<td>
<textarea NAME="tag" rows="4" size="21" class="css" font-family: Verdana; font-size: 8 pt; border: 1 solid white" maxlength="250" cols="20"></textarea></td>
</tr>
<tr>
<td></td>
<td><input type="submit" name="submit" value="Tag it" class="css" font-family: Verdana; font-size: 8 pt; border: 1 solid white">
<input type="reset" name="submit0" value="Reset" class="css" font-family: Verdana; font-size: 8 pt; border: 1 solid white"></td>
</tr>
</form>
</table>
<font face="verdana" size="1" color="#000000"><br>
<?
$result = mysql_query("SELECT * FROM tagwall ORDER BY id DESC") or die(mysql_error());
while ($row = mysql_fetch_array($result))
{
$output = $row['tag'];
$brugerip = $row['ip'];
$id = $row['id'];
if ($_REQUEST['admin'] == 1) {
echo "<a href=\"tagwall.php?mode=del&nummer=".$id."\">Slet</a><br>IP: $brugerip<br><br>";
}
echo $output;
}
echo '<br>Copyright by <a href="mailto:t-bird@c.dk">Jacob Overgaard</a> - All right reserved<br>';
echo '<br><a href="http://tfugl.dyndns.org">Tfugl.dyndns.org</a>';
}
mysql_close();
?>
</body>
</html>
<?
include "bund.php";
?>
Det som jeg prøvede:
<?
include "top.php";
?>
<?
$host = "host"; // Her defineres host til mysql serveren altså ip'en. Dette er normalt localhost.
$bruger = "bruger"; // Brugernavnet til mysql serveren.
$kode = "kode"; // Koden til mysql serveren.
$database = "database"; // Navnet på databasen, som tabellen "tagwall" ligger i.
// Ændringer herunder sker på eget ansvar!
$conn = mysql_connect("$host", "$bruger", "$kode");
mysql_select_db("$database");
// Modtagning af tag data og indsættelse i mysql databasen
if ($_REQUEST['mode'] == "ins") {
$tag = ereg_replace("<","<",$tag);
$tag = ereg_replace(">",">",$tag);
$tid = date("d/m-y H:i");
$navn = $_POST['navn'];
$email = $_POST['email'];
$tag = $_POST['tag'];
$tagfinal = "<tr align=\"left\"><td valign=\"top\"><a href=\"mailto:$email\" style=\"text-decoration:none\"><font face=\"arial\" size=\"2\" color=\"#808080\"><b>$navn</a> <br> </b></font><font face=\"$face\" size=\"2\" color=\"$farve\" valign=\"top\">$tag</i></b></font> <font face=\"$face\" size=\"1\" color=\"#666666\"><br>[$tid]<br></font></td></tr>-<br>\n";
$brugerip = $_SERVER['REMOTE_ADDR'];
$insertSQL = "insert into tagwall (tag, ip) values ('$tagfinal', '$brugerip')";
mysql_query($insertSQL);
echo '<script language=javascript>document.URL="tagwall.php";</script>';
}
// Slet-tag modulet
if ($_GET['mode'] == 'del') {
session_start();
if (isset($_SESSION["s_name"]))
{
$num = $_GET['nummer'];
$query = mysql_query("DELETE FROM tagwall WHERE id='$num'");
echo "<script langauge=javascript>document.URL='tagwall.php?admin=1';</script>";
}
echo "<script language=javascript>document.URL='tagwall.php';</script>"; // Hvis der ikke er admin adgang
}
else
{ // Hvis der ikke er lavet nogen request til ovenstående
?>
<html>
<head>
<title>Tagwall</title>
</head
<body>
<div align="left"><br>
<table align="center" cellpadding="0" cellspacing="0" border="0" align="center">
<form action="tagwall.php?mode=ins" method="POST" name="form">
<tr>
<td colspan="2" align="center"><p><b>Tilføj tag</b></p></td>
</tr>
<tr>
<td align="right"><p>Navn: </p></td>
<td><INPUT TYPE="text" NAME="navn" class="css" size="21" font-family: Verdana; font-size: 8 pt; border: 1 solid white" maxlength="15"></td>
</tr>
<tr>
<td align="right"><p>Email: </p></td>
<td><INPUT TYPE="text" NAME="email" class="css" size="21" font-family: Verdana; font-size: 8 pt; border: 1 solid white" maxlength="15"></td>
</tr>
<tr>
<td valign="top" align="right"><p>Tag: </p></td>
<td>
<textarea NAME="tag" rows="4" size="21" class="css" font-family: Verdana; font-size: 8 pt; border: 1 solid white" maxlength="250" cols="20"></textarea></td>
</tr>
<tr>
<td></td>
<td><input type="submit" name="submit" value="Tag it" class="css" font-family: Verdana; font-size: 8 pt; border: 1 solid white">
<input type="reset" name="submit0" value="Reset" class="css" font-family: Verdana; font-size: 8 pt; border: 1 solid white"></td>
</tr>
</form>
</table>
<font face="verdana" size="1" color="#000000"><br>
<?
$result = mysql_query("SELECT * FROM tagwall ORDER BY id DESC") or die(mysql_error());
while ($row = mysql_fetch_array($result))
{
$output = htmlspecialchars($row[tag]);
$output = str_replace(":D", "<img src=\"smilie/icon_biggrin.gif\">", $output);
$output = str_replace(":S", "<img src=\"smilie/icon_confused.gif\">", $output);
$output = str_replace(":8", "<img src=\"smilie/icon_cool.gif\">", $output);
$output = str_replace(":'(", "<img src=\"smilie/icon_cry.gif\">", $output);
$output = str_replace(":¨", "<img src=\"smilie/icon_eek.gif\">", $output);
$output = str_replace(":e", "<img src=\"smilie/icon_evil.gif\">", $output);
$output = str_replace("!", "<img src=\"smilie/icon_exclaim.gif\">", $output);
$output = str_replace(":i", "<img src=\"smilie/icon_idea.gif\">", $output);
$output = str_replace(":l", "<img src=\"smilie/icon_lol.gif\">", $output);
$output = str_replace(":[", "<img src=\"smilie/icon_mad.gif\">", $output);
$output = str_replace(":|", "<img src=\"smilie/icon_neutral.gif\">", $output);
$output = str_replace("?", "<img src=\"smilie/icon_question.gif\">", $output);
$output = str_replace(":r", "<img src=\"smilie/icon_razz.gif\">", $output);
$output = str_replace(":f", "<img src=\"smilie/icon_redface.gif\">", $output);
$output = str_replace(":re", "<img src=\"smilie/icon_rolleyes.gif\">", $output);
$output = str_replace(":(", "<img src=\"smilie/icon_sad.gif\">", $output);
$output = str_replace(":)", "<img src=\"smilie/icon_smile.gif\">", $output);
$output = str_replace(":O", "<img src=\"smilie/icon_surprised.gif\">", $output);
$output = str_replace(":tw", "<img src=\"smilie/icon_twisted.gif\">", $output);
$output = str_replace(";)", "<img src=\"smilie/icon_wink.gif\">", $output);
$output = nl2br($output);
echo $output;
$brugerip = $row['ip'];
$id = $row['id'];
if ($_REQUEST['admin'] == 1) {
echo "<a href=\"tagwall.php?mode=del&nummer=".$id."\">Slet</a><br>IP: $brugerip<br><br>";
}
echo $output;
}
echo '<br>Copyright by <a href="mailto:t-bird@c.dk">Jacob Overgaard</a> - All right reserved<br>';
echo '<br><a href="http://tfugl.dyndns.org">Tfugl.dyndns.org</a>';
}
mysql_close();
?>
</body>
</html>
<?
include "bund.php";
?>
på forhånd tak
m.v.h. th1