Tak chciałbym abyście mi poprawili
A powiedział by ktoś gdzie co muszę pozmieniać żeby między tymi zdjęciami dać napis: np. VS
Bitwa.php
<?php
class bitwa {
var $zdjecie1;
var $zdjecie2;
public function pokaz_bitwe() {
$katalog = 'images';
$n=0;
while (($file = readdir($d)) == true) {
$n++;
$img_los[$n] = $file;
$img_los2[$n] = $file;
}
}
}
if($img_poz != $img_poz2) {
$this->zdjecie1 = $img_los[$img_poz];
$this->zdjecie2 = $img_los2[$img_poz2];
echo "<td align=\"right\"><a href=\"rate.php?wygrana=$img_los[$img_poz]&przegrana=$img_los2[$img_poz2]\"><img style=\"background: white; border:1px solid grey;border-bottom:1px solid grey;padding:5px;\" src=\"$katalog/$img_los[$img_poz]\"></a></td>"; echo "<td><a href=\"rate.php?wygrana=$img_los2[$img_poz2]&przegrana=$img_los[$img_poz]\"><img style=\"background: white; border:1px solid grey;border-bottom:1px solid grey;padding:5px;\" src=\"$katalog/$img_los2[$img_poz2]\"></a></td>"; } else {
header('Location: index.php'); }
}
}
public function top() {
while($files = $dir->read()) {
if($files != '.' && $files != '..') {
$fp = fopen("ranking/".$files, "r"); $nowefiles = substr($files, 0
, -4
); $tablica[$nowefiles] = $stareDane;
}
}
$liczba_pozycji = count($tablica);
foreach($top as $klucz => $wartosc) {
echo "<img style=\"background: white; border:1px solid grey;border-bottom:1px solid grey;padding:3px; margin: 1px;\" src=\"images/$klucz\" width=\"70\" title=\"Ocena: $wartosc\"/>"; }
}
public function ranking($nazwa_pliku) {
$fp = fopen("ranking/$nazwa_pliku.txt", "r"); return $stareDane;
}
}
?>
rate.php
<?php
if(isset($_GET['wygrana']) && isset($_GET['przegrana'])) { $wygrany = $_GET['wygrana'];
$przegrany = $_GET['przegrana'];
function wygrana($wynik) {
$fp = fopen("ranking/" . $wynik . ".txt", "r"); $noweDane = $stareDane + 10;
$fp = fopen("ranking/" . $wynik . ".txt", "w"); }
function przegrana($wynik2) {
$fp = fopen("ranking/" . $wynik2 . ".txt", "r"); $stareDane = fread($fp, filesize("ranking/" . $wynik2 . ".txt")); $noweDane = $stareDane + 1;
$fp = fopen("ranking/" . $wynik2 . ".txt", "w"); }
wygrana($wygrany);
przegrana($przegrany);
header("Location: index.php"); }
?>
index.php
<?php
include('bitwa.php');
$bitwa = new bitwa();
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-2">
<meta name="generator" content="PSPad editor, www.pspad.com">
<meta name="Author" content="Hubert Pasierb">
<title>FaceMash</title>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<center>
<table style="margin-top: 30px">
<tr> <?php $bitwa->pokaz_bitwe(); ?> </tr>
<tr>
<td align="center"><b>Ocena:
<?php echo $bitwa->ranking($bitwa->zdjecie1); ?></b></td>
<td align="center"><b>Ocena:
<?php echo $bitwa->ranking($bitwa->zdjecie2); ?></b></td>
</tr>
<tr>
<td colspan="2" align="center"><?php $bitwa->top(); ?></td>
</tr>
<tr>
<td align="center" colspan="2">© 2011 Hubert Pasierb</td>
</tr>
</table>
</center>
</body>
</html>
<?php
?>