Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [html/php] Walidacja vs <meta http-equiv='Refresh' content='
Jarod
post
Post #1





Grupa: Zarejestrowani
Postów: 1 190
Pomógł: 27
Dołączył: 23.04.2005

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


Mam następujący problem. Potrzebuję w skrypcie przekierować użytkownika na jakąś stronę. Jeśli mogę to używam header.

Ale czasami potrzebuję przekierować po upływie np 3 sekund. W tym celu zastosowałem coś takiego:

Kod
<meta http-equiv='Refresh' content='3; url=index.php' />


Niestety walidator się pluje;
Cytat
Line 21 column 481: document type does not allow element "meta" here.

...='Refresh' content='3; url=index.php' />

The element named above was found in a context where it is not allowed. This could mean that you have incorrectly nested elements -- such as a "style" element in the "body" section instead of inside "head" -- or two elements that overlap (which is not allowed).

One common cause for this error is the use of XHTML syntax in HTML documents. Due to HTML's rules of implicitly closed elements, this error can create cascading effects. For instance, using XHTML's "self-closing" tags for "meta" and "link" in the "head" section of a HTML document may cause the parser to infer the end of the "head" section and the beginning of the "body" section (where "link" and "meta" are not allowed; hence the reported error).


Jak obejść ten problem?
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
Jarod
post
Post #2





Grupa: Zarejestrowani
Postów: 1 190
Pomógł: 27
Dołączył: 23.04.2005

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


  1. <?php
  2. session_name('tb');
  3. include 'config.inc.php';
  4. ?>
  5.  
  6. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  7. <html xmlns="http://www.w3.org/1999/xhtml" lang="pl" xml:lang="pl">
  8.  
  9. <head> 
  10. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2" />
  11. <meta http-equiv="Content-language" content="pl" />
  12. <meta name="Robots" content="all" />
  13. <meta name="Pragma" content="no-cache" />
  14. <meta name="Cache-Control" content="no-store, no-cache, must-revalidate" />
  15.  
  16.  
  17. <!-- dołączenie styli głównych -->
  18. <link rel="stylesheet" href="../css/autoryzacja.css" type="text/css" />
  19. </head>
  20. <body>
  21.  
  22. <?php
  23.  
  24. //$kontoId - numer ID użytkownika, któremu aktualizujemy hasło
  25. //$stareHaslo  - stare hasło, które użytkownik podał w formularzu
  26. //$noweHaslo, $noweHaslo2 - nowe hasła, które użytkownik podał w formularzu
  27. //$hasloBaza - dotychczasowe hasło użytkownika (pobrane z bazy)
  28.  
  29. //Połączenie z bazą danych
  30. $conn = mysql_connect($server, $identyfikator, $haslo)
  31. or die ('Nie udało się połączyć z bazą danych!');
  32. //Wybór bazy danych
  33. or die ('Nie udało się wybrać bazy!');
  34.  
  35. if ( ($_POST['hasloBaza'] == SHA1($_POST['stareHaslo'])) &&
  36.  ($_POST['noweHaslo'] == $_POST['noweHaslo2']) &&
  37.  ($_POST['noweHaslo'] != $_POST['stareHaslo']) &&
  38.  ( !empty($_POST['noweHaslo'])) )
  39. {
  40. //Zapytanie o dane użytkownika
  41. $query = 'UPDATE konto SET haslo=''.SHA1($_POST['noweHaslo']).'', waznosc=1 WHERE konto_id='.$_POST['kontoId'];
  42. $result = mysql_query($query)
  43. or die ('Zapytanie nieudane!');
  44. $query_data = mysql_fetch_row($result);
  45.  
  46. echo '<div class="ostrzezenie" style="margin: 160px auto; padding: 30px 0; font-size: 12px; font-weight: bold; color: #FF9C12; background-color: #FFFFFF; border: 1px #FF9C12 solid;">Hasło zostało zmienione...</div>';
  47. echo '<meta http-equiv="Refresh" content="3; url=index.php" />';
  48. }
  49. else
  50. {
  51. echo '<div id="log" style="padding: 10px; background-color: #FFFFFF; width: 550px; height: 85px;">';
  52. echo '<img style="float: left; margin: 0 0 0 30px;" src="../img/stop.gif" width="83px" height="83px" alt="Stop" name="Stop" border="0" />';
  53.  
  54. echo '<div class="ostrzezenie" style="margin: 25px 0 0 25px; padding: 10px; width: 380px; text-align: center; font-size: 11px; font-weight: bold; float: left;" >';
  55.  
  56. if ( $_POST['hasloBaza'] != SHA1($_POST['stareHaslo']) ) echo 'Stare hasło jest nieprawidłowe !';
  57. else if ( $_POST['noweHaslo'] != $_POST['noweHaslo2'] ) echo 'Wprowadzono dwa różne hasła !';
  58. else if ( $_POST['noweHaslo'] == $_POST['stareHaslo'] ) echo 'Nowe hasło nie może być takie samo jak stare !';
  59. else if ( empty($_POST['noweHaslo']) ) echo 'Nie wprowadziłeś nowego hasła !';
  60.  
  61. echo '</div>';
  62. echo '</div>';
  63. echo '<meta http-equiv="Refresh" content="3; url=index.php" />';
  64. }
  65. ?>
  66.  
  67. </body>
  68. </html>
  69.  
  70. <?php
  71. ?>
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 - 12:02