login  Naam:   Wachtwoord: 
Registreer je!
 Forum

ubb

Offline Ultimatum - 04/10/2005 20:48
Avatar van UltimatumPHP expert ok, zal wel verkeerde forum zijn, maar wist niet waar het anders moest

heb nu een script waar dit staat in ubb.php

  1. <?
  2. function kleuren($text){
  3. if (floor(phpversion())<4) {
  4. $buffer=$text;
  5. } else {
  6. $text = str_replace("<br>", "", $text);
  7. $text = str_replace("<br />", "", $text);
  8. $text = str_replace("&gt;", ">", $text);
  9. $text = str_replace("&lt;", "<", $text);
  10. $text = str_replace("&quot;", "\"", $text);
  11.  
  12. $text = str_replace("&amp;", "&", $text);
  13. $text = str_replace('$', '\$', $text);
  14. $text = str_replace('\n', '\\\\n', $text);
  15. $text = str_replace('\r', '\\\\r', $text);
  16. $text = str_replace('\t', '\\\\t', $text);
  17.  
  18. if (!strpos($text,"<?") and substr($text,0,2)!="<?") {
  19. $text="<?\n".trim($text)."\n?>";
  20. $addedtags=1;
  21. }
  22. $oldlevel=error_reporting(0);
  23. error_reporting($oldlevel);
  24. $buffer = ob_get_contents();
  25. if ($addedtags) {
  26. $openingpos = strpos($buffer,'<?');
  27. $closingpos = strrpos($buffer, '?');
  28. $buffer=substr($buffer, 0, $openingpos).substr($buffer, $openingpos+5, $closingpos-($openingpos+5)).substr($buffer, $closingpos+5);
  29. }
  30. $buffer = str_replace("&quot;", "\"", $buffer);
  31. }
  32. $gesplit = split("\n", $tekst);
  33. $grote = count($gesplit);
  34.  
  35. echo "<table bgcolor=#ffffff bordercolor=#cccccc cellspacing=0 width=100% style='border: 1px solid #cccccc'><tr bgcolor=#cccccc><td>&nbsp;</td><td>Code</td></tr>";
  36.  
  37. for($i = 0; $i < $grote; $i++)
  38. {
  39. $t = $i + 1;
  40. $tekst = $buffer;
  41.  
  42. echo "<tr><td bgcolor=#CCCCCC align=right width=14><font face=verdana
  43. size=1>".$t."</font></td>";
  44.  
  45. if($t < 2)
  46. {
  47. echo "<td style='padding-left: 5px' rowspan='10000' valign='top'>".$tekst."</td>";
  48. }
  49.  
  50. echo "</tr></table>";
  51. }
  52. }
  53. function ubbp($bericht){
  54. $bericht = htmlspecialchars($bericht);
  55. $bericht = nl2br($bericht);
  56. $bericht = preg_replace('_\[code\](.*?)\[/code\]_ise', "kleuren('\\1')", $bericht);
  57. $bericht = str_replace("sukkel" , "******", $bericht);
  58. $bericht = str_replace(":)", "<img src=\"url\" border=\"0\">", $bericht);
  59. $bericht = str_replace("[*]","<li>",$bericht);
  60. $bericht = str_replace("[hr]","<hr>",$bericht);
  61. $bericht = str_replace("[HR]","<hr>",$bericht);
  62.  
  63. $bericht = eregi_replace("\\[s\\]([^\\[]*)\\[/s\\]","<s>\\1</s>",$bericht);
  64. $bericht = eregi_replace("\\[S\\]([^\\[]*)\\[/S\\]","<s>\\1</s>",$bericht);
  65. $bericht = eregi_replace("\\[b\\]([^\\[]*)\\[/b\\]","<b>\\1</b>",$bericht);
  66. $bericht = eregi_replace("\\[B\\]([^\\[]*)\\[/B\\]","<b>\\1</b>",$bericht);
  67. $bericht = eregi_replace("\\[i\\]([^\\[]*)\\[/i\\]","<i>\\1</i>",$bericht);
  68. $bericht = eregi_replace("\\[I\\]([^\\[]*)\\[/I\\]","<i>\\1</i>",$bericht);
  69. $bericht = eregi_replace("\\[u\\]([^\\[]*)\\[/u\\]","<u>\\1</u>",$bericht);
  70. $bericht = eregi_replace("\\[U\\]([^\\[]*)\\[/U\\]","<u>\\1</u>",$bericht);
  71.  
  72. $bericht = eregi_replace("\\[a([^\\[]*)\\]([^\\[]*)\\[/p\\]","<a\\1>\\2</a>",$bericht);
  73. $bericht = eregi_replace("\\[p([^\\[]*)\\]([^\\[]*)\\[/p\\]","<p\\1>\\2</p>",$bericht);
  74. $bericht = eregi_replace("\\[table([^\\[]*)\\]([^\\[]*)\\[/table\\]","<table\\1>\\2</table>",$bericht);
  75. $bericht = eregi_replace("\\[tr([^\\[]*)\\]([^\\[]*)\\[/tr\\]","<tr\\1>\\2</tr>",$bericht);
  76. $bericht = eregi_replace("\\[td([^\\[]*)\\]([^\\[]*)\\[/td\\]","<td\\1>\\2</td>",$bericht);
  77. $bericht = eregi_replace("\\[div([^\\[]*)\\]([^\\[]*)\\[/div\\]","<div\\1>\\2</div>",$bericht);
  78. $bericht = eregi_replace("\\[font([^\\[]*)\\]([^\\[]*)\\[/font\\]","<font\\1>\\2</font>",$bericht);
  79.  
  80. $bericht = eregi_replace("\\[A([^\\[]*)\\]([^\\[]*)\\[/A\\]","<a\\1>\\2</a>",$bericht);
  81. $bericht = eregi_replace("\\[P([^\\[]*)\\]([^\\[]*)\\[/p\\]","<p\\1>\\2</p>",$bericht);
  82. $bericht = eregi_replace("\\[TABLE([^\\[]*)\\]([^\\[]*)\\[/TABLE\\]","<table\\1>\\2</table>",$bericht);
  83. $bericht = eregi_replace("\\[TR([^\\[]*)\\]([^\\[]*)\\[/TR\\]","<tr\\1>\\2</tr>",$bericht);
  84. $bericht = eregi_replace("\\[TD([^\\[]*)\\]([^\\[]*)\\[/TD\\]","<td\\1>\\2</td>",$bericht);
  85. $bericht = eregi_replace("\\[DIV([^\\[]*)\\]([^\\[]*)\\[/DIV\\]","<div\\1>\\2</div>",$bericht);
  86. $bericht = eregi_replace("\\[FONT([^\\[]*)\\]([^\\[]*)\\[/FONT\\]","<font\\1>\\2</font>",$bericht);
  87.  
  88. $bericht = eregi_replace("\\[list\\]([^\\[]*)\\[/list\\]","<ul>\\1</ul>",$bericht);
  89. $bericht = eregi_replace("\\[quote\\]([^\\[]*)\\[/quote\\]","<blockquote><span class=\"12px\">quote:</span><hr>\\1<hr></blockquote>",$bericht);
  90. $bericht = eregi_replace("\\[img\\]([^\\[]*)\\[/img\\]","<img src=\"http://\\1\">",$bericht);
  91. $bericht = eregi_replace("\\[img([^\\[]*)\\]([^\\[]*)\\[/img\\]", "<img//1 src=\"http://\\2\">",$bericht);
  92. $bericht = eregi_replace("\\[email\\]([^\\[]*)\\[/email\\]", "<a href=\"mailto:\\1\">\\1</a>",$bericht);
  93. $bericht = eregi_replace("\\[email=([^\\[]*)\\]([^\\[]*)\\[/email\\]", "<a href=\"mailto:\\1\">\\2</a>",$bericht);
  94. $bericht = eregi_replace("\\[url\\]www.([^\\[]*)\\[/url\\]", "<a href=\"http://www.\\1\" target=_blank>\\1</a>",$bericht);
  95. $bericht = eregi_replace("\\[url\\]([^\\[]*)\\[/url\\]","<a href=\"\\1\" target=_blank>\\1</a>",$bericht);
  96. $bericht = eregi_replace("\\[url\\]www.([^\\[]*)\\[/url\\]", "<a href=\"http://www.\\1\" target=_blank>\\1</a>",$bericht);
  97. $bericht = eregi_replace("\\[url\\]([^\\[]*)\\[/url\\]","<a href=\"\\1\" target=_blank>\\1</a>",$bericht);
  98. $bericht = eregi_replace("\\[url=([^\\[]*)\\]([^\\[]*)\\[/url\\]","<a href=\"\\1\" target=_blank>\\2</a>",$bericht);
  99.  
  100. $bericht = eregi_replace("\\[LIST\\]([^\\[]*)\\[/LIST\\]","<ul>\\1</ul>",$bericht);
  101.  
  102. $bericht = eregi_replace("\\[QUOTE\\]([^\\[]*)\\[/QUOTE\\]","<blockquote><span class=\"12px\">quote:</span><hr>\\1<hr></blockquote>",$bericht);
  103. $bericht = eregi_replace("\\[IMG\\]([^\\[]*)\\[/IMG\\]","<img src=\"http://\\1\">",$bericht);
  104. $bericht = eregi_replace("\\[IMG([^\\[]*)\\]([^\\[]*)\\[/IMG\\]", "<img//1 src=\"http://\\2\">",$bericht);
  105. $bericht = eregi_replace("\\[EMAIL\\]([^\\[]*)\\[/EMAIL\\]", "<a href=\"mailto:\\1\">\\1</a>",$bericht);
  106. $bericht = eregi_replace("\\[EMAIL=([^\\[]*)\\]([^\\[]*)\\[/EMAIL\\]", "<a href=\"mailto:\\1\">\\2</a>",$bericht);
  107. $bericht = eregi_replace("\\[URL\\]www.([^\\[]*)\\[/URL\\]", "<a href=\"http://www.\\1\" target=_blank>\\1</a>",$bericht);
  108. $bericht = eregi_replace("\\[URL\\]([^\\[]*)\\[/URL\\]","<a href=\"\\1\" target=_blank>\\1</a>",$bericht);
  109. $bericht = eregi_replace("\\[URL=([^\\[]*)\\]([^\\[]*)\\[/URL\ \]","<a href=\"\\1\" target=_blank>\\2</a>",$bericht);
  110. $bericht = eregi_replace("(^|[>[:space:]\n])([[:alnum:]]+)://([^[:space:]]*)([[:alnum:]#?/&=])([<[:space:]\n]|$)","\\1<a href=\"\\2://\\3\\4\" target=\"_blank\">\\2://\\3\\4</a>\\5",$bericht);
  111. $bericht = str_replace("http://http://", "http://", $bericht);
  112. $bericht = str_replace("&quot;", "\"", $bericht);
  113.  
  114. echo $bericht;
  115. return $bericht;
  116. }
  117. function ubb($bericht){
  118. $bericht = htmlspecialchars($bericht);
  119. $bericht = nl2br($bericht);
  120.  
  121.  
  122. $bericht = str_replace("sukkel" , "******", $bericht);
  123. $bericht = str_replace(":)", "<img src=\"url\" border=\"0\">", $bericht);
  124. $bericht = str_replace("[*]","<li>",$bericht);
  125. $bericht = str_replace("[hr]","<hr>",$bericht);
  126. $bericht = str_replace("[HR]","<hr>",$bericht);
  127.  
  128. $bericht = eregi_replace("\\[list\\]([^\\[]*)\\[/list\\]","<ul>\\1</ul>",$bericht);
  129. $bericht = eregi_replace("\\[quote\\]([^\\[]*)\\[/quote\\]","<blockquote><span class=\"12px\">quote:</span><hr>\\1<hr></blockquote>",$bericht);
  130. $bericht = eregi_replace("\\[img\\]([^\\[]*)\\[/img\\]","<img src=\"http://\\1\">",$bericht);
  131. $bericht = eregi_replace("\\[img([^\\[]*)\\]([^\\[]*)\\[/img\\]", "<img//1 src=\"http://\\2\">",$bericht);
  132. $bericht = eregi_replace("\\[email\\]([^\\[]*)\\[/email\\]", "<a href=\"mailto:\\1\">\\1</a>",$bericht);
  133. $bericht = eregi_replace("\\[email=([^\\[]*)\\]([^\\[]*)\\[/email\\]", "<a href=\"mailto:\\1\">\\2</a>",$bericht);
  134. $bericht = eregi_replace("\\[url\\]www.([^\\[]*)\\[/url\\]", "<a href=\"http://www.\\1\" target=_blank>\\1</a>",$bericht);
  135. $bericht = eregi_replace("\\[url\\]([^\\[]*)\\[/url\\]","<a href=\"\\1\" target=_blank>\\1</a>",$bericht);
  136. $bericht = eregi_replace("\\[url\\]www.([^\\[]*)\\[/url\\]", "<a href=\"http://www.\\1\" target=_blank>\\1</a>",$bericht);
  137. $bericht = eregi_replace("\\[url\\]([^\\[]*)\\[/url\\]","<a href=\"\\1\" target=_blank>\\1</a>",$bericht);
  138. $bericht = eregi_replace("\\[url=([^\\[]*)\\]([^\\[]*)\\[/url\\]","<a href=\"\\1\" target=_blank>\\2</a>",$bericht);
  139.  
  140. $bericht = eregi_replace("\\[LIST\\]([^\\[]*)\\[/LIST\\]","<ul>\\1</ul>",$bericht);
  141. $bericht = eregi_replace("\\[QUOTE\\]([^\\[]*)\\[/QUOTE\\]","<blockquote><span class=\"12px\">quote:</span><hr>\\1<hr></blockquote>",$bericht);
  142. $bericht = eregi_replace("\\[IMG([^\\[]*)\\]([^\\[]*)\\[/IMG\\]","<img//1 src=\"http://\\2\">",$bericht);
  143. $bericht = eregi_replace("\\[IMG([^\\[]*)\\]([^\\[]*)\\[/IMG\\]", "<img//1 src=\"http://\\2\">",$bericht);
  144. $bericht = eregi_replace("\\[EMAIL\\]([^\\[]*)\\[/EMAIL\\]", "<a href=\"mailto:\\1\">\\1</a>",$bericht);
  145. $bericht = eregi_replace("\\[EMAIL=([^\\[]*)\\]([^\\[]*)\\[/EMAIL\\]", "<a href=\"mailto:\\1\">\\2</a>",$bericht);
  146. $bericht = eregi_replace("\\[URL\\]www.([^\\[]*)\\[/URL\\]", "<a href=\"http://www.\\1\" target=_blank>\\1</a>",$bericht);
  147. $bericht = eregi_replace("\\[URL\\]([^\\[]*)\\[/URL\\]","<a href=\"\\1\" target=_blank>\\1</a>",$bericht);
  148. $bericht = eregi_replace("\\[URL=([^\\[]*)\\]([^\\[]*)\\[/URL\ \]","<a href=\"\\1\" target=_blank>\\2</a>",$bericht);
  149. $bericht = eregi_replace("(^|[>[:space:]\n])([[:alnum:]]+)://([^[:space:]]*)([[:alnum:]#?/&=])([<[:space:]\n]|$)","\\1<a href=\"\\2://\\3\\4\" target=\"_blank\">\\2://\\3\\4</a>\\5",$bericht);
  150. $bericht = str_replace("http://http://", "http://", $bericht);
  151. $bericht = str_replace("&quot;", "\"", $bericht);
  152.  
  153. echo $bericht;
  154. return $bericht;
  155. }
  156.  
  157. ?>


en nu op de plek waar het word aangeroepe staat:
Citaat:
Fatal error: Cannot redeclare kleuren() (previously declared in /usr/export/www/vhosts/funnetwork/hosting/ultimatum/members/ubb.php:2) in /usr/export/www/vhosts/funnetwork/hosting/ultimatum/members/ubb.php on line 2


wat is de fout 

6 antwoorden

Gesponsorde links
Offline nemesiskoen - 04/10/2005 21:13
Avatar van nemesiskoen Gouden medaille

PHP expert
doe eens
  1. <?php
  2. require_once 'ubb.php';
  3. //ipv
  4. require 'ubb.php'; //of include 'ubb.php';
  5. ?>


En het is php, waarom zet je het dan in het forum voor html en css... als je weet dat dit fout is. Een beetje nadenken...:)
Offline Ultimatum - 04/10/2005 21:16 (laatste wijziging 04/10/2005 21:18)
Avatar van Ultimatum PHP expert omdat ubb niet php is tog..

Offline nemesiskoen - 04/10/2005 21:17 (laatste wijziging 04/10/2005 21:17)
Avatar van nemesiskoen Gouden medaille

PHP expert
UBB = ultimate bulletin board = geschreven in PHP.

ubb is een manier om door de leek te begrijpen code om te zetten in html code, gebruik makend van een scriptingtaal (server side of client side). In dit geval met de taal PHP. Dus het behoort zeker bij de categorie php.
Offline Ultimatum - 04/10/2005 21:18
Avatar van Ultimatum PHP expert ow ok, wist ik niet, maar nu krijg ik een andere error 

Citaat:
Fatal error: Cannot redeclare beveiligd() (previously declared in /usr/export/www/vhosts/funnetwork/hosting/ultimatum/members/config.php:23) in /usr/export/www/vhosts/funnetwork/hosting/ultimatum/members/config.php on line 22


dit staat rond regel 22
  1. #verander hier verder niets
  2. mysql_connect("$host","$user","$pass");
  3. require_once 'ubb.php';
  4. $actie = $_GET["actie"];
  5. $datum = date("d/m/Y h:i");
  6. function beveiligd() {
  7. if ( !isset($_COOKIE['login'])){
  8. header("location: ?page=aanmelden");
  9. }
  10. }
  11. ?>
Offline nemesiskoen - 04/10/2005 21:30
Avatar van nemesiskoen Gouden medaille

PHP expert
  1. #verander hier verder niets
  2. mysql_connect("$host","$user","$pass");
  3. require_once 'ubb.php';
  4. $actie = $_GET["actie"];
  5. $datum = date("d/m/Y h:i");
  6. if(!function_exists("beveiligd")) {
  7. function beveiligd() {
  8. if ( !isset($_COOKIE['login'])){
  9. header("location: ?page=aanmelden");
  10. }
  11. }
  12. }
  13. ?>
Offline Ultimatum - 04/10/2005 22:00
Avatar van Ultimatum PHP expert thanx hij doet ut
Gesponsorde links
Dit onderwerp is gesloten.
Actieve forumberichten
© 2002-2024 Sitemasters.be - Regels - Laadtijd: 0.258s