TinyPortal
Development => Support => Topic started by: Senkusha on March 27, 2025, 04:42:58 PM
QuoteLink to my forum: https://forum.animerpgs.com (https://forum.animerpgs.com)
SMF version: 2.1.4
TP version: 3.0.2
Default Forum Language: English
Theme name and version: Reseller
Browser Name and Version: FireFox (136.0.1 (64-bit)), Chrome (134.0.6998.90 (Official Build) (64-bit))
Mods installed: Activity Bar (2.0.1), Alternate User Posting (2.1.2), Anime Avatars (1.0), Awesome Post Ratings (2.0.4b), Badge Awards (2.6.2b), Battle (1.17.9.4), Battle Image Expansion 1 (1.2), Battle Image Expansion 2 (1.1), Battle Image Expansion 3 (1.1), Battle Image Expansion 4 (1.1), Board Sorting Method (1.0.1), Country Flags (3.0), Curve2 Color Changer (1.4.2), Custom Board Icons (2.0.0), Dice Roller BBcode (2.0), Downloads Pro Addon - Display Credits (1.0), Emoji Pro (2.1a), Message Bookmarks (0.9.5), More Spiders (1.3.1), Optimus (3.0 RC3), Similar Topics (1.3.1), Simple Referrals (1.4.7), SimpleDesk - Integrated Helpdesk for Simple Machines Forum (2.1.3), SMF Classifieds (5.1.10), SMF Gallery Pro (10.2.2a), SMF Post Prefix (4.3.4), SMF Store (5.0.1), Spoiler (0.3.2), ST Shop (4.1.13), Stop Forum Spam (1.5.6), TinyPortal (3.0.2), Topic Solved (1.1.3)
Related Error messages:
5. critical
Error: No direct access...
SELECT value
FROM smf_settings
WHERE variable = 'number_recent_posts'
AND id_theme = 1
AND id_member = 0;
Function: eval
URL: https://forum.animerpgs.com/index.php?page=11 (https://forum.animerpgs.com/index.php?page=11)
File: /home/animerpgs/www/forum/Sources/TPSubs.php(1482) : eval()'d code (Line: 13)
I'm not sure what I'm doing different here. I've started the PHP block the same as others, yet I'm getting this "No Direct Access" error. The only difference that I can think of is that I upgraded TP. Did something change in 3.0.2?
I've looked in my other PHP blocks and I'm not seeing anything that stands out. But if something changed within TP versions, then none of my PHP pages would work.
global $smcFunc, $db_prefix, $scripturl, $modSettings, $settings, $user_info;
// Initialization!
$numTopics = 5;
// How many topics should I get?
$query = $smcFunc['db_query']('', '
SELECT value
FROM {db_prefix}settings
WHERE variable = {string:v}
AND id_theme = {int:t}
AND id_member = {int:m};',
array('v' => 'number_recent_posts',
't' => 1,
'm' => 0)
);
$result = $smcFunc['db_fetch_assoc']($query);
$numTopics = isset($result['value']) ? $result['value'] : $numTopics;
$smcFunc['db_free_result']($query);
2025-03-27 12_33_12-Error Log — Mozilla Firefox.png
Nothing changed in this respect in 3.0.2.
I have many PHP block that work, your code does not, so I am sure there is something wrong with the code...
Just to be sure I tested your code in TP 3.0.1 and it does not work there either
Okay. I found the problem. It was a semicolon at the end of the query (another problem was I was using the wrong table name, but that's beside the point.)
SELECT value
FROM {db_prefix}themes
WHERE variable = {string:v}
AND id_theme = {int:t}
AND id_member = {int:m};
Do not put the semicolon at the end of the MySQL statement. It only goes after the $smcFunc().