Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Problem bei Übergabe der Werte mit Sessions

Empfohlene Antworten

Veröffentlicht

Hi,

ich fülle auf einer Seite ein Formular aus und speichere die Werte in einer Session ... komischerweise kann die 2 Seite die Werte aus der Session nur lesen wenn ich einmal im Explorer auf den Zurückbutton drücke und dann das Formular nochmal bestätige.

vorher kommt diese Meldung:

Warning: Unknown(): Your script possibly relies on a session side-effect which existed until PHP 4.2.3. Please be advised that the session extension does not consider global variables as a source of data, unless register_globals is enabled. You can disable this functionality and this warning by setting session.bug_compat_42 or session.bug_compat_warn to off, respectively. in Unknown on line 0

ich weis aber nicht was ich damit anfangen soll.

register_globals is OFF und soll auch OFF bleiben.

Gruß Scratch

ajo da steht das du keine globalen variablen in die session schreiben kannst!

notfalls das prinzip probieren:



global $a;
$a = "12345";
$b = $a;

$_SESSION["a"] = $b;
[/PHP]

oder code posten

  • Autor

Seite 1:

<html>

<head>

<title></title>

</head>

<body>

<center>

<?php

if(isset($_GET["msg"]))

{

echo "<center><span class=\"confirmstyle\">" . $_GET["msg"] . "</span></center><br>";

}

?>

<form action="login_check.php" method="post">

<table border="0" cellspacing="0" cellpadding="2">

<tr>

<th colspan="2">Login</th>

</tr>

<tr>

<td>Kostenstelle:</td>

<td><input type="text" size="15" maxlength="4" name="kostenstelle"></td>

</tr>

<tr>

<td>Vorname:</td>

<td><input type="text" size="15" name="vorname"></td>

</tr>

<tr>

<td>Nachname:</td>

<td><input type="text" size="15" name="nachname"></td>

</tr>

<tr>

<td>Email:</td>

<td><input type="text" size="15" name="email"></td>

</tr>

<tr>

<td colspan="2" align="right"><input type="submit" value="weiter"></td>

</tr>

</table>

</form>

</center>

</body>

</html>

Seite 2:

<?php

include("../odbc/odbc_start.php");

session_start();

session_register("kostenstelle","vorname","nachname","email");

$kostenstelle = $_POST["kostenstelle"];

if(eregi("([0-9]{4})",$kostenstelle))

{

$anfrage = "SELECT DISTINCT test.test FROM user";

$ergebnis = odbc_prepare($odbcdb,$anfrage);

@odbc_execute($ergebnis);

$gefunden = 0;

while($zeile = odbc_fetch_array($ergebnis))

{

if($zeile["kst"] == $kostenstelle)

{

$gefunden = 1;

}

}

if($gefunden == 1)

{

$vorname = $_POST["vorname"];

if(strlen($vorname) > 1)

{

$nachname = $_POST["nachname"];

if(strlen($nachname) > 1)

{

$email = $_POST["email"];

if(eregi("^[a-z0-9]+([-_\.]?[a-z0-9])+@[a-z0-9]+([-_\.]?[a-z0-9])+\.[a-z]{2,4}", $email))

{

header("location: arbeitsauftrag.php?sid= " . session_id());

}

else

{

header("location: login.php?msg=Email%20nicht%20korrekt.");

}

}

else

{

header("location: login.php?msg=Nachname%20zu%20kurz.");

}

}

else

{

header("location: login.php?msg=Vorname%20zu%20kurz.");

}

}

else

{

header("location: login.php?msg=Kostenstelle%20existiert%20nicht.");

}

}

else

{

header("location: login.php?msg=Kostenstelle%20existiert%20nicht.");

}

odbc_close($odbcdb);

?>

Seite 3

<?php

session_start();

echo $_SESSION["nachname"];

session_register("datum");

$datum = date("d.m.Y");

echo $_SESSION["datum"];

?>

fehlermeldung? zeilennummer? wo iss die zeile in deinem code?

------

wenn du code postest dann mach doch bitte den PHP-Tag darum!

dann bleibt er wenigstens formatiert und man kann sich leichter reindenken!

Der "Knopf" dazu ist über dem textfeld beim eintippen und auf dem steht auch "PHP"

Original geschrieben von kills

zeilennummer? wo iss die zeile in deinem code?

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.