Ignore:
Timestamp:
Jan 14, 2008, 9:48:39 PM (16 years ago)
Author:
george
Message:

Upraveno: Změna přístupu k databázi na třídu rozšířenou mysqli.
Upraveno: Sjednocení
Upraveno: Změna kódování všech stránek na UTF-8.
Odstraňeno: Staré nepotřebné soubory.

Location:
www
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • www

    • Property svn:ignore set to
      config.php
      php_script_error.log
  • 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
     3include_once('../global.php');
     4include_once('../style.php'); 
     5ShowHeader('Výpis z historie SunriseChatu','Historie Sunrisechatu');
     6
     7if(array_key_exists('date',$_GET)) $Date = $_GET['date']; else $Date = date('Y-m-d');
     8$DateParts = explode('-',$Date);
    59 
    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();
    1212 
    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]);
    1517 
    16   $StartDateTimeParts = explode(' ',$RowTotal['MIN(time)']);
    17   $StartDateParts = explode('-',$StartDateTimeParts[0]);
    18   $EndDateTimeParts = explode(' ',$RowTotal['MAX(time)']);
    19   $EndDateParts = explode('-',$EndDateTimeParts[0]);
     18function dechexr($Num)
     19{
     20  $Num = dechex($Num);
     21  return(substr($Num,4,2).substr($Num,2,2).substr($Num,0,2));
     22}
    2023 
    21   function dechexr($Num)
     24echo('<div style="font-size: small;">');
     25for($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--)
    2232  {
    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     {
    3633//      echo('<div><span>');
    37       echo('<div style="border-style: solid; border-bottom-color: gray; border-width: 0 0 1 0; margin-bottom: 3px; padding-bottom: 2px;">'.$MonthNames[$Month].'
    38       <span style="position: absolute; left: 100px;">');
    39       if(($Year == $StartDateParts[0]) and ($Month == $StartDateParts[1])) $StartDay = ($StartDateParts[2]+0); else $StartDay = 1;
    40       if(($Year == $EndDateParts[0]) and ($Month == $EndDateParts[1])) $EndDay = ($EndDateParts[2]+0); else $EndDay = date('t',mktime(0,0,0,$Month,0,$Year));
    41       for($Day = $StartDay; $Day <= $EndDay; $Day++)
    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    {
    4340//        $Date = $Year.'-'.$Month.'-'.$Day;
    4441        //DB_Select('sunrisechat_history','COUNT(*)',"roomtype=0 AND time>'".$Date." 00:00:00' AND time<'".$Date." //23:59:59'");
    4542  //      $CR = DB_Row();
    4643//        $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);
    5348    }
    54     echo('</div>');
     49    echo('</span></div>');
    5550  }
    5651  echo('</div>');
     52}
     53echo('</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>');
     57echo('<div style="font-size: small;">');
     58while($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>&lt;'.$Row['nick'].'&gt;</strong> '.(htmlspecialchars($Text)).'</span><br>');
     63  flush();
     64}
     65echo('</div>');
    5766 
    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>&lt;'.$Row['nick'].'&gt;</strong> '.(htmlspecialchars($Text)).'</span><br>');
    66       flush();
    67     }
    68     echo('</div>');
    69  
    70   ShowFooter();
     67ShowFooter();
    7168?>
Note: See TracChangeset for help on using the changeset viewer.