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
/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
Confirm Admin Password
#21
Getting the function to call, and subtracting timestamps.
  Reply
#22
My current theory is to generate current datetime, fetch the "last confirm" time from db, run a diff between the two dates and if the result is less than 30mins then return true.
  Reply
#23
So where is it going wrong. Is it sending the datetime properly to the db?
  Reply
#24
Nope, the
Code:
adminverify.php
page works fine, doing checking of password and submitting of password. However, I am struggling with the following:
-Calling the function, see reply (https://userspice.com/forums/topic/confi...#post-3487) and function is in reply (https://userspice.com/forums/topic/confi...#post-3500).
-Subtracting the
Code:
$current
timestamp and the
Code:
$last_verified
timestamp. Even without in the function, I have tried doing it separately using the command you have given and other stuff I researched online, and no luck. Perhaps we should worry about getting the function to call first though.
  Reply
#25
the problem is formula for the time comparison.
  Reply
#26
Ok. I tested this and it works.

So, I have a column in my user table called last_confirm and it is formatted Y-m-d h:iConfused, so it looks like this
2016-01-20 00:00:00

Then I wrote this function and put it in the usersc/includes/custom_functions.php

https://hastebin.com/kitifexufe.xml

Then, to invoke it, you need to pass the user id in there, so on whatever page you want to call it, do this...

<?php verifyadmin($user->data()->id) ?>

Give that a whirl.
  Reply
#27
Mundmin, only concern is the h in your timestamp, should be H for 24-hour format, thoughts?
  Reply
#28
Yeah. That's fine. Just change to an H. It won't matter at all.
  Reply
#29
Just change it in all 3 places and you'll be good to go. The things you were missing were mainly the strtotime and the fact that you had to pass in the user's id manually because in the context of the function it doesn't know that.
  Reply
#30
You're an amazing human being mudmin! Now, can you help me tackle the referring URL? When I redirect to the page, I need to know what to redirect them back to if the login succeeds? Thoughts?
  Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)