Re: Ok, next step/question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ok.

Just tested this on another machine as well, and I now see if I go to the
phpInfo link on the WAMP server homepage on either machine it does seem to
work, but not in my own pages.

Also, rechecked on both machines, and I actually noticed that the very first
line:
<? php session_start(); ?>

does in fact seem to be being processed/disappears, but the rest of the php
code is still rendering unprocessed in those pages, so who knows.

Maybe I should actually send some of you my actual page file in case there's
something strange therein that I'm not noticing - who knows.

Stay well

Jacob Kruger
Blind Biker
Skype: BlindZA
'...Fate had broken his body, but not his spirit...'

----- Original Message ----- From: "Matt Horn" <matt@xxxxxxxxxxxxxxxxx>
To: "Jacob Kruger" <jacobk@xxxxxxxxxxx>
Sent: Tuesday, January 15, 2008 1:23 PM
Subject: Re:  Ok, next step/question


does
<?php
phpinfo();
?>

return anything?


On 15/01/2008, Jacob Kruger <jacobk@xxxxxxxxxxx> wrote:
Ok.

Been trying out various things including double-checking if my error
display
settings were there etc. etc., and finally sort of figured out what was
going wrong when I eventually saved the output of main.php from internet
explorer after it was still not showing any output, and then I sort of
discovered that for whatever reason, the PHP code isn't actually being
interpreted/processed since it still shows up in the html source thereof.

FWIW, here's the complete source code of that main.php file (as it
appears
when I edit it, or when I save it from IE):

<?php session_start(); ?>
<!doctype html public "-//W3C//DTD HTML 4.0 //EN">
<html>
<head>
       <title>Admin main page</title>
</head>
<body>
<? php
echo "admin?: " . $_SESSION["admin"] . "<br />";
echo "What the hell!?!?!?";
?>
</body>
</html>

Anyideas (and FWIW, I have tried changing various small things, but who
knows...)?

Jacob Kruger
Blind Biker
Skype: BlindZA
'...Fate had broken his body, but not his spirit...'

----- Original Message -----
From: "James Crow" <james@xxxxxxxxxxxxx>
To: "Jacob Kruger" <jacobk@xxxxxxxxxxx>
Cc: <php-windows@xxxxxxxxxxxxx>
Sent: Friday, January 11, 2008 8:25 PM
Subject: Re:  Ok, next step/question


> That is correct. The session_start() command must appear in each script
> that needs to access the $_SESSION variable.
>
> Thanks,
> James
>
> On Fri, 2008-01-11 at 15:57 +0200, Jacob Kruger wrote:
>> Ok.  Just realised that you might have meant that I need that
>> session_start(); statement on the first line of every page?
>>
>> Stay well
>>
>> Jacob Kruger
>> Blind Biker
>> Skype: BlindZA
>> '...Fate had broken his body, but not his spirit...'
>>
>> ----- Original Message -----
>> From: "Jacob Kruger" <jacobk@xxxxxxxxxxx>
>> To: <php-windows@xxxxxxxxxxxxx>
>> Sent: Friday, January 11, 2008 3:52 PM
>> Subject: Re:  Ok, next step/question
>>
>>
>> > Already got that one on the very first line of the initial
>> > (index.php)
>> > page,
>> > and I am assigning an array element in that first page, which seems
>> > to
>> > work
>> > fine.
>> >
>> > Stay well
>> >
>> > Jacob Kruger
>> > Blind Biker
>> > Skype: BlindZA
>> > '...Fate had broken his body, but not his spirit...'
>> >
>> > ----- Original Message -----
>> > From: "James Crow" <
>> > james@xxxxxxxxxxxxx>
>> > To: "Jacob Kruger" <
>> > jacobk@xxxxxxxxxxx>
>> > Cc: <
>> > php-windows@xxxxxxxxxxxxx>
>> > Sent: Friday, January 11, 2008 3:42 PM
>> > Subject: Re:  Ok, next step/question
>> >
>> >> Jacob,
>> >>
>> >>  You must issue a session_start() prior to outputting any code to
>> >> the
>> >> browser for sessions to work. There are tons of different ways to
>> >> configure things, but session_start() as the first thing in the
>> >> script
>> >> should get you started. Here is a basic example:
>> >>
>> >> index.php:
>> >> <?php
>> >> session_start();
>> >> $_SESSION['test_me'] = 'My test $_SESSION variable'; // stores a
>> >> value
>> >> in the $_SESSION array
>> >> ?>
>> >> <html><head>
>> >> <meta http-equiv="refresh" content="0;url=page2.php">
>> >> </head></html>
>> >> ################## End of index.php ##################
>> >>
>> >>
>> >> page2.php:
>> >> <?php
>> >> session_start()
>> >> ?>
>> >> <html><head><title>Page 2</title></head><body>
>> >> <?php
>> >> echo $_SESSION['test_me'];
>> >> ?>
>> >> </body></html>
>> >> ################# End of page2.php #######################
>> >>
>> >> The index.php page simply stores a value in the $_SESSION super
>> >> global
>> >> array and then immediately redirects to page2.php. page2.php
>> >> retrieves
>> >> the value stored by index.php and displays it as the content of the
>> >> web
>> >> page.
>> >>
>> >> This code is all from memory so it might have a bug, but it is how
>> >> I
>> >> got
>> >> started working with session support in PHP.
>> >>
>> >> Thanks,
>> >> James
>> >>
>> >>
>> >> On Fri, 2008-01-11 at 12:26 +0200, Jacob Kruger wrote:
>> >>> Now got that main page redirecting/spitting out the relevant JS
>> >>> code
>> >>> to
>> >>> get
>> >>> it to move on to the next page, but there I was trying to
>> >>> ascertain
>> >>> if
>> >>> the
>> >>> session variable/array element had actually been set, and, for
>> >>> whatever
>> >>> reason, no PHP code seems to be executing in main.php.
>> >>>
>> >>> Below is what I currently have inbetween the <body></body> tags:
>> >>>
>> >>> <? php
>> >>> echo "testing...";
>> >>> ?>
>> >>>
>> >>> Before I was trying to do something along the lines of:
>> >>> echo $_SESSION["admin"];
>> >>>
>> >>> And that also did nothing.
>> >>>
>> >>> I also tried changing the static HTML content to see if maybe the
>> >>> output
>> >>> was
>> >>> just being cached or something, but that renders correctly.
>> >>>
>> >>> Any ideas? (am I just not 'trying' correctly or something)
>> >>>
>> >>> Stay well
>> >>>
>> >>> Jacob Kruger
>> >>> Blind Biker
>> >>> Skype: BlindZA
>> >>> '...Fate had broken his body, but not his spirit...'
>> >>>
>> >>
>> >>
>> >
>> > --
>> > PHP Windows Mailing List (http://www.php.net/)
>> > To unsubscribe, visit: http://www.php.net/unsub.php
>> >
>> >
>>
>
>

--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




--

-------------------------------------------
matt@xxxxxxxxxxxxxxxxx
http://www.cypherpunk.za.net
------------------------------------------


--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux