Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Not a member yet? Click here to register.
Forgot Password?

Data from an additional page on another subpage

Asked Modified Viewed 674 times
R
Rafee
R
Rafee 10
  • Newbie, joined since
  • Contributed 2 posts on the community forums.
  • Started 1 thread in the forums
  • Started this discussions
asked
Newbie

Good morning,

I cannot cope with the correct display of the data stored in the database on the website. I wanted the content from the additional page to be displayed in a different file than the default one (viewpage.php)

Well, it has the page content saved in the mysqli database:
<?php 
echo "<a href='https://www.php-fusion.co.uk/' target='_blank'>Najlepsze forum</a>";
?>


I created a file called xxx.php and put it in the main directory of the website

The content of the file:
<?php
/*-------------------------------------------------------+
| PHPFusion Content Management System
| Copyright (C) PHP Fusion Inc
| https://phpfusion...
+--------------------------------------------------------+
| Filename: viewpage.php
| Author: Core Development Team
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or >
| at www.gnu.org/licen... Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
require_once __DIR__.'/maincore.php';
require_once THEMES.'templates/header.php';
 
echo render_breadcrumbs();
 
$cp_result = dbquery("SELECT * FROM ".DB_CUSTOM_PAGES." WHERE page_id='".$_GET['v']."'");
if (dbrows($cp_result)) {
 $cp_data = dbarray($cp_result);
 
opentable2();
echo "<div style='text-align: center; padding-bottom: 17px; font-size: 35px; font-weight: bold; color: #000;'>".$cp_data['page_title']."</div>";
 
eval("?>".stripslashes($cp_data['page_content'])."<?php ");
 
closetable();
 
require_once THEMES.'templates/footer.php';


Unfortunately, after entering the website https://www.sitesite.com/xxx.php?#v=1, it loads my saved content, but not in the internet version
images92.fotosik.pl/584/bf866f8087bbf0fc.png


Is it possible for the content to be displayed like at viewpage.php? Using a modified code?
Edited by Rafee on 06-04-2022 09:59,
0 replies

3 posts

F
Falk
F
Falk 131
Need help?, Having trouble?
• View our Documentation for Guides, Standards and Functions
• Name and Organize your Topics and Content correctly in the corresponding Forums for best support results
• Attaching Log Files and Screenshots when reporting issues will help
• Provide with an URL to live example if one exists
• Please read the How to Report an Error post
• Please read and comply with the Code of Conduct

(¯·._.·(¯°·._.·°º*[ Project Manager ]*º°·._.·°¯)·._.·¯)
  • Super Admin, joined since
  • Contributed 6,201 posts on the community forums.
  • Started 639 threads in the forums
  • Answered 11 questions
answered
Super Admin

If it is only HTML, use
parse_textarea($cp_data['page_content'], FALSE, FALSE, TRUE, NULL, $cp_data['page_content'] == 'y' ? TRUE : FALSE)


Not sure if you have line breaks there, but can remove it.
Also if you have a dedicated page for a specific page, you can just echo it instead of storing in database.
require_once __DIR__.'/maincore.php';
require_once THEMES.'templates/header.php';
echo "<a href='https://www.php-fusion.co.uk/' target='_blank'>Najlepsze forum</a>";
require_once THEMES.'templates/footer.php';


If you still want to use the database, instead of forcing a input on the page as you do with page_id='".$_GET['v']."' , change it to page_id='YOURID' then your URL will be cleaner.
1 reply
D
douwe_yntema
D
  • Senior Member, joined since
  • Contributed 667 posts on the community forums.
  • Started 57 threads in the forums
  • Answered 1 question
answered
Senior Member

Quote

If you still want to use the database, instead of forcing a input on the page as you do with page_id='".$_GET['v']."' , change it to page_id='YOURID' then your URL will be cleaner.


And you must use some sort of stripinput to prevent XSS atacks.
So in your code use:
$page_id = stripinput ($G__GET['page_id']

Never use $_GET or $_POST directly in your code.

About your error:

You are using opentable2(), but thus function does not exists in core. Is this a typo or have you added this function in your theme?
0 replies
K
karix094
K
  • Newbie, joined since
  • Contributed 7 posts on the community forums.
  • Started 1 thread in the forums
answered
Newbie

The user "Rafee" has created a file named "xxx.php" which works the same or similar to the file "viewpage.php"
E.g.:
When you enter:
"xxx.php? v = 1"
It will be displayed the same as on:
"viewpage.php? page_id = 1"

User "Rafee" adds a new page in "Custom Pages"
The content of the custom page includes the following text:::
“<?php
echo "<a href='https://www.php-fusion.co.uk/' target='_blank'>Najlepsze forum</a>";
?>"

The user "Rafee" has a problem that the content in the xxx.php file is from "Custom Pages" where the php script does not work.

For example, in panels such a possibility is ...
"System Admin> Panels> Add Panel> Allow PHP Execution"

Do you have an idea how to run PHP from custom page content in xxx.php?
0 replies

Labels

None yet

Statistics

  • Views 0 views
  • Posts 3 posts
  • Votes 0 votes
  • Topic users 4 members

4 participants

F
F
Falk 131
Need help?, Having trouble?
• View our Documentation for Guides, Standards and Functions
• Name and Organize your Topics and Content correctly in the corresponding Forums for best support results
• Attaching Log Files and Screenshots when reporting issues will help
• Provide with an URL to live example if one exists
• Please read the How to Report an Error post
• Please read and comply with the Code of Conduct

(¯·._.·(¯°·._.·°º*[ Project Manager ]*º°·._.·°¯)·._.·¯)
  • Super Admin, joined since
  • Contributed 6,201 posts on the community forums.
  • Started 639 threads in the forums
  • Answered 11 questions
D
D
  • Senior Member, joined since
  • Contributed 667 posts on the community forums.
  • Started 57 threads in the forums
  • Answered 1 question
R
R
Rafee 10
  • Newbie, joined since
  • Contributed 2 posts on the community forums.
  • Started 1 thread in the forums
  • Started this discussions
K
K
  • Newbie, joined since
  • Contributed 7 posts on the community forums.
  • Started 1 thread in the forums

Notifications

Track thread

You are not receiving notifications from this thread.

Related Questions

Not yet