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 - Printable Version +- UserSpice (https://userspice.com/forums) +-- Forum: Miscellaneous (https://userspice.com/forums/forumdisplay.php?fid=28) +--- Forum: Modifications and Hackery (https://userspice.com/forums/forumdisplay.php?fid=29) +--- Thread: Confirm Admin Password (/showthread.php?tid=427) |
Confirm Admin Password - Brandin - 01-20-2017 Getting the function to call, and subtracting timestamps. Confirm Admin Password - sabr - 01-20-2017 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. Confirm Admin Password - mudmin - 01-20-2017 So where is it going wrong. Is it sending the datetime properly to the db? Confirm Admin Password - Brandin - 01-20-2017 Nope, the Code: adminverify.php -Calling the function, see reply (https://userspice.com/forums/topic/confirm-admin-password/#post-3487) and function is in reply (https://userspice.com/forums/topic/confirm-admin-password/#post-3500). -Subtracting the Code: $current Code: $last_verified Confirm Admin Password - sabr - 01-20-2017 the problem is formula for the time comparison. Confirm Admin Password - mudmin - 01-20-2017 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. Confirm Admin Password - Brandin - 01-20-2017 Mundmin, only concern is the h in your timestamp, should be H for 24-hour format, thoughts? Confirm Admin Password - mudmin - 01-20-2017 Yeah. That's fine. Just change to an H. It won't matter at all. Confirm Admin Password - mudmin - 01-20-2017 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. Confirm Admin Password - Brandin - 01-20-2017 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? |