This forum is archived. Posts are preserved for historical reference. For current help, join us on Discord.

I broke my pages

In UserSpice 4.3 and Below · Started by astropos on 2019-01-22 1:41 pm · 8257 views · 2 replies

Hi, 4.3.26 on Ubuntu/Apache2

Just wanted to check something (I'm spinning up another instance to test further while I type):

I attempted to run a test system and live system off the same db - it seemed to work OK while I worked on it.
The latest feature initially required an AJAX GET (just to bring in a list of comments). Whilst working on the subsequent AJAX POST, I noticed that the files called by AJAX were not being added to the pages table. Moreover, there were many entries in pages_permissions for pages that did not exist.

The pages called by AJAX have a successful call to init and a call to a DB instance, and return data correctly.
If I access these pages directly in my browser, I am prompted to secure them - but the pages table is not updated.


Is this a result of the live/test 'stunt' or is it anything to do with calling by AJAX?

cheers
There are 2 things you can do with ajax parser files. I tend not to like to clog up my pages table with parser files, so I tend to not use the securePage function and instead do something like...

require_once("../../users/init.php"); /obviously with your own path
$db = DB::getInstance();
if(!hasPerm([2,3],$user->data()->id)){
die("Not logged in");
}

If you really want the parsers files to use securePage, then you have to add the folder that they're stored in to the z_us_root file.
perfect, thankyou Mudmin. I should have figured out that old school method myself ;)

I'll be asking about Validation next, once I've built this new server...

thanks again,