Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [php][mysql] Problem z logowaniem
Forum PHP.pl > Forum > Przedszkole
wbijok
Witam,
Mam proste logowanie z użyciem php,mysql. Wcześniej to logowanie działało mi na WampServer i ogólnie na wykonanych stronach. Po formacie zainstalowałem WS 2.0i z php 5.3.0; mysql 5.1.36 i apache 2.2.11 i niestety podczas wykonywanie skryptu wysypuje się Apache. Link do printscreena: http://img697.imageshack.us/img697/1830/apachez.png
Ma ktoś pomysł co jest nie tak?

logowanie.php:
  1. <?php
  2. require_once('./config.php'); // załaczamy plik config.php
  3.  
  4. function usun($data){
  5.  
  6. GLOBAL $dbc;
  7. if (ini_get('magic_quotes_gpc')){
  8. $data = stripslashes($data);
  9. }
  10. return mysql_real_escape_string($data, $dbc);
  11. }
  12. if (isset($_POST['submit'])){
  13.  
  14. if (empty($_POST['login'])){
  15. $message .= '<font class="blad">Nie podałeś loginu</font><br />';
  16. $l = FALSE;
  17. }else{
  18. $l = usun($_POST['login']);
  19. }
  20.  
  21. if (empty($_POST['haslo'])){
  22. $message .= '<font class="blad">Nie podałeś hasła</font><br />';
  23. $h = FALSE;
  24. }else{
  25. $h = usun($_POST['haslo']);
  26. }
  27. if ( $l && $h ){
  28.  
  29. $query = "SELECT username, access, user_id FROM lwow_user WHERE username='$l' AND haslo=password('$h')";
  30. $result = mysql_query($query);
  31. $row = mysql_fetch_array ($result, MYSQL_ASSOC);
  32. if($row){
  33. $_SESSION['username'] = $row['username'];
  34. $_SESSION['access'] = $row['access'];
  35. $_SESSION['user_id'] = $row['user_id'];
  36. $_GET['cmd'] = 'ok';
  37. header ("Location: panel.php"); // przekierowuje nas na jaka strone chcemy
  38. }else{
  39. $message .= '<font class="blad">Błędne hasło lub login</font><br />';
  40. }
  41. }else{
  42. $message .= '<font class="blad">Spróbuj jeszcze raz</font>';
  43. }
  44. }
  45. ?>
  46.  
  47. <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
  48. <table align="center" border="0">
  49. <tr>
  50. <td align="right" class="uni_01">Login:</td>
  51. <td><input type="text" name="login" size="30"></td>
  52. </tr>
  53. <tr>
  54. <td align="right" class="uni_01">hasło:</td>
  55. <td><input type="password" name="haslo" size="30"></td>
  56. </tr>
  57. <tr>
  58. <td align="right" class="uni_01"> </td>
  59. <td>
  60. <p align="center"><input style="font-weight: bold;" type="submit" name="submit" value="loguj">
  61. </td></tr>
  62. </table>
  63. </form>
  64.  
  65. <div align="center">
  66. <?php if(isset($message)){
  67. echo $message;
  68. }
  69. ?>
  70. </div>


a dalej plik panel.php:
  1. <?php
  2.  
  3. if(($_SESSION['access'] != 'admin')){
  4. @header ("Location: login.php");
  5. }
  6. ...
  7. ?>


athei
Kliknij LPM na ikonę WampServer w trayu, wybierz Apache i Apache error.log i access.log i zobacz czy tam nie ma czegoś ciekawego.
wbijok
niestety nic nie ma:

[Tue Jan 12 00:08:13 2010] [notice] Apache/2.2.11 (Win32) PHP/5.3.0 configured -- resuming normal operations
[Tue Jan 12 00:08:13 2010] [notice] Server built: Dec 10 2008 00:10:06
[Tue Jan 12 00:08:13 2010] [notice] Parent: Created child process 2708
[Tue Jan 12 00:08:13 2010] [notice] Child 2708: Child process is running
[Tue Jan 12 00:08:13 2010] [notice] Child 2708: Acquired the start mutex.
[Tue Jan 12 00:08:13 2010] [notice] Child 2708: Starting 64 worker threads.
[Tue Jan 12 00:08:13 2010] [notice] Child 2708: Starting thread to listen on port 80.
[Tue Jan 12 00:08:27 2010] [notice] Parent: child process exited with status 3221225477 -- Restarting.
[Tue Jan 12 00:08:28 2010] [notice] Apache/2.2.11 (Win32) PHP/5.3.0 configured -- resuming normal operations
[Tue Jan 12 00:08:28 2010] [notice] Server built: Dec 10 2008 00:10:06
[Tue Jan 12 00:08:28 2010] [notice] Parent: Created child process 2420
[Tue Jan 12 00:08:28 2010] [notice] Child 2420: Child process is running
[Tue Jan 12 00:08:28 2010] [notice] Child 2420: Acquired the start mutex.
[Tue Jan 12 00:08:28 2010] [notice] Child 2420: Starting 64 worker threads.
[Tue Jan 12 00:08:28 2010] [notice] Child 2420: Starting thread to listen on port 80.

oraz access.log
127.0.0.1 - - [12/Jan/2010:00:08:16 +0100] "GET /CMS/lwow/1/login.php HTTP/1.1" 200 666
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.