• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Simple Countdown php script

RaikND

facebook.xenoria.org
Joined
May 12, 2010
Messages
942
Reaction score
10
Location
Spain
i dont know where i take this code, but was usefull for all whos doesnt know much the languange .php

create a own script with name "countdown.php" and paste this code:
PHP:
// Define your target date here
    $targetYear   = 2010;
    $targetMonth  = 6;
    $targetDay    = 20;
    $targetHour   = 23;
    $targetMinute = 00;
    $targetSecond = 00;
// End target date definition

$targetDate = mktime($targetHour,$targetMinute,$targetSecond,$targetMonth,$targetDay,$targetYear);
$actualDate = time();

$secondsDiff = $targetDate - $actualDate;

$remainingDay     = floor($secondsDiff/60/60/24);
$remainingHour    = floor(($secondsDiff-($remainingDay*60*60*24))/60/60);
$remainingMinutes = floor(($secondsDiff-($remainingDay*60*60*24)-($remainingHour*60*60))/60);
$remainingSeconds = floor(($secondsDiff-($remainingDay*60*60*24)-($remainingHour*60*60))-($remainingMinutes*60));

$dateFormat = "Y-m-d H:i:s";

$targetDateDisplay = date($dateFormat,$targetDate);
$actualDateDisplay = date($dateFormat,$actualDate);
after your got the archive create and edited, go to the your "layout" and paste on header from your website this another code for declare another archive "countdown.php"
PHP:
include('dir/countdown.php');
and now copy last code and put where your want for show it
PHP:
<?php echo "$remainingDay days, $remainingHour hours, $remainingMinutes minutes, $remainingSeconds seconds";?>

And finish :) sorry for my basic english >.<, rep+ :) bye!
 
It's nice would be cool if you could add pictures to though.
Rep :)

Edit: can't rep right now.. will rep later
 
<center><font size="6"><script language="JavaScript"> TargetDate = "06/11/2010 6:00 PM"
; BackColor = "false"; ForeColor = "red";
CountActive = true; CountStepper = -1; LeadingZero
= true; DisplayFormat = "%%D%% Days, %%H%% Hours,
%%M%% Minutes, %%S%% Seconds.";
FinishMessage = "It is finally here!";
</script> <script language="JavaScript"
src="http://scripts.hashemian.com/js/countdown.js">
</script></font></center><br />
Paste it to news. Is much easier:thumbup:
 
Dear Atlantique. I think you are being rude. I didnt mentioned anything about you, and you call me a "noob". Nobody is perfect, i'm not good at web stuff. So what? That gives you rights to call me a Noob? I don't think so! There must be something you fail at, and i bet you won't like people call you Noob for that.
 
thanks Djivar :)

@tayron

x) ur looking for my name and show this script? haha
 
Dear Atlantique. I think you are being rude. I didnt mentioned anything about you, and you call me a "noob". Nobody is perfect, i'm not good at web stuff. So what? That gives you rights to call me a Noob? I don't think so! There must be something you fail at, and i bet you won't like people call you Noob for that.

Fail?

You clearly stated that you weren't good at "web stuff" and that actually makes you a noob.

Noob = newbie = beginner.
 
Why ?
i have this ? 3827 Days, 06 Hours, 40 Minutes, 10 Seconds.
when i give that :
Code:
<center><font size="6"><script language="JavaScript"> TargetDate = "06/11/2010 6:00 PM"
; BackColor = "false"; ForeColor = "red";
CountActive = true; CountStepper = -1; LeadingZero
= true; DisplayFormat = "%%D%% Days, %%H%% Hours,
%%M%% Minutes, %%S%% Seconds.";
FinishMessage = "It is finally here!";
</script> <script language="JavaScript"
src="http://scripts.hashemian.com/js/countdown.js">
</script></font></center><br />
 
... cant edit -.-
i have this.. :
Code:
<center><font size="6"><script language="JavaScript"> TargetDate = "11/09/2010 12:00 PM"
; BackColor = "false"; ForeColor = "red";
CountActive = true; CountStepper = -1; LeadingZero
= true; DisplayFormat = "%%D%% Days, %%H%% Hours,
%%M%% Minutes, %%S%% Seconds.";
FinishMessage = "It is finally here!";
</script> <script language="JavaScript"
src="http://scripts.hashemian.com/js/countdown.js">
</script></font></center><br />
 
... cant edit -.-
i have this.. :
Code:
<center><font size="6"><script language="JavaScript"> TargetDate = "11/09/2010 12:00 PM"
; BackColor = "false"; ForeColor = "red";
CountActive = true; CountStepper = -1; LeadingZero
= true; DisplayFormat = "%%D%% Days, %%H%% Hours,
%%M%% Minutes, %%S%% Seconds.";
FinishMessage = "It is finally here!";
</script> <script language="JavaScript"
src="http://scripts.hashemian.com/js/countdown.js">
</script></font></center><br />
Change this.... learn to read before asking where to edit... "Target date", not hard to understand?
Code:
TargetDate = "11/09/2010 12:00 PM"
 
@up
NVM the code itself is wrong! use this:
PHP:
<center><h2><script language="JavaScript">
TargetDate = "12/31/2010 5:00 AM";
BackColor = "";
ForeColor = "gray";
CountActive = true;
CountStepper = -1;
LeadingZero = true;
DisplayFormat = "%%D%% Days, %%H%% Hours, %%M%% Minutes, %%S%% Seconds.";
FinishMessage = "It is finally here!";
</script>
<script language="JavaScript" src="http://panchira.mine.nu/countdown.js"></script>
</h2></center><br />
Chnage
Code:
<script language="JavaScript" src="http://panchira.mine.nu/countdown.js"></script>
TO
Code:
<script language="JavaScript" src="http://scripts.hashemian.com/js/countdown.js"></script>
 
oh guys, NeverDown has relased nice script to countdown your start server and you are using javascript? it's not well.
Script relased by NeverDown is wrote in php that means you can implement this script into your CMS, add few fucntions and make config file and implement for eternality exist!.

Here you have one of options:
open you config file in ACC and add there these lines:
Code:
//Countdown
$config['site']['countdown'] = 1; // SHOW COUNT DOWN 1-yes / 0-no
    $config['site']['year'] = 2020; // year
    $config['site']['month'] = 1; // month
    $config['site']['day'] = 15; // day
    $config['site']['hour'] = 00; // hour
    $config['site']['minute'] = 00; // minute
    $config['site']['second'] = 00; // second
Goto countdown.php file and replace all by this (REMEBER countdown.php must be in your main dir):
Code:
<?
// Define your target date here
    $targetYear   = $config['site']['year'];
    $targetMonth  = $config['site']['month'];
    $targetDay    = $config['site']['day'];
    $targetHour   = $config['site']['hour'];
    $targetMinute = $config['site']['minute'];
    $targetSecond = $config['site']['second'];
// End target date definition

$targetDate = mktime($targetHour,$targetMinute,$targetSecond,$targetMonth,$targetDay,$targetYear);
$actualDate = time();

$secondsDiff = $targetDate - $actualDate;

$remainingDay     = floor($secondsDiff/60/60/24);
$remainingHour    = floor(($secondsDiff-($remainingDay*60*60*24))/60/60);
$remainingMinutes = floor(($secondsDiff-($remainingDay*60*60*24)-($remainingHour*60*60))/60);
$remainingSeconds = floor(($secondsDiff-($remainingDay*60*60*24)-($remainingHour*60*60))-($remainingMinutes*60));

$dateFormat = "Y-m-d H:i:s";

$targetDateDisplay = date($dateFormat,$targetDate);
$actualDateDisplay = date($dateFormat,$actualDate);
?>

Now go to your layout.php file and put upon <?PHP echo $main_content; ?> these few lines of code:
Code:
<?PHP
include($layout_name.'/../../countdown.php');
if($config['site']['countdown'] == 1){
						echo '<div class="SmallBox" >  <div class="MessageContainer" >    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeLeftTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeRightTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="ErrorMessage" >      <div class="BoxFrameVerticalLeft" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div>      <div class="BoxFrameVerticalRight" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div>      <div class="AttentionSign" style="background-image:url('.$layout_name.'/images/content/attentionsign.gif);" /></div><b><font size="3"><blink>'.$config['server']['serverName'].' is going to start for '.$remainingDay.' days, '.$remainingHour.' hours, '.$remainingMinutes.' minutes, '.$remainingSeconds.' seconds get ready!.</blink></font><br></b></div>    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeRightBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>  </div></div><br>';
}
?>

I hope you like it, enjoy!.
 
Back
Top