This forum is archived. Posts are preserved for historical reference. For current help, join us on Discord.

Confirm Admin Password

In Modifications and Hackery · Started by Brandin on 2017-01-15 9:18 pm · 134918 views · 57 replies

Okay and how can I use the function to pull this data? The function will use the UserSpice formula to get the page name, but how do I use this data e.g. $pagename = blah blah and check the pagename in the db and output this value to the function so I can continue? This is where I'm stuck at.
Ok. So this function assumes a column int(1) in the pages table called re_auth

http://pastebin.com/jWZQZe9x

to call it, it will be something along the lines of
<?php if (!reAuth($_SERVER['PHP_SELF'])){die();} ?>

or maybe just
reAuth($_SERVER['PHP_SELF']);

I got this working with a bit of changes, only issues is I am getting this error in my nav:
Notice: Undefined property: stdClass::$private in /home/aircentralized/public_html/boss/usersc/includes/custom_functions.php on line 43

This appears to be because of the
'private' => $results->private
in the $pageDetails section

Function:
https://hastebin.com/boqixiwono.php

Called by:
<?php if (!reAuth($_SERVER['PHP_SELF'],$user->data()->id)) ?>
Try changing that to
$pageDetails = array( 'id' =>$results->id, 'page' => $results->page, 're_auth' => $results->re_auth);
This has replicated it. Thank you so much!

https://hastebin.com/nuhenotolu.php
Awesome! Glad it worked.
I'm trying to dupe the "Private or Public" section for re_auth, but it is not built in to fetchPageDetails, obviously, how can I go about doing this and replicating this error?

Notice: Undefined property: stdClass::$re_auth in /home/aircentralized/public_html/boss/usersc/admin_page.php on line 185

---

I replicated this by making a new function:
https://hastebin.com/inuvequpix.php
Can you send me a hastebin of the full file that has the error on line 185?
I was able to fix this using the new haste I posted, I had edited it afterwards, sorry!
In case anyone wants to deploy this or @Mudmin wants to include it in alpha:
adminverify.php
https://pastebin.com/LvTPwTwA
admin_page.php
add after private page setting:
https://pastebin.com/hfgjWYRz
And the HTML (I put under Private):
https://pastebin.com/uDJvwi0i

Custom Functions:
https://pastebin.com/QSkHNsc4

DB alters:
Add colum re_auth to pages table int 1 default 0

I think thats all! If you run into any issues let me know!

@brandin...
Maybe you can take a look at the latest build where I started the reauth thing. The force reauth checkbox isn't updating and even if I put reauth in the db, it's not asking for a pw. Maybe I'm missing something. My brain is a bit fried.
I will whenever I get my server working......I did a mariaDB upgrade on it and it fried a bunch of stuff....including creating users! And I'm too lazy to setup localhost lol

Did you dump this reAuth script in or your own?
Maybe if I told you to call the reAuth in the nav we both would be fine.....lol

I'm clearly tired too!
<?php if (!reAuth($_SERVER['PHP_SELF'],$user->data()->id)) ?>

You can move this up into the header if you want but I put it in my nav.
I'm probably going to forget 80 more things!!!!!

I forgot to get you to add the last_confirm to the users table as well!!!

last_confirm datetime default NULL

Here is my paste of my users table too in case you need anything else from it:
http://pasted.co/fab5992b
I got it to call but looks like the functions weren't put in:
Fatal error: Call to undefined function reAuth() in /home/aircentralized/public_html/us4alpha/users/includes/header.php on line 169
The whole lazy thing sounds backwards to me. It takes more time for me to do things on my live server.
Yeah. You gave me a bunch of functions and I hadn't gotten a chance to look through them all, so I was adding them as they threw errors. Great work by the way...this reauth function is something I particularly needed.
I'm setup to quickly do stuff with my live server and would prefer to do it that way so I can work from home and work on the alpha project. I just make a dev account on my cP server so it's not really much more work then it would be to do a localhost and what not.

And okay I just wasn't sure if they were put in or were just not being called right or something.

You should only need the reAuth and verifyadmin functions for this project.
‹ Prev123