I have a simple user files like this
joe.php
<?php
$pass = 'joepassword';
$userpath = 'work/joe';
?>
sam.php
<?php
$pass = 'sampassword';
$userpath = 'work/sam';
?>
I use these files for text authentication one is included once the user logs in setting the path for that user while checking the authentication. Once authenticated, I immediately overwite that $pass variable with"text" so the password is not available as a variable to prying eyes.
Now I need to log in as "joe"
so I include joe.php sessing $userpath
$userpath='work/joe'
I now need for admin purposes, to access sam's $userpath as a destination, and joe's $userpath as a source at the same time but if I include sam.php I will be overwithing joe's $userpath
I figure there is a simpler solution like using fopen and extracting only the (second) path for sam, but not sure how to go about this.
I am not posting this for a lecture in security so please abstain from responding about secirity. These files are not in a folder accessible to the web server anyway.
password_hash(). And then you can validate your user checking the available credentials in one place.passwword_hash()to store andpassword_verify()for login.