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
Securing my own page
#1
Ok,
I just installed userspice and followed the userspice don't care video in order to secure and existing page. The problem is the headers and requires in the video do not match version 4.2. What do I need to put in my pages header and footer to secure the page?
  Reply
#2
Sorry. I need to update that video.

Basically all you need is a require once/include to the init file and that securepage function.

So if you open up any existing userspice page you'll see
Code:
<?php require_once 'init.php'; ?>
and
Code:
<?php if (!securePage($_SERVER['PHP_SELF'])){die();} ?>

The second line you paste right after your menus etc.

The first line goes at the top and needs to point to yourdomain/users/init.php
So, if you are adding a page in the root it's
Code:
users/init.php
if you are in mydomain/myfolder and userspice is in mydomain/users it's
Code:
../users/init.php

Basically you just need that path to be correct. It's always going to be static, so once you figure it out, it shouldn't be too bad. From there, you can decide if you want to include our header. I would suggest doing it because you will have access to a lot of userspice stuff in there.

If you need to put your own stuff in the header and don't want our updates to break it, then create a file called
Code:
usersc/includes/head_tags.php
and put your contact in there.

If you don't want to use our header at all, then you probably want to instnatiate the DB manually and grab the settings table.
Code:
$db = DB::getInstance();
Code:
$settingsQ = $db->query("Select * FROM settings");
Code:
$settings = $settingsQ->first();

You'll also want to include and css/js you need.
  Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)