Redirecting page without being authorized(bug)?

hello i’m experiencing issues as i’m using mysql database from infinityfree where i have log in system. it checks if username and password are correct since its connected to my mysql database and then it proceeds to the next page. lets say one user’s name is John and John is the url(john.php), so if i enter url in incognito in url search bar http://my_website_name/john.php, it’ll still open the website without being secured by username and password, since John hasn’t logged in in incognito mode. I tried everything to fix it and to make it work but it just doesn’t work, i’m still not sure why not. I need some serious help from someone who knows how to solve this issue.

Thanks, Timmy

Welcome

I am not quite sure what you are trying to say. Can you please share the exact URL?

Hello. I managed to fix this issue. Before I created a login system where i had to put correct username and password, then it proceeded me onto next page. But I didn’t figure out what was missing. Basically it was missing this under neath the body in html

<?php if (isset($_SESSION['logged_in'])) { ?>

and above the end of body:

<?php } ?>

so just because of this, it wasn’t working. I took around 5 hours to figure this out :sob::sob::trophy:

1 Like

That works, but personally I would do something like this at the top of the file:

<?php if (!isset($_SESSION['logged_in'])) { 
echo 'You are not logged in!';
exit;
}
?>
4 Likes

Oh thanks. I have one question. Recently I made changes to one of my subpages and if i go into incognito mode, the changes can be seen but if I open it on my phone or in my browser on PC, the changes aren’t there. What do I do to see changes even on devices that have accessed that website already?

https://tinkertechlab.com/webhosting/security/how-to-clear-your-browsers-cache

2 Likes

what if i made changes to the website where I’d have visitors(like 3000 visitors) so that means all 3000 visitors have to clear their cache on their browser just to see my new changes to my page? i need a better alternative

Only if they wanted to see the changes immediately, and they have visited your site before.

After a period of time, the cache will expire, and your visitors will see the updated version of the site.

1 Like

when does cache expire? I’m not good at this so I’d need some serious help.

Our servers add caching headers to all static file responses telling the browser to cache it for 30 days. This means the cached data should remain cached for at most 30 days, it can be less if browser cache is cleared for some other reason (reducing storage space, browser updates, etc.).

Note that this only applies to static files, we don’t set caching headers on PHP responses.

You can override our cache settings with .htaccess rules. But please think carefully before you do this, because disabling caching results in a slower website and more hits usage (meaning your website will be able to handle less traffic).

4 Likes

Thanks for your reply:) I managed to transform my .html page into .php so it changes instantly:)

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.