Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Headers o co chodzi?!
exman
post
Post #1





Grupa: Zarejestrowani
Postów: 30
Pomógł: 0
Dołączył: 13.11.2005
Skąd: opole

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


Witam!
Mam problem dotyczący nagłówków i sesji. Otórz zrobilem system logowania którego kod jest podany poniżej:
  1. <?
  2. header ("Expires: Thu, 17 May 2001 10:17:17 GMT");
  3. header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
  4. header ("Cache-Control: no-cache, must-revalidate");
  5. header ("Pragma: no-cache");
  6.  
  7.  
  8. if (!isset($_SESSION['SESSION'])) require ( "session_init.php");
  9.  
  10. if(isset($_SESSION['LOGGEDIN'])){
  11. if($_SESSION['LOGGEDIN'] != TRUE){
  12. header("Location: login.php");
  13.   exit;
  14. }
  15. }
  16. ?>
  17. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
  18. <html xmlns="http://www.w3.org/1999/xhtml">
  19.  
  20. <head>
  21.   <meta http-equiv="content-type" content="text/html;charset=utf-8" />
  22.   <meta name="generator" content="Adobe GoLive" />
  23.   <title>Admin Login</title>
  24.   <link href="admin.css" rel="stylesheet" type="text/css" media="all" />
  25. </head>
  26.  
  27. <body bgcolor="#ffffff">
  28. <?
  29.  
  30. require_once 'functions.php';
  31. if (!isset($_SESSION['SESSION'])) require ( "session_init.php");
  32. // echo "<B>".$_SESSION['LOGGEDIN']."</b>";
  33. if($_SESSION['LOGGEDIN'] == TRUE){
  34.   header("Location: index.php");
  35.   exit;
  36. }
  37. if($_POST[user] && $_POST[pass]){
  38.   $user=$_POST[user];
  39.   $pass=$_POST[pass];
  40.   
  41.   $sql = "SELECT * FROM users WHERE USR_name = '$user' AND USR_passwd = PASSWORD('$pass') ";
  42.   $wynik = query($sql);
  43.   
  44.   if(mysql_num_rows($wynik)==1){
  45.     $_SESSION['LOGGEDIN'] = TRUE;
  46.     $_SESSION['USERNAME'] = $user;
  47.     @header("Location: index.php");
  48.     exit;
  49.   }
  50.   else fail("Podano niewłaściwe dane!");
  51. }
  52. else fail("Proszę podać nazwę użytkownika i hasło.");
  53.  
  54. ?>
  55. <form method="POST" action="login.php" style="margin-top:50px">
  56.     <table width="324" border="0" cellspacing="3" cellpadding="0" align="center">
  57.      <tr>
  58.       <td width="152">
  59. Nazwa użytkownika:</td>
  60.       <td><input type="text" size="20" name="user" /></td>
  61.      </tr>
  62.      <tr>
  63.       <td width="152">
  64. Hasło:</td>
  65.       <td><input type="password" name="pass" size="20" /></td>
  66.      </tr>
  67.     </table>
  68.      <br>
  69.     <br>
  70. <center><input type="submit" value="zaloguj"/></center>
  71.  
  72. </body>
  73.  
  74. </html>

(IMG:http://forum.php.pl/uwaga.gif)
poprawiam
---
nospor


Gdy to wszystko testowalem lokalnie działało bezproblemowo. Po wrzuceniu tego na serwer zaczelo szales nieziemsko wywalająć mi masębłędów
Cytat
Cannot modify header information - headers already sent by (...)
session_start(): Cannot send session cookie - headers already sent by (...) (

Próbowałem już rzeczy typu ob_start() - ob_flush(), usówanie pustych znaków etc, nie wiem ale jakośnic nie chce działa. Prosze o pomoc jest to BARDZ ważne.
Z góry diękuję.
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
exman
post
Post #2





Grupa: Zarejestrowani
Postów: 30
Pomógł: 0
Dołączył: 13.11.2005
Skąd: opole

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


Też bym się nie przejmował, ale przeszkadza to (nie wiem czemu) w dalszej pracy skrypu nie przechodzi do panelu administracyjnego tylko wyświetla pustą strone :/
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: 15.10.2025 - 16:47