Help with redirect to login page

The php web video script that I’m using displays an Upload button on the home page. When a User is logged in, and that button is selected the User is redirected to the Upload page. And it appears that when a web visitor is not logged-in and selects the Upload button, the next thing that appears is 404 page not found.

How would I change the not logged in . select Upload button to redirect to the log-in page, instead of 404 page? After looking around the script I see this in the header html file:

<?php if ($pt->config->upload_system == 'on') { ?>
 <li class="hide-from-mobile">
<a href="{{LINK upload-video}}" class="btn upload-button" data-load="?link1=upload-video">
<!--<svg xmlns="" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-upload"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path><polyline points="17 8 12 3 7 8"></polyline><line x1="12" y1="3" x2="12" y2="15"></line></svg>-->
<!--<span class="hide-in-mobile">{{LANG upload}}</span>-->
<?php } ?>

And this in the upload php file:

if (IS_LOGGED == false || $pt->config->upload_system != 'on') {
	header("Location: " . PT_Link('login'));

I’d try to modify one of these or both, with some guidance on what you might suggest
I look forward to any assistance.

Well first you have to determine if the button, when the user is not logged in, contains a link to a page that doesn’t exist OR you are being directed to a page that does exist but is then directing you to a page that doesn’t exist through the upload.php code you show there. Depending on which situation it is will tell you where to make a change.

If it is the first instance, then you need to find out how to change the link behind the upload button. While you are not logged in, hover over the button and see which URL it takes you to. Does it look like a valid page?

If it is the second situation, then the link in the header() call, the PT_Link(‘login’) code, is pointing to the wrong page. If it were me, I would try changing the upload.php file first and have PT_Link point to the a the login page itself (hardcode it in). If you still get the 404, then you know it is the link behind the button that is faulty.

I hope you see what I am getting at. :slight_smile:

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