Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Skrypt działa na php 4.4.2 a na 4.4.1 juz nie ?
mariano
post
Post #1





Grupa: Zarejestrowani
Postów: 7
Pomógł: 0
Dołączył: 23.01.2006

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


Witam
Mam taki skrypt do logowana i na poprzednim serwerze (wersja php 4.4.2) bylo wszystko ok. zmienilem hosting i ten sam skrypt nie dziala pod wersja php 4.4.1. ponizej wklejam fragment skryptu i linijki w ktorych jest błąd. moze ktos wie jak to przeksztalcic zeby dzialalo pod wersja php 4.4.1 ?


  1. <?php
  2. ?>
  3. <?php
  4. $secret_word = "mleko";
  5. $user = $_POST['username'];
  6. $pass = $_POST['password'];
  7. if($user && $pass){
  8. if($user=='login' && $pass=='haslo'){
  9. setcookie('login',''.$user.','.md5($pass.$secret_word).'');
  10. header("Location: ./admin/index.php");
  11. }
  12. else {
  13. echo "<br/><h5>Podałeś nieprawidłową nazwę uzytkownika lub hasło.</h5>";
  14. }
  15. }
  16. ?>

poprawiam
---
nospor



błędy wyskakuja w linijce: setcookie i tej pozniej czyli header location.
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 6)
Sabistik
post
Post #2


Administrator wortalu


Grupa: Przyjaciele php.pl
Postów: 960
Pomógł: 39
Dołączył: 21.10.2003
Skąd: Kraków

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


No to moze bys podal te bledy....
Go to the top of the page
+Quote Post
mariano
post
Post #3





Grupa: Zarejestrowani
Postów: 7
Pomógł: 0
Dołączył: 23.01.2006

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


Warning: Cannot modify header information - headers already sent by (output started at /home/radomiak/public_html/login.php:1) in /home/radomiak/public_html/login.php on line 22

Warning: Cannot modify header information - headers already sent by (output started at /home/radomiak/public_html/login.php:1) in /home/radomiak/public_html/login.php on line 23

takie bledy
Go to the top of the page
+Quote Post
Sabistik
post
Post #4


Administrator wortalu


Grupa: Przyjaciele php.pl
Postów: 960
Pomógł: 39
Dołączył: 21.10.2003
Skąd: Kraków

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


Tyle razy to bylo.. uzywaj wyszikiwarki.
http://phppl.ezpublish.no/phppl/wortal/art...ch_programistow
http://wiki.php.pl/index.php/Cannot_add_he...ready_sent_by...

Ten post edytował Sabistik 23.01.2006, 12:09:38
Go to the top of the page
+Quote Post
mariano
post
Post #5





Grupa: Zarejestrowani
Postów: 7
Pomógł: 0
Dołączył: 23.01.2006

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


no ok, ale z tego co tam wyczytalem to wychodzi ze ja mam kod w porzadku ohmy.gif
Go to the top of the page
+Quote Post
Wave
post
Post #6





Grupa: Zarejestrowani
Postów: 332
Pomógł: 6
Dołączył: 13.01.2005

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


@Sabistik: nie widzisz że ma tam Output Buffering?
@mariano: Zmieniałeś może kodowanie pliku?
Go to the top of the page
+Quote Post
mariano
post
Post #7





Grupa: Zarejestrowani
Postów: 7
Pomógł: 0
Dołączył: 23.01.2006

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


nie.. wszystko zostalo tak jak bylo na starym serwerze

a moze cos jest nie tak w plku index.php panelu admina czyli tam gdzie jest stawione przkeirowanie w login.php.
tutaj poczatek kodu index.php w adminie :

  1. <?php
  2. unset($username);
  3. $secret_word = "mleko";
  4. if($_COOKIE['login']){
  5. list($c_username,$cookie_hash) = split(',',$_COOKIE['login']);
  6. if ((md5($c_username.$secret_word) == $cookie_hash)){
  7. header("Location: ../login.php");
  8. }
  9. }
  10. else {
  11. header("Location: ../login.php");
  12. }
  13. require_once '../config.inc.php';
  14. ?>


moze tu cos nie gra ?

Ten post edytował mariano 23.01.2006, 14:03:23
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: 19.08.2025 - 07:34