NABS
By: xell | Date: Aug 6 2007 13:23 | Format: PHP | Expires: never | Size: 11.58 KB | Hits: 1983
- Beste leden van WMCity,
- Aangezien ik bezig ben met een nieuwssysteem en ik nog niet zo bijster goed ben met php/mysql maar ik dit een leuke uitdaging vind om zo me kennis te ontwikkelen ben ik een news-systeem aan het maken wat gaat dienen voor me site.
- News werkt alleen krijg ik nadat ik me ubb.php heb geinclude in me functions.php, en ik news submit een wit scherm.
- En ik vind de fout niet.
- Nou mijn vraag aan jullie hoe kan ik me ubb werkend krijgen?
- PS: site is engels omdat daar mijn doelgroep ligt.
- [b]News.php [/b]
- [code] <?
- include '../config.php';
- admin();
- ?>
- <?
- "July", "August", "September", "October", "November", "December");
- mysql_query("INSERT INTO nieuws_posts SET nieuws='". $naam ."', author='". $author ."', bericht='".$bericht."', datum='".$date."'") or die (mysql_error());
- echo "The message has been added!<META HTTP-EQUIV="REFRESH" CONTENT="2; URL=news.php"> ";
- }
- "July", "August", "September", "October", "November", "December");
- mysql_query("UPDATE nieuws_posts SET nieuws='". $naam ."', author='". $author ."', bericht='".$bericht."', datum='".$date."' WHERE id=".$id."") or die (mysql_error());
- echo "The message has been updated!<META HTTP-EQUIV="REFRESH" CONTENT="2; URL=news.php"> ";
- }
- ?>
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="content-type" content="text/html; charset=utf-8" />
- <title><? titleadmin(); ?></title>
- <meta name="keywords" content="" />
- <meta name="description" content="" />
- <link href="../default.css" rel="stylesheet" type="text/css" />
- </head>
- <body>
- <div id="wrapper">
- <div id="header">
- <h1><a href="#">Hackers-ProJect</a></h1>
- </a>
- </div>
- <!-- end div#header -->
- <div id="menu">
- </div>
- <!-- end div#menu -->
- <?
- echo '
- <div id="page">
- <div id="content">
- <div id="welcome">
- <h1>Admin</h1>
- <p>Welcome to the news admin panel!</p>
- <lu>
- <li><a href="news.php?x=add">Add news</a></li>
- <li><a href="news.php?x=edit">Edit news</a></li>
- <li><a href="news.php?x=del">Delete news</a></li>
- </ul>
- </div>
- ';
- }
- if($_GET['x'] == 'add'){
- echo '
- <div id="page">
- <div id="content">
- <div id="welcome">
- <h1>Admin</h1>
- <p>
- <form method="post">
- Title:<br />
- <input type="text" name="naam"><br />
- Author:<br />
- <input type="text" name="author"><br />
- Message:<br />
- <textarea name="bericht" cols="35" rows="10"></textarea><br />
- <input type="submit" name="stuur" value="Send!"><br />
- </form></p>
- </div>
- ';
- }
- elseif($_GET['x'] == 'edit'){
- echo '
- <div id="page">
- <div id="content">
- <div id="welcome">
- <h1>Admin</h1>
- <ul>';
- echo '<li><a href="news.php?x=editid&id='.$News['id'].'">'.$News['nieuws'].'</li>';
- }
- echo '
- </div>
- ';
- }
- elseif($_GET['x'] == 'editid'){
- $SqlNews = mysql_query("SELECT id,nieuws,bericht,author FROM nieuws_posts WHERE id=".$_GET['id']."");
- echo '
- <div id="page">
- <div id="content">
- <div id="welcome">
- <h1>Admin</h1>
- <p>
- <form method="post">
- Title:<br />
- <input type="text" name="naam" value="'.$Select['nieuws'].'"><br />
- Author:<br />
- <input type="text" name="author" value="'.$Select['author'].'"><br />
- Message:<br />
- <textarea name="bericht" cols="35" rows="10">'.$Select['bericht'].'</textarea><br />
- <input type="hidden" name="id" value="'.$id.'">
- <input type="submit" name="edit" value="Edit!"><br />
- </form></p>
- </div>
- ';
- }
- elseif($_GET['x'] == 'del'){
- echo '
- <div id="page">
- <div id="content">
- <div id="welcome">
- <h1>Admin</h1>
- <p><i>Warning: When you click on the title of the message it will be <b>deleted!</b></i></p>
- <ul>';
- echo '<li><a href="news.php?x=delid&id='.$News['id'].'">'.$News['nieuws'].'</li>';
- }
- echo '
- </div>
- ';
- }
- if($_GET['x'] == 'delid'){
- echo '
- <div id="page">
- <div id="content">
- <div id="welcome">
- <h1>Admin</h1>
- <p>Message has been <b>deleted</b> succesfully!</p>
- </div>
- ';
- }
- ?>
- <!-- end div#welcome -->
- <!-- Geen 'links();' op deze pagina ;) -->
- <!-- end div#sample2 -->
- </div>
- <!-- end div#content -->
- <div id="sidebar">
- <ul>
- <?
- admin_menu();
- ?>
- <!-- end li#submenu -->
- <li id="news">
- <h2>News & Updates</h2>
- <ul>
- <?
- nieuws();
- ?>
- </ul>
- </li>
- <!-- end li#news -->
- </ul>
- </div>
- <!-- end div#sidebar -->
- <div style="clear: both; height: 1px"></div>
- </div>
- <!-- end div#page -->
- <div id="footer">
- </div>
- <!-- end div#footer -->
- </div>
- <!-- end div#wrapper -->
- </body>
- </html>
- [b]Functions.php stukje[/b]
- function nieuws(){
- $query = "SELECT id,nieuws,datum FROM nieuws_posts WHERE 1 ORDER BY id DESC LIMIT 5";
- $uitvoer = mysql_query($query) or die (mysql_error());
- while($lijst = mysql_fetch_assoc($ntext))
- {
- include "ubb.php";
- echo insertbbcode($ntext);
- echo "
- <h3>". $lijst['datum'] ."</h3>
- <p><a href="news.php?id=".$lijst['id']."">". $lijst['nieuws'] ."</a></p>
- ";
- }
- }
- ubb.php [/b]
- <?PHP
- function InsertBBCode($ntext){
- $ntext = eregi_replace("\[img height=([^\[]*)\ width=([^\[]*)\]([^\[]*)\[/img\]","<img src="\3" height="\1" width="\2">",$ntext);
- $ntext = eregi_replace("\[img width=([^\[]*)\ height=([^\[]*)\]([^\[]*)\[/img\]","<img src="\3" width="\1" height="\2">",$ntext);
- $ntext = 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>",$ntext);
- $ntext = eregi_replace("\[shadow=([^\[]*)\,([^\[]*)\,([^\[]*)\]([^\[]*)\[/shadow\]","<font style="Filter: Shadow(color=\1, Direction=\2); Width=\3px;">\4</font>",$ntext);
- $ntext = eregi_replace("\[glow=([^\[]*)\,([^\[]*)\,([^\[]*)\]([^\[]*)\[/glow\]","<font style="Filter: Glow(color=\1, Strength=\2); Width=\3px;">\4</font>",$ntext);
- $ntext = eregi_replace("\[email=([^\[]*)\]([^\[]*)\[/email\]", "<a href="mailto:\1">\2</a>",$ntext);
- $ntext = eregi_replace("\[url\]www.([^\[]*)\[/url\]", "<a href="http://www.\1" target=_blank>\1</a>",$ntext);
- $ntext = eregi_replace("\[url=([^\[]*)\]([^\[]*)\[/url\]","<a href="\1" target=_blank>\2</a>",$ntext);
- $ntext = eregi_replace("(^|[>[:space:]n])([[:alnum:]]+)://([^[:space:]]*)([[:alnum:]#?/&=])([<[:space:]n]|$)","\1<a href="\2://\3\4" target="_blank">\2://\3\4</a>\5", $ntext);
- return $ntext;
- }
- function InsertSmileys($ntext){
- return $ntext;
- }
- ?>
- Alvast bedankt. :k
Latest pastes
1 hours ago
11 hours ago
1 days ago
2 days ago
2 days ago