Jump to the post that solved this thread.
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Solved: 3 Years, 8 Months ago Custom Page Redirect
#1
Solved: 3 Years, 8 Months ago
I have a problem with a custom page that is on my forum.  If they login on the custom page, the redirect page comes up and says that it will "take you back to where you came from".  However, the redirect does not go back to the custom page but rather to the index.php page.  Is there anyway to fix this problem?

market.php
define('IN_MYBB', 1);
require_once './global.php';

$plugins->run_hooks('index_start');

add_breadcrumb("Market", "market.php");

eval("\$market = \"".$templates->get("market")."\";");
output_page($market);
?>

market html template:
<html>
<head>
<title>{$mybb->settings[bbname]}</title>
{$headerinclude}
</head>
<body>
<style>
    body {
    background-color: #FFF;
    background-image: none;
    background-repeat: repeat;
    background-size: 60px 60px;
    background-attachment: fixed;
    color: #666;
    font-family: 'open_sansregular',Tahoma,Arial,Sans-Serif;
    font-size: 13px;
    text-align: left;
    line-height: 1.4;
    margin: 0 auto;
    overflow-y: hidden;
}
</style>
{$miunashout}
If you do not see the chat, ensure that you have logged in.  Chat is not available for guests.
<div class="rblock">{$welcomeblock}</div>
<div class="lblock">
</div>
</body>
</html>



Page in question: forums.seekingprodigy.com/market.php
X-post: http://stackoverflow.com/questions/37930...4_37930409
Reply
#2
Solved: 3 Years, 8 Months ago
Okay I would really love to see if someone could help me out on this.  My page is giving an HTTP Referer to member.php I believe when the login is initiated and successful, but yet is still redirecting back to the index.php!  I don't understand why myBB is not redirecting back to the HTTP Referer as it says it will.

Member.php
                // Successful login
		if($loginhandler->login_data['coppauser'])
		{
			error($lang->error_awaitingcoppa);
		}

		$loginhandler->complete_login();

		$plugins->run_hooks("member_do_login_end");

		$mybb->input['url'] = $mybb->get_input('url');

		if(!empty($mybb->input['url']) && my_strpos(basename($mybb->input['url']), 'member.php') === false && !preg_match('#^javascript:#i', $mybb->input['url']))
		{
			if((my_strpos(basename($mybb->input['url']), 'newthread.php') !== false || my_strpos(basename($mybb->input['url']), 'newreply.php') !== false) && my_strpos($mybb->input['url'], '&processed=1') !== false)
			{
				$mybb->input['url'] = str_replace('&processed=1', '', $mybb->input['url']);
			}

			$mybb->input['url'] = str_replace('&amp;', '&', $mybb->input['url']);

			// Redirect to the URL if it is not member.php
			redirect(htmlentities($mybb->input['url']), $lang->redirect_loggedin);
		}
         	else
		{

			redirect("index.php", $lang->redirect_loggedin);
		}
	}


Is there something with the code snippet below that is not passing the http referer to member.php and initiating it in the redirect?
$mybb->input['url'] = $mybb->get_input('url');



After the page redirect it looks like it just skips the redirect to the line:
redirect("index.php", $lang->redirect_loggedin);


All help is appreciated.  I have been stumped on this for some time now.
Reply
#3
Solved: 3 Years, 8 Months ago
Please provide url, installed plugins and .htaccess
Reply
#4
Solved: 3 Years, 8 Months ago
Well my apologies I feel pretty dumb for not doing this in the first place but it was a theme issue.  Of course!  My theme's popup login box (header_welcome_guest) was missing some code that was in the default (header_welcome_guest).  Adding in this script to my themes (header_welcome_guest) seemed to fix the problem and pass along the Http Referer.

<script type="text/javascript">
$("#test-popup input[name='url']").val($(location).attr('href'));
</script>
Reply
Jump to the post that solved this thread.


Forum Jump:


Users browsing this thread: 1 Guest(s)