Witam!

Dzisiaj zbudowałem sobie tokena. Prosty nie wiem czy skuteczny - dla mnie wystarczy. Ponizej przedstawiam tylko kod tokena, zamknięty w funkcji. Niestety jak dołączam go poprzez require_once używany przeze mnie szablon rozkleja się. Niestety nie wiem dlaczego. Proszę o pomoc.

Wygląd po dołączeniem i wygląd przed dołączeniem.

CODE

<?php
function formularz_ksiegi(){

session_start();

//****************************************//
//*******USTAWIANIE OBRAZKA TOKENA********//
//****************************************//


$_SESSION['token'] = '';

$obrazek[1] = 'A';
$obrazek[2] = 'D';
$obrazek[3] = 'C';
$obrazek[4] = 'O';
$obrazek[5] = 'Y';
$obrazek[6] = 'E';
$obrazek[7] = 'W';
$obrazek[8] = 'b';
$obrazek[9] = 'L';


//-------------------------------------------
//PIERWSZA LICZBA

$control = mt_rand(0,1);
if($control == 0){
$liczba = rand(0,14);
$_SESSION['token'] .= $liczba;
$img= '<img src="design/token/'.$liczba.'.gif" />';

}

if($control == 1){

$liczba = rand(1,9);
$_SESSION['token'] .= $obrazek[$liczba];
$img= '<img src="design/token/'.$obrazek[$liczba].'.gif" />';

}

//-------------------------------------------
//DRUGA LICZBA

$control = mt_rand(0,1);
if($control == 0){

$liczba = rand(0,14);
$_SESSION['token'] .= $liczba;
$img .= '<img src="design/token/'.$liczba.'.gif" />';

}

if($control == 1){

$liczba = rand(1,9);
$_SESSION['token'] .= $obrazek[$liczba];
$img .= '<img src="design/token/'.$obrazek[$liczba].'.gif" />';

}

//-------------------------------------------
//TRZECIA LICZBA

$control = mt_rand(0,1);
if($control == 1){

$liczba = rand(0,14);
$_SESSION['token'] .= $liczba;
$img .= '<img src="design/token/'.$liczba.'.gif" />';

}

if($control == 0){

$liczba = rand(1,9);
$_SESSION['token'] .= $obrazek[$liczba];
$img .= '<img src="design/token/'.$obrazek[$liczba].'.gif" />';

}

//-------------------------------------------
//CZWARTA LICZBA

$control = mt_rand(0,1);
if($control == 0){

$liczba = rand(0,14);
$_SESSION['token'] .= $liczba;
$img .= '<img src="design/token/'.$liczba.'.gif" />';

}

if($control == 1){

$liczba = rand(1,9);
$_SESSION['token'] .= $obrazek[$liczba];
$img .= '<img src="design/token/'.$obrazek[$liczba].'.gif" />';

}

//****************************************//
//*****************KONIEC*****************//
//****************************************//

?>


 <p align="left"><h2>Dodaj wpis do księgi gości</h2></p>
 <br>
 <form action="sprawdz.php" method="post">
 <table align="left">
 
 <tr><td>Twoje imię: </td> <td><input type="text" name="imie"></td></tr>
 
 <tr><td>Numer GG: </td> <td><input type="text" name="gg"></td></tr>
 
 <tr><td>Email: </td> <td><input type="text"name="email"></td></tr>
 
 <tr><td valign="top">Twoje imię:</td> <td><textarea name="tresc" ></textarea></td></tr>
 
 <tr><td>   </td> <td>   </td></tr>
 
 <tr><td>   </td> <td><?php echo $img; ?></td></tr>
 
 <tr><td> Kod weryfikacyjny:    </td> <td><input type="text" name="token"></td></tr>
 
 <tr><td>   </td> <td>   </td></tr>
 
 <tr><td>   </td> <td><input type="submit" value="Wyślij" id="przycisk"></td></tr>
 
 </table>
 
 </form>


<?php

}

?>