PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
ol4pr0
Forum Regular
Posts: 926 Joined: Thu Jan 08, 2004 11:22 am
Location: ecuador
Post
by ol4pr0 » Mon Apr 05, 2004 10:44 am
Some time ago i seen something like the following
Code: Select all
if ('on' = 'HTTPS') {
do something
}
else
{
do something else
}
however i tried this but it will always do the } else { part
Anybody knows how to do this.
it need to check if the connection used is true the SSL - https
if not do something else
lostboy
Forum Contributor
Posts: 329 Joined: Mon Dec 30, 2002 8:12 pm
Location: toronto,canada
Post
by lostboy » Mon Apr 05, 2004 11:01 am
I would suspect that 'on' is the result of some kind of URL grabbing function that splits the incoming URL to see if it equals 'HTTPS'
vigge89
Forum Regular
Posts: 875 Joined: Wed Jul 30, 2003 3:29 am
Location: Sweden
Post
by vigge89 » Mon Apr 05, 2004 11:02 am
the got you got now tries to set 'on' to 'https', which can't be done i reckon
JayBird
Admin
Posts: 4524 Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:
Post
by JayBird » Mon Apr 05, 2004 11:09 am
does this help?
Code: Select all
<?
$url_components = parse_url($_SERVER["SCRIPT_URI"]);
if ($url_components['scheme'] == "https") {
// do something
} else {
// do something else
}
?>
Mark
JayBird
Admin
Posts: 4524 Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:
Post
by JayBird » Mon Apr 05, 2004 11:16 am
maybe the information stored in $_SERVER['SERVER_PROTOCOL'] may also be useful.
Mark
ol4pr0
Forum Regular
Posts: 926 Joined: Thu Jan 08, 2004 11:22 am
Location: ecuador
Post
by ol4pr0 » Mon Apr 05, 2004 11:54 am
Found something else that might do the trick however i am gonna try both.. and see what it will get me
Thanks
Code: Select all
<?
$port = $_SERVER['REMOTE_PORT'];
IF ($port == 443) {
do something
}
else
{
do something else
}
?>
ol4pr0
Forum Regular
Posts: 926 Joined: Thu Jan 08, 2004 11:22 am
Location: ecuador
Post
by ol4pr0 » Tue Apr 06, 2004 4:13 pm
tried both cases.. the $port and the scheme
However both of them return the else statement as it did with ' on' == ' https'
Any other suggestions ?!
markl999
DevNet Resident
Posts: 1972 Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)
Post
by markl999 » Tue Apr 06, 2004 4:20 pm
Tried this ?
Code: Select all
if($_SERVER['SERVER_PORT'] == 443){
//ssl
} else {
//not ssl
}
ol4pr0
Forum Regular
Posts: 926 Joined: Thu Jan 08, 2004 11:22 am
Location: ecuador
Post
by ol4pr0 » Tue Apr 06, 2004 4:23 pm
Anything with that line simply wont work or in any form of that because port changes constantly
markl999
DevNet Resident
Posts: 1972 Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)
Post
by markl999 » Tue Apr 06, 2004 4:26 pm
SERVER_PORT not REMOTE_PORT
ol4pr0
Forum Regular
Posts: 926 Joined: Thu Jan 08, 2004 11:22 am
Location: ecuador
Post
by ol4pr0 » Tue Apr 06, 2004 4:27 pm
I could almost kiss ya Bleeep....
Thanks that logic didnt come up my mind....