Просмотр файла rated/view.php

Размер файла: 1.1Kb
<?php
  // ядро вывода картинки и подсчета 
  include "config.inc.php";

  if ($mycon = mysql_connect($db_host,$db_user,$db_pass)) {
   if($mybase = mysql_select_db($db_name, $mycon)) {
    if($db_query = mysql_query("select date,views,today from $table_wapcat where name='$name'", $mycon)) {
     $user_array = mysql_fetch_row($db_query);
     $date   = $user_array[0]; 
     $views  = $user_array[1]; 
     $today  = $user_array[2]; 
     if($date == date("d.m.Y",time())) {
      mysql_query("update $table_wapcat set today=today+1 where name='$name'");
     }
     else {
      mysql_query("update $table_wapcat set today=0 where name='$name'");      
      mysql_query("update $table_wapcat set views=views+".$today." where name='$name'");
      mysql_query("update $table_wapcat set date='".date("d.m.Y",time())."' where name='$name'");
     }
    }
   }
   @mysql_close($mycon);
  }

  if(!$today) $today = "null";

  $im = ImageCreateFromPng($cat_picture);
  ImageString ($im, 2, 23, 11, $today,0); 

   header("Content-Type:image/png"); 
   ImagePNG($im);
   ImageDestroy($im);
?>