function control_click(click_, url, vote) { childW = window.open(url,'childW','width=980, heigth=1000, status=no, scrollbars=yes, resizable=yes, location=yes, dependent=yes'); cur_click = click_; if(vote==1 || vote==2 || vote==3) { frm = 0; setTimeout(\"while_loading();\",100); } } function while_loading() { var bocik = '123456789012345678901234567890'; if(!childW.closed) {//window.closed frm =frm+1; setTimeout('while_loading();',100); } else { if(frm<40) { alert('Musisz zagłosować i zaczekać aż strona ci się załaduje.'); } else { var bocik = '".$_SESSION['voter']."'; document.location = \"vote.php?glos=\"+cur_click+\"&bot=\"+bocik; } } } "; if (isset($_GET['glos'])) { if (!ereg("^[1-9][0-9]*$", $_GET['glos'])) error("Wpisz cyfrę"); if (empty($_GET['bot'])) error("Nie oszukuj"); $_GET['bot'] = strip_tags($_GET['bot']); if (strlen($_GET['bot']) != 32) error("Nie oszukuj"); if ($_GET['bot'] != $_SESSION['voter']) error("Nie oszukuj"); $arrvotes = array(1,2,3,4,5,6,7,8,9,10,11); if (!in_array($_GET['glos'],$arrvotes)) error("Nie ma takiej toplisty"); $vote = $db -> EXECUTE("SELECT id FROM votes WHERE owner=".$player -> id." AND vote_id=".$_GET['glos']." LIMIT 1"); if (!$vote -> fields['id']) { $db -> EXECUTE("UPDATE players SET energy=energy+".$gain_energy." WHERE id=".$player -> id." LIMIT 1"); $db -> EXECUTE("INSERT INTO votes (owner,vote_id) VALUES (".$player -> id.",".$_GET['glos'].")"); print 'Głosowaleś, otrzymujesz '.$gain_energy.' energii. Dziękujemy!Wróć'; unset($_SESSION['voter']); header("LOCATION:vote.php"); exit; } else print 'Już głosowałeś na tę toplistę dziękujemy za promocję gry mimo wszystko :) Wróć'; $vote -> Close(); unset($_SESSION['voter']); header("LOCATION:vote.php"); exit; } else { $i = 1; while ($i < 4) { $topka = $db -> EXECUTE("SELECT * FROM votes WHERE owner=".$player -> id." AND vote_id=".$i." LIMIT 1"); if (!$topka -> fields['id'] && $i == 1) print "

"; if (!$topka -> fields['id'] && $i == 2) print "

"; if (!$topka -> fields['id'] && $i == 3) print "

"; $topka -> Close(); $i = $i + 1; } } ?>