15/02/2008, 04h38
|
#7
|
|
|
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
==================
|
|
|
|