Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [PHP]Sesja root ?
sliwa007
post
Post #1





Grupa: Zarejestrowani
Postów: 69
Pomógł: 7
Dołączył: 18.08.2010
Skąd: Rzeszów

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


Witam,
Mam taki oto kod. Po zalogowniu zmienna $_SESSION['user'] => $login ale po odświeżeniu stony wartość zmiennej zmienia się na $_SESSION['user'] => root o co chodzi ?

  1. <?php
  2. if($_GET['action'] == 'logout') {
  3. header("location:index.php");
  4. }
  5. include('../db.php');
  6.  
  7. if(isset($_POST['log'])) {
  8.  
  9. $login = $_POST['login'];
  10. $password = sha1($_POST['password']);
  11.  
  12. $log = mysql_query("SELECT * FROM users WHERE login = '$login' AND password = '$password'");
  13. $log_row = mysql_num_rows($log);
  14. if($log_row == 1) {
  15. $_SESSION['user'] = $login;
  16. } else {
  17. echo 'Nieprawidłowy login lub hasło';
  18. }
  19. }
  20.  
  21. if(!isset($_SESSION['user'])) {
  22. ?>
  23. <form method="post" action="index.php">
  24. <input type="text" name="login"/>
  25. <input type="password" name="password"/>
  26. <input type="submit" name="log" value="Zaloguj"/>
  27. </form>
  28.  
  29.  
  30. <?php
  31. } else {
  32. include('modules/admin.php');
  33. print_r($_SESSION);
  34. }
Go to the top of the page
+Quote Post

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

 



RSS Aktualny czas: 21.08.2025 - 22:47