01-20-2017, 03:28 PM
Getting the function to call, and subtracting timestamps.
The following warnings occurred: | ||||||||||||
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.2.25 (Linux)
|
Confirm Admin Password
|
01-20-2017, 03:28 PM
Getting the function to call, and subtracting timestamps.
01-20-2017, 03:39 PM
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.
01-20-2017, 03:48 PM
So where is it going wrong. Is it sending the datetime properly to the db?
01-20-2017, 03:53 PM
Nope, the
Code: adminverify.php -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 Code: $last_verified
01-20-2017, 03:56 PM
the problem is formula for the time comparison.
01-20-2017, 04:30 PM
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:i, 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.
01-20-2017, 04:39 PM
Mundmin, only concern is the h in your timestamp, should be H for 24-hour format, thoughts?
01-20-2017, 04:57 PM
Yeah. That's fine. Just change to an H. It won't matter at all.
01-20-2017, 04:58 PM
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.
01-20-2017, 05:12 PM
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?
|