Sendeplan

  • geschlossen

  • cruelfantasy
  • 822 Aufrufe 5 Antworten

Diese Seite verwendet Cookies. Durch die Nutzung unserer Seite erklären Sie sich damit einverstanden, dass wir Cookies setzen. Weitere Informationen

  • Hallo
    Ich habe da ein Problem mit einer login.php

    ich erhalte immer die Fehlermeldung in zeile 64, wenn ich mich einlogge, in den Adminbereich.

    PHP-Quellcode

    1. include("".$section.".php");



    Name: admin
    Passwort: admin

    Ich habe das Script mal auf einen [I]Testserver installiert, wo es sich jeder anschauen kann.[/I]

    PHP-Quellcode

    1. <?php
    2. if (isset($_GET['section'])) {
    3. $section = $_GET['section'];
    4. }
    5. if (!isset($section)) {
    6. $section = "";
    7. }
    8. if (isset($_GET['option'])) {
    9. $option = $_GET['option'];
    10. }
    11. if (!isset($option)) {
    12. $option = "";
    13. }
    14. if(isset($option) && ($option == "logout")) {
    15. @session_register("user");
    16. @session_register("password");
    17. session_unregister("S_ID");
    18. session_unset();
    19. }
    20. if(isset($_POST['submit']) && "Log" == $_POST['submit']) {
    21. $sql = "SELECT * FROM users WHERE user = '".$_POST['user']."'";
    22. $result = mysql_query($sql) OR die(mysql_error());
    23. $row = mysql_fetch_assoc($result);
    24. $userID = $row['id'];
    25. $pw = $_POST['password'];
    26. if(isset($userID,$pw) AND login_right(addslashes($userID),addslashes($pw))) {
    27. }
    28. }
    29. if(isset($_SESSION['S_ID']) && ($_SESSION['S_ID'] != "")) {
    30. $rights = getRights();
    31. if(!in_array("Moderator", $rights)) {
    32. no_rights();
    33. }
    34. else {
    35. echo "<table align='center' width='800' cellpadding='0' cellspacing='0'>
    36. <tr>
    37. <td width='200' valign='top'><font color='white' size=1 face='arial,tahoma'>
    38. <br>:: <a href=?section=edit>Sendeplan bearbeiten</a>
    39. <br>:: <a href=?section=del>Sendeplan leeren</a>
    40. <br>:: <a href=?section=madd>Modaccount erstellen</a>
    41. <br>:: <a href=?section=mdel>Modaccount l&ouml;schen</a>
    42. <br>
    43. <br>:: <a href=?option=logout>Logout</a></td>
    44. <td width='600' valign='top'>";
    45. if(isset($section)) {
    46. include("".$section.".php");
    47. }
    48. echo "</td>
    49. </tr>
    50. </table>";
    51. }
    52. }
    53. else {
    54. echo "<br><br>
    55. <form action='show.php' method='post'>
    56. <table align='center' width='400' cellpadding='0' cellspacing='0'>
    57. <tr>
    58. <td width='75'>$font <b>N</b>ame:</td>
    59. <td width='150'><input type='text' name='user' value=''></input></td>
    60. </tr>
    61. <tr>
    62. <td width='75'>$font <b>P</b>asswort:</td>
    63. <td width='150'><input type='password' name='password' value=''></input></td>
    64. </tr>
    65. <tr>
    66. <td colspan='2'><br></td>
    67. </tr>
    68. <tr>
    69. <td colspan='2'><input type='submit' name='submit' value='Log'></input></td>
    70. </tr>
    71. </table></form>";
    72. }
    73. ?>
    Alles anzeigen


    Ich wäre dankbar, wenn mir einer helfen könnte.
    [SIZE=1]Meine Up Appz:[/SIZE] [SIZE=1]UP1, UP2 , UP3, UP4, UP5, UP6, UP7, UP8, UP9, UP10, UP11, UP12, UP13, UP14, UP15, UP16, UP17, UP18, UP19, UP20, UP21, UP22, UP23, UP24, UP25, UP26, UP27, UP28, UP29, UP30, UP31, UP32, UP33, UP34, UP35, UP36, UP37, UP38, UP39, UP40, UP41, UP42, UP43, UP44, UP45, UP46, UP47, UP48, UP49, UP50, UP51, UP52 [/SIZE]
    DER GESCMACK IST ALLEN MENSCHEN NATÜRLICH; SIE HABEN IHN ABER NICHT ALLE IN GLEICHEM MAßE.

    Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von cruelfantasy ()

  • Hallo cruelfantasy,

    ohne mir den ganzen Code jetzt genauer angeschaut zu haben, beantworte ich gleich direkt deine Frage.

    Quellcode

    1. Warning: include(.php) [function.include]: failed to open stream: No such file or directory in /var/www/user/tomcat.xail.net/plan/login.php on line 64


    Diese Fehlermeldung kommt daher, dass du die Datei ".php" einbinden willst, die vermutlich nicht existiert. Dass die Datei eingebunden werden soll, liegt daran, dass $_GET['section'] und damit auch $section nicht gesetzt ist.

    cruelfantasy schrieb:


    PHP-Quellcode

    1. if (!isset($section)) {
    2. $section = "";
    3. }



    Hiermit setzt du aber $section auf "", initialisierst die Variable also. Folglich ist sie bei folgender Abfrage auch vorhanden:

    cruelfantasy schrieb:


    PHP-Quellcode

    1. if(isset($section)) {
    2. include("".$section.".php");
    3. }



    Du solltest also nicht auf $section überprüfen, sondern ob $section == "" ist oder ob $_GET['section'] nicht gesetzt ist. Sicherer wäre es allerdings noch, zu prüfen, ob der per $_GET['section'] übergebene Wert überhaupt zulässig ist, das heißt, ob der Wert dem Namen einer Section entspricht. Trifft das nämlich nicht zu, gibt es wieder eine Fehlermeldung, dass die Datei "abc.php" nicht existiert, wobei "abc" für den Wert steht, der per GET übergeben wurde.

    Ich hoffe, ich konnte dir etwas helfen.

    Viele Grüße

    underattack
  • PHP-Quellcode

    1. if (isset($_GET['section'])) {
    2. $section = $_GET['section'];
    3. }
    4. if (!isset($section)) {
    5. $section = "";
    6. }
    7. //$section ist auf jedenfall gesetzt
    8. //bei mir hat die isset() methode bei localen variablen nie zufalässig funktioniert. besser wäre hier die empty() methode
    9. ...
    10. .....
    11. if(isset($section)) {
    12. include("".$section.".php"); // wenn nun der 2. fall von der obigen abfrage eingetreten ist,
    13. //ist $session == "" ==> der 2. fehler
    14. }
    15. echo "</td>
    Alles anzeigen

    besser wäre da

    PHP-Quellcode

    1. if (isset($_GET['section'])) {
    2. $section = $_GET['section'];
    3. }
    4. else{
    5. $section = "";
    6. }
    7. .....
    8. .....
    9. if(!empty($section)){
    10. include($session.'.php')
    11. }
    Alles anzeigen
  • Habe das Problem gelöst, und habe einfach eine leere .php datei in den ordner geschoben, und schon läuft das Ding.

    Trotzdem, VIELEN DANK FÜR EUERE HILFE. :bing:
    [SIZE=1]Meine Up Appz:[/SIZE] [SIZE=1]UP1, UP2 , UP3, UP4, UP5, UP6, UP7, UP8, UP9, UP10, UP11, UP12, UP13, UP14, UP15, UP16, UP17, UP18, UP19, UP20, UP21, UP22, UP23, UP24, UP25, UP26, UP27, UP28, UP29, UP30, UP31, UP32, UP33, UP34, UP35, UP36, UP37, UP38, UP39, UP40, UP41, UP42, UP43, UP44, UP45, UP46, UP47, UP48, UP49, UP50, UP51, UP52 [/SIZE]
    DER GESCMACK IST ALLEN MENSCHEN NATÜRLICH; SIE HABEN IHN ABER NICHT ALLE IN GLEICHEM MAßE.