Simple Login Page ?

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

    • Werbung zur Unterstützung des Forums ( Bitte AddBlocker deaktivieren )

    • PHP-Quellcode

      1. <?php
      2. ob_start();
      3. session_start();
      4. $connection= mssql_pconnect("USER-PC\SQLEXPRESS","sa","pw");
      5. if(!$connection)
      6. die("Konnte keine Verbindung herstellen");
      7. mssql_select_db("ACCOUNT_DBF") or die("Could not find account database");
      8. echo '<title>Control Panel - Login</title>';
      9. if ( !(isset($_SESSION['user'])) )
      10. {
      11. echo '<form action="index.php" method="post">
      12. Username:
      13. <input name="username" type="text" size="15" />
      14. <br />
      15. Passwort:
      16. <input name="pass" type="password" size="15" />
      17. <br />
      18. <input name="submit" type="submit" value="Log in" />
      19. </form>
      20. <br />';
      21. echo 'Willkommen Gast! Bitte log dich ein.
      22. <br />
      23. Noch keinen Account?
      24. <a href="#">Klick Hier!</a>
      25. <br />';
      26. if ( isset($_POST['submit']) )
      27. {
      28. $username = $_POST['username'];
      29. $pass = $_POST['pass'];
      30. $md5pass = md5("kikugalanet" . $pass);
      31. $query = mssql_query("SELECT * FROM ACCOUNT_TBL WHERE account='$username'");
      32. if (mssql_num_rows($query) == 0)
      33. {
      34. echo '<font color="red">Falscher Username!</font>';
      35. mssql_close();
      36. }
      37. else
      38. {
      39. $getinfo = mssql_fetch_assoc($query);
      40. $serverpass = $getinfo['password'];
      41. if ($serverpass != $md5pass)
      42. {
      43. echo '<font color="red">Falsches Passwort!</font>';
      44. mssql_close();
      45. }
      46. else
      47. {
      48. $_SESSION['user'] = $username;
      49. mssql_close();
      50. }
      51. }
      52. }
      53. }
      54. else
      55. {
      56. mssql_close();
      57. echo '<font color="green">Willkommen ' . $_SESSION['user'] . '!</font>
      58. <br />
      59. <a href="logout.php">Log out.</a>';
      60. }
      61. ?>
      Alles anzeigen
    • [FONT="Comic Sans MS"][COLOR="Wheat"]Hey erstmal vielen dank...

      ich bekomme aber diese Errors

      Quellcode

      1. Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\xampp\htdocs\login\login.php:1) in C:\xampp\htdocs\login\login.php on line 3
      2. Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\login\login.php:1) in C:\xampp\htdocs\login\login.php on line 3


      und den Teil :

      PHP-Quellcode

      1. echo '<form action="index.php" method="post">
      2. Username:
      3. <input name="username" type="text" size="15" />
      4. <br />
      5. Passwort:
      6. <input name="pass" type="password" size="15" />
      7. <br />
      8. <input name="submit" type="submit" value="Log in" />
      9. </form>
      10. <br />';


      Verstehe ich nicht :*>[/COLOR][/FONT]

      E: und den Teil von Yannick versteh ich auch nicht ...

      sry Sql befehle + Ich = Fail :/
    • Dane;100568 schrieb:

      [FONT="Comic Sans MS"][COLOR="Wheat"]Hey erstmal vielen dank...

      ich bekomme aber diese Errors

      Quellcode

      1. Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\xampp\htdocs\login\login.php:1) in C:\xampp\htdocs\login\login.php on line 3
      2. Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\login\login.php:1) in C:\xampp\htdocs\login\login.php on line 3


      und den Teil :

      PHP-Quellcode

      1. echo '<form action="index.php" method="post">
      2. Username:
      3. <input name="username" type="text" size="15" />
      4. <br />
      5. Passwort:
      6. <input name="pass" type="password" size="15" />
      7. <br />
      8. <input name="submit" type="submit" value="Log in" />
      9. </form>
      10. <br />';


      Verstehe ich nicht :*>[/COLOR][/FONT]


      1. Error sagt dass du schon Header versendet hast (eigentlich nicht , soweit ich das so sehen kann).
      2. Dort wird halt die Form ausgegeben damit man sich auch einloggen kann ;)
    • Dane;100572 schrieb:

      [FONT="Comic Sans MS"][COLOR="Wheat"]also muss ich den code in ne index.php machen ?

      hab nämlich nur ne login.php gemacht[/COLOR][/FONT]


      Es ist eigentlich egal wie die Datei heißt...
      Kannst ja mal im PHP Bereich nachfragen.
      Dort gibt es auch ein Tutorial zur Session
      von Internetfreak!

      PS: Ein Thanks tut nicht weh ;)
    • [FONT="Comic Sans MS"][COLOR="Wheat"]soo okay :D also hab einfach mal dieses

      session_start();

      gelöscht ..(macht das was)

      nun kommen keine Errors mehr ...

      aber wenn ich mich einlogge verbindet es mich mit inde.php (hab ich so gewollt)

      aber wenn das pw falsch ist komm ich trozdem dahin...[/COLOR][/FONT]
    • Dane;100579 schrieb:

      [FONT="Comic Sans MS"][COLOR="Wheat"]soo okay :D also hab einfach mal dieses

      session_start();

      gelöscht ..(macht das was)

      nun kommen keine Errors mehr ...

      aber wenn ich mich einlogge verbindet es mich mit inde.php (hab ich so gewollt)

      aber wenn das pw falsch ist komm ich trozdem dahin...[/COLOR][/FONT]


      Jop er verbindet immer zur index.php , da du dies wahrscheinlich in der Form eingestellt hast:

      <form action="[COLOR="Red"]index.php[/COLOR]" method="post">