Welcome Guest ( Log In | Register)



 
Reply to this topicStart new topic
> Php Clock, source Code
alexia
post Mar 11 2005, 01:11 PM
Post #1


Super Member
*********

Group: Members
Posts: 310
Joined: 9-February 05
From: Italian
Member No.: 3,677



Hi Every one i find this code its very easy simple php clock i think you can use it blink.gif
CODE
<?
// Binary Clock
// script copyright© 2002 Andreas Tscharnuter
// questions? contact: psychodad@psychodad.at || [url=http://www.psychodad.at/clock/]http://www.psychodad.at/clock/[/url]
// free to use, copy and modify but leave comments untouched;)
// just include this file where your binary clock should appear
// version 1.2   03 September 2003

// below you can change different settings
// and remember to drink m000re milk!


$size =  "40";  //size of one square in pixel (height & width)
$hourdiff =  "0";  //difference between server time and local time + or -
$bgon =  "#cc0000"; //set color in hex for on (#cc0000 = darkred); check google.com for "hex color table" if you dont know how to use hex colors
$bgoff =  "#000000"; //set color in hex for off (#000000 = black); check google.com for "hex color table" if you dont know how to use hex colors
$enableclock = "1";  //switch the "real clock" beneath binary clock on(1) or off(0)


/*************************************
nothing needs to be changed below here
*************************************/
$std = str_pad((date("H") + $hourdiff + 24) % 24,2,"0",STR_PAD_LEFT);
$min = date("i");
$sec = date("s");

if ($std > 24 || $std < 0) {
die("<b><font color=\"#cc0000\">$std:$min no way... =)</font></b>");
}
$std1 = decbin(substr($std,0,1));
$std2 = decbin(substr($std,1,1));
$min1 = decbin(substr($min,0,1));
$min2 = decbin(substr($min,1,1));
$sec1 = decbin(substr($sec,0,1));
$sec2 = decbin(substr($sec,1,1));
function reihe($kette,$anfang,$ende) {  //background output
global $size,$bgon,$bgoff;
$pad = str_pad($kette,4,"0",STR_PAD_LEFT);
if(substr($pad,$anfang,$ende)==1) {
 echo "<td width=\"$size\" height=\"$size\" bgcolor=\"$bgon\">&nbsp;</td>";
} else {
 echo "<td width=\"$size\" height=\"$size\" bgcolor=\"$bgoff\">&nbsp;</td>";
}
}
?>
<table cellpadding="0" cellspacing="1" border="0" bgcolor="#000000">
<tr>
 <td>
<table cellpadding="0" cellspacing="1" border="0" bgcolor="#cccccc">
<tr>
<td colspan="2" align="center"><i><font face="verdana" size="1">hour</font></i></td>
<td colspan="2" align="center"><i><font face="verdana" size="1">min</font></i></td>
<td colspan="2" align="center"><i><font face="verdana" size="1">sec</font></i></td>
</tr>
<tr><?
reihe($std1,0,1);
reihe($std2,0,1);
reihe($min1,0,1);
reihe($min2,0,1);
reihe($sec1,0,1);
reihe($sec2,0,1);
?></tr>
<tr><?
reihe($std1,1,1);
reihe($std2,1,1);
reihe($min1,1,1);
reihe($min2,1,1);
reihe($sec1,1,1);
reihe($sec2,1,1);
?></tr>
<tr><?
reihe($std1,2,1);
reihe($std2,2,1);
reihe($min1,2,1);
reihe($min2,2,1);
reihe($sec1,2,1);
reihe($sec2,2,1);
?></tr>
<tr><?
reihe($std1,3,1);
reihe($std2,3,1);
reihe($min1,3,1);
reihe($min2,3,1);
reihe($sec1,3,1);
reihe($sec2,3,1);
?>
</tr>
<?
if ($enableclock == 1) { //disables,enables bottom clock
?>
<tr>
<td align="center" colspan="2"><font face="verdana" size="1"><? echo $std ?></font></td>
<td align="center" colspan="2"><font face="verdana" size="1"><? echo $min ?></font></td>
<td align="center" colspan="2"><font face="verdana" size="1"><? echo $sec ?></font></td>
</tr>
<? } ?>
</table>
 </td>
</tr>
</table>


Darkmeca - ok first of all you need to put this in quote or code, second you must credit the author of the code. This is your first warning if this happens again further actions will be taken. Thank you.

This post has been edited by darkmeca: Mar 11 2005, 01:37 PM
Go to the top of the page
 
+Quote Post
alexia
post Mar 11 2005, 01:13 PM
Post #2


Super Member
*********

Group: Members
Posts: 310
Joined: 9-February 05
From: Italian
Member No.: 3,677



sorry i posting again but i forget told u
you can Customize this clock (font,Size,Color)...
Go to the top of the page
 
+Quote Post
OwrLam
post Mar 17 2005, 05:18 PM
Post #3


Newbie [Level 3]
***

Group: Members
Posts: 46
Joined: 17-March 05
Member No.: 4,610



Also displays information about time:

CODE
<?php
 print "<p>Current Date: <br><br><strong>";
 print date("D d.m.Y G:i:s") . "<br>";
 print date("F j, Y, g:i a") . "<br>";
 print date("m.d.y") . "<br>";
 print date("j, n, Y") . "<br>";
 print date("Ymd") . "<br>";
 print date('h-i-s, j-m-y, it is w Day z ') . "<br>";
 print date('\i\t \i\s \t\h\e jS \d\a\y.') . "<br>";
 print date("D M j G:i:s T Y") . "<br>";
 print date('H:m:s \m \i\s\ \m\o\n\t\h') . "<br>";
 print date("H:i:s") . "<br>";
 print "</strong></p>\n";
?>
Go to the top of the page
 
+Quote Post
iGuest
post Jan 7 2008, 02:55 AM
Post #4


Hail Caesar!
*********************

Group: Members
Posts: 5,876
Joined: 21-September 07
Member No.: 50,369



analog clock
Php Clock

I wanna put/make analog clock in my web page.
But I don't know how..
Can you give me some tips or guide how to make it?

-eney
Go to the top of the page
 
+Quote Post
jlhaslip
post Jan 7 2008, 04:32 AM
Post #5


A computer once beat me at chess, but it was no match for me at kick boxing.
Group Icon

Group: [MODERATOR]
Posts: 4,079
Joined: 24-July 05
From: Linix, DOS and Windows…the good, the bad and the ugly
Member No.: 9,787
Spam Patrol



Try this site:

http://free-flash-clocks.trap17.com/
Go to the top of the page
 
+Quote Post
coldasice
post Jan 7 2008, 09:01 PM
Post #6


Newbie [Level 2]
**

Group: Members
Posts: 34
Joined: 10-December 07
From: Norway
Member No.: 54,556



how to make this clock auto refresh =?

or go like those flash clocks =) is what i realy meant smile.gif
Go to the top of the page
 
+Quote Post
galexcd
post Jan 9 2008, 06:43 AM
Post #7


Define:EVIL PROGRAMMER (ē'vəl prō'grăm'ər)- n. An organism that converts caffeine into evil software.
***********

Group: [HOSTED]
Posts: 1,074
Joined: 25-September 05
From: Los Angeles, California
Member No.: 12,251



QUOTE(coldasice @ Jan 7 2008, 01:01 PM) *
how to make this clock auto refresh =?

or go like those flash clocks =) is what i realy meant smile.gif


You could have js do some ajax to get the updated time and format if you wanted to use the php code, but it would just be easier to do the whole thing in js if you want it to update automatically.
Go to the top of the page
 
+Quote Post
coldasice
post Jan 13 2008, 05:41 PM
Post #8


Newbie [Level 2]
**

Group: Members
Posts: 34
Joined: 10-December 07
From: Norway
Member No.: 54,556



QUOTE(alex7h3pr0gr4m3r @ Jan 9 2008, 07:43 AM) *
You could have js do some ajax to get the updated time and format if you wanted to use the php code, but it would just be easier to do the whole thing in js if you want it to update automatically.


thanks.. i dont know ajax.. only php.. dont know js either =D

but i get to it =D
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. How do you test your php code(80)
  2. Change Permission With Php Code(3)
  3. Just About Completed My Own Message Board Source.(10)