Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP] Jak narzucić strefę czasową?
Mishczu
post
Post #1





Grupa: Zarejestrowani
Postów: 20
Pomógł: 0
Dołączył: 6.04.2010

Ostrzeżenie: (0%)
-----


Witam! Mam prosty system newsów i stronę na zagranicznym hostingu. Formularz dodaje do bazy automatycznie datę, ale niestety tą z z serwera.
Czy można gdzieś dodać linijkę ustawiającą Polską strefę czasową?

Ten post edytował Mishczu 5.05.2010, 11:34:22
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
Mishczu
post
Post #2





Grupa: Zarejestrowani
Postów: 20
Pomógł: 0
Dołączył: 6.04.2010

Ostrzeżenie: (0%)
-----


Proszę, to jest ten skrypt, który dodaje formularz. Sam formularz wyciąłem.


  1. <?php
  2.  
  3. while(list($klucz, $wart) = each($_POST)) {
  4. eval("\$".$klucz."='".addslashes(stripslashes($wart))."';\n");
  5. }
  6.  
  7. include("config.php");
  8.  
  9. $db = mysql_connect($db_host, $db_user, $db_password);
  10.  
  11. function news_form(){
  12. print '<form name="sign_news_form" method="post" action="">///formularz///
  13. </form>';
  14.  
  15. global $news_error;
  16.  
  17. if ($news_error)
  18. echo "All fields are required!";
  19.  
  20. }
  21.  
  22. function new_news(){
  23.  
  24. global $db_host, $db_user, $db_password, $db_name, $rodzaj, $platforma, $serwer, $skill, $gg, $www, $vsvs, $info, $date;
  25.  
  26. $rodzaj = addslashes(stripslashes($rodzaj));
  27. $platforma = addslashes(stripslashes($platforma));
  28. $serwer = addslashes(stripslashes($serwer));
  29. $skill = addslashes(stripslashes($skill));
  30. $www = addslashes(stripslashes($www));
  31. $vsvs = addslashes(stripslashes($vsvs));
  32. $info = addslashes(stripslashes($info));
  33. $date = date("d-m-Y, H:i");
  34.  
  35.  
  36. $db = mysql_connect($db_host, $db_user, $db_password);
  37. if ($db == FALSE)
  38. die ("Errore Connecting database.");
  39.  
  40. mysql_select_db($db_name, $db)
  41. or die ("Error selecting database");
  42.  
  43. $query = "INSERT INTO rtnews (_rodzaj, _platforma, _date, _serwer, _skill, _gg, _www, _vsvs, _info) VALUES ('$rodzaj', '$platforma', '$date','$serwer','$skill','$gg', '$www', '$vsvs', '$info')";
  44.  
  45. if (!mysql_query($query, $db))
  46. die ("Error inserting entry in db");
  47.  
  48. echo ("Formularz dodany. Dziękujemy! Wejdz na <A HREF=\"lista.php\">listę</A>, aby zobaczyć.");
  49.  
  50. }
  51.  
  52. {
  53. if($write_news)
  54. if ($rodzaj!= "" && $platforma != "" && $serwer != "" && $gg != "")
  55. new_news();
  56. else
  57. $news_error = true;
  58. news_form();
  59.  
  60.  
  61. }
  62.  
  63. ?>

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: 13.10.2025 - 09:12