hallo,

ben ik weer:P

ik heb een nieuwsysteempje en bij de admin bij toevoegen wil ik de ubb er in doen nou ik heb het erin gezet maar dan krijg ik een lege pagina te zien ken iemand me helpen...


PS: de ubb komt van Xikeon @ wmcity


Toevoegen:
 
<?php 

ob_start(); 
include("../../config.php"); 

?> 
<?php 
include ("includes/ubb.php"); 

/** 
* Codes: (Beste in deze volgorde invullen) 
* h: No HTML (blockt <b> / <strong> enzo 
* u: UBB (zorgt dat UBB werkt) 
* j: No JavaScript (removed het woord 'javascript:' uit de input) 
* e: Replace Enters (veranderd enters in <br />) 
**/ 
$ubb = new UBB( 'huje' ); 
if (!isset($_POST['stuur'])) {

    $msg = $ubb->UBB( $_POST[ 'bericht' ] ); 
    echo $msg; 
} 
?>
    <?php 
} else { 
$naam = trim($_POST['naam']); 
$bericht = trim($_POST['bericht']); 
$titel = trim($_POST['titel']);
} 
?> 
<table width='90%'>
	<form method='post' name='formulier'>
	<tr>
		<td>
			Titel:		</td>
		<td>
			<input name='titel' type='text' id="titel" />		</td>
	</tr>
	<tr>
      <td> Bericht: </td>
	  <td><textarea name="bericht" cols="50" rows="5" id="bericht"><?php echo $_POST[ 'bericht' ]; ?></textarea>	  </td>
	  </tr>
	<tr>
      <td> Datum: </td>
	  <td><input type='text' name='datum' /></td>
	  </tr>
	<tr>
		<td>&nbsp;		</td>
		<td>
			<input type='submit' name='post' value='Voeg nieuws toe!' />		</td>
	</tr>
	</form>
</table>

<?
	if(isset($_POST['post']))
	{
		$titel = $_POST['titel'];
		$bericht = $_POST['bericht'];

		$datum = $_POST['datum'];
		$id = $_POST['id'];
		
	
		mysql_query("INSERT INTO nieuws (titel,bericht,datum,id) VALUES ('$titel','$bericht','$datum','$id')") or die( mysql_error() );
		
		echo "uw nieuws is succesvol toegevoegd! <br />";
		echo "<meta http-equiv='refresh' content='1;URL=index.php?x=admin/index' />";
		
	
}
?>
<p><a href="?x=admin/index">&gt;&gt;  Terug naar admin</a> </p>



UBB:

 
<?php 

/** 
* UBB Parser Class 
* By Xikeon / Mike 
**/ 

class UBB 
{ 
    var $input; 
    var $codes; 
    protected $return; 

    public function __construct( $code ) 
    { 
        $this->codes = $code; 
    } 

    public function UBB( $input ) 
    { 
        $this->return = $this->code_check( $input, $this->codes ); 
        return $this->return; 
    } 

    public function code_check( $input, $code ) 
    { 
        $this->return = $input; 

        if( preg_match( '/h/i', $code ) ) 
        { 
            $this->return = htmlspecialchars( $this->return ); 
        } 

        if( preg_match( '/u/i', $code ) ) 
        { 
            $this->return = $this->do_ubb( $this->return ); 
        } 

        if( preg_match( '/j/i', $code ) ) 
        { 
            $this->return = $this->no_javascript( $this->return ); 
        } 

        if( preg_match( '/e/i', $code ) ) 
        { 
            $this->return = $this->replace_enters( $this->return ); 
        } 

        return $this->return; 
    } 

    public function do_ubb( $input ) 
    { 
        $input = preg_replace( '/\[b\](.+?)\[\/b\]/is', '<strong>\\1</strong>', $input ); 
        $input = preg_replace( '/\[i\](.+?)\[\/i\]/is', '<em>\\1</em>', $input ); 
        $input = preg_replace( '/\[u\](.+?)\[\/u\]/is', '<u>\\1</u>', $input ); 
        $input = preg_replace( '/\[center\](.+?)\[\/center\]/is', '<center>\\1</center>', $input ); 
        $input = preg_replace( '/\[color=(.+?)\](.+?)\[\/color\]/is', '<span style="color: \\1;">\\2</span>', $input ); 
        $input = preg_replace( '/\[url=(.+?)\](.+?)\[\/url\]/is', '<a href="\\1">\\2</a>', $input ); 
        $input = preg_replace( '/\[url\](.+?)\[\/url\]/is', '<a href="\\1">\\1</a>', $input ); 
        $input = preg_replace( '/\[img\](.+?)\[\/img\]/is', '<img src="\\1" />', $input ); 
        $input = preg_replace( '/\[quote\](.+?)\[\/quote\]/is', '<div style="border: 1px dotted #000000;"><strong>Quote:</strong><br />\\1</div>', $input ); 
        $input = preg_replace( '/\[quote=(.+?)\](.+?)\[\/quote\]/is', '<div style="border: 1px dotted #000000;"><strong>Quote from \\1:</strong><br />\\2</div>', $input ); 
        $input = preg_replace( '/\[offtopic\](.+?)\[\/offtopic\]/is', '<span style="font-size: 10px; color: gray;"><em>Offtopic:<br />\\1</em></span>', $input ); 
        return $input; 
    } 

    public function no_javascript( $input ) 
    { 
        $input = preg_replace( '/javascript:/i', '', $input ); 
        return $input; 
    } 

    public function replace_enters( $input ) 
    { 
        $input = nl2br( $input ); 
        return $input; 
    } 
} 

?> 
mootje schreef op 21.02.2008 13:52
... maar dan krijg ik een lege pagina te zien

Dan zal er een { of ( niet worden afgesloten. Of er missen ; aan het eind van regels. Of je quotes kloppen niet.
ja maar waar is de fout dan ik ken het niet vinden
is er niemand die me kan helpen:$
Bijvoorbeeld: Regel 25
} else {

Van welke if() is dat een else?
ik kan nu toevoegen thnx... maar de ubb code lukt maar niet

klik hier

Reageren