Witam
panowie mam taki skrypt i odpowiada mi on.
chcialbym go umiescic u mnie na stronie

na dysku wszystko dziala i loguje sie bez problemu

lecz po dodaniu skryptu na serwer nie dziala mi logowanie

tzn. wszystko sie otwiera ale przy logowaniu stoi w miejscu
czy napisze dobre haslo czy zle zawsze mam odpowiedz podaj halo
i nie moge wejsc do wpisywania ani usowania newsow...

podaje kod do skryptu i mam nadzieje ze ktos zobaczy gdzie jest blad...

admin.php
  1. <?
  2. require "config.php";
  3. echo "<HTML>
  4. <HEAD>
  5. <META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=$encoding">
  6. <title>Administracja sytemem newsów</TITLE>
  7. </HEAD>";
  8. $newsdata="newsdata.dat";
  9. $login_form="<center><b>Podaj hasło administratora</b><br><form method=post action=admin.php>hasło: <input type=password name=pass size=20><br>
  10. <input type=submit value=login></form><hr size=1 noshade>";
  11. $menu="<b>Menu:</b> | <a href="$main_url">strona główna</a> | <a href=admin.php?pass=$pass>administracja</a> | <a href=admin.php?action=delete&pass=$pass>usuń newsa</a> | <a href=admin.php?action=new&pass=$pass>dodaj newsa</a> |<br>";
  12.  
  13. if(!isset($action)) {
  14. $action="drawmenu";
  15. }
  16.  
  17. switch ($action) {
  18.  
  19.  
  20. case "delete":
  21. if($pass==$password)
  22. {
  23. echo "$menu<br>";
  24. $table=file($newsdata);
  25. $total=count($table);
  26. $size=(int)((filesize("$newsdata")+1023)/1024);
  27. if ($size==0) {
  28. $total=0;
  29. }
  30. echo "<b>Liczba wpisów w bazie:</b> $total<br> <b>Rozmiar bazy: </b>$size KB<br><hr size=1 noshade><br>";
  31. $table=file($newsdata);
  32. $total=count($table);
  33. $nr=1;
  34. for ($i=$total; $i >= 0; $i--)
  35. {
  36. $table[$i]=trim($table[$i]);
  37. if($table[$i]!="")
  38. {
  39. $text=str_replace("<img src=news/img/news_ico.gif align=bottom>", "", $table[$i]);
  40. echo "$nr. $text | <a href=admin.php?action=remove&id=$i&pass=$pass>usuń newsa</a>$spacer";
  41. $nr++;
  42. }
  43. }
  44. }
  45. else
  46. {
  47. echo "$login_form";
  48. }
  49. break;
  50.  
  51. case "new":
  52. if($pass==$password)
  53. {
  54. echo("$menu<br><p><b>Dodaj newsa</b></p><form method=POST action=admin.php?action=add>
  55. tytuł:<br><input type=text name=title size=30><br>
  56. tre¶ć:<br><textarea rows=5 name=newsbody cols=25></textarea><br>
  57. autor:<br><input type=text name=author size=20><br>
  58. email:<br><input type=text name=email size=20><br>
  59. <input type=submit value=dodaj>
  60. <input type=hidden name=pass value=$pass><br>
  61. </form><hr size=1 noshade>");
  62. }
  63. else
  64. {
  65. echo "$login_form";
  66. }
  67. break;
  68.  
  69. case "add":
  70. if($pass==$password)
  71. {
  72. $date=date("d-m-Y");
  73. $hour=date("H:i");
  74. if (eregi("8859-2", $encoding)) {
  75. $newsbody=ereg_replace("ˇ", "ˇ", $newsbody);
  76. $newsbody=ereg_replace("¦", "¦", $newsbody);
  77. $newsbody=ereg_replace("¬", "¬", $newsbody);
  78. $newsbody=ereg_replace("Ľ", "Ľ", $newsbody);
  79. $newsbody=ereg_replace("±", "±", $newsbody);
  80. $newsbody=ereg_replace("¶", "¶", $newsbody);
  81.  
  82. $title=ereg_replace("ˇ", "ˇ", $title);
  83. $title=ereg_replace("¦", "¦", $title);
  84. $title=ereg_replace("¬", "¬", $title);
  85. $title=ereg_replace("Ľ", "Ľ", $title);
  86. $title=ereg_replace("±", "±", $title);
  87. $title=ereg_replace("¶", "¶", $title);
  88. }
  89. $newsbody=stripslashes($newsbody);
  90. $newsbody=eregi_replace("n", "<br>", $newsbody);
  91. $title=stripslashes($title);
  92. $author=stripslashes($author);
  93. $data="<img src=$image align=bottom> <b>$title</b><br>$date $hour<br><br>$newsbody<p align=left><b>dodał:</b> <a href=mailto:$email>$author</a></p>n";
  94. $f=fopen($newsdata, "a");
  95. flock($f, "2");
  96. fputs($f, $data);
  97. flock($f, "3");
  98. fclose($f);
  99. echo "$menu<br><b>News został dodany</b>.";
  100. }
  101. else
  102. {
  103. echo "$login_form";
  104. }
  105. break;
  106.  
  107. case "remove":
  108. $table=file($newsdata);
  109. $total=count($table);
  110. $f=fopen($newsdata, "w");
  111. flock($f, "2");
  112. for ($i=0; $i <= $total; $i++)
  113. {
  114. if($i!=$id)
  115. {
  116. fputs($f, $table[$i]);
  117. }
  118. }
  119. flock($f, "3");
  120. fclose($f);
  121. echo "$menu<br><b>Usunięto.</b>";
  122. break;
  123.  
  124. case "drawmenu":
  125. if($pass==$password)
  126. {
  127. echo "$menu<br>";
  128. $table=file($newsdata);
  129. $total=count($table);
  130. $size=(int)((filesize("$newsdata")+1023)/1024);
  131. if ($size==0) {
  132. $total=0;
  133. }
  134. echo "<b>Liczba wpisów w bazie:</b> $total<br> <b>Rozmiar bazy: </b>$size KB<hr size=1 noshade><br>";
  135. }
  136. else
  137. {
  138. echo "$login_form";
  139.  
  140. }
  141. break;
  142. }
  143. ?>



prosze o pomoc lub o kontakt na GG: 976879

dziekuje i pozdrawiam
Marcin