Ето така ще ти тръгне.Ако този файл го използваш не инкуднат във друг.
Ако го използваш инклуднат да кажем към drugastranica.php използвай горния код който ти дадох и просто сложи в head-а на страницата този код:
Ако го използваш инклуднат да кажем към drugastranica.php използвай горния код който ти дадох и просто сложи в head-а на страницата този код:
HTML:
<meta http-equiv="Content-Type" Content="text/html; charset=utf-8" />
PHP:
<? session_start(); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" Content="text/html; charset=utf-8" />
<title>Addres Book</title>
</head>
<body>
<?php
// Freeware by Scriptol.com
// User configuration: update these data according to your own website
$site = "http://krivanotah.net78.net/";
$forumdir = "forum/";
$formatflag = false;
$cvt = array(
"(Вґ)"=>"'",
"(Г )"=>"à",
"(Гў)"=>"â",
"(Г¤)"=>"ä",
"(Г§)"=>"ç",
"(ГЁ)"=>"è",
"(Г©)"=>"é",
"(ГЄ)"=>"ê",
"(Г«)"=>"ë",
"(Г®)"=>"î",
"(ГЇ)"=>"ï",
"(Гґ)"=>"ô",
"(Г¶)"=>"ö",
"(Г№)"=>"ù",
"(Гј)"=>"ü",
"(Г»)"=>"û",
"(В«)"=>"«",
"(В»)"=>"»",
"(В©)"=>"©",
"(В§)"=>"¶",
);
// Use this function only if the format differs
function convert($content)
{
$len = count($cvt);
while($htmlchar = current($cvt))
{
$letter = key($cvt);
preg_replace($letter, $htmlchar, $content);
next($cvt);
}
return $content;
}
// Use to convert to UTF-8
function makeUTF($desc)
{
$desc = cp1251($desc);
$desc = stripslashes($desc);
return($desc);
}
function display($host, $dbname, $dbuser, $password, $size)
{
global $site;
global $forum;
global $topiclist;
global $table_prefix;
$db = @mysql_connect($host, $dbuser,$password);
mysql_select_db($dbname);
mysql_query("SET NAMES utf8")or die(mysql_error());
$posts = $table_prefix."posts";
$users = $table_prefix."users";
$top = $table_prefix."topics";
/*
$sql = "SELECT REF.post_id, TOP.topic_id, TXT.post_subject, REF.post_time, USER.username, TOP.topic_first_post_id
FROM $posts REF, $texts TXT, $users USER, $top TOP
WHERE REF.post_id = TOP.topic_first_post_id
AND REF.post_id = TXT.post_id
AND USER.user_id = TOP.topic_poster
ORDER BY post_time DESC LIMIT $size";
*/
$sql = "SELECT TOP.topic_id, TOP.topic_title, TOP.topic_time, USER.username
FROM $posts REF, $users USER, $top TOP
WHERE REF.post_id = TOP.topic_first_post_id
AND TOP.topic_poster = USER.user_id
ORDER BY REF.post_time DESC LIMIT $size";
// optionally: AND TOP.forum_id IN (1,2,4,5, ...)
$results = mysql_query($sql) or die(mysql_error());
mysql_query("SET NAMES utf8")or die(mysql_error());
// Extracting and displaying titles
while($line = mysql_fetch_assoc($results))
{
$title = $line['topic_title'];
//$title = $line['post_subject'];
$url = $forum . "viewtopic.php?t=" . $line['topic_id'];
if($formatflag) $title = convert($title);
$username = $line['username'];
$date = strftime("%A %B %e, %Y %H:%M", $line['topic_time']+(0));
echo "<a href='$url'>$title</a> от <span class='cssuser'>$username</span><br>\n";
}
}
if(substr($site, -1, 1) != "/") $site = $site. "/";
$forum = $site . $forumdir;
if(substr($forum,-1, 1) != "/") $forum = $forum. "/";
include($forumdir."config.php");
if (! PHPBB_INSTALLED) die("phpBB not installed in $forumdir");
display($dbhost, $dbname , $dbuser, $dbpasswd , 5);
?>
</body>
</html>