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
/showthread.php 28 require_once





× This forum is read only. As of July 23, 2019, the UserSpice forums have been closed. To receive support, please join our Discord by clicking here. Thank you!

  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Using UserSpice Without the UI
#1
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.
  Reply
#2
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.
  Reply
#3
Ah. It was the securePage thing I was missing. I'll give it a try with that in place. Thanks for the quick reply!
  Reply
#4
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).

  Reply
#5
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!
  Reply
#6
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.
  Reply
#7
Ah thank you!!
I'm a bit of a beginner btw, thanks for the quick reply!
  Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)