Help Desk Software & Beyond
May 21, 2012, 11:33:28 PM *
Welcome, Guest. Please login or register.
To post messages you need to register. We apologize for inconvenience, but this is to prevent spam.
Registration is instant (no email verification) and we do not ask for any personal information.

Login with username, password and session length
News: Welcome to Help Desk Software forum!
 
   Home   Help Search Login Register  
Pages: 1 2 [3]
  Print  
Author Topic: If HTTPS do this else do that  (Read 11342 times)
Sparky
Moderator
Hero Member
*****

Karma: 83
Posts: 2,228


stop pushing all those buttons


View Profile
« Reply #30 on: October 08, 2007, 05:45:10 PM »

SERVER_PORT is available, but HTTPS is not.

Then the original code should be working.

In TTX, condense it down to this...

Quote
$data->{THE_PORT} = $ENV{SERVER_PORT};

Make absolutely sure that your HTML macro is this...

Quote
(%THE_PORT%)

The red parts must match and it has to work because ALL the macros in TTX work like this.


Quote
I should see something like:

$port = "80"; in my source. Right?

Absolutely.  something like

portSSL = "80";

EDIT: made everything bigger to avoid bracket confusion.
« Last Edit: October 08, 2007, 05:50:00 PM by sparky672 » Logged

Did you update the paths in ttxcfg.cgi after moving TTX to your new location?   Undecided
To those seeking help.... please report back when you figure it out.  Cheesy
loneguard
Jr. Member
**

Karma: 0
Posts: 98


View Profile
« Reply #31 on: October 08, 2007, 06:15:52 PM »

This is my TTXticket.pm:

Quote
# ======================================================================= ticket

sub ticket {
  my ($cfg, $query, $data) = @_;
  checkgroups($cfg);
  TTXCommon::tickedvars($cfg, $data);

  $data->{THE_PORT} = $ENV{SERVER_PORT};

  if ($query->param('cancel') ne undef) {
    if ($query->param('sid') ne undef) {
      $query->param(-name => 'tid', -value=> '');
      $query->param(-name => 'do', -value=> '');
      return 'helpdesk';

This is my newticket.html snippet:

Quote
</script>
<script language="JavaScript"><!--
function preview(){
hwstring="scrollbars=yes,width=600,height=500,resizable=yes,toolbar=no,menubar=no";
var newwin = window.open('', 'winpreview', hwstring);
newwin.focus();
document.forms['preview'].msg.value = document.forms['newticket'].problem.value;
document.forms['preview'].submit();
return false;
}
portSSL = "(%THE_PORT%)";
//--></script>

And this is my 'View source' output from ttx.cgi:

Quote
<script language="JavaScript"><!--
function preview(){
hwstring="scrollbars=yes,width=600,height=500,resizable=yes,toolbar=no,menubar=no";
var newwin = window.open('', 'winpreview', hwstring);
newwin.focus();
document.forms['preview'].msg.value = document.forms['newticket'].problem.value;
document.forms['preview'].submit();
return false;
}
portSSL = "";
//--></script>

There's no chance of typos, because I'm not the one typing it. Strict copy and paste.
Logged
Sparky
Moderator
Hero Member
*****

Karma: 83
Posts: 2,228


stop pushing all those buttons


View Profile
« Reply #32 on: October 08, 2007, 06:23:13 PM »

I'm stumped because it looks perfectly fine.

I'm out of suggestions.

We still don't know if it's the macro or the server environment variable at fault.

Try this in TTXTicket in order to verify the functionality of the TTX macro...

Quote
$data->{THE_PORT} = "some text for testing";

comment out your original...

Quote
# $data->{THE_PORT} = $ENV{SERVER_PORT};
Logged

Did you update the paths in ttxcfg.cgi after moving TTX to your new location?   Undecided
To those seeking help.... please report back when you figure it out.  Cheesy
loneguard
Jr. Member
**

Karma: 0
Posts: 98


View Profile
« Reply #33 on: October 08, 2007, 06:29:48 PM »

nope. Here's the TTXticket.pm:

Quote
# $data->{THE_PORT} = $ENV{SERVER_PORT};
   $data->{THE_PORT} = "some text for testing";

And this is the output from ttx.cgi:

Quote
<script language="javascript"><!--
portSSL = "";
//--></script>

All reloaded and tested in IE and FF.
Logged
loneguard
Jr. Member
**

Karma: 0
Posts: 98


View Profile
« Reply #34 on: October 08, 2007, 06:30:58 PM »

Sparky, let's take a break. I'm a little spent  Smiley
Logged
Sparky
Moderator
Hero Member
*****

Karma: 83
Posts: 2,228


stop pushing all those buttons


View Profile
« Reply #35 on: October 08, 2007, 06:41:48 PM »

Sparky, let's take a break. I'm a little spent  Smiley

Take as much time as you like.

I'll have to make my replies as they come though.

So now we know there is definitely something wrong with the macro.  There are no typos posted here and the same exact macro code is working fine for me.

Sometimes I wish I could get more sleep....  *long sigh*  This is mostly my fault.

You're working on the newticket.html template and I'm working on the ticket.html template.  Doh! Doh! Doh!   Angry  Angry

(I've been working on something else in the ticket subroutine today.)   Grin



Just move your one line of code over to the "newticket" subroutine.

Quote
$data->{THE_PORT} = $ENV{SERVER_PORT};

Quote
sub newticket {
  my ($cfg, $query, $data) = @_;
 $data->{THE_PORT} = $ENV{SERVER_PORT};
« Last Edit: October 08, 2007, 06:44:54 PM by sparky672 » Logged

Did you update the paths in ttxcfg.cgi after moving TTX to your new location?   Undecided
To those seeking help.... please report back when you figure it out.  Cheesy
loneguard
Jr. Member
**

Karma: 0
Posts: 98


View Profile
« Reply #36 on: October 08, 2007, 06:49:24 PM »

whew!
Finally. Now, I'm going to take a nap!
Thank you.
Logged
Sparky
Moderator
Hero Member
*****

Karma: 83
Posts: 2,228


stop pushing all those buttons


View Profile
« Reply #37 on: October 08, 2007, 06:51:33 PM »

I was working today while we had a major brown-out.  Both legs dropped from 120 VAC to fluctuations between 45 and 65 VAC.   Shocked    Had to shut down the entire building and call Edison... working the phones while I made my replies on a laptop with only my DSL running on UPS battery back-up.

... excuses, excuses... oh well.   Undecided

You should be good now... on your way to crafting your IF/THEN javascript.   Wink
Logged

Did you update the paths in ttxcfg.cgi after moving TTX to your new location?   Undecided
To those seeking help.... please report back when you figure it out.  Cheesy
loneguard
Jr. Member
**

Karma: 0
Posts: 98


View Profile
« Reply #38 on: October 08, 2007, 06:53:09 PM »

You should take a minute to rest, you know. Smiley
Logged
Sparky
Moderator
Hero Member
*****

Karma: 83
Posts: 2,228


stop pushing all those buttons


View Profile
« Reply #39 on: October 09, 2007, 01:11:02 PM »

Quote from: loneguard
SERVER_PORT is available, but HTTPS is not.

Regarding the "HTTPS" environment variable:

$ENV{HTTPS}

This is described in CGI 101 as "on" when true.  Although implied, it does not mean it's returning an "off" when false.

example usage...

Quote
if ($ENV{HTTPS}){
     # then do this if secure;
}

or

Quote
if (!$ENV{HTTPS}){
     # then do this if not secure;
}

I verified the existence of the HTTPS variable with the CGI script that lists all available server variables.


In http://, the HTTPS variable is missing from the page.

In https://, the script returned...

Quote
HTTPS = on


For the purpose of this thread, the point is totally moot but perhaps still informative.
« Last Edit: October 09, 2007, 01:29:50 PM by sparky672 » Logged

Did you update the paths in ttxcfg.cgi after moving TTX to your new location?   Undecided
To those seeking help.... please report back when you figure it out.  Cheesy
loneguard
Jr. Member
**

Karma: 0
Posts: 98


View Profile
« Reply #40 on: October 09, 2007, 10:13:44 PM »

Thanks Sparky.
Logged
Pages: 1 2 [3]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1 RC3 | SMF © 2001-2006, Lewis Media Valid XHTML 1.0! Valid CSS!
Page created in 0.031 seconds with 19 queries.