Page 2 of 2

Re: Admin Required Link

Posted: Wed Aug 10, 2022 2:59 pm
by WineMan
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.

Re: Admin Required Link

Posted: Wed Aug 10, 2022 3:07 pm
by George
you are going to have to give us more information
what version of flatpress are you using ?
what php version are you using ?

Re: Admin Required Link

Posted: Wed Aug 10, 2022 5:36 pm
by WineMan
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

Re: Admin Required Link

Posted: Wed Aug 10, 2022 6:35 pm
by George
i think php version 5.6.39 is too out of date.
7.4 should be fine is your code working out of flatpress?

Re: Admin Required Link

Posted: Wed Aug 10, 2022 6:40 pm
by WineMan
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.

Re: Admin Required Link

Posted: Sat Sep 17, 2022 12:32 pm
by Arvid
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?