siemka chcialem sie zapytac co jest zle w mojej klasie do ksiegi gosci mam nadzieje ze ktos pomoze :D i z gory dzieki
<?php
session_start();
class Ksiega {
include('../config.php');
public $zmien;
public $ip;
public $nick;
public $message;
public function Wyswietl_form() {
echo('<html>\n
<head><meta http-equiv="content-type" charset="utf-8" /></head>\n<body>\n<h1>Ksiega gosci</h1>\n<form action="post" />\n<table widht="100%" bgcolor="#4E4E68" border="1" />\n<tr><td>Podaj nick :)<input type="text" name="Nick" /></td></tr>\n<tr><td>Wpisz wiadomosc<input type="text" name="message" /></td></tr>\n<tr><td width="80"><img src="token.php"></td><td><input type="text" name="token" /></td></tr>\n<tr><td align="right"><INPUT TYPE=image VALUE=submit src="buttons.php"/></td></tr>\n');
}
public function bbcode() {
$this->zmien = htmlspecialchars($this->zmien);
$this->zmien = preg_replace("#\[url=(.*?)?(.*?)\](.*?)\[/url\]#si", "<A HREF='\\2' TARGET='top'>\\3</A>", $this->zmien);
$this->zmien = str_replace(":D","<img src='obrazki/biggrin.gif' />", $this->zmien);
$this->zmien = str_replace(":)","<img src='obrazki/smile.gif' />", $this->zmien);
$this->zmien = str_replace(":(","<img src='obrazki/confused.gif' />", $this->zmien);
$this->zmien = str_replace(";p","<img src='obrazki/tongue.gif' />", $this->zmien);
$this->zmien = str_replace(":]","<img src='obrazki/cool.gif' />", $this->zmien);
$this->zmien = str_replace("[:","<img src='obrazki/bigrazz.gif' />", $this->zmien);
$this->zmien = str_replace("()","<img src='obrazki/wink.gif' />", $this->zmien);
$this->zmien = preg_replace("#\[i](.*?)[/i]#si", "<i>\\1</i>" $this->zmien);
$this->zmien = preg_replace("#\[b](.*?)[/b]#si", "<b>\\1</b>" $this->zmien);
$this->zmien = preg_replace("#\[ins](.*?)[/ins]#si", "<ins>\\1</ins>", $this->zmien);
$this->zmien = preg_replace("#\[small](.*?)[/small]#si", "<small>\\1</small>", $this->zmien);
$this->zmien = preg_replace("#\[big](.*?)[/big]#si", "<big>\\1</big>", $this->zmien);
return $this->zmien;
}
public function Date() {
$this->data = date('j/n/Y H:i:s;');
}
public function Dodaj_wpis() {
$this->ip = $_SERVER['REMOTE_ADRESS'];
$this->nick = htmlspecialchars($_POST['nick']);
$this->message = bbcode(htmlspecialchars($_POST['message']));
if($token->Zwroc_token() == $_POST['token'] && !empty($this->nick) && !empty($this->message)) {
$db = mysql_connect($this->pasy['host'], $this->pasy['login'], $this->pasy['haslo']);
$db->select_db($this->pasy['baza']);
if(!is_resource($this->db)) {
echo('Polaczenie z baza niemozliwe prosze sprobowac pozniej');
return;
}
$this->zapytanie = sprintf("insert into ksiega_gosci(nick,message,data,ip) values('%s', '%s','$this->data', '$this->ip')");
mysql_real_escape_string($this->nick, $this->db);
mysql_real_escape_string($this->message, $this->db);
$db->query($zapytanie) or die('Polaczenie nie mozliwe prosze sprobowac pozniej');
if($this->zapytanie) {
echo('<Br><center><h2>Dziekuje za wpis<Br></h2></center>');
else {
echo('Prosze wypelnic wszystkie pola');
}
else {
echo('Podaj wlasciy token');
$token->Resetuj();
}
}
}
}
public function Pokaz_ksiege() {
$db = mysql_connect($this->pasy['host'], $this->pasy['login'], $this->pasy['haslo']);
$db->select_db($this->['baza']);
if(!is_resource($this->db)) {
echo('Polaczenie z baza niemozliwe prosze sprobowac pozniej');
return;
}
$this->zapytanie('select nick,message,data from ksiega_gosci order by data desc')
$wynik = $db->query($zapytanie);
while($tab = $wynik->fetch_assoc()) {
echo('<tr><td>"Dodal: ".'$this->tab['nick'].'</td><td>"Dnia: ".'$this->tab['data'].'</td></tr>
<tr><td>'.$this->tab['message'].'</td></tr>\n</table>\n</form>\n</body>\n</html>\n');
}
class Token {
public $token
public function Sesja_tokena() {
$this->token = $_SESSION['randtoken'];
}
public function Generuj_token() {
$generuj_liczby = rand(1, 1000);
$this->token = substr(md5($generuj_liczby)0, 6);
$_SESSION['randtoken'] = $this->token;
}
public function Zwroc_token() {
return $this->token;
}
public function Resetuj() {
$_SESSION['randtoken'] = "";
$this->token = "";
}
public function Zrob_obrazek_tokena() {
header("Content-type: image/png");
$image = @imagecreate(100,20);
if($image) {
$background = imagecolorallocate($image, 0,0,0);
$text = imagecolorallocate($image, 255,255,235);
imagestring($image, 4, 25,5, $this->token, $text);
header("Content-type: image/png");
imagepng($image);
imagedestroy($image);
}
}
}
?>
nie wiem czemu nie dziala jesli ktos moze pomoc jakos mu sie odwdziecze