GetDotted Domains

Viewing Thread:
"Urusei Machie"

The "Freeola Customer Forum" forum, which includes Retro Game Reviews, has been archived and is now read-only. You cannot post here or create a new thread or review on this forum.

Sat 18/11/06 at 21:41
Regular
Posts: 19,415
This is where I post problems and questions while I work on my Language/Travel website.

Link coming soon =)
Fri 24/11/06 at 01:53
Regular
"Devil in disguise"
Posts: 3,151
Ok, somewhat easier if the script is working.
The page thats got the SSI on it, make sure the file extension is shtml instead of just html.
Fri 24/11/06 at 09:09
Moderator
"Are you sure?"
Posts: 5,000
Garin wrote:
> Ok, somewhat easier if the script is working.
> The page thats got the SSI on it, make sure the file extension
> is shtml instead of just html.

It does look like it's 'html' and not 'shtml' - well that's Machie's current home page with the clock code in it anyway - which would explain why the code isn't being called.


Not quite the 'holding page' I suggested way back - but I guess it's better than the hosts adverts...
Fri 24/11/06 at 09:54
Regular
Posts: 19,415
d'oh I thought it might be that but by the time I realised I was already in bed :D I'll test it now.

It's my perl test for the moment :) I think my robot txt is still telling the search engines to go away.
Fri 24/11/06 at 12:09
Regular
Posts: 19,415
Ah I have it working now :D

Okay next I want to use this script to display the time ane date "00:00AM/PM on Monday" but I want to be able to add or subtract hours. This is for the time zones. So Singapore is 8 hours ahead so it would have to +8 in somewhere, and for New York -5. Could I use this script? Would it be easy to do that? and if I have 200 pages with this does that mean I would have to have 200 perl scripts or could I do something in the code that calls it to the webpage?
Fri 24/11/06 at 12:46
Regular
"Devil in disguise"
Posts: 3,151
Machie wrote:
> Okay next I want to use this script to display the time ane date
> "00:00AM/PM on Monday" but I want to be able to add or
> subtract hours. This is for the time zones. So Singapore is 8
> hours ahead so it would have to +8 in somewhere, and for New
> York -5. Could I use this script? Would it be easy to do that?

The script looks like it'll do it easily enough as it already has support for time zones. Just a matter of rearranging the output as you want it I guess.

> and if I have 200 pages with this does that mean I would have to
> have 200 perl scripts or could I do something in the code that
> calls it to the webpage?

If you have 200 pages, theres nothing to stop all of them calling the same script. So no, you dont need 200 copies of the perl script. :)
Fri 24/11/06 at 12:51
Regular
Posts: 19,415
There isnt even 200 time zones what am I talking about >_<

okay great, don't suppose you know how to rearranging the output do you? :)
Fri 24/11/06 at 12:53
Regular
"Devil in disguise"
Posts: 3,151
Well what do you want it to display exactly?
Fri 24/11/06 at 13:06
Regular
Posts: 19,415
"23:59 on Monday"

It's for my "what time is it in X" pages. So if you want to know what time it is in Hong Kong, you click a link, and hopefully this perl script will take the server time and add 8 hours to it and display the time it is in Hong Kong in the format above. For the New York page hopefully the perl script will subtract 5 hours from the server time and display what time it is in New York :)

X represents countries/states and major cities
Fri 24/11/06 at 14:57
Regular
"Devil in disguise"
Posts: 3,151
Ok I think this works...


#!/usr/local/bin/perl

use CGI qw(:standard);

# Define Variables #

%Time_Zones= (
'GMT' => '0',
'NewYork' => '-5',
'HongKong' => '8',
);

$Display_Week_Day = '1';

$Display_Month = '0';

$Display_Month_Day = '0';

$Display_Year = '0';

$Display_Time = '1';

$Display_Time_Zone = '0';

$Standard_Time_Zone = 'EST';
$Daylight_Time_Zone = 'EDT';

$Display_Link = '0';

# Done
#

@Week_Days = ('Sunday','Monday',
'Tuesday','Wednesday',
'Thursday','Friday','Saturday');

@Months = ('January','February',
'March','April'
,'May','June','July',
'August','September','October'
,'November','December');

$query = new CGI;

if (($query->param('zone')) && ($Time_Zones{$query->param('zone')})) {
$current_zone=$query->param('zone');
} else {
$current_zone='GMT';
}

print "Content-type: text/html\n\n";

if ($Display_Link != 0) {
print "<a href=\"http://www.scriptarchive.com/\">";
}

($Second,$Minute,$Hour,$Month_Day,
$Month,$Year,$Week_Day,$IsDST) = gmtime(time+($Time_Zones{$current_zone}*3600));

if ($IsDST == 1) {
$Time_Zone = $Daylight_Time_Zone;
}
else {
$Time_Zone = $Standard_Time_Zone;
}

if ($Second < 10) {
$Second = "0$Second";
}
if ($Minute < 10) {
$Minute = "0$Minute";
}
if ($Hour < 10) {
$Hour = "0$Hour";
}
if ($Month_Day < 10) {
$Month_Day = "0$Month_Day";
}
$Year += 1900;


if ($Display_Month != 0) {
print "$Months[$Month] ";
}

if ($Display_Month_Day != 0) {
print "$Month_Day";
if ($Display_Year != 0) {
print ", ";
}
}

if ($Display_Year != 0) {
print "$Year";
if ($Display_Time != 0) {
print " - ";
}
elsif ($Display_Time_Zone != 0) {
print " ";
}
}

if ($Display_Time != 0) {
print "$Hour\:$Minute\:$Second";
if ($Display_Time_Zone != 0) {
print " ";
}
}

if ($Display_Week_Day != 0) {
print " on $Week_Days[$Week_Day]";
}
if ($Display_Time_Zone != 0) {
print "$Time_Zone";
}

if ($Display_Link != 0) {
print "</a>";
}

exit;


Ok, the bit you'll need to add/modify is the %Times_Zones variable. Simply its a list of timezone offsets. Its a keyword matched to an offset. So simply add additional keywords and their timezone as required.

To use the script as before ie
<!--#exec cgi="/cgi-bin/textclock.cgi"-->

except when you want it to display a different time zone you just use the keyword you chose. eg
<!--#exec cgi="/cgi-bin/textclock.cgi?zone=NewYork"-->

Not been able to test it properly beyond making sure it compiles as I lack any testing environment but works from a cmd line at least. :-)
Fri 24/11/06 at 15:21
Regular
Posts: 19,415
:O incredible! Ah a list, that would make it really easy, I think what I'll do is list all the time zones instead of the countries so the list shouldnt be too long. Like this..

%Time_Zones= (
'GMT' => '0',
'Zone 1' => '-12',
'Zone 2' => '-11',
'Zone 3' => '-10',
etc
);


I'll give it a try as soon as I finish this sandwich :D thanks Garin. Will it list the day correct? I mean if it's 11pm in the UK and someone wants the time in Russia will it change Friday to Saturday?

Freeola & GetDotted are rated 5 Stars

Check out some of our customer reviews below:

Just a quick note to say thanks for a very good service ... in fact excellent service..
I am very happy with your customer service and speed and quality of my broadband connection .. keep up the good work . and a good new year to all of you at freeola.
Matthew Bradley
Best Provider
The best provider I know of, never a problem, recommend highly
Paul

View More Reviews

Need some help? Give us a call on 01376 55 60 60

Go to Support Centre
Feedback Close Feedback

It appears you are using an old browser, as such, some parts of the Freeola and Getdotted site will not work as intended. Using the latest version of your browser, or another browser such as Google Chrome, Mozilla Firefox, or Opera will provide a better, safer browsing experience for you.