|
Posted by mcserret on 09/05/07 15:56
On Sep 4, 7:26 pm, "Rik Wasmus" <luiheidsgoe...@hotmail.com> wrote:
> Well, it's obvious some kind of output was created, and relocating it the
> starting of the session placed it before the code that did the output.
> Without the original script there's not much I can say about where or why
> though... (hint).
> --
Rick-
I gave a short, but complete example of the code that failed in my
original post. It was:
<?php
header("location:www.foo.org/subdir/enterStuff.php");
?>
Here is the code that _worked_, after I included the SESSION variables
at the top.
<?php
session_start();
if(session_is_registered("SESSION")){
$issession=1;
header("location:www.foo.com/enterStuff.php"); //logged in
}
else {
header("location:www.foo.com/login/index.php"); //not logged in
exit();
}
$x7 = $_POST['rAction'];
$x0 = $_POST['year'];
$x1 = $_POST['month'];
$x2 = $_POST['day'];
$x3 = $_POST['event'];
$x4 = $_POST['desc'];
$x5 = $_POST['emph'];
$x6 = $_POST['canc'];
//format date for database
$x1 = $x1 + 1;
$dt = $x0 . "-" . $x1 . "-" . $x2;
$user = "user";
$password = "pass";
$database = "db";
$dbh = @mysql_connect ("localhost", $user, $password);
@mysql_select_db($database);
if($x7 == 3) {
$fId = $_POST[frmId];
$qry = "UPDATE `schedule` SET `date`='$dt', `event`='$x3',
`descript`='$x4', `emph`='$x5', `canc`='$x6', `modby`='$m' WHERE `id`
= $fId LIMIT 1";
@mysql_query($qry) or die ("Query failed: " . mysql_error());
} else {
$qry = "INSERT INTO `schedule`
(`date`,`event`,`descript`,`emph`,`canc`,`modby`) VALUES
('$dt','$x3','$x4','$x5','$x6','$m')";
@mysql_query($qry) or die ("Query failed: " . mysql_error());
}
mysql_close($dbh);
exit();
?>
Now if I _remove_ the SESSION section, so that it starts like this:
<?php
header("location:www.foo.com/enterStuff.php");
$x7 = $_POST['rAction'];
$x0 = $_POST['year'];
$x1 = $_POST['month'];
.....
exit();
?>
the dreaded "Warning:..." pops up. Note that the data will still get
processed, but the user will not be returned.
MC
Navigation:
[Reply to this message]
|