Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP]instrukcja switch
red9skull
post
Post #1





Grupa: Zarejestrowani
Postów: 157
Pomógł: 0
Dołączył: 11.07.2009
Skąd: root

Ostrzeżenie: (10%)
X----


  1. <?php
  2. include("mysql_connect.php");
  3.  
  4. $stats = mysql_query("select * from `konta` where `login` = '$login'"); // Pobieramy z bazy danych wszelkie informacje.
  5. $dane = mysql_fetch_array($stats);
  6.  
  7. $date = date('H:i:s');
  8. switch($dane['atak']) {
  9. case 1:
  10. $timestamp = strtotime(date("H:i:s", strtotime($date)) . " + 90 seconds");
  11. break;
  12. case 2:
  13. $timestamp = strtotime(date("H:i:s", strtotime($date)) . " + 120 seconds");
  14. break;
  15. case 3:
  16. $timestamp = strtotime(date("H:i:s", strtotime($date)) . " + 150 seconds");
  17. break;
  18. case 4:
  19. $timestamp = strtotime(date("H:i:s", strtotime($date)) . " + 180 seconds");
  20. break;
  21. case 5:
  22. $timestamp = strtotime(date("H:i:s", strtotime($date)) . " + 220 seconds");
  23. break;
  24. case 6:
  25. $timestamp = strtotime(date("H:i:s", strtotime($date)) . " + 250 seconds");
  26. break;
  27. case 7:
  28. $timestamp = strtotime(date("H:i:s", strtotime($date)) . " + 380 seconds");
  29. break;
  30. default:
  31. $timestamp = strtotime(date("H:i:s", strtotime($date)) . " + 666 seconds");
  32. break;
  33. }
  34. $expired = date('H:i:s', $timestamp);
  35.  
  36. $login = $_SESSION['login'];
  37. var_dump($dane['atak']);
  38. $czas = "UPDATE `konta` SET `czas` = '$expired' WHERE `login`='$login'";
  39. mysql_query($czas);
  40.  
  41. $szkolenie = "UPDATE `konta` SET `szkolenie` = '1' WHERE `login`='$login'";
  42. mysql_query($szkolenie);
  43.  
  44.  
  45. ?>


Czemu zmienna $timestamp zawsze przyjmuje defaultową wartość (666)?
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 3.10.2025 - 02:12