GetDotted Domains

Viewing Thread:
"Web Server (8) time return problem"

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.

Thu 01/07/10 at 20:22
Regular
"Ctrl, Alt, Woof"
Posts: 212
Since the rebuild of my site after the crash and burn of freeola webserver 8 a few weeks ago, my java script to display the server time has stopped working.

This is the function which gets the time (some spaces added to get over the 50char post limit):

function displaytime(){
serverdate.setSeconds(serverdate.getSeconds()+1)
var daystring=dayarray[serverdate.getDay()];
var datestring=daystring+", "+montharray[serverdate.getMonth()]+" "+padlength(serverdate.getDate())+", "+serverdate.getFullYear();
var timestring=padlength(serverdate.getHours())+":" +padlength(serverdate.getMinutes())+ ":"+padlength(serverdate.getSeconds())
document.getElementById ("servertime").innerHTML=datestring+" "+timestring
}


I've checked and double checked the coding but it looks identical to the page b.c. (before crash). Is there a global variable/permission which needs to be switched [back?] on to allow the return of the sever time upon request?

Failing this - does anyone have a good script to do this? It must be the server time and not the local pc time.

thanks

JTD
Thu 01/07/10 at 20:22
Regular
"Ctrl, Alt, Woof"
Posts: 212
Since the rebuild of my site after the crash and burn of freeola webserver 8 a few weeks ago, my java script to display the server time has stopped working.

This is the function which gets the time (some spaces added to get over the 50char post limit):

function displaytime(){
serverdate.setSeconds(serverdate.getSeconds()+1)
var daystring=dayarray[serverdate.getDay()];
var datestring=daystring+", "+montharray[serverdate.getMonth()]+" "+padlength(serverdate.getDate())+", "+serverdate.getFullYear();
var timestring=padlength(serverdate.getHours())+":" +padlength(serverdate.getMinutes())+ ":"+padlength(serverdate.getSeconds())
document.getElementById ("servertime").innerHTML=datestring+" "+timestring
}


I've checked and double checked the coding but it looks identical to the page b.c. (before crash). Is there a global variable/permission which needs to be switched [back?] on to allow the return of the sever time upon request?

Failing this - does anyone have a good script to do this? It must be the server time and not the local pc time.

thanks

JTD
Thu 01/07/10 at 20:49
Regular
"Devil in disguise"
Posts: 3,151
What is serverdate? Its obviously a Date object, but its not initialised anywhere. I suppose somewhere in the working version its initialised with the server date/time.
Thu 01/07/10 at 20:56
Regular
"Ctrl, Alt, Woof"
Posts: 212
Garin,

servertime is a new instance of a date object

Here is the code in full - like I said below this defo worked before the rebuild (I understand what's going on in the script but I didn't write it - it was off a free javascript site):


<script type="text/javascript">
var dayarray=new Array("Sunday","Monday","Tuesday ","Wednesday","Thursday","Friday" ,"Saturday")
var currenttime ='<? echo date("l, F j, Y H:i:s", time())?>'
var montharray=new Array ("January"," February","March","April","May" ," June","July","August","September", "October","November","December")
var serverdate=new Date(currenttime)

function padlength(what){
var output=(what.toString().length==1)? "0"+what : what
return output
}

function displaytime(){
serverdate.setSeconds(serverdate.getSeconds()+1)
var daystring=dayarray[serverdate.getDay()];
var datestring=daystring+", "+montharray[serverdate.getMonth()]+" "+padlength(serverdate.getDate())+", "+serverdate.getFullYear();
var timestring=padlength(serverdate.getHours())+": "+padlength(serverdate.getMinutes())+": "+padlength(serverdate.getSeconds())
document.getElementById("servertime ").innerHTML=datestring+" "+timestring
}

window.onload=function(){
setInterval("displaytime()", 1000)
}

</script>

<b>Server Time:</b> <span id="servertime"></span>


JTD
Thu 01/07/10 at 21:03
Regular
"Devil in disguise"
Posts: 3,151
So is that PHP being executed?
Thu 01/07/10 at 21:13
Regular
"Ctrl, Alt, Woof"
Posts: 212
It is within a predominantly php built site but the script is outside of any php coding. The tag takes the servertime element ID (as HTML) and displays what the script returns.

I had a thought (it was bound to happen sometime) and I've tested the code on a throwaway site I never got round to:

here

...which is on freeolaweb1 and it works.



JTD
Thu 01/07/10 at 22:12
Regular
"Devil in disguise"
Posts: 3,151
View the source of the page and see if the php is still there. Maybe short tags are turned off, try
Fri 02/07/10 at 09:16
Regular
"Ctrl, Alt, Woof"
Posts: 212
The rest of the site (all PHP) is working OK. It's only this one script which has stopped working... and I always use

The site works on an 'includes' navigation mechanism which also proves to me that the core site is OK as it is the same main page which gets loaded every time.

The link to the test page (see previous post) on freeolaweb1 shows the script is OK but it's not getting a response from freeolaweb8.

JTD
Fri 02/07/10 at 11:08
Moderator
"Are you sure?"
Posts: 5,000
Hi JTD,
I don't know if this helps or not!...

I've just tried your script on server 8 and it works fine for me.
That was just using plain old html with the JavaScript.

Have you tried running phpinfo's to compare server 8 with another server?


[s]Hmmm...[/s]
Fri 02/07/10 at 12:54
Regular
"Ctrl, Alt, Woof"
Posts: 212
Thanks Hmmm... that is interesting.

I gave the phpinfo on freeolaweb a quick once over yesterday but didn't compare it to another webserver as I came to a (possibly incorrect) conclusion that it wasn't a PHP issue.

I also didn't try the script in it's own file - though I'm not sure why it would make a difference.

I'll do some more tests tonight and feedback results.


JTD
Fri 02/07/10 at 13:08
Regular
"Devil in disguise"
Posts: 3,151
Is the PHP being parsed or not? If it is being parsed, what is it assigning to currenttime.

Freeola & GetDotted are rated 5 Stars

Check out some of our customer reviews below:

Very pleased
Very pleased with the help given by your staff. They explained technical details in an easy way and were patient when providing information to a non expert like me.
Everybody thinks I am an IT genius...
Nothing but admiration. I have been complimented on the church site that I manage through you and everybody thinks I am an IT genius. Your support is unquestionably outstanding.
Brian

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.