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



UserSpice
Best practice/ moving files to usersc - Printable Version

+- UserSpice (https://userspice.com/forums)
+-- Forum: Support Center (https://userspice.com/forums/forumdisplay.php?fid=23)
+--- Forum: UserSpice 4.3 and Below (https://userspice.com/forums/forumdisplay.php?fid=26)
+--- Thread: Best practice/ moving files to usersc (/showthread.php?tid=969)



Best practice/ moving files to usersc - rjs5327 - 02-23-2018

Some of the php files have: <?php require_once '../users/init.php'; ?>
Others have: <?php require_once 'init.php'; ?>


And from what i have read it should be :
require_once $abs_us_root.$us_url_root.'users/init.php';

Am i correct on that? Reason for question is i am playing with the admin_users.php and am trying to put a copy in the usersc folder. Then i get a HTTP 500 error. I added permissions for them and even tried public same issue. So i figure it has to be the includes. i see there is not a consistencey in how it is written so that is why i ask what is best practice?

Thanks,
RJ


Best practice/ moving files to usersc - dan - 02-23-2018

I'm actually in the process of writing the best practices for usersc right now. Feel free to create a bug report in userspice.com/bugs to remind me that not all pages work with usersc "out of the box" and I'll go back and fix that. (I'm out of town right now and on public wifi or I would do it myself).

In the mean time, here's what you need to know.

The only two lines of code a userspice public facing file needs to have are the require init.ph and the line about securePage. Other than that, it's all optional. You can completely write your own login.php file.

Ok, so re: init.php if you're in the usersc folder, then init.php is in users, so when you require in init, you need to do '../users/init.php'

This is basically back one folder to root and up one folder to users.

If the page fails to load it's almost always because we didn't follow our own rules and use the us_url_root thing when we were doing an include/require_once somewhere else on that same page. So if we didn't, then you just need to change those requires/includes to go to the right path. I can fix that all in the next update, but if you want it to work now, you'll just have to do the includes.

Regarding error 500. That most likely means that your server has error reporting turned off for PHP which is great when you're in production, but makes knowing what's wrong when you're developing a pain in the butt. I really think most people would be better served by using something like XAMPP to develop on their local machine or at least turning both error reporting to 1 and e_all (there is an example of how to do this in at the top of login.php


Best practice/ moving files to usersc - rjs5327 - 02-23-2018

Very fast response thanks