PDA

View Full Version : Secure or not Secure thats my question


Mickie D
02-25-2004, 10:20 PM
is it possible to have a forum both HTTPS and HTTP

i know you can have it but can you have it without the privacy reports when you switch from one to the other ?

i get alot of privacy reports when i am not using https and that shows up all the images as being https

cheers i would like to have the option of either if possible

Regards
Mickie

NTLDR
02-26-2004, 02:48 PM
Any item included via HTML on a HTTPS page that is on a HTTP URL will generate a warning if the user has selected for there browser to warn them.

Mickie D
02-26-2004, 08:18 PM
ok then i was thinking this

making 2 sections of the forums like this

forum

forums

and editing the php file that calls the settings db and the style db calls

so it hard calls maybe settings and settings1 and style and style1
(settings1 and style1 are copies of settings and style from the DB)

now they are complete copies of each other apart from the fact that one has https and the other has http URLS

basicly i dont like all the privacy reports stopping my https and vice versa

anyway thats what i am after doing and if i had the time i would probably do it myself but i dont know if its a problem with vbulletin to run to copies even though they are the same forum ? and also i dont know which files and i am sure it will be lots of them aswell

Andreas
02-26-2004, 08:37 PM
Hmm ...

What about replacing all hard-coded http:// in the PHP-Files & Templates with $protocol and then set $portocol at the beginning of global.php to either http:// or https:// depending on the value of getenv('SERVER_PORT')?
(And for the URLs in array vboptions too)
This way you would not have to duplicate anything but it should still have http or https only.

Mickie D
02-26-2004, 10:12 PM
see i knew there was an easier way lol i can code a small amount of php and in my spare time i teach myself :)

i have seen a hack b4 that used the same server_port code

so help me out with this then please m8

if getenv('SERVER_PORT' = 80)
{
$secure = http;
}
elseif getenv('SERVER_PORT' = 443)
{
$secure = https;
}


i done that off the top of me head will it be ok ?

Mickie D
02-27-2004, 02:53 PM
ok after more attempts i came up with this (with help from another source aswell)

but i cant get it to work anyone have any ideas why i am getting parse errors ?



// Mickies secure non secure hack
if getenv($_SERVER['SERVER_PORT'] = 80)
{
$secure = 'http';
}
elseif getenv($_SERVER['SERVER_PORT'] = 443)
{
$secure = 'https';
}

NTLDR
02-27-2004, 03:00 PM
if ($_SERVER['SERVER_PORT'] == 80) {
$secure = 'http';
} elseif ($_SERVER['SERVER_PORT'] == 443) {
$secure = 'https';
}


Should do the trick. However there are probably very few, if any references to http://..... in the source and templates so a better option IMO would be to just change the value of the boards URL:


if ($_SERVER['SERVER_PORT'] == 443) {
$vboptions['bburl'] = 'https://mydomain.com/forums';
}

Of course you'll still get errors for inline images in [IMG] code if there are on HTTP but thats unavoidable unless you disable it.

Mickie D
02-27-2004, 05:06 PM
cheers m8 i will give that a try.

and try and get it working with the styles lol

thanks again

Mickie D
02-27-2004, 05:18 PM
i was just thinking does the style take the vboptions if there is no hard coded http in the style settings ??

i.e it normally would look like

/images/misc/

if you get my drift ?

NTLDR
02-27-2004, 06:32 PM
If its not a full URL, ie its /images/misc and not http://mydomain.com/images/misc then it will automaticlly use HTTPS.

Mickie D
02-28-2004, 07:40 AM
if ($_SERVER['SERVER_PORT'] == 80) {
$vboptions['bburl'] = 'http://mydomain.com/forums';
}


i have my doman setup for https so vboptions is https://mydomain.com

so i changed the above code around

this is not working :(, it does not change the url as it still calls https and changes over to https when i just visit from http

i hope that makes sense ?

thanks again for your help

Regards
Mickie

NTLDR
02-28-2004, 06:35 PM
Where have you added this code?

Mickie D
02-28-2004, 11:29 PM
forums/global.php

i hope thats the right one lol

Andreas
02-29-2004, 01:14 AM
Should be the right place - if you put it somewhere after


require_once('./includes/init.php');


Otherweise init.php will unset $vboptions and then populate it with the values from the database.

Mickie D
02-29-2004, 10:12 PM
ahhh i c i put it at the bloody top of the file thanks very much for your insight i will give it a try now :)

hopefully this is useful for others aswell as me :)

Mickie D
02-29-2004, 11:19 PM
Brilliant this is almost complete :)

all i gotta do is sort out the navbar as that must be calling stuff not using the vboptions i think

thanks again its gr8 now you can switch between https or http with no privacy reports and just a padlock or no padlock

now i gotta work out how to port this into photopost and thats the whole site covered ;)

Regards
Mickie

Mickie D
02-29-2004, 11:42 PM
Right the NavBar is being a right pain in the backside :(

i have gone through it and found all the hrefs are pointing to $vboptions[bburl]/etc/etc

and i am getting the MS popup to display non secure items :(

i checked all the src= and they are pointing to the $style whatever ?

and the links on the navbar when i am in https still show http ? but everywhere else on the site is fine ? .. can secure sites not use java ?

thanks for all the help people

Regards
Mickie

Andreas
02-29-2004, 11:56 PM
@MickieD
Can you post the URL of your board? So I could check which elements (Images, etc.) cause problems.

Mickie D
03-01-2004, 09:52 PM
cee we are moving server and its on my spare box (linux) at home waiting to be transfered but i know the only problem is the navbar

but i have looked at the navbar and they all seem to have vbulletinoptions for the links

but i did check the other navbar template and it has a $nav_url insert and i cannot find any reference to this anywhere ?

thanks again i cant move until i fix the ssl and i am not making much progress, but thanks for your help its much appreicated :)

Regards
Mickie

Mickie D
03-02-2004, 09:55 PM
anyone got any ideas why my https wont work with the navbar ??

thanks in advance :)

Andreas
03-02-2004, 10:00 PM
$nav_url is being used in function construct_navbits () in file includes/functions.php

I think i'll make a test setup to find out if there are problems with the navbar.

Mickie D
03-02-2004, 10:07 PM
thanks very much kirbyDE thats really kind of you m8y

i want to install my forums by thursday so i am porting them tomoz and i will give you a link and you can see if you like on my setup but wont be until tomorrow

again thanks m8 i really need to try and get this sorted :)

Andreas
03-02-2004, 10:17 PM
Hmm ... I just setup SSL for my Testboard and it seems to work - even without putting the bburl-replacement-code into global.php

I don't get security warnings.

Did you make any changes to the default style?

Mickie D
03-03-2004, 07:49 AM
i have done quite a few bits to templates lol

let me add the default style as a new style and try it

if not then i give you link :)

Mickie D
03-03-2004, 07:57 AM
i took out the hack you helped me create

and the bloody thing works ?

im a little lost as to how but it works completely ?

no privacy no errors ?

i dont understand it ?, but im happy it works though lol

thanks again for all your help