Jump to content

share me your opinion on self-refreshing the page as PHP use


samoi

Recommended Posts

hello guys, I have no knowledge of java script to make a refresh counter !

 

and I play Travian Game, and an idea came to my mind.

 

The idea:

 

instead of making a java script and set it as a counter.

 

I did this

 

 

<?php

/**
* @author 
* @copyright 2009
*/

$time = date("g:i:s a");



echo "<META http-equiv=\"refresh\" content=\"1;URL={$_SERVER['PHP_SELF']}\">";

echo $time;
?>

 

I tried it and it works just fine  ;D

 

but I think this will cause an over load of the server or something like that, and also I think this won't work for anything else within this page. what I mean is, if a user would enter values into a form, this refreshing process will make him very angry  :P right?

 

because it won't let him even enter it unless the user do so in less than a sec!  :o 'I didn't try it, but it's very clear that would happen'.

 

so, what do you think guys?

What exactly are you trying to do?

 

what I'm trying to do is the following as I explained above:

 

I don't code in javascript and my knowledge is very weak in Javascript !

 

so, I made this instead to make a live timer !

 

within this code the page will be updated to the last second ! right?

 

but what are the sequences of using this on the server ? and the user action !

PHP is not meant for "real-time" processing, it is called a Hypertext "PreProcessor" for a reason.

 

You dont have to know how to write javascript, to be able to use an already written time function.

---

With our method you would need to use aax to stop the page from updating completely. But its pointless it would give completely superfluous connections.

 

Google it "javascript Real Time Clock", most of them is just a .js file you include with a meta tag, after that you put a tiny piece of avascript on your page where ou want the clock to be.

 

Most of the time you can customize the clocks appearence.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.