The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/global.php(961) : eval()'d code 26 errorHandler->error
/global.php 961 eval
/printthread.php 16 require_once



UserSpice
double slash on login page redirect - Printable Version

+- UserSpice (https://userspice.com/forums)
+-- Forum: Support Center (https://userspice.com/forums/forumdisplay.php?fid=23)
+--- Forum: UserSpice 4.3 and Below (https://userspice.com/forums/forumdisplay.php?fid=26)
+--- Thread: double slash on login page redirect (/showthread.php?tid=331)



double slash on login page redirect - dimitrisscript - 11-02-2016

Sorry if this isn't the right place to post but when I click on the bugs forum I'm getting an error 500 from your page.

So I created an override to login.php in the usersc folder, and its contents are:

require_once '../users/init.php';
Redirect::to('../dashboard/login.php');

And it indeed works, and redirects normally and the login form works well, except that I'm getting a double slash on the url:
http://example.com//dashboard/login.php

And when I login I get a triple slash:
http://example.com///users/account.php

Anyway we can fix this?



double slash on login page redirect - dimitrisscript - 11-02-2016

Forgot to mention I'm using version 4.1.7b


double slash on login page redirect - dimitrisscript - 11-02-2016

I just realized I wasn't using the latest version (the exact version number isn't mentioned on the homepage) and I updated.
I'm using now Version 4.1.8b

However, now I'm getting three slashes when I get redirected to /dashboard/login.php

http://example.com///dashboard/login.php

and two slashes when I login:

http://example.com//users/account.php


double slash on login page redirect - dan - 11-02-2016

Let me take a look at that. There were several changes to redirect and login functions lately. I will try to get out a fix this week.

Btw, when you upgraded to 4.1.8b did you do the full upgrade (including the usersc folder)... That is where the first fix was for this problem.


double slash on login page redirect - dimitrisscript - 11-02-2016

When I did the upgrade, I downloaded this:

https://userspice.org/patch/417bto418b.zip

and I extracted & overwritten everything in my server folders.


double slash on login page redirect - Brandin - 11-02-2016

My update went fine. Could it be the / you have in your login script prior to the remainder of the URL? Try removing that and see what that does for ya.


double slash on login page redirect - venedude - 11-03-2016

I was having the same problem with double slashes (//) and then a comment introduced in 4.1.8b helped me fix it. In you usersc\scripts\custom_login_script.php file it mentions that the Redirect path is relative from userc/scripts thus they added ../../ before the actual redirect to destination. I was using Redirect::to($us_url_root.'folder/home.php'); so I changed that to Redirect::to('../../'.'folder/home.php'); and now double slashes are gone.


double slash on login page redirect - dimitrisscript - 11-03-2016

Ok here's how I fixed it. In my usersc/login.php override,

Instead of:
require_once ‘../users/init.php’;
Redirect::to(‘../dashboard/login.php’);

I put:
require_once '../users/init.php';
$root = (!empty($_SERVER['HTTPS']) ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . '/';
Redirect::to($root.'dashboard/login.php');


Props to @venedude for helping me understand what's going on.


double slash on login page redirect - mudmin - 11-03-2016

Yep...great work. The original problem was that people were updating our core code to change where people login and then would lose those changes when they updated. This is a fix for that, but it reacts slightly differently on different servers, so we need to keep working out some kinks.