[Проблем с CMS] Не показва последните теми във форума

PHP, MySQL, JavaScript, HTML, CSS и др.
Аватар
FEEL MY STYLE
Извън линия
Потребител
Потребител
Мнения: 96
Регистриран на: 16 Сеп 2017, 12:30
Се отблагодари: 5 пъти
Получена благодарност: 2 пъти

[Проблем с CMS] Не показва последните теми във форума

Мнение от FEEL MY STYLE » 07 Май 2020, 10:30

~jeff написа: 07 Май 2020, 01:31 Тази система е пълен батак :confused: :confused:
Пробвай така:

Код за потвърждение: Избери целия код

<?php
require "top.php";
require "config.php";

$topicsSelect = mysql_query($connect, "
	SELECT * 
	FROM " . TOPICS_TABLE . " 
	ORDER BY topic_id 
	DESC LIMIT 10
	");
	
echo "<table class='list1' style='font-size:12px; text-align:center; border-collapse: collapse; cellpadding='0' cellspacing='2' width='100%' border='0'>";

while($row = mysql_fetch_assoc($topicsSelect))
{
		$postsSelect = mysql_query($connect, "
			SELECT * 
			FROM " . POSTS_TABLE . " 
			WHERE topic_id = ".$row['topic_id']."
			");
		$post = mysql_fetch_array($postsSelect);
							
		$userSelect = mysql_query($connect, "
			SELECT * 
			FROM " . USERS_TABLE . " 
			WHERE user_id = ".$post['poster_id']."
		");
		$user = mysql_fetch_array($userSelect);

		$topicReplies  = mysql_query($connect, "SELECT count(topic_id) as total FROM " . POSTS_TABLE . " WHERE topic_id = '". $row['topic_id'] ."'"); 
		$allTopicReplies = mysql_fetch_assoc($topicReplies);
  
echo "<tr style='height:35px; background: url(images/newsbg.gif);'>
<td style=' width: 25px; text-align:left;'><img src='images/topic.png' height='22' style='padding: 6px;'></td>
<td style=' text-align:left;'><div style='padding: 0px 0 0 5px;'><a href='viewtopic.php?f=" . $post['forum_id'] . "&t=" . $post['topic_id'] . "' target='_blank' style='font: 10px verdana; font-weight: bold;'>" . $row['topic_title'] . "</a><span style='font: 10px arial;'></td>
<td style='width: 55px;'>" . $allTopicReplies . "</td>
<td style=''><a href='forum/memberlist.php?mode=viewprofile&u=" . $user['user_id'] . "' style='font-size: 10px; font-family: verdana;color: #" . $user['user_colour'] . "'>". $row['topic_first_poster_name'] ."</a> <font style='font: 11px arial; color: #666;'>" . $row['topic_first_poster_name'] . "</font></td>
</tr></div>";
}
echo "</table>";
?>
Мм не.., излиза ми това:
[phpBB Debug] PHP Warning: in file /home/vol6_6/epizy.com/epiz_25622.../htdocs/lastforum.php on line 10: mysql_query() expects parameter 1 to be string, resource given
[phpBB Debug] PHP Warning: in file /home/vol6_6/epizy.com/epiz_25622.../htdocs/lastforum.php on line 14: mysql_fetch_assoc() expects parameter 1 to be resource, null given

d3ath2435 написа: 07 Май 2020, 01:30 Интересно!
Note that versions of PHP before 5.6 are already not patched for security issues. So if you are using an earlier version of PHP like PHP 5.2 (popular for phpBB 3.0 and 2.0) or PHP 5.3, 5.4 or 5.5 you are already at risk. You really can’t upgrade to PHP 7.0 as you will experience errors. Some phpBB 2.0 and 3.0 users have issues running PHP 5.6.
Един съвет: Махни тези готови системи и си пригоди форума както трябва! Препоръчително е 7.2 мисля, че беше за 3.2. Време е за Ъпдейт. Спрете с тези готови системи със стари версии на php.

Другия вариант е остави файла lastpost.php работещия където му е мястото и използвай <iframe> </iframe>, щом толкова желаеш да си с тази система и искаш всичко да работи. Опитай. Вариант е!
Това с <iframe> мисля да е последното нещо, което да опитам, предполагам, че има още варианти, аз също търся, но нещо не ме огрява слънцето.. Не знам...

Аватар
~jeff
Извън линия
Потребител
Потребител
Мнения: 158
Регистриран на: 24 Ное 2018, 12:39
Се отблагодари: 2 пъти
Получена благодарност: 27 пъти

[Проблем с CMS] Не показва последните теми във форума

Мнение от ~jeff » 07 Май 2020, 11:31

Код за потвърждение: Избери целия код

<?php
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);

$user->session_begin();
$auth->acl($user->data);

mysql_connect('localhost', 'usr', 'pwd');
mysql_select_db('db');

$topicsSelect = "
	SELECT * 
	FROM " . TOPICS_TABLE . " 
	ORDER BY topic_id 
	DESC LIMIT 10
	";
$topicsSelectQuery = mysql_query($topicsSelect) or die (mysql_error());
	
echo "<table class='list1' style='font-size:12px; text-align:center; border-collapse: collapse; cellpadding='0' cellspacing='2' width='100%' border='0'>";

while($row = mysql_fetch_assoc($topicsSelectQuery))
{
		$postsSelect = mysql_query("
			SELECT * 
			FROM " . POSTS_TABLE . " 
			WHERE topic_id = ".$row['topic_id']."
			");
		$post = mysql_fetch_array($postsSelect);
							
		$userSelect = mysql_query("
			SELECT * 
			FROM " . USERS_TABLE . " 
			WHERE user_id = ".$post['poster_id']."
		");
		$user = mysql_fetch_array($userSelect);

		$topicReplies  = mysql_query("SELECT count(topic_id) as total FROM " . POSTS_TABLE . " WHERE topic_id = '". $row['topic_id'] ."'"); 
		$allTopicReplies = mysql_fetch_assoc($topicReplies);
  
echo "<tr style='height:35px; background: url(images/newsbg.gif);'>
<td style=' width: 25px; text-align:left;'><img src='images/topic.png' height='22' style='padding: 6px;'></td>
<td style=' text-align:left;'><div style='padding: 0px 0 0 5px;'><a href='viewtopic.php?f=" . $post['forum_id'] . "&t=" . $post['topic_id'] . "' target='_blank' style='font: 10px verdana; font-weight: bold;'>" . $row['topic_title'] . "</a><span style='font: 10px arial;'></td>
<td style='width: 55px;'>" . $allTopicReplies['total'] . "</td>
<td style=''><a href='forum/memberlist.php?mode=viewprofile&u=" . $user['user_id'] . "' style='font-size: 10px; font-family: verdana;color: #" . $user['user_colour'] . "'>". $row['topic_last_poster_name'] ."</a> <font style='font: 11px arial; color: #666;'>" . $row['topic_first_poster_name'] . "</font></td>
</tr></div>";
}

echo "</table>";
?>
Go to work, get married, have some kids, pay your taxes, pay your bills, watch your tv, follow fashion, act normal, obey the law and repeat after me: I AM FREE

Публикувай отговор
  • Подобни теми
    Отговори
    Преглеждания
     Последно мнение

Обратно към “Уеб Програмиране”

Кой е на линия

Потребители разглеждащи този форум: 0 регистрирани и 12 госта