<?



If ($name == "") {

 echo "<script> alert('Параметры заданы неверно!'); history.back();</script>";

 exit;

}



$fusr = @file("users/$name");



$d = dir("responses/");

while($tme = $d->read()) {

 If ($tme <> "." and $tme <> ".." and $tme <> ".htaccess") {

  $arresp[] = $tme;

 }

}

$d->close();



$prod = 0;

$rating = 0;

$rsp0 = 0;

$rsp1 = 0;

$d = dir("goods/");

while($tme = $d->read()) {

 If ($tme <> "." and $tme <> ".." and $tme <> ".htaccess") {

  $fr = @file("goods/$tme");

  If (trim($fr[0]) == $name) {

   $prod = $prod + (integer) trim($fr[15]);



   for ($s = 0; $s < count($arresp); $s++) {

    If ($tme == $arresp[$s]) {

     $fr2 = @file("responses/$tme");



     $m = 0;

     while ($fr2[$m] <> "") {

      $ar2 = explode("^", trim($fr2[$m]));

      If ($ar2[0] == "0") {

       $rating = $rating + 1;

       $rsp1 = $rsp1 + 1;

      }

      ElseIf ($ar2[0] == "1") {

       $rating = $rating - 1;

       $rsp0 = $rsp0 + 1;

      }

      $m++;

     }



    }

   }

  }

 }

}

$d->close();





// Выводим изображение счетчика gif



    Header("Content-type: image/gif");

    $im = imagecreatefromgif("knopka.gif");

    $orange = ImageColorAllocate($im, 0, 0, 0);

    ImageString($im,2,5,18,$prod,$orange);

    ImageString($im,2,50,18,$rating,$orange);

    ImageGif($im);

    ImageDestroy($im);

?>