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
create a log
#1
So I could use some help, I want to make a page in my program that every 2 hours durning the day, starting at the time they say they woke up (which can be adjustable), has them select there location from a list of pre determined locations then save that to a log, with a time stamp. Would that be possible? 

Thanks
   Myles
  Reply
#2
This is probably something that Dan could help you with. @mudmin
  Reply
#3
Hi @mcharlesworth
Sorry for the slow response. This one took a bit of coding. I basically just made you an example that you can modify as needed.

This is patch.php - it goes in your root and gets run once. It adds the needed column to your users table and adds a sample log table.
https://pastebin.com/TUByXJRC

The contents of this file go in usersc/includes/head_tags.php
https://pastebin.com/BDbKwFs8

Note that this is what deals with seeing if it's been too long and they need to reup their location. I have it currently set to 2 mins, but you can change it as needed.
You can also do all sort of checks in there, like if you don't want admins to do it, you can do something like
if (!hasPerm([2],$user->data()->id)){ //around the whole thing

Finally is location.php, which is where they get redirected to update their info. You'll obviously have to personalize that however you want it, I just got the form working so you can see what needs to happen.

This is location.php
https://pastebin.com/EMgPveeE

Hope that helps.
  Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)