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
Undefined Variables on Page - Printable Version

+- UserSpice (https://userspice.com/forums)
+-- Forum: Miscellaneous (https://userspice.com/forums/forumdisplay.php?fid=28)
+--- Forum: Off-topic Discussions (https://userspice.com/forums/forumdisplay.php?fid=10)
+--- Thread: Undefined Variables on Page (/showthread.php?tid=414)



Undefined Variables on Page - Brandin - 01-02-2017

Hello!

I have 6 pages that have public access in my system:
Code:
usersc/includes/external/phoneadd.php
Code:
usersc/includes/external/phoneedit.php
Code:
usersc/includes/external/templateadd.php
Code:
usersc/includes/external/templateedit.php
Code:
usersc/includes/external/zipadd.php
Code:
usersc/includes/external/zipedit.php

These pages are accessed via
Code:
usersc/externalpublic.php
using
Code:
?type
in the URL and defined accordingly. However, when a "guest" (non-logged in user) visits the pages, the page works just fine, but in the header we have these errors:
Notice: Trying to get property of non-object in /home/aircentralized/public_html/boss/usersc/externalpublic.php on line 27

Notice: Undefined variable: column in /home/aircentralized/public_html/boss/users/helpers/us_helpers.php on line 111

Notice: Undefined variable: data in /home/aircentralized/public_html/boss/users/helpers/us_helpers.php on line 111

I have removed the navigation from the files as I do not want the public having access to the navigation. These pages are linked separately from my system.

Any thoughts on how to cure these errors? Let me know if you need some code and what.


Undefined Variables on Page - Brandin - 01-02-2017

Note: When a logged in user visits these pages, the errors disappear.


Undefined Variables on Page - mudmin - 01-02-2017

It sounds like you are running queries on those pages that require a logged in user. They are probably looking for the user id.

Wrap those queries in

Code:
if ($user->isLoggedIn()) {
Code:
//queries go here
Code:
}



Undefined Variables on Page - Brandin - 01-03-2017

You're smart...like really smart! LOL. I just removed the get user info from my externalpublic.php page. Thanks!


Undefined Variables on Page - mudmin - 01-03-2017

haha. Awesome. Glad it worked!