Admin Required Link

This is the right place to report general bugs, make suggestions or ask for help.
User avatar
WineMan
Posts: 78
Joined: Tue Sep 01, 2020 5:03 pm

Re: Admin Required Link

Post by WineMan » Wed Aug 10, 2022 2:59 pm

Yes, I know...I merely added that code to let him know that adding [exec] code [/exec] using the code I posted did not work.

George
Posts: 37
Joined: Tue May 18, 2021 10:54 am
Location: Uk
Contact:

Re: Admin Required Link

Post by George » Wed Aug 10, 2022 3:07 pm

you are going to have to give us more information
what version of flatpress are you using ?
what php version are you using ?
Proudly using flatpress https://www.mypoppy.uk/blog

User avatar
WineMan
Posts: 78
Joined: Tue Sep 01, 2020 5:03 pm

Re: Admin Required Link

Post by WineMan » Wed Aug 10, 2022 5:36 pm

Thanks for the follow up George.

I am using FlatPress version 1.2.1 and two different domains. One is running php version 5.6.39 and the other one is running php version 7.4.24

George
Posts: 37
Joined: Tue May 18, 2021 10:54 am
Location: Uk
Contact:

Re: Admin Required Link

Post by George » Wed Aug 10, 2022 6:35 pm

i think php version 5.6.39 is too out of date.
7.4 should be fine is your code working out of flatpress?
Proudly using flatpress https://www.mypoppy.uk/blog

User avatar
WineMan
Posts: 78
Joined: Tue Sep 01, 2020 5:03 pm

Re: Admin Required Link

Post by WineMan » Wed Aug 10, 2022 6:40 pm

Yes, the code is working out of FlatPress. It doesn't appear that it is going to work and I don't have the coding skills to develop a Plugin to set this up.

User avatar
Arvid
FlatPress Coder
Posts: 443
Joined: Sat Jan 26, 2019 7:40 pm
Contact:

Re: Admin Required Link

Post by Arvid » Sat Sep 17, 2022 12:32 pm

Your code, embedded in exec tags, works for me (I have no data.txt so I get the "The file cannot be found!" message).

But: Getting this error, exit is called. This stops every PHP execution immediately, so nothing else of your FlatPress will be displayed after that!
I'd recommend removing the exit and rework this in a more if/else fashion. Totally untested:

Code: Select all

if(!file_exists("data.txt")) {
	echo "The file cannot be found!";
}
else {
	$fp = fopen("data.txt", "r");
	if(!$fp) {
		echo "File cannot be opened";
	}
	else {
		echo "<table border = 2>";
		while(!feof($fp))
			{
				$info = fgets($fp);
				echo "<tr>";
				
				echo "<td>$info</td>\n";
				
				echo "<br />";
			}
			echo "</tr>\n";
			echo "</table>";
		fclose($fp);
	}
}
What I noticed: The code snippet you posted here misses the last semicolon after

Code: Select all

fclose($fp)
- could that be your initial problem?
Helpful FlatPress links: Project blog 📝 - FlatPress wiki 📖 - FlatPress@Twitter 🐦 - FlatPress@Mastodon 🐘
Stay up to date with our feeds: Forum RSS feed 📜 - Project blog RSS feed 📜
Feel free to say Thank you: Donate ❤️

🔥 How to rework your themes and plugins for FlatPress 1.3 / Smarty 4 🔥

🇩🇪 Für meinen Arbeitgeber in Bochum habe ich eine Stelle zu besetzen: Junior-Systemadministrator 🇩🇪

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest