1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
|
<html>
<head>
<title>Newsscript</title>
<style type="text/css">
<!--
.codDiv
{
text-align:left;
border:1px solid black;
font-size:12px;
color:green;
background-color:#ececec;
padding:5px;
}
.quoteDiv
{
text-align:left;
border:1px solid black;
font-size:12px;
color:blue;
background-color:#ececec;
padding:5px;
}
.global
{
border: solid 1px black;
margin: 10px;
font-family: Verdana,Arial,Helvetica,sans-serif;
font-size:10px;
}
.content
{
background-color: #527AAE;
padding: 5px;
}
.message
{
background-color: #C1E7EC;
padding: 5px;
}
.footer
{
background-color: #527AAE;
padding: 5px;
}
-->
</style>
</head>
<body bgcolor="#C1E7EC">
<?php
function bbcode_parse($text)
{
$text = preg_replace("/\[img\](.*?)\[\/img\]/si", '<img src="\\1" border="0" />', $text);
$text = preg_replace("/\[url\](.*?)\[\/url\]/si", '<a href="\\1">\\1</a>', $text);
$text = preg_replace("/\[url=\'(.*?)\'\](.*?)\[\/url\]/si", '<a href="\\1">\\2</a>', $text);
$text = preg_replace("/\[url=(.*?)\](.*?)\[\/url\]/si", '<a href="\\1">\\2</a>', $text);
$text = preg_replace("/\[align=(.*?)\](.*?)\[\/align\]/si", '<span style="text-align:\\1">\\2</span>', $text);
$text = preg_replace("/\[email\](.*?)\[\/email\]/si", '<a href="mailto:\\1">\\1</a>', $text);
$text = preg_replace("/\[code\](.*?)\[\/code\]/si", 'Code:<div class="codeDiv">\\1</div>', $text);
$text = preg_replace("/\[quote\](.*?)\[\/quote\]/si", 'Zitat:<div class="quoteDiv">\\1</div>', $text);
$text = preg_replace('/\[(\/?)(b|i|u|li|ul|ol)\]/i', '<$1$2>', $text);
$text = preg_replace('/^(={1,6})\s*(.+)\s*(\1)\s*$/me', '\'<h\'.strlen(\'$1\').\'>\'.rtrim(\'$2\').\'</h\'.strlen(\'$1\').\'>\'', $text);
return nl2br($text);
}
$host = 'localhost'; // Adresse des MySQL-Servers, meistens localhost
$username = 'user'; // MySQL-Benutzer ... Besitzer der Datenbank, bei lokalen Installationen meist root
$dbname = 'wbb3'; // Name der Datenbank
$passwd = 'passwd'; // Passwort des MySQL-Benutzers
$url2profile = 'http://board.dizzy-w3.at/index.php?page=User&userID=';
$url2thread = 'http://board.dizzy-w3.at/index.php?page=Thread&threadID=';
$boardID = 35;
@$db = new mysqli($host, $username, $passwd, $dbname);
if ($mysqli->connect_error) {
die('Connect Error: ' . $mysqli->connect_error);
}
$query = 'SELECT wbb1_1_thread.time, wbb1_1_post.username, wbb1_1_thread.threadID, wbb1_1_thread.isDeleted, wbb1_1_thread.replies, wbb1_1_post.subject, wbb1_1_post.message, wbb1_1_post.time, wbb1_1_thread.userID, wbb1_1_thread.views
FROM wbb1_1_post, wbb1_1_thread
WHERE wbb1_1_post.postID = wbb1_1_thread.firstPostID
AND wbb1_1_thread.boardID = '.$boardID.'
AND wbb1_1_thread.isDeleted = 0
ORDER BY wbb1_1_thread.time DESC
LIMIT 0 , 30';
$res = $db->query($query);
$num_res = $res->num_rows;
for($i = 0; $i < $num_res; $i++)
{
$row = $res->fetch_assoc();
echo '<div class="global"><div class="content">
<span style="margin-left: 20px;"><b><a href="'.$url2thread.stripslashes($row['threadID']).'">'.stripslashes($row['subject']).'</a></b> von <a href="'.$url2profile.stripslashes($row['userID']).'">'
.stripslashes($row['username']).'</a> am '. date('d m Y', $row['time']) .' um '. date('H:i', $row['time']) .'</span></div>';
echo '<div class="message"><p>'.bbcode_parse(stripslashes($row['message'])).'</p><br /><br /></div>
<div class="footer">Views: '.stripslashes($row['views']).' | Antworten: ' . stripslashes($row['replies']) . '</div></div>';
}
$res->close();
$db->close();
?>
</body>
</html> |