czesc mam problem probowalem przerobc kod tokena ktory jest napisany na klasach i chodzi na funckje wiec mam 3 pliki
funkcje_tokena.php
<?php
function Sesja_tokena() {
$token = $_SESSION['randtoken'];
}
function Generuj_token() {
$RandNumber = rand(1
,1000
); $token = substr(md5($RandNumber), 0
,6
); $_SESSION['randtoken'] = $token;
}
function Zwroc_token() {
return $token;
}
function Resetuj() {
$_SESSION['randtoken'] = \"\";
$token = \"\";
}
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, $token, $text);
header(\"Content-type: image/png\"); imagepng($image);
imagedestroy($image);
}
}
?>
potem token.php
<?php
include('funkcje_tokena.php');
Sesja_tokena($token);
Zrob_obrazek_tokena($token);
?>
i strone na ktora ma wyswietlic tokena wys_token.php
<?php
include('funkcje_tokena.php');
Generuj_token($token);
Zwroc_token();
?>
<html>
<head><meta http-equiv="content-type" charset="utf-8" /></head>
<body>
<form method="post" action="wys_token.php" />
<table>
<tr><td width="80"><img src="token.php"></td><td><input type="text" name="token" /></td></tr>
</table>
</form>
</body>
</html>
nie wywala zadnego bledy ale zamiast obrazka jest nom wiecie jak sie obrazek nie wysweitli taka chodzby karta i nie wiem co jest zle (IMG:
http://forum.php.pl/style_emoticons/default/sad.gif)
Ten post edytował marcio 1.10.2007, 16:18:58