[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4688: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4690: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4691: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4692: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
Webmasterplein.net • Toon onderwerp - kleurcode
aan alle goede dingen komt een eind, webmasterplein.net 2003 - 2013
wij danken jullie voor al mooie momenten die dankzij dit forum ontstonden - Derk, Rutger en Stef

kleurcode

Je komt er niet helemaal uit bij het scripten? Übergoede functie geschreven? Alles met betrekking tot scripting, kun je hier terecht.

Berichtdoor mats » 21 mei 2005 18:37

[syntax="php"]
<? include "config2.php"; ?>
<?
function kleurcode($code) {
ob_start();
$code = wordwrap($code,100);
$code = str_replace(" <?", "<?", $code);
$code = str_replace("<br>", "", $code);
$code = str_replace("<br />", "", $code);
$code = str_replace("<", "<", $code);
$code = str_replace(">", ">", $code);
$code = str_replace(""", "\"", $code);
$code = str_replace("&", "&", $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>
&lt;td width=\"100%\" bgcolor=\"#FFFFFF\" &gt;&lt;b&gt;$list-&gt;scriptnaam<hr>&lt;/b&gt;
&lt;/b&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width=\"100%\"&gt;

&lt;b&gt;Categorie :&lt;/b&gt; $list-&gt;scriptcat&lt;BR&gt;&lt;b&gt;Score :&lt;/b&gt; <img align=\"absmiddle\" src=\"$star\">&lt;BR&gt;
&lt;br&gt;&lt;BR&gt;
&lt;b&gt;Voorbeeld:&lt;/b&gt;&lt;br&gt; $informatie&lt;br&gt;

&lt;br&gt;
&lt;BLOCKQUOTE&gt;&lt;b&gt;Code:&lt;/b&gt;&lt;br&gt;
&lt;TABLE cellSpacing=0 cellPadding=4 width=\"100%\" border=0&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width=\"100%\"&gt;&lt;form name=\"example\"&gt;
&lt;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.\"&gt;&lt;br&gt;
&lt;textarea rows=\"8\" name=\"code\" cols=\"50\"&gt;$code&lt;/textarea&gt;&lt;/form&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;

&lt;br&gt;
&lt;/td&gt;
&lt;/tr&gt;

&lt;/table&gt;";

// -----------------------------------
// 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) &amp;&amp; !strstr($Dit-&gt;IPadressen,"|$REMOTE_ADDR|")) {
if(mysql_num_rows($Huidig)) { mysql_query("UPDATE $MySQLTabel SET Stemmen = '$Dit-&gt;Stemmen|$keuze', IPadressen = '$Dit-&gt;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-&gt;IPadressen,"|$REMOTE_ADDR|")) {
}
else {
echo("&lt;br&gt;
&lt;table border=\"1\" cellpadding=\"2\" cellspacing=\"0\" bordercolor=\"#000000\" width=\"100%\"&gt;
&lt;tr&gt;
&lt;td width=\"100%\" bgcolor=\"#DEDFDE\" &gt;&lt;b&gt;Rating &lt;/b&gt;
&lt;/b&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width=\"100%\"&gt;&lt;form method=post action=''&gt;&lt;b&gt;Geef dit script een score (1= heel slecht / 5= heel goed): &lt;/b&gt;&lt;br&gt;\n&lt;BLOCKQUOTE&gt;");
if($Keuzemenu) { echo("&lt;select name=keuze onchange='this.form.submit()'&gt;&lt;option&gt;&lt;/option&gt;"); }
for($i = 1; $i &lt; $AantalKeuzes+1; $i++) { if($Keuzemenu) { echo("&lt;option value='$i'&gt;$i&lt;/option&gt;"); } else { echo("&lt;input type=radio name=keuze value='$i' onclick='this.form.submit()'&gt; $i &amp;nbsp;"); } }
if($Keuzemenu) { echo("&lt;/select&gt;"); }
echo("&lt;/BLOCKQUOTE&gt;&lt;/form&gt;&lt;/td&gt;
&lt;/tr&gt;

&lt;/table&gt;");
}

if ($react_title &amp;&amp; $react_name &amp;&amp; $react_message &amp;&amp; $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 ("&lt;br&gt;
&lt;table border=\"1\" cellpadding=\"2\" cellspacing=\"0\" bordercolor=\"#000000\" width=\"100%\"&gt;
&lt;tr&gt;
&lt;td width=\"100%\" bgcolor=\"#DEDFDE\" &gt;&lt;b&gt;".$react_info['title']."&lt;/b&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width=\"100%\"&gt;
&lt;b&gt;Poster :&lt;/b&gt; &lt;a href=\"mailto:".$react_info['mail']."\"&gt; ".$react_info['name']."&lt;/a&gt;&lt;BR&gt;&lt;b&gt;Gepost op :&lt;/b&gt; ".$date." &lt;BR&gt;&lt;br&gt;$message&lt;/td&gt;
&lt;/tr&gt;

&lt;/table&gt;
");

}
}



?&gt;
&lt;?
}
?&gt;


[/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 Very Happy
Avatar gebruiker
mats
wmpr
 
Berichten: 3748
Geregistreerd: 19 sep 2004 12:00

Keer terug naar PHP, ASP, SQL



cron