I have a simple methodology to my page. Log in the user and if the credentails matched, the user is given a session variable “id” which is linked to the database to get info about the user. The thing was running fine on my “localhost” but it isn’t running here. I run:
<?php
if(isset($_SESSION["user"])){
echo "the session variable is here!";
//redirect to another page --probably dashboard or something like that--
}
But when I run the page and I visit to the "Secure"
button and see in the cookies section, the session is there but the string isn't print. I tried changing it to:
?>
<script>
alert("The session variable exists");
</script>
<?php
But nothing gets alerted!
I tried accessing the .htaccess
file and adding one line that says: php_flag session.auto_start on
but it doesn't work. So, what should I do?
NOTE: It is to mention that I have session_start()
and I haven't made those beginner mistakes.