The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/global.php(961) : eval()'d code 26 errorHandler->error
/global.php 961 eval
/printthread.php 16 require_once



UserSpice
Using UserSpice Without the UI - Printable Version

+- UserSpice (https://userspice.com/forums)
+-- Forum: Miscellaneous (https://userspice.com/forums/forumdisplay.php?fid=28)
+--- Forum: Documentation (https://userspice.com/forums/forumdisplay.php?fid=30)
+--- Thread: Using UserSpice Without the UI (/showthread.php?tid=498)



Using UserSpice Without the UI - tradeJmark - 03-16-2017

Hi,
I noticed your video on integrating UserSpice with existing websites seems to use an old version of UserSpice. The files have changed since then, and I was wondering what the bare minimum requirements now are to control user access to a page. I tried including header and init on my page, but all that did was add some css that I plan to get rid of anyway. The page was viewable in the Pages screen, but taking it private did not work, I was still able to access it while signed out.


Using UserSpice Without the UI - mudmin - 03-16-2017

The bare minimum you need is
1. A require_once to the init file
2. That securePage function that is at the top of each page.


Using UserSpice Without the UI - tradeJmark - 03-16-2017

Ah. It was the securePage thing I was missing. I'll give it a try with that in place. Thanks for the quick reply!


Using UserSpice Without the UI - mudmin - 03-16-2017

Yeah. No problem at all. Not only do you not need the ui, but by getting that init file in there, you pretty much get 100{3bc1fe685386cc4c3ab89a3f76566d8931e181ad17f08aed9ad73b30bf28114d} of the functionality of all the classes. (although you might need to include a few other things in your header...like the settings query and stuff like that).




Using UserSpice Without the UI - laplaplap - 03-18-2017

Hi!

I've had the same problem but I'm still a bit confused.
What exactly is it we need a the top of each page?

I have tried in the head:

<?php require_once('/mybigfancyproject/users/init.php'); ?>
<?php if (!securePage($_SERVER['PHP_SELF'])){die();} ?>

But it gave a blank page and didn't load any source could after and including this in the page.

I noticed on the walkthrough for monitoring additional files it is copying some function for 4.0 and for 4.2 just adding the directory to the array in z_us_root.php
I have 4.2 and tried this but didn't seem to work Sad

Any ideas?
Thanks!


Using UserSpice Without the UI - mudmin - 03-19-2017

That init require doesn't quite look right.

Let's say your project is in mydomain.com and your init file is in mydomain.com/users/init.php your require would look like
<?php require_once('users/init.php'); ?>
If your page is located in the root (mydomain.com) folder. You also have to make sure you have ' quotes and not ’ quotes.


Using UserSpice Without the UI - laplaplap - 03-20-2017

Ah thank you!!
I'm a bit of a beginner btw, thanks for the quick reply!