[syntax="php"]
<? include "config2.php"; ?>
<?
function kleurcode($code) {
ob_start();
$code = wordwrap($code,100);
$code = str_replace(" &lt;?", "&lt;?", $code);
$code = str_replace("<br>", "", $code);
$code = str_replace("<br />", "", $code);
$code = str_replace("&lt;", "<", $code);
$code = str_replace("&gt;", ">", $code);
$code = str_replace("&quot;", "\"", $code);
$code = str_replace("&amp;", "&amp;", $code);
highlight_string($code);
$code = ob_get_contents();
ob_end_clean();
return $code;
}
$select = "SELECT * FROM scripts WHERE id = '$id'";
$query = mysql_query($select) or die (mysql_error());
while ($list = mysql_fetch_object($query)) {
$code=$list->code;
$code = kleurcode($code);
$scriptnaam = $list->scriptnaam;
$informatie = $list->informatie;
$informatie = eregi_replace("([a-zA-Z0-9_-]+)@([a-zA-Z0-9\._-]+)(\.[a-zA-Z]+)", "<a href=\"mailto:\\1@\\2\\3\">\\1@\\2\\3</a>", $informatie);
$informatie = ereg_replace("[[]]+://[^<>[]]+[[]/]","<a href=\"\\0\" target=\"_blank\">\\0</a>",$informatie);
$Afronden = 1;
$Alles = mysql_query("SELECT * FROM scripts_rating WHERE id='$list->id'");
$rating = mysql_num_rows ($Alles);
if ($rating != 0) {
while($Huidig = mysql_fetch_object($Alles)) {
$Stemmen = explode("|",$Huidig->Stemmen);
$gem = sprintf("%6.".$Afronden."f",array_sum($Stemmen)/count($Stemmen));
} }else{
$gem = '0';
}
if ($gem>=5)
{
$star = "images2/5star.gif" ;
}
if ($gem<=4.5)
{
$star = "images2/45star.gif" ;
}
if ($gem<=4)
{
$star = "images2/4star.gif" ;
}
if ($gem<=3.5)
{
$star = "images2/35star.gif" ;
}
if ($gem<=3)
{
$star = "images2/3star.gif" ;
}
if ($gem<=2.5)
{
$star = "images2/25star.gif" ;
}
if ($gem<=2)
{
$star = "images2/2star.gif" ;
}
if ($gem<=1.5)
{
$star = "images2/15star.gif" ;
}
if ($gem<=1)
{
$star = "images2/1star.gif" ;
}
if ($gem<=0.5)
{
$star = "images2/05star.gif" ;
}
if ($gem<=0)
{
$star = "images2/25star.gif" ;
}
$date = date ("d-m-Y H:i", $list->datum);
$date2 = date ("d-m-Y H:i", $list->datum2);
if ($date2=="01-01-1970 01:00") {} else {$date3="<b>Bijgewerkt op :</b> $date2 <BR>";}
echo "
<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" bordercolor=\"#FFFFFF\" width=\"100%\">
<tr>
<td width=\"100%\" bgcolor=\"#FFFFFF\" ><b>$list->scriptnaam<hr></b>
</b></td>
</tr>
<tr>
<td width=\"100%\">
<b>Categorie :</b> $list->scriptcat<BR><b>Score :</b> <img align=\"absmiddle\" src=\"$star\"><BR>
<br><BR>
<b>Voorbeeld:</b><br> $informatie<br>
<br>
<BLOCKQUOTE><b>Code:</b><br>
<TABLE cellSpacing=0 cellPadding=4 width=\"100%\" border=0>
<TBODY>
<TR>
<TD width=\"100%\"><form name=\"example\">
<input Type=\"button\" style=\"font-family: Verdana; font-size: 8 pt; color: #000000; border: 1px solid #000000; background-color: #F3F3F3\"onClick=\"SelectIt(this.form.code)\" Value=\"Kopieer naar klembord.\"><br>
<textarea rows=\"8\" name=\"code\" cols=\"50\">$code</textarea></form></TD></TR></TBODY></TABLE></BLOCKQUOTE>
<br>
</td>
</tr>
</table>";
// -----------------------------------
// Verander de gegevens hieronder
$MySQLTabel = "scripts_rating";
$AantalKeuzes = 5;
// Het aantal keuzes.
$Afronden = 1;
// Hoeveel decimalen?
$Keuzemenu = false;
// true; of false;
// Bij false; worden 'radio buttons' gebruikt.
$ID=$id;
if(!isset($ID)) { die("Er is geen ID opgegeven"); }
@mysql_select_db($mysql[db]) or die(mysql_error());
mysql_query("SELECT ID FROM $MySQLTabel") or die(mysql_error());
if(isset($keuze)) {
$Huidig = mysql_query("SELECT * FROM $MySQLTabel WHERE ID = '$ID'");
$Dit = mysql_fetch_object($Huidig);
if(intval($keuze) && !strstr($Dit->IPadressen,"|$REMOTE_ADDR|")) {
if(mysql_num_rows($Huidig)) { mysql_query("UPDATE $MySQLTabel SET Stemmen = '$Dit->Stemmen|$keuze', IPadressen = '$Dit->IPadressen|$REMOTE_ADDR|' WHERE ID = '$ID'"); }
else { mysql_query("INSERT INTO $MySQLTabel VALUES('$ID','$keuze','|$REMOTE_ADDR|')"); }
}
}
$Huidig = mysql_fetch_object(mysql_query("SELECT * FROM $MySQLTabel WHERE ID = '$ID'"));
if(strstr($Huidig->IPadressen,"|$REMOTE_ADDR|")) {
}
else {
echo("<br>
<table border=\"1\" cellpadding=\"2\" cellspacing=\"0\" bordercolor=\"#000000\" width=\"100%\">
<tr>
<td width=\"100%\" bgcolor=\"#DEDFDE\" ><b>Rating </b>
</b></td>
</tr>
<tr>
<td width=\"100%\"><form method=post action=''><b>Geef dit script een score (1= heel slecht / 5= heel goed): </b><br>\n<BLOCKQUOTE>");
if($Keuzemenu) { echo("<select name=keuze onchange='this.form.submit()'><option></option>"); }
for($i = 1; $i < $AantalKeuzes+1; $i++) { if($Keuzemenu) { echo("<option value='$i'>$i</option>"); } else { echo("<input type=radio name=keuze value='$i' onclick='this.form.submit()'> $i &nbsp;"); } }
if($Keuzemenu) { echo("</select>"); }
echo("</BLOCKQUOTE></form></td>
</tr>
</table>");
}
if ($react_title && $react_name && $react_message && $react_mail) {
$message = nl2br ($message);
$date = time();
$sql = "INSERT INTO reactions VALUES ('', '$art_id', '$date', '$react_name', '$react_message', '$react_title', '$react_mail')";
$add_reaction = mysql_query ($sql);
if (!$add_reaction) {
echo ("Fout toevoegen script");
}
}
$get_reactions = mysql_query ("SELECT * FROM reactions WHERE art_id='$id' ORDER BY date DESC");
$num_of_reactions = mysql_num_rows ($get_reactions);
if ($num_of_reactions != 0) {
while ($react_info = mysql_fetch_array ($get_reactions)) {
$date = date ("d-m-Y H:i", $react_info['date']);
$message = htmlspecialchars ($react_info['message']);
echo ("<br>
<table border=\"1\" cellpadding=\"2\" cellspacing=\"0\" bordercolor=\"#000000\" width=\"100%\">
<tr>
<td width=\"100%\" bgcolor=\"#DEDFDE\" ><b>".$react_info['title']."</b></td>
</tr>
<tr>
<td width=\"100%\">
<b>Poster :</b> <a href=\"mailto:".$react_info['mail']."\"> ".$react_info['name']."</a><BR><b>Gepost op :</b> ".$date." <BR><br>$message</td>
</tr>
</table>
");
}
}
?>
<?
}
?>
[/syntax]
Het lukt me neit om die codes weg te kijgen zodat alles normaal getoont word in de textarea, kan iemand me helpen dat deeleruit te halen zodat er geen fout word gegeven?
Alvast bedankt
<hr />alles is opgelost