Afficher un message
Vieux 14/02/2008, 03h14   #4
John
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: In Need Of Serious

On Feb 13, 1:42am, "Rik Wasmus" <luiheidsgoe...@hotmail.com> wrote:
> On Wed, 13 Feb 2008 03:38:38 +0100, John <john.conk...@cox.net> wrote:
> > I am need of some . A few months ago I created a PHP application
> > for a client and am using session variables to pass a variable
> > (OrderNum) between pages so they can create orders and print them on-
> > line.

>
> > Everything was working great, no problems at all but all of a sudden
> > the session variable is not getting passed between pages and nothing
> > is working anymore. I am a novice PHP developer and need any you
> > can provide.

>
> > Can anyone tell me what may cause session variables to stop being
> > passed?

>
> > Any and all comments, suggestions are greatly appreciated.

>
> Without code, impossible to tell, however, here are some 'frequent
> offenders':
> - register_globals is turned off (but you didn't rely on that, did you?)
> - a change in code has let to output before session_start(), making it
> impossible to start a session (check your error log, as errors should not
> be displayed in production, but definitly logged)
> - something has moved/changed, making the path to where PHP saves its
> sessionfiles not readable/writable anymore
> - rare, but just to mention it: there is no, or a faulty, garbage handler,
> leading to no more space on disk to write session files.
>
> HTH, it not, give relevant portion of the code.
> --
> Rik Wasmus


Thank you Rik and Jerry for your response. I will check with my
hosting company again and find out more information, but they said
nothing has changed except a restart.

I'm posting my code form two of my pages that are having the problem,
because maybe it is something I did when I created them, and just got
luckey that they have worked for so long.

-----------------PAGE 1 - All Orders: Show a listing of orders and
has a link to either edit or view/print. This page works ok, it is
when i click on one of the links to go to the other pages when it
doesn't pass the session variable ---------------------

<?php
/* Include Files *********************/
//session_start();
include("database.php");
include("login.php");
error_reporting(E_ALL);
/*************************************/

if($logged_in == 1){

require($_SERVER["DOCUMENT_ROOT"] . "/FORMfields/FORMfields.php");

define("SLEEP", 4);

if (array_key_exists("EquipID", $_POST)) {

$formBean = new FormBean();
$formBean->addField(new IntegerField("OrderNum", "Order #", REQUIRED,
10, 1, 10, 99999, 1));
$formBean->addField(new DateField("OrderDate", "Order Date",
REQUIRED, " "));
$formBean->setValue("OrderDate",Date('m d Y'));
$formBean->addField(new TextField("OrderedBy", "Ordered By",
REQUIRED, 25, 1, 15));
$formBean->addField(new TextField("PurchaseOrder", "Purchase Order
#", NOT_REQUIRED, 25, 1, 15));
$formBean->addField(new IntegerField("CustomerID", "Customer ID #",
REQUIRED, 4, 4, 4, 9999, 1));
$formBean->addField(new TextField("JobNum", "Job #", NOT_REQUIRED,
15, 1, 15));
$custname = getList("SELECT CONCAT(CustomerID, ' ' ,CompanyName) FROM
customers Order By CompanyName");
$formBean->addField(new DropDownField("CompanyName", "Company",
REQUIRED, $custname, $custname, "[Select One]"));
$formBean->addField(new TextField("ContractorName", "Contractor
Name", NOT_REQUIRED, 60, 1, 35));
$formBean->addField(new TimeField("PUTime", "Pick-up Time",
NOT_REQUIRED));
$formBean->addField(new TextField("PUTimeComment", "Pick-up Comment",
NOT_REQUIRED, 90, 1, 35));
$formBean->addField(new TextField("DelyTime", "Dely Time",
NOT_REQUIRED, 20, 1, 10));
$formBean->addField(new TextField("DelyTimeComment", "Dely Comment",
NOT_REQUIRED, 90, 1, 35));
$formBean->addField(new TextAreaField("Comments", "Order Comments",
NOT_REQUIRED, 1000, 1, 6, 50));
$vendors = Dber::splitResultSet(gmysql_query("SELECT EquipID,
Description FROM equipment ORDER BY EquipID"));
$formBean->addField(new DropDownField("EquipID", "Equipment
Description", NOT_REQUIRED, $vendors[1], $vendors[0], "[Select
One]"));
$drivername = getList("SELECT CONCAT(DriverNum, ' ', FullName) FROM
drivers Order By FullName");
$formBean->addField(new DropDownField("DriverName", "Driver",
NOT_REQUIRED, $drivername, $drivername, "[Select One]"));
$trailer = getList("SELECT ConfigNum FROM trconfig Order By
ConfigNum");
$formBean->addField(new DropDownField("ConfigNum", "Trailer",
REQUIRED, $trailer, $trailer, "[Select One]"));

$PUlocationid = getList("SELECT CONCAT(LocationID, ' ', Address) FROM
location Order By LocationID");
$formBean->addField(new DropDownField("PULocationID", "Pick-up
Location", NOT_REQUIRED, $PUlocationid, $PUlocationid, "[Select
One]"));
$DELlocationid = getList("SELECT CONCAT(LocationID, ' ', Address)
FROM location Order By LocationID");
$formBean->addField(new DropDownField("DELLocationID", "Delivery
Location", NOT_REQUIRED, $DELlocationid, $DELlocationid, "[Select
One]"));

$formBean->addField(new HiddenField("EnteredBy", $username));
$formBean->addField(new SubmitField("_submit", "Submit"));
$formBean->addField(new SubmitField("clear", "Clear"));
$formBean->addField(new SubmitField("cancel", "Cancel"));


$formBean->loadValuesFromDb("orders", "WHERE OrderNum=" .
$_POST["OrderNum"]);
//$formBean->loadValuesFromDb("orders", "WHERE OrderNum=" .
$_REQUEST["OrderNum"];
}
?>
<? /* END - SECTION 1 */ ?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>

<head>
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1" />
<title>All Orders - Last 30 Days</title>
<? /* BEGIN - SECTION 2 */ ?>
<link rel="stylesheet" type="text/css" href="/FORMfields/
FORMfields.css" />
<script type="text/javascript" src="/FORMfields/FORMfields.js"></
script>
<script type="text/javascript">
function init() {
window.print();
}
</script>

<link rel="stylesheet" type="text/css" href="/FORMfields/
tableers.css" />
<link rel="stylesheet" type="text/css" href="/FORMfields/default.css" /
>

<style type="text/css">
form {
margin: 0px;
}

h1.FORMfields {
font: normal normal bold 15px verdana;
margin-top: 5px;
margin-bottom: 5px;
}

a {
font: normal normal bold 12px verdana;
}


h1.FORMfields {
background-color: #cccccc;
padding: 3px;
padding-left: 5px;
border: 1px outset #777777;
}

td.tableersFormFields1, td.tableersFormFields2 {
background-color: #cccccc;
border: 1px double #777777;
}

div.FORMfields {
border: 1px dashed #dddddd;
padding: 5px;
}

label.isValid {
color: black;
}

</style>
<? /* END - SECTION 2 */ ?>
</head>

<body>
<table width="90%">
<tr>
<td>
<? /* BEGIN - SECTION 3 */ ?>
<form action="editCustomers.php" method="post">
<div class="FORMfields">
<h1 class="FORMfields">Orders Last 20 Days</h1>
<?
if (array_key_exists("OrderNum", $_POST)) {
echo "<div><a href=\"?\">« Go Back to List</a></div>";
echo $formBean->getDisplayTableTag();

} else {
echo "<a href='menu.php'>Close Form</a>";
$tableSet = new TableSet();

$tableSet->enableSort = true;

$tableSet->loadQuery("SELECT CONCAT('<a href=\"editOrder.php?
OrderNum=',OrderNum,'\">Edit</a>') AS '', CONCAT('<a href=
\"printOrder.php?OrderNum=',OrderNum,'\">View/Print</a>') AS '',
CONCAT(OrderNumPrefix, OrderNum) as 'Order Number', c.CompanyName AS
'Company', DATE_FORMAT(OrderDate, '%m/%d/%Y') AS 'Order Date' FROM
orders LEFT JOIN customers c on orders.CustomerID = c.CustomerID WHERE
DATEDIFF( CURDATE( ) , OrderDate ) <=20 ORDER BY OrderDate DESC");

echo $tableSet->getTableTag();
session_register("OrderNum");
}
?>
<input type='button' value='Print' onclick='init()'>
</div>
</form>
</td>
</tr>
</table>
</body>
</html>
<?
}
else{
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://
www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Precision Heavy Haul - Dispatch Application</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="dispatchStyle.css" />
<style type="text/css">
<!--
.style1 {font-size: x-small}
-->
</style>
</head>

<body>
<center>
<table>
<tr>
<td height="147"><img src="PHHlogo.gif" width="306" height="131"> </
td>
</tr>
<td align="center"><h2>Dispatch Application</h2>
</tr>
</table>
<?
echo "<h3 align='center'>You can not access this page directly.</h3>
\n";
echo "<h3 align='center'>Please <a href=\"index.php\">Log In</a></
h3>";
}
?>
</center>
</body>
</html>
</html>
-----------------------------END OF CODE PAGE 1
-------------------------------------
----------------------------CODE: EDIT ORDER PAGE
-----------------------------------
<?php
/* Include Files *********************/
//session_start();
include("database.php");
include("login.php");
ini_set('display_errors',1);
error_reporting (E_ALL & ~E_NOTICE);
/*************************************/

if($logged_in == 1){

// Include FormFields library
require($_SERVER["DOCUMENT_ROOT"] . "/FORMfields/FORMfields.php");

define("FF_CANCEL_URL", "menu.php");
define("FF_DONE_URL", "menu.php");

////////// FORM BEAN SPECIFICATION - START //////////

$formBean = new FormBean();
$formBean->addField(new TextField("OrderNum", "Order Number",
NOT_REQUIRED, 25, 1, 15));
$formBean->setValue("OrderNum", $OrderNum);
$formBean->addField(new DateField("OrderDate", "Order Date",
REQUIRED, " "));
$formBean->setValue("OrderDate",Date('m d Y'));
$formBean->addField(new DateField("DateHauled", "Date Hauled",
REQUIRED, " "));
$formBean->setValue("DateHauled",Date('m d Y'));
$custname = Dber::splitResultSet(gmysql_query("SELECT
CustomerID, CompanyName FROM customers ORDER BY CompanyName"));
$formBean->addField(new DropDownField("CustomerID", "Company Name",
REQUIRED, $custname[1], $custname[0], "[Select Customer]"));
$formBean->addField(new TextField("OrderedBy", "Ordered By",
NOT_REQUIRED, 25, 1, 15));
$formBean->addField(new TextField("PurchaseOrder", "Purchase Order
#", NOT_REQUIRED, 25, 1, 15));
$formBean->addField(new TextField("JobNum", "Job #", NOT_REQUIRED,
25, 1, 15));
$formBean->addField(new TextField("ContractorName", "Contractor
Name", NOT_REQUIRED, 60, 1, 35));
$formBean->addField(new TimeField("PUTime", "Pick-up Time",
NOT_REQUIRED));
$formBean->addField(new TextField("PUTimeComment", "Pick-up Comment",
NOT_REQUIRED, 90, 1, 35));
$formBean->addField(new TimeField("DelyTime", "Delivery Time",
NOT_REQUIRED));
$formBean->addField(new TextField("DelyTimeComment", "Del Comment",
NOT_REQUIRED, 90, 1, 35));
$formBean->addField(new TextAreaField("Comments", "Order Comments",
NOT_REQUIRED, 1000, 1, 5, 80));
$vendors = Dber::splitResultSet(gmysql_query("SELECT DISTINCT
EquipID, Description FROM equipment ORDER BY EquipID"));
$formBean->addField(new DropDownField("EquipID1", "Equipment
Description", NOT_REQUIRED, $vendors[1], $vendors[0], "[Select
Equipment]"));
$drivername = Dber::splitResultSet(gmysql_query("SELECT
DriverNum, FullName FROM drivers ORDER BY FullName"));
$formBean->addField(new DropDownField("DriverName", "Driver",
REQUIRED, $drivername[1], $drivername[0], "[Select Driver]"));
$trailer = Dber::splitResultSet(gmysql_query("SELECT ConfigNum,
Description FROM trconfig WHERE OutOfService = 'No' Order By
ConfigNum"));
$formBean->addField(new DropDownField("ConfigNum", "Trailer",
NOT_REQUIRED, $trailer[0], $trailer[0], "[Select Config]"));
$PUlocationid = Dber::splitResultSet(gmysql_query("SELECT
LocationID, Address FROM location WHERE Address != '' ORDER BY
LocationID"));
$formBean->addField(new DropDownField("PULocationID1", "Pick-up
Location", NOT_REQUIRED, $PUlocationid[1], $PUlocationid[0], "[Select
Pickup Location]"));
$DELlocationid = Dber::splitResultSet(gmysql_query("SELECT
LocationID, Address FROM location WHERE Address != '' ORDER BY
LocationID"));
$formBean->addField(new DropDownField("DELLocationID1", "Delivery
Location", NOT_REQUIRED, $DELlocationid[1], $DELlocationid[0],
"[Select Delivery Location]"));
$formBean->addField(new HiddenField("ModifiedBy", $username));
$formBean->addField(new SubmitField("_submit", "Submit"));
$formBean->addField(new SubmitField("clear", "Clear"));
$formBean->addField(new SubmitField("cancel", "Cancel"));

////////// FORM BEAN SPECIFICATION - END //////////

$formBean->getParameters();

if ($formBean->getValue("_submit")) {
if ($formBean->checkValues()) {
$formBean->addField(new DateTimeField("DateModified", "Date
Modified", REQUIRED, null));
$formBean->formFields["DateModified"]->getCurrentDateTime();
$formBean->updateValuesInDb("orders", "WHERE
OrderNum='$OrderNum'");
session_unregister("OrderNum");
header("Location: " . FF_DONE_URL);

}
} else if ($formBean->getValue("cancel")) {
// INSERT CODE FOR CANCEL OPERATION
session_unregister("OrderNum");
header("Location: " . FF_CANCEL_URL);
} else if ($formBean->getValue("clear")) {
$formBean->clearAllData();
} else {
$formBean->loadValuesFromDb("orders", "WHERE OrderNum='$OrderNum'");
session_unregister("OrderNum");
}

?>
<LINK rel="stylesheet" type="text/css" href="/FORMfields/
FORMfields.css" />
<SCRIPT type="text/javascript" src="/FORMfields/FORMfields.js"></
SCRIPT>
<LINK rel="stylesheet" type="text/css" href="/FORMfields/
tableers.css" />
</HEAD>

<BODY>
<? if ($formBean->getValue("_submit") && !$formBean->isError) { ?>
<H1>Order Updated</H1>
<? } else if ($formBean->getValue("cancel")) { ?>
<H1>Update Order Cancelled</H1>
<? } else { ?>
<FORM action="" method="post">
<H2>Update Order:</H2>
<?= $formBean->getTableTag() ?>
</FORM>
<? } ?>
</center>
</BODY>
</HTML>
<?
}
else{
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://
www.w3.org/TR/html4/loose.dtd">
<HTML>
<HEAD>
<TITLE>Precision Heavy Haul - Dispatch Application</TITLE>
<META http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<LINK rel="stylesheet" type="text/css" href="dispatchStyle.css" />
<STYLE type="text/css">
<!--
.style1 {font-size: x-small}
-->
</STYLE>
</HEAD>

<BODY>
<CENTER>
<TABLE>
<TR>
<TD height="147"><IMG src="PHHlogo.gif" width="306" height="131"> </
TD>
</TR>
<TD align="center"><H2>Dispatch Application</H2>
</TR>
</TABLE>
<?
echo "<h3 align='center'>You can not access this page directly.</h3>
\n";
echo "<h3 align='center'>Please <a href=\"index.php\">Log In</a></
h3>";
}
?>
</BODY>
</HTML>
</html>
--------------------------------------END OF
CODE-----------------------------------

If you could take a look and provide your input it would be
appreciated. I thank you again for your responses and look forward to
hearing from you again.

~John
  Réponse avec citation
 
Page generated in 0,14464 seconds with 9 queries