PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.lang.php > In Need Of Serious
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
In Need Of Serious

Réponse
 
LinkBack Outils de la discussion
Vieux 13/02/2008, 02h38   #1
John
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut In Need Of Serious

Hello All,

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.

Thank you in advance for your assistance.

~John
  Réponse avec citation
Vieux 13/02/2008, 03h04   #2
Jerry Stuckle
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: In Need Of Serious

John wrote:
> Hello All,
>
> 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.
>
> Thank you in advance for your assistance.
>
> ~John
>


First of all, find out what the hosting company changed. But without
code, it's impossible to tell what might be going wrong.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

  Réponse avec citation
Vieux 13/02/2008, 08h42   #3
Rik Wasmus
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: In Need Of Serious

On Wed, 13 Feb 2008 03:38:38 +0100, John <john.conklin@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
  Réponse avec citation
Vieux 14/02/2008, 02h14   #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
Vieux 14/02/2008, 05h05   #5
Jerry Stuckle
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: In Need Of Serious

John wrote:
> On Feb 13, 1:42 am, "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.


<snip>

I didn't look at your code in detail (it is midnight here :-) ), but it
looks like you may be relying on register_globals to be set - and it
probably isn't.

The reason I say this - I don't see where $logged_in is being set. If
this is supposed to be coming from the session, you should have
something like:

$logged_in = isset($_SESSION['logged_in'] : $_SESSION['logged_in'] : null;

And this is exactly why registered_globals is bad - it would be very
easy for me to enter a URL such as:

http://www.example.com?logged_in=1

and I have full access to your members area.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

  Réponse avec citation
Vieux 14/02/2008, 21h11   #6
John
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: In Need Of Serious

On Feb 13, 10:05pm, Jerry Stuckle <jstuck...@attglobal.net> wrote:
> John wrote:
> > On Feb 13, 1:42 am, "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.

>
> <snip>
>
> I didn't look at your code in detail (it is midnight here :-) ), but it
> looks like you may be relying on register_globals to be set - and it
> probably isn't.
>
> The reason I say this - I don't see where $logged_in is being set. If
> this is supposed to be coming from the session, you should have
> something like:
>
> $logged_in = isset($_SESSION['logged_in'] : $_SESSION['logged_in'] : null;
>
> And this is exactly why registered_globals is bad - it would be very
> easy for me to enter a URL such as:
>
> http://www.example.com?logged_in=1
>
> and I have full access to your members area.
>
> --
> ==================
> Remove the "x" from my email address
> Jerry Stuckle
> JDS Computer Training Corp.
> jstuck...@attglobal.net
> ==================- Hide quoted text -
>
> - Show quoted text -


Hi Jerry,

First, thanks for your response.

The login is being set on another page (login.php) and the system
appears to be holding that in the session variable. When I display
the session variables on the pages I am having problems with I get
this:

----------------------ERROR--------------
Array ( [username] => John [password] => [Encrypted Password shows
here] [Company] => ) SELECT SQL_CALC_FOUND_ROWS CONCAT('Edit') AS
'',Company as 'Company ID', LocationDescription AS 'Location
Description', Address as 'Address', City as 'City', State as 'State'
FROM location WHERE Company = LIMIT 0, 25
-----------------------END ERROR---------

So the username is in the session variable username, and my password
is also there. Just the Company is not being saved when I go from the
first page to the second.

I didn't think I was relying on register_globals to be on, but you
guys would know better than me. Do you think I will have to recode
this entire project differently than I have?

`John
  Réponse avec citation
Vieux 15/02/2008, 03h38   #7
Jerry Stuckle
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: In Need Of Serious

John wrote:
> On Feb 13, 10:05 pm, Jerry Stuckle <jstuck...@attglobal.net> wrote:
>> John wrote:
>>> On Feb 13, 1:42 am, "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.

>> <snip>
>>
>> I didn't look at your code in detail (it is midnight here :-) ), but it
>> looks like you may be relying on register_globals to be set - and it
>> probably isn't.
>>
>> The reason I say this - I don't see where $logged_in is being set. If
>> this is supposed to be coming from the session, you should have
>> something like:
>>
>> $logged_in = isset($_SESSION['logged_in'] : $_SESSION['logged_in'] : null;
>>
>> And this is exactly why registered_globals is bad - it would be very
>> easy for me to enter a URL such as:
>>
>> http://www.example.com?logged_in=1
>>
>> and I have full access to your members area.
>>
>> --
>> ==================
>> Remove the "x" from my email address
>> Jerry Stuckle
>> JDS Computer Training Corp.
>> jstuck...@attglobal.net
>> ==================- Hide quoted text -
>>
>> - Show quoted text -

>
> Hi Jerry,
>
> First, thanks for your response.
>
> The login is being set on another page (login.php) and the system
> appears to be holding that in the session variable. When I display
> the session variables on the pages I am having problems with I get
> this:
>
> ----------------------ERROR--------------
> Array ( [username] => John [password] => [Encrypted Password shows
> here] [Company] => ) SELECT SQL_CALC_FOUND_ROWS CONCAT('Edit') AS
> '',Company as 'Company ID', LocationDescription AS 'Location
> Description', Address as 'Address', City as 'City', State as 'State'
> FROM location WHERE Company = LIMIT 0, 25
> -----------------------END ERROR---------
>
> So the username is in the session variable username, and my password
> is also there. Just the Company is not being saved when I go from the
> first page to the second.
>
> I didn't think I was relying on register_globals to be on, but you
> guys would know better than me. Do you think I will have to recode
> this entire project differently than I have?
>
> `John
>


The reason I said that is because it looks like you're using variables
such as $username but have never initialized them. Or maybe this isn't
your entire code.

As for the company name not being there - it looks like you're saving
the SQL to select the correct row from the database instead of executing
the mysql query.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 07h46.


Édité par : vBulletin® version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,26556 seconds with 15 queries