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
Warning [2] Undefined property: MyLanguage::$archive_pages - Line: 2 - File: printthread.php(287) : eval()'d code PHP 8.2.25 (Linux)
File Line Function
/printthread.php(287) : eval()'d code 2 errorHandler->error
/printthread.php 287 eval
/printthread.php 117 printthread_multipage



UserSpice
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)

Pages: 1 2 3 4 5 6


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
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/confirm-admin-password/#post-3487) and function is in reply (https://userspice.com/forums/topic/confirm-admin-password/#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.


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: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.


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?