Changeset 4 for www/sunrisechat/history.php
- Timestamp:
- Jan 14, 2008, 9:48:39 PM (17 years ago)
- Location:
- www
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
www
-
Property svn:ignore
set to
config.php
php_script_error.log
-
Property svn:ignore
set to
-
www/sunrisechat/history.php
r1 r4 1 <? 2 include_once('../is/db.php'); 3 include_once('../style.php'); 4 include_once('../global.php'); 1 <?php 2 3 include_once('../global.php'); 4 include_once('../style.php'); 5 ShowHeader('Výpis z historie SunriseChatu','Historie Sunrisechatu'); 6 7 if(array_key_exists('date',$_GET)) $Date = $_GET['date']; else $Date = date('Y-m-d'); 8 $DateParts = explode('-',$Date); 5 9 6 DB_Init('localhost','root','','is'); 7 DB_Query('SET CHARACTER SET latin2'); 8 ShowHeader('Výpis z historie SunriseChatu','Historie Sunrisechatu'); 9 10 if(array_key_exists('date',$_GET)) $Date = $_GET['date']; else $Date = date('Y-m-d'); 11 $DateParts = explode('-',$Date); 10 $DbResult = $Database->select('sunrisechat_history','MAX(time),MIN(time)'); 11 $RowTotal = $DbResult->fetch_array(); 12 12 13 DB_Select('sunrisechat_history','MAX(time),MIN(time)'); 14 $RowTotal = DB_Row(); 13 $StartDateTimeParts = explode(' ',$RowTotal['MIN(time)']); 14 $StartDateParts = explode('-',$StartDateTimeParts[0]); 15 $EndDateTimeParts = explode(' ',$RowTotal['MAX(time)']); 16 $EndDateParts = explode('-',$EndDateTimeParts[0]); 15 17 16 $StartDateTimeParts = explode(' ',$RowTotal['MIN(time)']); 17 $StartDateParts = explode('-',$StartDateTimeParts[0]); 18 $EndDateTimeParts = explode(' ',$RowTotal['MAX(time)']); 19 $EndDateParts = explode('-',$EndDateTimeParts[0]); 18 function dechexr($Num) 19 { 20 $Num = dechex($Num); 21 return(substr($Num,4,2).substr($Num,2,2).substr($Num,0,2)); 22 } 20 23 21 function dechexr($Num) 24 echo('<div style="font-size: small;">'); 25 for($Year = $EndDateParts[0]; $Year >= $StartDateParts[0]; $Year--) 26 { 27 echo('<div style="border-style: solid; border-bottom-color: gray; border-width: 0 0 1 0; margin-bottom: 3px; padding-bottom: 2px;">'.$Year.'</div> 28 <div style="margin-left: 15px; margin-right: 15px;">'); 29 if($Year == $StartDateParts[0]) $StartMonth = ($StartDateParts[1]+0); else $StartMonth = 1; 30 if($Year == $EndDateParts[0]) $EndMonth = ($EndDateParts[1]+0); else $EndMonth = 12; 31 for($Month = $EndMonth; $Month >= $StartMonth; $Month--) 22 32 { 23 $Num = dechex($Num);24 return(substr($Num,4,2).substr($Num,2,2).substr($Num,0,2));25 }26 27 echo('<div style="font-size: small;">');28 for($Year = $EndDateParts[0]; $Year >= $StartDateParts[0]; $Year--)29 {30 echo('<div style="border-style: solid; border-bottom-color: gray; border-width: 0 0 1 0; margin-bottom: 3px; padding-bottom: 2px;">'.$Year.'</div>31 <div style="margin-left: 15px; margin-right: 15px;">');32 if($Year == $StartDateParts[0]) $StartMonth = ($StartDateParts[1]+0); else $StartMonth = 1;33 if($Year == $EndDateParts[0]) $EndMonth = ($EndDateParts[1]+0); else $EndMonth = 12;34 for($Month = $EndMonth; $Month >= $StartMonth; $Month--)35 {36 33 // echo('<div><span>'); 37 38 39 40 41 42 34 echo('<div style="border-style: solid; border-bottom-color: gray; border-width: 0 0 1 0; margin-bottom: 3px; padding-bottom: 2px;">'.$MonthNames[$Month].' 35 <span style="position: absolute; left: 100px;">'); 36 if(($Year == $StartDateParts[0]) and ($Month == $StartDateParts[1])) $StartDay = ($StartDateParts[2]+0); else $StartDay = 1; 37 if(($Year == $EndDateParts[0]) and ($Month == $EndDateParts[1])) $EndDay = ($EndDateParts[2]+0); else $EndDay = date('t',mktime(0,0,0,$Month,0,$Year)); 38 for($Day = $StartDay; $Day <= $EndDay; $Day++) 39 { 43 40 // $Date = $Year.'-'.$Month.'-'.$Day; 44 41 //DB_Select('sunrisechat_history','COUNT(*)',"roomtype=0 AND time>'".$Date." 00:00:00' AND time<'".$Date." //23:59:59'"); 45 42 // $CR = DB_Row(); 46 43 // $Text = '<a href="history.php?date='.$Year.'-'.$Month.'-'.$Day.'">'.$Day.'('.$CR['COUNT(*)'].')</a> '; 47 $Text = '<a href="history.php?date='.$Year.'-'.$Month.'-'.$Day.'">'.$Day.'</a> '; 48 flush(); 49 if(($DateParts[0] == $Year) and ($DateParts[1] == $Month) and ($DateParts[2] == $Day)) $Text = '<strong style="border-style: solid; border-width: 1; border-color: black; padding-left: 3px;">'.$Text.'</strong>'; 50 echo($Text); 51 } 52 echo('</span></div>'); 44 $Text = '<a href="history.php?date='.$Year.'-'.$Month.'-'.$Day.'">'.$Day.'</a> '; 45 flush(); 46 if(($DateParts[0] == $Year) and ($DateParts[1] == $Month) and ($DateParts[2] == $Day)) $Text = '<strong style="border-style: solid; border-width: 1; border-color: black; padding-left: 3px;">'.$Text.'</strong>'; 47 echo($Text); 53 48 } 54 echo('</ div>');49 echo('</span></div>'); 55 50 } 56 51 echo('</div>'); 52 } 53 echo('</div>'); 54 55 $DbResult = $Database->select('sunrisechat_history','nick,color,text,UNIX_TIMESTAMP(time)',"roomtype=0 AND time>'".$Date." 00:00:00' AND time<'".$Date." 23:59:59' ORDER BY time DESC"); 56 //echo('Výpis posledních 100 zpráv:<br>'); 57 echo('<div style="font-size: small;">'); 58 while($Row = $DbResult->fetch_array()) 59 { 60 $Text = $Row['text'];; 61 // StrTr($Row['text'], "\x8A\x8D\x8E\x9A\x9D\x9E", "\xA9\xAB\xAE\xB9\xBB\xBE"); 62 echo('['.date('d.m.Y H:i:s',$Row['UNIX_TIMESTAMP(time)']).'] <span style="color: #'.dechexr($Row['color']).'"><strong><'.$Row['nick'].'></strong> '.(htmlspecialchars($Text)).'</span><br>'); 63 flush(); 64 } 65 echo('</div>'); 57 66 58 DB_Select('sunrisechat_history','nick,color,text,UNIX_TIMESTAMP(time)',"roomtype=0 AND time>'".$Date." 00:00:00' AND time<'".$Date." 23:59:59' ORDER BY time DESC"); 59 //echo('Výpis posledních 100 zpráv:<br>'); 60 echo('<div style="font-size: small;">'); 61 while($Row = DB_Row()) 62 { 63 $Text = $Row['text'];; 64 // StrTr($Row['text'], "\x8A\x8D\x8E\x9A\x9D\x9E", "\xA9\xAB\xAE\xB9\xBB\xBE"); 65 echo('['.date('d.m.Y H:i:s',$Row['UNIX_TIMESTAMP(time)']).'] <span style="color: #'.dechexr($Row['color']).'"><strong><'.$Row['nick'].'></strong> '.(htmlspecialchars($Text)).'</span><br>'); 66 flush(); 67 } 68 echo('</div>'); 69 70 ShowFooter(); 67 ShowFooter(); 71 68 ?>
Note:
See TracChangeset
for help on using the changeset viewer.