script werkt niet:(

Status
Niet open voor verdere reacties.

rhcp

Gebruiker
Lid geworden
13 mrt 2004
Berichten
857
ik heb een nieuws systeem gemaakt maar het werkt niet echt lekekr

hier de links:


versturen bericht

ophalen van berichten

Hert script werkt wel alleen het ubbc neit hier de codes:

nieuws.php:

PHP:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> 
<?php 
include ("connect.php"); 
?> 
<html> 
<head> 
    <title><?php echo "$titel"; ?></title> 
</head> 

<body> 
<center><h1><?php echo "$titel"; ?></h1></center> 

<?php 



//verbinding met de database maken 

include("connect.php"); 

mysql_select_db("$db") 
  or die(mysql_error()); 

$sql = "SELECT id, titel_2, bericht, reacties FROM nieuwssysteem ORDER BY id DESC"; 
$res = mysql_query($sql) or die('fout in query :'. $sql.' : '. mysql_error());    
$num = mysql_num_rows($res); 
  if (empty($num)){ 
    $num = "geen"; 
  } 
  if($num == '0'){ 
  echo"Er zijn nog geen nieuwsberichten gepost."; } 
   
  while($row = mysql_fetch_object($res)){ 
    
?> 
<br> 
<?php 
require("ubbc.php"); 
echo "<b>$row->titel_2</b><br>$row->bericht<br> 
<i>reacties toegestaan</i> : <a href=\"reageer.php?id=$row->id\">$row->reacties</a><hr>"; 

?> 

<?  } 
  ?> 
<center><?php echo " $copy"; ?> 


</body> 
</html>

nieuwsberichtversturen.php:

PHP:
<?php include("connect.php"); ?> 
<html> 
<head> 
    <title><?php echo "$titel"; ?></title> 
</head> 

<body> 
<center><h1><?php echo "$titel"; ?></h1></center> 
<h1>Nieuwsbericht versturen</h1> 

<form name="formulier" action="nieuwsberichtverstuurd.php" method="post"> 
Je kunt gewoon HTML gebruiken in het berichtenvak, voor de smileys kijk hieronder. 
<script language="JavaScript1.2" type="text/javascript" src="javascript/ubbc.js"></script> 

<div align="center"><script language="JavaScript1.2" type="text/javascript" src="javascript/knoppen.js"></script></div> 
<div align="center"><script language="JavaScript1.2" type="text/javascript" src="javascript/smileys.js"></script></div> 

<table> 

<tr> 
       <td>Titel :</td> 
       <td><input type="text" name="titel_2" size="80"></td> 
</tr> 
<tr> 
       <td valign="top">Bericht :</td> 
       <td>  <textarea name="bericht" cols="50" rows="5" class="input"></textarea></td> 
</tr> 
</table> 
Reacties toestaan : <input type="radio" name="reacties" value="ja">ja <input type="radio" name="reacties" value="nee">nee 

<br><input type="reset" name="reset" value="wissen"> <input  class="input" type="submit" name="submit" value="verzenden"> 
</form> 


<center><?php echo "$copy"; ?> 

</body> 
</html>


Ik heb nog een script ubbc.php maar die is voor het probleem niet nodig.

Het probleem is dat ubbc gewoon niet werkt.


Vriendelijke groet

Pim
Pim
 
Ik merk dat je een nieuws systeem met reactie's probeert te maken??

Ik kan je jammer genoeg niet helpen want ik zie ook nergens een fout. Maar ik kan je wel een tip geven:
Als je een nieuwsSysteempje moet hebben met reacties en een simpele installatie is dit een fijn programma!

Suc6 ermee verder
 
tja.

Het werkt ook maar ubbc werkt niet:(
 
Fatal error: Call to undefined function: ubb() in /usr/home/rhcp/domains/nodomain.nl/public_html/nieuws2.0/nieuws.php on line 39

Plaats toch die ubbc.php maar even...
Je heb daar waarschijnlijk een verwijzing naar een functie instaan die niet bestaat, o.i.d.
 
ik heb het neiuws script verandert. en ik dnwek dat dat klopt.


PHP:
<?php
// Maak de UBBC codes aan
// Enters                        V
$bericht = str_replace ("[br]","\n",$bericht);
$bericht = str_replace ("\n","<br>",$bericht);

// Code                         V
$bericht = str_replace ("[code]","<b>Code:</b><br /><table bgcolor=\"#000000\" cellspacing=\"1\" width=\"90%\"><tr><td><table cellpadding=2 cellspacing=\"0\" bgcolor=\"#FFFFFF\" width=\"100%\"><tr><td><font face=Courier size=\"1\" color=\"#000000\">", $bericht);
$bericht = str_replace ("[/code]", "</font></td></tr></table></td></tr></table>", $bericht);

// Vet, schuin, etc            V
$bericht = preg_replace("/\[b\](.+?)\[\/b\]/is",'<strong>\1</strong>', $bericht);
$bericht = preg_replace("/\[i\](.+?)\[\/i\]/is",'<em>\1</em>', $bericht);
$bericht = preg_replace("/\[u\](.+?)\[\/u\]/is",'<u>\1</u>', $bericht);
$bericht = preg_replace("/\[s\](.+?)\[\/s\]/is",'<s>\1</s>', $bericht);

// Marquee
$bericht = str_replace ("[move]", "<div align=\"center\"><marquee width=\"90%\">", $bericht);
$bericht = str_replace ("[/move]", "</marquee></div>", $bericht);

// Flash                      V
$bericht = eregi_replace("\\[flash=([^\\[]*)\\,([^\\[]*)\\]([^\\[]*)\\[/flash\\]","<object classid=\"clsid: D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\\1 height=\\2><param name=movie value=\\3><param name=play value=true><param name=loop value=true><param name=quality value=high><embed src=\\3 width=\\1 height=\\2 play=true loop=true quality=high></embed></object>",$bericht);

// Glow & Shadow              V
$bericht = preg_replace ("/\[glow](.*)\[\/glow\]/","<table border='0' style='FILTER: glow(color=#00FF00, strength=2)'><tr><td>\\1</td></tr></table>",$bericht);
$bericht = preg_replace ("/\[shadow](.*)\[\/shadow\]/", "<table style='FILTER: shadow(color=#808080, direction=5, strength=4)' border='0'><tr><td>\\1</td></tr></table>",$bericht);
$bericht = preg_replace ("/\[glow=(.*)\\](.*)\[\/glow\]/","<table border='0' style='FILTER: glow(color=\\1, strength=2)'><tr><td>\\2</td></tr></table>",$bericht);
$bericht = preg_replace ("/\[shadow=(.*)\\](.*)\[\/shadow\]/", "<table style='FILTER: shadow(color=\\1, direction=5, stregth=2)' border='0'><tr><td>\\2</td></tr></table>",$bericht);

// Color, font & size        V
$bericht = preg_replace ("#\[color=(\#[0-9A-F]{6}|[a-z\-]+)\](.*?)\[/color\]#si", "<font color=\"\\1\">\\2</font>", $bericht);
$bericht = preg_replace ("/\[font=(.*)\](.*)\[\/font\]/", "<font face=\"$1\">$2</font>", $bericht);
$bericht = preg_replace ("/\[size=(.*)\](.*)\[\/size\]/", "<font size=\"$1\">$2</font>", $bericht);

// Plaatje toevoegen           V
$bericht = preg_replace("/\[img\](.*?)\[\/img\]/si", "<img src=\"\\1\" border=\"0\">",$bericht);

// Diversen               V
$bericht = str_replace ("[tt]", "<tt>", $bericht);
$bericht = str_replace ("[/tt]", "</tt>", $bericht);
$bericht = str_replace ("[left]", "<div align=left>", $bericht);
$bericht = str_replace ("[/left]", "</div>", $bericht);
$bericht = str_replace ("[center]", "<div align=\"center\">", $bericht);
$bericht = str_replace ("[/center]", "</div>", $bericht);
$bericht = str_replace ("[right]", "<div align=\"right\">", $bericht);
$bericht = str_replace ("[/right]", "</div>", $bericht);
$bericht = str_replace ("[sub]", "<sub>", $bericht);
$bericht = str_replace ("[/sub]", "</sub>", $bericht);
$bericht = str_replace ("[sup]", "<sup>", $bericht);
$bericht = str_replace ("[/sup]", "</sup>", $bericht);
$bericht = str_replace ("[fixed]", "<font face=\"Courier New\">", $bericht);
$bericht = str_replace ("[/fixed]", "</font>", $bericht);
$bericht = str_replace ("[[","{{",$bericht);
$bericht = str_replace ("]]","}}",$bericht);
$bericht = str_replace ("|","|",$bericht);
$bericht = str_replace ("[pre]","<pre>",$bericht);
$bericht = str_replace ("[/pre]","</pre>",$bericht);
$bericht = str_replace ("{{","[",$bericht);
$bericht = str_replace ("}}","]",$bericht);

// Horizontale lijn    V
$bericht = str_replace ("[hr]","<hr color=\"#000000\" noshade />",$bericht);

// URL's               V
$bericht = preg_replace ("#\[url\]([a-z]+?://){1}([a-z0-9\-\.,\?!%\*_\#:;~\\&$@\/=\+\(\)]+)\[/url\]#", "<a href=\"\\1\\2\" target=\"_blank\">\\2</a>", $bericht);
$bericht = preg_replace ("#\[url\]([a-z0-9\-\.,\?!%\*_\#:;~\\&$@\/=\+\(\)]+)\[/url\]#", "<a href=\"http://\\1\" target=\"_blank\">\\1</a>", $bericht);
$bericht = preg_replace ("#\[url=([a-z]+?://){1}([a-z0-9\-\.,\?!%\*_\#:;~\\&$@\/=\+\(\)]+)\](.*?)\[/url\]#", "<a href=\"\\1\\2\" target=\"_blank\">\\2</a>", $bericht);
$bericht = preg_replace ("#\[url=([a-z0-9\-\.,\?!%\*_\#:;~\\&$@\/=\+\(\)]+)\](.*?)\[/url\]#", "<a href=\"http://\\1\" target=\"_blank\">\\2</a>", $bericht);

// UseNet & FTP         V
$bericht = preg_replace ("#\[news\]([a-z]+?://){1}([a-z0-9\-\.,\?!%\*_\#:;~\\&$@\/=\+\(\)]+)\[/news\]#", "<a href=\"news:\\1\\2\" target=\"_blank\">\\2</a>", $bericht);
$bericht = preg_replace ("#\[news\]([a-z0-9\-\.,\?!%\*_\#:;~\\&$@\/=\+\(\)]+)\[/news\]#", "<a href=\"news:\\1\" target=\"_blank\">\\1</a>", $bericht);
$bericht = preg_replace ("#\[news=([a-z]+?://){1}([a-z0-9\-\.,\?!%\*_\#:;~\\&$@\/=\+\(\)]+)\](.*?)\[/news\]#", "<a href=\"news:\\1\\2\" target=\"_blank\">\\2</a>", $bericht);
$bericht = preg_replace ("#\[news=([a-z0-9\-\.,\?!%\*_\#:;~\\&$@\/=\+\(\)]+)\](.*?)\[/news\]#", "<a href=\"news:\\1\" target=\"_blank\">\\2</a>", $bericht);

$bericht = preg_replace ("#\[ftp\]([a-z]+?://){1}([a-z0-9\-\.,\?!%\*_\#:;~\\&$@\/=\+\(\)]+)\[/ftp\]#", "<a href=\"ftp://\\1\\2\" target=\"_blank\">\\2</a>", $bericht);
$bericht = preg_replace ("#\[ftp\]([a-z0-9\-\.,\?!%\*_\#:;~\\&$@\/=\+\(\)]+)\[/ftp\]#", "<a href=\"ftp://\\1\" target=\"_blank\">\\1</a>", $bericht);
$bericht = preg_replace ("#\[ftp=([a-z]+?://){1}([a-z0-9\-\.,\?!%\*_\#:;~\\&$@\/=\+\(\)]+)\](.*?)\[/ftp\]#", "<a href=\"ftp://\\1\\2\" target=\"_blank\">\\2</a>", $bericht);
$bericht = preg_replace ("#\[ftp=([a-z0-9\-\.,\?!%\*_\#:;~\\&$@\/=\+\(\)]+)\](.*?)\[/ftp\]#", "<a href=\"ftp://\\1\" target=\"_blank\">\\2</a>", $bericht);

// E-mails               V
$bericht = preg_replace ("#\[email\]([a-z0-9\-_.]+?@[\w\-]+\.([\w\-\.]+\.)?[\w]+)\[/email\]#", "<a href=\"mailto:\\1\">\\1</a>", $bericht);
$bericht = preg_replace ("#\[email=([a-z0-9\-_.]+?@[\w\-]+\.([\w\-\.]+\.)?[\w]+)\](.*?)\[/email\]#", "<a href=\"mailto:\\1\">\\3</a>", $bericht);

// Quotes                V
$bericht = preg_replace ("/\[quote\](.*)\[\/quote\]/","<p><i>Quote:</i><table bgcolor=#000000 cellspacing=\"1\" width=\"75%\" align=\"left\"><tr><td width=\"100%\"><table cellpadding=\"2\" cellspacing=\"0\" width=\"100%\" bgcolor=\"#FFFFFF\"><tr><td width=\"100%\"><font face=\"Verdana\" size=\"1\" color=\"#000000\">$1</font></td></tr></table></td></tr></table></p>",$bericht);

// Lijst                 V
$bericht = str_replace ("[list]","<ul>",$bericht);
$bericht = str_replace ("[*]","<li>",$bericht);
$bericht = str_replace ("[/list]","</li></ul>",$bericht);

// Tabel                  V
$bericht = str_replace ("[table]","<table class=\"main\">",$bericht);
$bericht = str_replace ("[/table]","</table>",$bericht);
$bericht = str_replace ("[tr]","<tr>",$bericht);
$bericht = str_replace ("[/tr]","</tr>",$bericht);
$bericht = str_replace ("[td]","<td>",$bericht);
$bericht = str_replace ("[/td]","</td>",$bericht);

// Smiley's                V
// Roll Eyes
$bericht = str_replace ("::)","<img src=\"img/ubbc/rolleyes.gif\" width=\"15\" height=\"15\" border=\"0\">",$bericht);
$bericht = str_replace ("[rolleyes]","<img src=\"img/ubbc/rolleyes.gif\" width=\"15\" height=\"15\" border=\"0\">",$bericht);
$bericht = str_replace ("::-)","<img src=\"img/ubbc/rolleyes.gif\" width=\"15\" height=\"15\" border=\"0\">",$bericht);
// Smile
$bericht = str_replace (":)","<img src=\"img/ubbc/smiley.gif\" width=\"15\" height=\"15\" border=\"0\">",$bericht);
$bericht = str_replace ("[smile]","<img src=\"img/ubbc/smiley.gif\" width=\"15\" height=\"15\" border=\"0\">",$bericht);
$bericht = str_replace (":-)","<img src=\"img/ubbc/smiley.gif\" width=\"15\" height=\"15\" border=\"0\">",$bericht);
// Wink
$bericht = str_replace (";)","<img src=\"img/ubbc/wink.gif\" width=\"15\" height=\"15\" border=\"0\">",$bericht);
$bericht = str_replace ("[wink]","<img src=\"img/ubbc/wink.gif\" width=\"15\" height=\"15\" border=\"0\">",$bericht);
$bericht = str_replace (";-)","<img src=\"img/ubbc/wink.gif\" width=\"15\" height=\"15\" border=\"0\">",$bericht);
// Cheesy
$bericht = str_replace (":D","<img src=\"img/ubbc/cheesy.gif\" width=\"15\" height=\"15\" border=\"0\">",$bericht);
$bericht = str_replace ("[cheesy]","<img src=\"img/ubbc/cheesy.gif\" width=\"15\" height=\"15\" border=\"0\">",$bericht);
$bericht = str_replace (":-D","<img src=\"img/ubbc/cheesy.gif\" width=\"15\" height=\"15\" border=\"0\">",$bericht);
// Grin
$bericht = str_replace (";D","<img src=\"img/ubbc/grin.gif\" width=\"15\" height=\"15\" border=\"0\">",$bericht);
$bericht = str_replace ("[grin]","<img src=\"img/ubbc/grin.gif\" width=\"15\" height=\"15\" border=\"0\">",$bericht);
$bericht = str_replace (";-D","<img src=\"img/ubbc/grin.gif\" width=\"15\" height=\"15\" border=\"0\">",$bericht);
// Angry
$bericht = str_replace (">:(","<img src=\"img/ubbc/angry.gif\" width=\"15\" height=\"15\" border=\"0\">",$bericht);
$bericht = str_replace ("[angry]","<img src=\"img/ubbc/angry.gif\" width=\"15\" height=\"15\" border=\"0\">",$bericht);
$bericht = str_replace (">:-(","<img src=\"img/ubbc/angry.gif\" width=\"15\" height=\"15\" border=\"0\">",$bericht);
// Sad
$bericht = str_replace (":(","<img src=\"img/ubbc/sad.gif\" width=\"15\" height=\"15\" border=\"0\">",$bericht);
$bericht = str_replace ("[sad]","<img src=\"img/ubbc/sad.gif\" width=\"15\" height=\"15\" border=\"0\">",$bericht);
$bericht = str_replace (":-(","<img src=\"img/ubbc/sad.gif\" width=\"15\" height=\"15\" border=\"0\">",$bericht);
// Shocked
$bericht = str_replace (":o","<img src=\"img/ubbc/shocked.gif\" width=\"15\" height=\"15\" border=\"0\">",$bericht);
$bericht = str_replace ("[shocked]","<img src=\"img/ubbc/shocked.gif\" width=\"15\" height=\"15\" border=\"0\">",$bericht);
$bericht = str_replace (":-o","<img src=\"img/ubbc/shocked.gif\" width=\"15\" height=\"15\" border=\"0\">",$bericht);
// Cool
$bericht = str_replace ("8)","<img src=\"img/ubbc/cool.gif\" width=\"15\" height=\"15\" border=\"0\">",$bericht);
$bericht = str_replace ("[cool]","<img src=\"img/ubbc/cool.gif\" width=\"15\" height=\"15\" border=\"0\">",$bericht);
$bericht = str_replace ("8-)","<img src=\"img/ubbc/cool.gif\" width=\"15\" height=\"15\" border=\"0\">",$bericht);
// Huh???
$bericht = str_replace ("???","<img src=\"img/ubbc/huh.gif\" width=\"15\" height=\"22\" border=\"0\">",$bericht);
$bericht = str_replace ("[huh]","<img src=\"img/ubbc/huh.gif\" width=\"15\" height=\"22\" border=\"0\">",$bericht);
$bericht = str_replace (":?","<img src=\"img/ubbc/huh.gif\" width=\"15\" height=\"22\" border=\"0\">",$bericht);
// Tongue
$bericht = str_replace (":P","<img src=\"img/ubbc/tongue.gif\" width=\"15\" height=\"15\" border=\"0\">",$bericht);
$bericht = str_replace ("[tongue]","<img src=\"img/ubbc/tongue.gif\" width=\"15\" height=\"15\" border=\"0\">",$bericht);
$bericht = str_replace (":-P","<img src=\"img/ubbc/tongue.gif\" width=\"15\" height=\"15\" border=\"0\">",$bericht);
// Embarresed
$bericht = str_replace (":[","<img src=\"img/ubbc/embarassed.gif\" width=\"15\" height=\"15\" border=\"0\">",$bericht);
$bericht = str_replace ("[embarassed]","<img src=\"img/ubbc/embarassed.gif\" width=\"15\" height=\"15\" border=\"0\">",$bericht);
$bericht = str_replace (":-[","<img src=\"img/ubbc/embarassed.gif\" width=\"15\" height=\"15\" border=\"0\">",$bericht);
// Lipsrsealed
$bericht = str_replace (":-X","<img src=\"img/ubbc/lipsrsealed.gif\" width=\"15\" height=\"15\" border=\"0\">",$bericht);
$bericht = str_replace ("[lipsrsealed]","<img src=\"img/ubbc/lipsrsealed.gif\" width=\"15\" height=\"15\" border=\"0\">",$bericht);
$bericht = str_replace (":X","<img src=\"img/ubbc/lipsrsealed.gif\" width=\"15\" height=\"15\" border=\"0\">",$bericht);
// Undecided
$bericht = str_replace (":-/","<img src=\"img/ubbc/undecided.gif\" width=\"15\" height=\"15\" border=\"0\">",$bericht);
$bericht = str_replace ("[undecided]","<img src=\"img/ubbc/undecided.gif\" width=\"15\" height=\"15\" border=\"0\">",$bericht);
$bericht = str_replace (":-s","<img src=\"img/ubbc/undecided.gif\" width=\"15\" height=\"15\" border=\"0\">",$bericht);
$bericht = str_replace (":s","<img src=\"img/ubbc/undecided.gif\" width=\"15\" height=\"15\" border=\"0\">",$bericht);
// Kiss
$bericht = str_replace (":*","<img src=\"img/ubbc/kiss.gif\" width=\"15\" height=\"15\" border=\"0\">",$bericht);
$bericht = str_replace ("[kiss]","<img src=\"img/ubbc/kiss.gif\" width=\"15\" height=\"15\" border=\"0\">",$bericht);
$bericht = str_replace (":-*","<img src=\"img/ubbc/kiss.gif\" width=\"15\" height=\"15\" border=\"0\">",$bericht);
// Cry
$bericht = str_replace (":\'(","<img src=\"img/ubbc/cry.gif\" width=\"15\" height=\"15\" border=\"0\">",$bericht);
$bericht = str_replace ("[cry]","<img src=\"img/ubbc/cry.gif\" width=\"15\" height=\"15\" border=\"0\">",$bericht);
$bericht = str_replace (":\'-(","<img src=\"img/ubbc/cry.gif\" width=\"15\" height=\"15\" border=\"0\">",$bericht);
// Love
$bericht = str_replace ("(L)","<img src=\"img/ubbc/love.gif\" width=\"15\" height=\"15\" border=\"0\">",$bericht);
$bericht = str_replace ("[love]","<img src=\"img/ubbc/love.gif\" width=\"15\" height=\"15\" border=\"0\">",$bericht);
?>


Nieuwe nieuws.php:

PHP:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> 
<?php 
include ("connect.php"); 
?> 
<html> 
<head> 
    <title><?php echo "$titel"; ?></title> 
</head> 

<body> 
<center><h1><?php echo "$titel"; ?></h1></center> 

<?php 



//verbinding met de database maken 

include("connect.php"); 

mysql_select_db("$db") 
  or die(mysql_error()); 

$sql = "SELECT id, titel_2, bericht, reacties FROM nieuwssysteem ORDER BY id DESC"; 
$res = mysql_query($sql) or die('fout in query :'. $sql.' : '. mysql_error());    
$num = mysql_num_rows($res); 
  if (empty($num)){ 
    $num = "geen"; 
  } 
  if($num == '0'){ 
  echo"Er zijn nog geen nieuwsberichten gepost."; } 
   
  while($row = mysql_fetch_object($res)){ 
    
?> 
<br> 
<?php 
require("ubbc.php"); 
echo "<b>".ubb(htmlspecialchars($row->titel_2))."</b><br>".ubb(htmlspecialchars($row->bericht))."<br> 
<i>reacties toegestaan</i> : <a href=\"reageer.php?id=$row->id\">$row->reacties</a><hr>"; 

?> 

<?  } 
  ?> 
<center><?php echo " $copy"; ?> 


</body> 
</html>

A;vast beankt:)
 
Domme vraag misschien, maar waarom include je je 'connect.php' 2x? De eerste keer lijkt mij overbodig ;)
 
tja..
Ik wete eigk neit meer maar het had een reden
Hij weergaf de titel ofz niet:s
 
Overigens kunnen str_replace() en preg_replace() met arrays maken, wat de snelheid van je script waarschijnlijk heel wat zou verbeteren.
 
dat soort dingen doe ik pas als het script werkt;)

Is een gewoonte van me eerst werken dan snelheid:rolleyes:
 
Geplaatst door rhcp
Is een gewoonte van me eerst werken dan snelheid:rolleyes:
Ach, met wat meer ervaring leer je wel efficiënter te coden ;)

En als je dat niet doet, zou ik het absoluut aanleren, Eerst opzetten en dan nog eens aanpassen ... Yikes. Gaat zo f*cking veel tijd in zitten.
 
oki maar back on topicweet jij een oploosing ik zit me de handen in het haar .

Het script heb ik van een tut hier is dat script:



link

script:

index.html (het verzenden):

PHP:
<html>
<head>
<title>Voorbeeld Formulier UBBC code</title>
</head>
<body>

<form name="formulier" method="post" action="verwerk.php">
<p>Vul het onderstaande formulier volledig in om een bericht toe te voegen:</p>

<script language="JavaScript1.2" type="text/javascript" src="javascript/ubbc.js"></script>

<div align="center"><script language="JavaScript1.2" type="text/javascript" src="javascript/knoppen.js"></script></div>
<div align="center"><script language="JavaScript1.2" type="text/javascript" src="javascript/smileys.js"></script></div>

<p align="center">Tekst:<br>
  <textarea name="bericht" cols="50" rows="5" class="input"></textarea>
</p>
<p align="center">
  <input type="submit" value="Toevoegen" class="input">
</p>
</form>

<p><a href="ubbc.zip">Downloaden als ZIP</a></p>

</body>
</html>

verwerk.php:

PHP:
<?php

// Verwerk.php

// Variabelen
$bericht = $_POST['bericht'];

?>

<html>
<head>
<title>Voorbeeld Formulier UBBC code</title>
</head>
<body>

<?php

echo "<p>Dit is de output zonder UBBC</p>\n\n";

echo "<p>$bericht</p>\n\n";

echo "<p>Hier is dezelfde output met UBBC</p>\n\n";

// UBBC toepassen
require("ubbc.php");

echo "<p>$bericht</p>\n\n";

?>

</body>
</html>


Dan is er nog het ubbc.php script maar dat staat al gepost ;)
 
Laatst bewerkt:
Door die lap code van je (wat echt niet nodig was :confused: ) ben ik je probleem kwijt geraakt.
 
dit klopt niet:

PHP:
?> 
<br> 
<?php 
require("ubbc.php"); 
echo "<b>$row->titel_2</b><br>$row->bericht<br> 
<i>reacties toegestaan</i> : <a href=\"reageer.php?id=$row->id\">$row->reacties</a><hr>"; 

?>

Krijg deze error:

Fatal error: Call to undefined function: ubb() in /usr/home/rhcp/domains/nodomain.nl/public_html/nieuws2.0/nieuws.php on line 39

als ik een andere koce gebruik werkt het wel alleen ubbc werkt dan neit :(


Pim
 
heb je dan ook maar ergens iets staan als
PHP:
function ubb ()
{
...
}
?
 
moet dat in het ubbc.php script of in nieuws.php?:eek:
 
ubbc.php is niet van mij vandaar.

en ik ben nog een beginner dit is mijn eerste script
 
Als dit je eerste script is zou ik vanaf het begin beginnen en niet 'n bestaand script bewerken..

Je roept ergens de functie ubb () aan. Als de functie niet bestaat, kan ie ook niet gebruikt worden DUS stopt het script met uitvoeren.

Dus ergens moet de functie ubb () aangemaakt worden.

Een voorbeeld functie:
PHP:
function ubb ( $text, $html = 1 )
{
  if ( $html == 1 )
  {
    $text = htmlentities ( $text );
  }
  
  $text = preg_replace ( '/\[b\](.+)\[\/b\]/i', '<b>\\1</b>', $text );
  return $text;
}

Aanroepen met:

echo ubb ( $mijntextvariable, $htmlaanofuit );
Zoals je ziet heeft de waarde $html in de functie ubb al 'n waarde. Je kan de functie ook zo aanroepen:
echo ubb ( $mijntextvariable );

Ik weet niet zeker of de preg_replace werkt, maar het zou [b]mijn text[/b] om moeten zetten naar mijn text.
 
het script zelf (wat ik gescript heb ) wertk wel.
het is eigenlijk mijn eerste grote code:eek: dat ook echt wat nuttigs doet.

Allen het ubb werkte dus niet
ik zal vanavond ff kijken .
 
Status
Niet open voor verdere reacties.
Terug
Bovenaan Onderaan