chizijs Posted March 29, 2010 Report Share Posted March 29, 2010 Kāpēc $maxlogin_time; visu laiku rada 300? $_SESSION['blocked_time'] = time()+60*5; if(isset($_SESSION['blocked_time'])){ if($_SESSION['blocked_time'] == time()){ $_SESSION['blocked_time'] = 0; $_SESSION['maxlogins'] = 0; }else{ $maxlogin_time = time()-$_SESSION['blocked_time']; echo $maxlogin_time; ?> <center><font color="red">Mēģiniet vēlreiz pēc <?php echo date("m.s",$maxlogin_time); ?></font></center> <?php } } ?> Link to comment Share on other sites More sharing options...
briedis Posted March 29, 2010 Report Share Posted March 29, 2010 $_SESSION['blocked_time'] = time()+60*5; $maxlogin_time = time()-$_SESSION['blocked_time']; Link to comment Share on other sites More sharing options...
chizijs Posted March 29, 2010 Author Report Share Posted March 29, 2010 Ar ko tad atšķiras? ^^ Link to comment Share on other sites More sharing options...
briedis Posted March 29, 2010 Report Share Posted March 29, 2010 Ar ko tad atšķiras? ^^ Es tev tikai norādīju vietu, kur skatīties. Nu padomā loģiski, kāpēc lai tur nebūtu visu laiku 300, ja tu viņu uzliec uz 300. Link to comment Share on other sites More sharing options...
2easy Posted March 29, 2010 Report Share Posted March 29, 2010 (edited) aizej skolā uz kādu matemātikas stundu: time()+60*5 - time() = 60*5 = 300 lol, tomēr nē vnk nomaini nosacījumu ;) if ($_SESSION['blocked_time'] >= time()) ... Edited March 29, 2010 by 2easy Link to comment Share on other sites More sharing options...
chizijs Posted March 29, 2010 Author Report Share Posted March 29, 2010 (edited) Nu bet man to $_SESSION['blocked_time']; tikai 1 reizi saglabā :D man vajag lai šeit sak skaitīt no 5min, bet man otradāk viņš pieaug Mēģiniet vēlreiz pēc <?php echo date("m.s",$maxlogin_time); ?> Edited March 29, 2010 by chizijs Link to comment Share on other sites More sharing options...
briedis Posted March 29, 2010 Report Share Posted March 29, 2010 (edited) Eh, lūdzu, iemācies tab'ulēt kodu. <? $_SESSION['blocked_time'] = time()+60*5; if(isset($_SESSION['blocked_time'])){ if($_SESSION['blocked_time'] == time()){ $_SESSION['blocked_time'] = 0; $_SESSION['maxlogins'] = 0; }else{ $maxlogin_time = time()-$_SESSION['blocked_time']; echo $maxlogin_time; ?> <center><font color="red">Mēģiniet vēlreiz pēc <?php echo date("m.s",$maxlogin_time); ?></font></center> <? } } ?> Kā redzi, maxlogin tiek rēķināt no session blocked time, bet tas session blocket time tiek vienmēr uzstādīts pašā sākumā uz time()+300. Kādu tad rezultātu ceri sagaidīt, godīgi? :) Edited March 29, 2010 by briedis Link to comment Share on other sites More sharing options...
chizijs Posted March 29, 2010 Author Report Share Posted March 29, 2010 Vispār to blocked_time man aprēķina šita if($_SESSION['maxclicks'] == 5){ $_SESSION['blocked_time'] = time()+60*5; $_SESSION['maxclicks'] = 0; } Link to comment Share on other sites More sharing options...
2easy Posted March 29, 2010 Report Share Posted March 29, 2010 (edited) pirmais if ir bezjēdzīgs ;) (tajā sākotnējā kodā) nomaini tač $_SESSION['blocked_time'] == time() uz $_SESSION['blocked_time'] >= time() vai tu tiešām domā, ka useris uzklikos tieši precīzi tajā sekundē, kad beidzas timeout??? lol, turklāt date funkcijai ir jāpadod viss laiks, nevis starpība un vēl atlikušo laiku rēķina no lielākā atņemot mazāko, savādāk sanāk negatīva laika starpība! kr4 padomā, kad kodē... Edited March 29, 2010 by 2easy Link to comment Share on other sites More sharing options...
Recommended Posts