Autor Beitrag
Marco D.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: Sa 26.05.07 13:56 
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
$_SESSION['title_de'] = $_POST['title_de'];
$_SESSION['title_eng'] = $_POST['title_eng'];
$_SESSION['content_de'] = $_POST['content_de'];
$_SESSION['content_eng'] = $_POST['content_eng'];
$_SESSION['closed'] = $_POST['closed'];
$_SESSION['mode'] = $_POST['mode'];

Speichert man die geposteten Daten so in der Session?
ausblenden Quelltext
1:
2:
3:
4:
5:
$title_de = $_SESSION['title_de'];
$title_eng = $_SESSION['title_eng'];
$content_de = $_SESSION['content_de'];
$content_eng = $_SESSION['content_eng'];
$page_mode = $_SESSION['mode'];

Weil das Session-Array leer ist beim Auslesen. :nixweiss:
Habe am Anfang session_start() zu stehen.

Moderiert von user profile iconUGrohne: C#- durch Code-Tags ersetzt

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
GTA-Place
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: Sa 26.05.07 14:35 
Ist das Session-Array auf der selben Seite noch leer, oder nach Seitenwechsel? Wird die Session-ID in irgendeiner Weise übertragen?

_________________
"Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.de)
Marco D. Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: Sa 26.05.07 14:39 
user profile iconGTA-Place hat folgendes geschrieben:
Ist das Session-Array auf der selben Seite noch leer, oder nach Seitenwechsel? Wird die Session-ID in irgendeiner Weise übertragen?

Nach Seitenwechsel. Sie wird nicht übertragen. Es funktioniert aber z.B. mit dem Benutzernamen auch. :roll:

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
Marco D. Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: So 27.05.07 16:47 
Kann mir denn niemand helfen?

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
Martok
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 3661
Erhaltene Danke: 604

Win 8.1, Win 10 x64
Pascal: Lazarus Snapshot, Delphi 7,2007; PHP, JS: WebStorm
BeitragVerfasst: So 27.05.07 17:20 
user profile iconMarco D. hat folgendes geschrieben:
Sie wird nicht übertragen. Es funktioniert aber z.B. mit dem Benutzernamen auch. :roll:

:shock:
Also wenn die nicht übertragen wird, kann es eigentlich nicht gehen... Kein Cookie, kein GET-Parameter?

Ansonsten ist der Code erstmal ok. Sollte gehen ;)

_________________
"The phoenix's price isn't inevitable. It's not part of some deep balance built into the universe. It's just the parts of the game where you haven't figured out yet how to cheat."
Marco D. Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: So 27.05.07 17:31 
Den Usernamen ermittelt man so bei uns:
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
//gibt den Benutzernamen des eingeloggten Benutzers zurück
function GetUserName() {
  if (!empty($_SESSION['name']))
    return $_SESSION['name'];
  else return "Internal Error!";
}

Und gespeichert wird das so:
ausblenden Quelltext
1:
2:
3:
$_SESSION['name'] = $username;
$_SESSION['id'] = $assoc['id'];
$_SESSION['lang'] = $assoc['lang'];

niemals die session_id per URL übergeben!

Moderiert von user profile iconUGrohne: C#- durch Code-Tags ersetzt

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
Martok
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 3661
Erhaltene Danke: 604

Win 8.1, Win 10 x64
Pascal: Lazarus Snapshot, Delphi 7,2007; PHP, JS: WebStorm
BeitragVerfasst: So 27.05.07 17:39 
Hm, dann wohl doch ein Cookie.

Bist du dir ganz sicher, dass das session_start() davor liegt? Ich hatte den Fall auch mal, aber mir war dann im Endeffekt nur ein include in der Zeile verrutscht.

user profile iconMarco D. hat folgendes geschrieben:
Weil das Session-Array leer ist beim Auslesen. :nixweiss:

Hm, leere strings oder echt empty()?
Kannst ja mal ein var_dump($_SESSION) machen, einmal nach dem Schreiben und vor dem Lesen.

_________________
"The phoenix's price isn't inevitable. It's not part of some deep balance built into the universe. It's just the parts of the game where you haven't figured out yet how to cheat."
Christian V.
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 311

Win Xp Prof
Turbo Delphi 2005
BeitragVerfasst: Mi 30.05.07 10:32 
session_start(); muss auf jeder Seite sein, wo du Session Variablen verwendest, nicht nur einmal um eine zu starten.
Falls du Cookie-Basiert Session verwendest, dann muss das session_start vor irgendwelchen ausgaben stehen.

_________________
Hardware runs the world, software controls the hardware, code generates software - Have You already coded today?