Hi everyone.
At the beginning i want to sorry for my english..
Ok so.. i have a problems with this ‘api’: [url]http://www.testy2k12.bugs3.com/
Firstly to have sure that everything is working right open this with Google Chrome. Enter login: janko and haslo(password): zaq123 then click “Rozpocznij test”
My problems is:
1st: this is the most important and i have no idea how to fix it, so if you refresh the page – timer (Czas: ) is reseting
2nd: timer is start counting down even if picture is still loading
I know that this ‘api’ is suck because of everything is doing in php and it would be much better if i do this in js but i’m new in webdeveloping and doing all that from the beginning in js would take me much much time which i dont have:/
I will be grateful for help.
Source code is:
in index.php when you just login as a ‘user’ :
if ($_SESSION[‘dostep’] == ‘user’)
{
$odpowiedzi[0]=0;
$_SESSION[‘odpowiedzi’]=$odpowiedzi;
$query = mysql_query(“SELECT id FROM pytania;”);
$i=0;
while ($rekord = mysql_fetch_assoc($query))
{
$zakres3[$i] = $rekord[‘id’];
$i++;
}
$query = mysql_query(“SELECT ilosc_pytan,ilosc_bledow FROM ustawienia WHERE id=’1′;”);
while ($rekord = mysql_fetch_assoc($query))
{
$ilosc_pytan = $rekord[‘ilosc_pytan’];
$ilosc_bledow = $rekord[‘ilosc_bledow’];
}
$ilosc_pytan_w_bazie=$i;
$tabelka=$zakres3;
shuffle($tabelka);
$tabelka = array_slice($tabelka, 0, $ilosc_pytan);
$_SESSION[‘tablica’]=$tabelka;
if ($ilosc_pytan_w_bazie < $ilosc_pytan)
{
$_SESSION[‘ilosc_pytan’]=$ilosc_pytan_w_bazie;
}
else
{
$_SESSION[‘ilosc_pytan’]=$ilosc_pytan;
}
$_SESSION[‘ilosc_bledow’]=$ilosc_bledow;
$i=0;
here i just preper session’s var which i will use in test.
And here you go file egzamin.php : [url]http://wrzucacz.pl/file/1171338838828/egzamin.php
I couldn’t post it here because of too long lenght