Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Unexpected error redirecting...
Old 08-18-2008, 01:56 PM Unexpected error redirecting...
Webmaster Talker

Posts: 626
Trades: 0
I'm writing a mambot for Joomla and I want it to execute when entering the {mos} tag with the parameter on or off in there.

Here is the code:
Code:
$action = $matches[1];
	$port = $_SERVER['HTTPS'];
 	$url = $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
		
	if(empty($port) && $action == 'on')
	   header("location:https://$url");
	else if(!empty($port) && $action == 'off')
	   header("location:http://$url)"); 
	else
	   return true;
this is just the function that is actually performing the action. At this point I have already successfully retrieved the action from the mostag.

If you have the OFF parameter set and the page is accessed with HTTP, nothing happens (the page loads normally).

If you have the OFF parameter set and the page is accessed with HTTPS, it redirects to the same page but with only HTTP.

If you have the ON parameter set and the page is accessed with HTTPS, nothing happens (the page loads normally).

If you have the ON parameter set and the page is accessed with HTTP, it attempts to redirect but then Firefox says "This page is redirecting in a way that will never stop".

I cannot figure out why it is working when it is set to OFF but not when it is set to ON. The purpose of this script is so the administrator can force the use of SSL or not.

Can anyone here tell me what I've done wrong?
jim.thornton is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 08-18-2008, 01:57 PM Re: Unexpected error redirecting...
Webmaster Talker

Posts: 626
Trades: 0
I forgot to mention when the parameter is set to ON and the page is accessed using HTTPS, the script echos a "1" to the page for some reason.

I can't figure that out either.
jim.thornton is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Unexpected error redirecting...
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.09754 seconds with 12 queries