Re: check if logged in php issue
Posted: Tue Dec 08, 2015 6:51 am
Variables are not evaluated inside single quotes. You'll need to use double quotes or append the variable to the string.
A community of PHP developers offering assistance, advice, discussion, and friendship.
http://forums.devnetwork.net/
Try this:Code: Select all
header('Location:affiliate-profile.php?id=$id');
Code: Select all
header("Location: affiliate-profile.php?id={$id}");No. Use bcrypt. Use bcrypt.ianhaney wrote:Ok, yeah have heard usin md5 is not good to use and to salt the password by using sha56, is that right?
As I mentioned in an earlier post, you're not defining $id. You can take different approaches here and while perhaps not the most elegant, the simplest is simply to pull the ID from the database after you've checked that a username is stored in session data and pass that into your header redirect.ianhaney wrote:It has logged me in now but just need to work the issue out of checking if already logged in and if so to redirect from the login page to the profile page, it is doing it but the url looks like the following
http://it-doneright.co.uk/affiliate-profile.php?id=
and on the page it says No results to display
the url should look like http://it-doneright.co.uk/affiliate-profile.php?id=14
would the coding in the login page need changing or the profile page coding?
Code: Select all
[9:54][local][~]
% php -a
Interactive shell
php > $password = 'top_secret_special_sauce';
php > $hashed = password_hash($password, PASSWORD_DEFAULT);
php > print $hashed;
$2y$10$qDJNhRodgQs9F16IyJGueuAi3NUziToFMFYj4gkOaq0B4cvpYsHSm
php >