php-general Digest 27 Dec 2003 19:27:49 -0000 Issue 2497

Topics (messages 173355 through 173382):

Re: File Uploads
        173355 by: Jough Jeaux

Re: How New Is <<<HERE?
        173356 by: stiano.optonline.net
        173358 by: Olwen Williams
        173359 by: Grant Walters
        173364 by: David T-G
        173370 by: stiano.optonline.net
        173372 by: Asegu

Problems with imagejpeg
        173357 by: René Fournier

web based inn server
        173360 by: Jayanta Debnath

Failed error_log directive
        173361 by: Aidan Lister

PHP Session Variables Not Being Set For Certain Browsers
        173362 by: Andy Higgins
        173365 by: Andras Kende
        173367 by: Andy Higgins
        173371 by: Gerard Samuel
        173373 by: Andy Higgins
        173374 by: Mark Charette
        173376 by: Andy Higgins
        173377 by: Gerard Samuel
        173381 by: Andy Higgins

how to get mails in digest mode
        173363 by: Jayanta Debnath
        173375 by: Website Managers, LLC

SESSION Query
        173366 by: Aniruddha
        173368 by: Andy Higgins

encoding problem
        173369 by: Pedro Salgueiro

Re: Maths dumbass
        173378 by: David T-G

Regular Expression
        173379 by: Joshua
        173382 by: Kelly Hallman

HELP! -- Problem with imagejpeg()
        173380 by: René Fournier

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [EMAIL PROTECTED]


----------------------------------------------------------------------
--- Begin Message ---
Hmm, well, to answer my own question, it looks like
the following will do.  Sorry to make an ass of
myself.  Hope you were all entertained!!

<form enctype="multipart/form-data" action="_URL_"
method="POST">
<input type="hidden" name="MAX_FILE_SIZE"
value="30000">
Send this file: <input name="userfile" type="file">
<input type="submit" value="Send File">
</form>


--- Jough Jeaux <[EMAIL PROTECTED]> wrote:
> Greetings all, I want to allow users to upload
> images
> to an online profile.  Anyone know how to let the
> user
> browse his/her local filesystem from the web page?
> 
> 
> __________________________________
> Do you Yahoo!?
> New Yahoo! Photos - easier uploading and sharing.
> http://photos.yahoo.com/
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

__________________________________
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing.
http://photos.yahoo.com/

--- End Message ---
--- Begin Message ---
By "comment[ing] out line 11", I take it you mean making a comment of line
11. I just did--as this problem woke me from a night's sleep at just past
2:30 AM--and the error message is now:

Parse error: parse error, unexpected $ in [path to file] on line 19

Where will this end?

Steve

Original Message:
-----------------
From: Olwen Williams [EMAIL PROTECTED]
Date: Sat, 27 Dec 2003 18:25:00 +1300
To: [EMAIL PROTECTED]
Subject: Re: [PHP] How New Is <<<HERE?


Comment out line 11 to checkj it's the cause of the proble.  If the 
error goes away then retype the line.  I just tested this code and got 
no errors.  It could be a character that is not what it seems.

[EMAIL PROTECTED] wrote:

> Cesar,
> 
> Sorry to have taken so long to answer. My day got complicated. Anyway,
> here's  the code all over again, with the last changes I was advised to
> make. I took out the line spaces and added line numbers. But first, the
> latest error message:
> 
>    Parse error: parse error, unexpected T_VARIABLE in [path to file] on
> line 11
> 
> The code:
> 
> 1 <html>
> 2 <head>
> 3 <title>
> 4 persistence demo
> 5 </title>
> 6 </head>
> 7 <body>
> 8 <h1>Persistence Demo</h1>
> 9 <form>
> 10 <?php
> 11 $txtBoxCounter = $_POST['txtBoxCounter'];

-- 
Olwen Williams
See my B&B site
http://www.bandbclub.com
and my new site http://www.handyman.co.nz - A virtual shed for real kiwi 
blokes.

--------------------------------------------------------------------
mail2web - Check your email from the web at
http://mail2web.com/ .

--- End Message ---
--- Begin Message --- Interesting that it's the same variable on both lines. The second error would not show untill the first disappeared. Would you have copied and pasted some of the line? I'm still for retyping the lines in case there's something odd lurking in there and not visible.

[EMAIL PROTECTED] wrote:
By "comment[ing] out line 11", I take it you mean making a comment of line
11. I just did--as this problem woke me from a night's sleep at just past
2:30 AM--and the error message is now:

Parse error: parse error, unexpected $ in [path to file] on line 19

Where will this end?

Steve

Original Message:
-----------------
From: Olwen Williams [EMAIL PROTECTED]
Date: Sat, 27 Dec 2003 18:25:00 +1300
To: [EMAIL PROTECTED]
Subject: Re: [PHP] How New Is <<<HERE?


Comment out line 11 to checkj it's the cause of the proble. If the error goes away then retype the line. I just tested this code and got no errors. It could be a character that is not what it seems.

[EMAIL PROTECTED] wrote:


Cesar,

Sorry to have taken so long to answer. My day got complicated. Anyway,
here's  the code all over again, with the last changes I was advised to
make. I took out the line spaces and added line numbers. But first, the
latest error message:

  Parse error: parse error, unexpected T_VARIABLE in [path to file] on
line 11

The code:

1 <html>
2 <head>
3 <title>
4 persistence demo
5 </title>
6 </head>
7 <body>
8 <h1>Persistence Demo</h1>
9 <form>
10 <?php
11 $txtBoxCounter = $_POST['txtBoxCounter'];



--
Olwen Williams
See my B&B site
http://www.bandbclub.com
and my new site http://www.handyman.co.nz - A virtual shed for real kiwi blokes.
--- End Message ---
--- Begin Message ---
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Sent: Saturday, 27 December 2003 20:56
> To: [EMAIL PROTECTED]
> Cc: [EMAIL PROTECTED]
> Subject: Re: [PHP] How New Is <<<HERE?
> 
> 
> By "comment[ing] out line 11", I take it you mean making a comment of line
> 11. I just did--as this problem woke me from a night's sleep at just past
> 2:30 AM--and the error message is now:
> 
> Parse error: parse error, unexpected $ in [path to file] on line 19
> 
> Where will this end?
> 
> Steve
> 
> Original Message:
> -----------------
> From: Olwen Williams [EMAIL PROTECTED]
> Date: Sat, 27 Dec 2003 18:25:00 +1300
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP] How New Is <<<HERE?
> 
> 
> Comment out line 11 to checkj it's the cause of the proble.  If the 
> error goes away then retype the line.  I just tested this code and got 
> no errors.  It could be a character that is not what it seems.
> 
> [EMAIL PROTECTED] wrote:
> 
> > Cesar,
> > 
> > Sorry to have taken so long to answer. My day got complicated. Anyway,
> > here's  the code all over again, with the last changes I was advised to
> > make. I took out the line spaces and added line numbers. But first, the
> > latest error message:
> > 
> >    Parse error: parse error, unexpected T_VARIABLE in [path to file] on
> > line 11
> > 
> > The code:
> > 
> > 1 <html>
> > 2 <head>
> > 3 <title>
> > 4 persistence demo
> > 5 </title>
> > 6 </head>
> > 7 <body>
> > 8 <h1>Persistence Demo</h1>
> > 9 <form>
> > 10 <?php
> > 11 $txtBoxCounter = $_POST['txtBoxCounter'];
> 
> -- 

For what it is worth,  I cut and pasted your full html into a file.

Under PHP version 4.3.1

It runs from the command line without fault.

Apache 1.3.22

It runs without fault (increments properly).

What text editor are you using?  I saved the code as both Unix and DOS format and it 
works for both.

I've attached my file for you to try.  Hope it helps as I can't fault the code.

Regards

Grant Walters
Brainbench 'Most Valuable Professional' for Unix Admin
Walters & Associates, P O Box 13-043 Johnsonville, Wellington, NEW ZEALAND
Telephone: +64 4 4765175 OR 4762661, CellPhone 025488265, ICQ# 23511989 

"Never argue with an idiot. They drag you down to their level, then beat you with 
experience."


--- End Message ---
--- Begin Message ---
Steve --

From your private reply to me, we know that ripping out the <<<HERE stuff
makes no difference, so it has nothing to do with that.  I would also be
inclined to rip out all of the bare HTML to make sure you don't have
anything funky in there, too, especially since it comes before the error.

...and then [EMAIL PROTECTED] said...
% 
% By "comment[ing] out line 11", I take it you mean making a comment of line
% 11. I just did--as this problem woke me from a night's sleep at just past
% 2:30 AM--and the error message is now:

OK; there is obviously some problem with line 11.  Since it reads fine
for us and runs when we try it, it must be in your actual code.  The next
things I would try are

  - if the original file is short, zip it up and attach it, or else make
    it available for download, so that we can see the *real* thing

  - insert before and after line 11 an innocuous
      print "testing\n";
    statement, and then break the line around the = so it becomes three
    lines and see where the parse error ends up

[Oh, and uncomment the line, of course.]


% 
% Parse error: parse error, unexpected $ in [path to file] on line 19

We'll get to that later.  Now that we know that there is a problem with
line 11, let's fix it first.


% 
% Where will this end?

At the error(s), of course :-)


% 
% Steve


HTH & HAND & Happy Holidays

:-D
-- 
David T-G                      * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, "Science and Health"
http://justpickone.org/davidtg/      Shpx gur Pbzzhavpngvbaf Qrprapl Npg!

Attachment: pgp00000.pgp
Description: PGP signature


--- End Message ---
--- Begin Message ---
Okay, everyone, here's some real progress.

I retyped the file from scratch. I'm both attaching it--it's not a big
file--and printing it below:

<html>
<head>
<title>persistence demo</title>
</head>
<body>
<h1>Persistence Demo</h1>
<form>
<?php

$txtBoxCounter = $_POST['txtBoxCounter'];
$hdnCounter = $_POST['hdnCounter'];

//increment the counters
$txtBoxCounter++;
$hdnCounter++;

print <<<HERE

<input type = "text"
name = "txtBoxCounter"
value = "$txtBoxCounter">

<input type = "hidden"
name = "hdnCounter"
value = "$hdnCounter">

<h3>The hidden value is $hdnCounter</h3>

<input type = "submit"
value = "click to increment counters">

HERE;

?>

</form>
</body>
</html>

My results were mixed, but definitely moved me forward.

The H1 head--Persistence Demo--displayed, as did a field with the number
"1" in it.

After a blank line was printed "The hidden value is 1".

That was followed by another blank line space, and then a button with
"click to increment counters in it".

When I click the button, I get a box dropping down that says the info I've
entered "is to be sent over an unencrypted connection" and could be read by
others, and do I still want to send it. I click "Continue", and that box
disappears.

There ends my success. I'm left with:

The H1 head--Persistence Demo--displayed, and the number "1" in it.

The blank line followed by "The hidden value is 1".

The other blank line space, and then the button with "click to increment
counters in it".

No seeming advance to the counters.

Whattaya think?

Steve Tiano

--------------------------------------------------------------------
mail2web - Check your email from the web at
http://mail2web.com/ .


--- End Message ---
--- Begin Message ---
It looks like your form tag is missing some attributes needed to point
your browser to the script as to where to submit the data.

if you were to try with your form tag as <form
action="___SCRIPT_ITSELF_FILENAME___" method="post"> ??

Andrew.

ps: if that doesn't work, may I recommend inserting
   echo("<pre>"); print_r($_POST); echo("</pre>");
to see what your post data is?


> Okay, everyone, here's some real progress.
>
> I retyped the file from scratch. I'm both attaching it--it's not a big
file--and printing it below:
>
> <html>
> <head>
> <title>persistence demo</title>
> </head>
> <body>
> <h1>Persistence Demo</h1>
> <form>
> <?php
>
> $txtBoxCounter = $_POST['txtBoxCounter'];
> $hdnCounter = $_POST['hdnCounter'];
>
> //increment the counters
> $txtBoxCounter++;
> $hdnCounter++;
>
> print <<<HERE
>
> <input type = "text"
> name = "txtBoxCounter"
> value = "$txtBoxCounter">
>
> <input type = "hidden"
> name = "hdnCounter"
> value = "$hdnCounter">
>
> <h3>The hidden value is $hdnCounter</h3>
>
> <input type = "submit"
> value = "click to increment counters">
>
> HERE;
>
> ?>
>
> </form>
> </body>
> </html>
>
> My results were mixed, but definitely moved me forward.
>
> The H1 head--Persistence Demo--displayed, as did a field with the number
"1" in it.
>
> After a blank line was printed "The hidden value is 1".
>
> That was followed by another blank line space, and then a button with
"click to increment counters in it".
>
> When I click the button, I get a box dropping down that says the info
I've entered "is to be sent over an unencrypted connection" and could be
read by
> others, and do I still want to send it. I click "Continue", and that box
disappears.
>
> There ends my success. I'm left with:
>
> The H1 head--Persistence Demo--displayed, and the number "1" in it.
>
> The blank line followed by "The hidden value is 1".
>
> The other blank line space, and then the button with "click to increment
counters in it".
>
> No seeming advance to the counters.
>
> Whattaya think?
>
> Steve Tiano
>
> --------------------------------------------------------------------
mail2web - Check your email from the web at
> http://mail2web.com/ .
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---
--- Begin Message --- I have a function that [is meant to] check if an image is greater than a certain width and height, and if it is, downsample it. The checking part works fine. Downsampling is happening though. Here's what I've got ($file = "/somedirectory/photo.jpg"):

$src_img=imagecreatefromJPEG($file);
$dst_img=imagecreatetruecolor($new_width,$new_height);
imagecopyresampled($dst_img,$src_img,0,0,0,0,$new_width,$new_height,$siz e[0],$size[1]);
imagejpeg($dst_img,$file,$img_quality);

Any ideas?

Thanks.

...Rene
--- End Message ---
--- Begin Message ---
hi,
we have a inn news server running on linux machine in
our institute. we want to make a web interface for
this. can anyone please suggest where and how to start
with. 
--Jayanta

__________________________________
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing.
http://photos.yahoo.com/

--- End Message ---
--- Begin Message ---
Hello,

I am trying to log all php script errors from a virtualhost to a file.
A callback function is not the solution I am looking for.

I have tried to the following settings in my httpd.conf (apache) to no
avail.

php_admin_flag display_errors off
php_admin_flag log_errors on
php_admin_flag error_log /tmp/phplog

When an erroneous file is viewed, errors are not displayed (as expected),
however the file /tmp/phplog is not created.

I'd be grateful for any help.

Thank you.

--- End Message ---
--- Begin Message ---
Hello All,

I have been racking my head over a problem where a large percentage of users
are unable to log into my php site due to what seems to be a problem with
setting php session variables on certain end user browsers (certain versions
of AOL seem to be particularly problematic). Below are some snippets of code
that are used to do the authentication/ login.

Has anyone encountered the same problem and if so do you have a solution?
The only solution I can think of is to pass the session using PHPSESSION in
the URL however I would like to avoid this if at all possible as it involves
a major re-write of the code (as session variables are used elsewhere in the
session) and if I am not mistaken if a user accesses a non-php page then the
session is lost requiring them to log in again.

Currently the following code is used to check whether a user is logged in:

<?php

$notAuthenticated = !isset($HTTP_SESSION_VARS['authenticatedUser']);

$notLoginIp = isset($HTTP_SESSION_VARS['loginIpAddress']) &&
($HTTP_SESSION_VARS['loginIpAddress'] != $_SERVER["REMOTE_ADDR"]);

if ($notAuthenticated || $notLoginIp) {

 if (!session_is_registered("targetURL"))
   session_register("targetURL");

 $HTTP_SESSION_VARS['targetURL'] = $_SERVER["REQUEST_URI"];

 header("Location: /smartbid/php/Login.php");

}

?>

And in Login.php after doing a check on the username and password the
following session variables are set:

       session_start();

       session_register("authenticatedUser");
       $HTTP_SESSION_VARS['authenticatedUser'] = $userId;

       session_register("loginIpAddress");
       $HTTP_SESSION_VARS['loginIpAddress'] = $_SERVER["REMOTE_ADDR"];

It is the setting of the above session variables in Login.php that appears
to be failing for some browsers resulting in users using these browsers
continually being redirected to the Login page when the above check to see
if they are logged in is done.

Any help that could be supplied would be greatly appreciated.

Thank you.

Regards,
Andy


--- End Message ---
--- Begin Message ---
-----Original Message-----
From: Andy Higgins [mailto:[EMAIL PROTECTED] 
Sent: Saturday, December 27, 2003 6:04 AM
To: [EMAIL PROTECTED]
Subject: [PHP] PHP Session Variables Not Being Set For Certain Browsers

Hello All,

I have been racking my head over a problem where a large percentage of users
are unable to log into my php site due to what seems to be a problem with
setting php session variables on certain end user browsers (certain versions
of AOL seem to be particularly problematic). Below are some snippets of code
that are used to do the authentication/ login.

Has anyone encountered the same problem and if so do you have a solution?
The only solution I can think of is to pass the session using PHPSESSION in
the URL however I would like to avoid this if at all possible as it involves
a major re-write of the code (as session variables are used elsewhere in the
session) and if I am not mistaken if a user accesses a non-php page then the
session is lost requiring them to log in again.

Currently the following code is used to check whether a user is logged in:

<?php

$notAuthenticated = !isset($HTTP_SESSION_VARS['authenticatedUser']);

$notLoginIp = isset($HTTP_SESSION_VARS['loginIpAddress']) &&
($HTTP_SESSION_VARS['loginIpAddress'] != $_SERVER["REMOTE_ADDR"]);

if ($notAuthenticated || $notLoginIp) {

 if (!session_is_registered("targetURL"))
   session_register("targetURL");

 $HTTP_SESSION_VARS['targetURL'] = $_SERVER["REQUEST_URI"];

 header("Location: /smartbid/php/Login.php");

}

?>

And in Login.php after doing a check on the username and password the
following session variables are set:

       session_start();

       session_register("authenticatedUser");
       $HTTP_SESSION_VARS['authenticatedUser'] = $userId;

       session_register("loginIpAddress");
       $HTTP_SESSION_VARS['loginIpAddress'] = $_SERVER["REMOTE_ADDR"];

It is the setting of the above session variables in Login.php that appears
to be failing for some browsers resulting in users using these browsers
continually being redirected to the Login page when the above check to see
if they are logged in is done.

Any help that could be supplied would be greatly appreciated.

Thank you.

Regards,
Andy



-------------------------------------

Andy,

Not sure, but maybe AOL users on proxy and their ip address can change.....

Andras Kende
http://www.kende.com

-------------------------------------







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

--- End Message ---
--- Begin Message ---
Hi Andras,

Yes, good point Thank you. It could be that the IP address of the user is
changing on each HTTP request that is made, which would explain the problem
(although that does seem quite odd). Can anyone confirm whether AOL (or any
other ISPs for that matter) change a user's IP address as seen by the web
server (for eample through a proxy) within the same session?

Assuming that the above is the problem, does any one know whether by
removing the check in the authentication to see whether the user is using
the same IP address as they logged in with comprises the security of the
login i.e. will it be possible for some one to hijack the login if this
check is not there? Or does anyone have any other suggesstions for doing
authentication?

Thank you.

Regards,
Andy

"Andras Kende" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> -----Original Message-----
> From: Andy Higgins [mailto:[EMAIL PROTECTED]
> Sent: Saturday, December 27, 2003 6:04 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] PHP Session Variables Not Being Set For Certain Browsers
>
> Hello All,
>
> I have been racking my head over a problem where a large percentage of
users
> are unable to log into my php site due to what seems to be a problem with
> setting php session variables on certain end user browsers (certain
versions
> of AOL seem to be particularly problematic). Below are some snippets of
code
> that are used to do the authentication/ login.
>
> Has anyone encountered the same problem and if so do you have a solution?
> The only solution I can think of is to pass the session using PHPSESSION
in
> the URL however I would like to avoid this if at all possible as it
involves
> a major re-write of the code (as session variables are used elsewhere in
the
> session) and if I am not mistaken if a user accesses a non-php page then
the
> session is lost requiring them to log in again.
>
> Currently the following code is used to check whether a user is logged in:
>
> <?php
>
> $notAuthenticated = !isset($HTTP_SESSION_VARS['authenticatedUser']);
>
> $notLoginIp = isset($HTTP_SESSION_VARS['loginIpAddress']) &&
> ($HTTP_SESSION_VARS['loginIpAddress'] != $_SERVER["REMOTE_ADDR"]);
>
> if ($notAuthenticated || $notLoginIp) {
>
>  if (!session_is_registered("targetURL"))
>    session_register("targetURL");
>
>  $HTTP_SESSION_VARS['targetURL'] = $_SERVER["REQUEST_URI"];
>
>  header("Location: /smartbid/php/Login.php");
>
> }
>
> ?>
>
> And in Login.php after doing a check on the username and password the
> following session variables are set:
>
>        session_start();
>
>        session_register("authenticatedUser");
>        $HTTP_SESSION_VARS['authenticatedUser'] = $userId;
>
>        session_register("loginIpAddress");
>        $HTTP_SESSION_VARS['loginIpAddress'] = $_SERVER["REMOTE_ADDR"];
>
> It is the setting of the above session variables in Login.php that appears
> to be failing for some browsers resulting in users using these browsers
> continually being redirected to the Login page when the above check to see
> if they are logged in is done.
>
> Any help that could be supplied would be greatly appreciated.
>
> Thank you.
>
> Regards,
> Andy
>
>
>
> -------------------------------------
>
> Andy,
>
> Not sure, but maybe AOL users on proxy and their ip address can
change.....
>
> Andras Kende
> http://www.kende.com
>
> -------------------------------------
>
>
>
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---
--- Begin Message ---
On Saturday 27 December 2003 07:03 am, Andy Higgins wrote:
> Hello All,
>
> I have been racking my head over a problem where a large percentage of
> users are unable to log into my php site due to what seems to be a problem
> with setting php session variables on certain end user browsers (certain
> versions of AOL seem to be particularly problematic). Below are some
> snippets of code that are used to do the authentication/ login.
>
> Has anyone encountered the same problem and if so do you have a solution?
> The only solution I can think of is to pass the session using PHPSESSION in
> the URL however I would like to avoid this if at all possible as it
> involves a major re-write of the code (as session variables are used
> elsewhere in the session) and if I am not mistaken if a user accesses a
> non-php page then the session is lost requiring them to log in again.
>

Im just putting the finishing touches to my code, that I had to rewrite for 
similar reasons as you.
You're going to have to include the session id in the url for those users who 
do not allow cookies.
Using this fact about the constant SID
a)  If the user's browser accepts cookies, SID will be empty ""
b)  If the user's browser does not accept cookies, SID will be "PHPSESSID=xxx"

So what I did, was append the constant SID to all urls/forms and php header() 
(for redirection) functions that point to the site that is serving the 
content (dont append SID to urls going to other sites).

So the final results will be
a) If the user's browser accepts cookies, urls/forms/php header() will be 
normal
b)  If the user's browser does not accept cookies, the session id is appended 
to urls/forms/php header()

OR 

you can take the easy way out, and turn on transparent ids with ->
http://us2.php.net/manual/en/
install.configure.php#install.configure.enable-trans-sid

--- End Message ---
--- Begin Message ---
Hi  Gerard,

Thank you very much for the response. Please can you clarify the following:

1. At the time of login will the login code need to check if the clients
browser accepts cookies and if not then append the SID as described? If so,
do you perhaps have a sample piece of code that does this?
2. Am I correct in understanding that if the client has logged in (with no
cookies enabled i.e. the SID needs to be passed) and the site contains other
static pages (that cannot pass the SID) that if the client browses any of
these static pages and then returns to a page that required the client to be
logged that they will have to log in again?
3. For forms, where the SID need to be passed, do you pass this as a hidden
form variable or do you do it on the URL?

You help is greatly appreciated.

Thanks again.

Regards,
Andy


"Gerard Samuel" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> On Saturday 27 December 2003 07:03 am, Andy Higgins wrote:
> > Hello All,
> >
> > I have been racking my head over a problem where a large percentage of
> > users are unable to log into my php site due to what seems to be a
problem
> > with setting php session variables on certain end user browsers (certain
> > versions of AOL seem to be particularly problematic). Below are some
> > snippets of code that are used to do the authentication/ login.
> >
> > Has anyone encountered the same problem and if so do you have a
solution?
> > The only solution I can think of is to pass the session using PHPSESSION
in
> > the URL however I would like to avoid this if at all possible as it
> > involves a major re-write of the code (as session variables are used
> > elsewhere in the session) and if I am not mistaken if a user accesses a
> > non-php page then the session is lost requiring them to log in again.
> >
>
> Im just putting the finishing touches to my code, that I had to rewrite
for
> similar reasons as you.
> You're going to have to include the session id in the url for those users
who
> do not allow cookies.
> Using this fact about the constant SID
> a)  If the user's browser accepts cookies, SID will be empty ""
> b)  If the user's browser does not accept cookies, SID will be
"PHPSESSID=xxx"
>
> So what I did, was append the constant SID to all urls/forms and php
header()
> (for redirection) functions that point to the site that is serving the
> content (dont append SID to urls going to other sites).
>
> So the final results will be
> a) If the user's browser accepts cookies, urls/forms/php header() will be
> normal
> b)  If the user's browser does not accept cookies, the session id is
appended
> to urls/forms/php header()
>
> OR
>
> you can take the easy way out, and turn on transparent ids with ->
> http://us2.php.net/manual/en/
> install.configure.php#install.configure.enable-trans-sid

--- End Message ---
--- Begin Message ---
> -----Original Message-----
> From: Andy Higgins [mailto:[EMAIL PROTECTED]
> Can anyone confirm whether
> AOL (or any
> other ISPs for that matter) change a user's IP address as seen by the web
> server (for eample through a proxy) within the same session?

It's been pointed out and confirmed many, many times here. An IP is not
useful for authentication in the general case (you may have a specific case
on an intranet, but major players like AOL put everything through load
balancing proxies that change from request to request).

--- End Message ---
--- Begin Message ---
Hi Mark,

Thank you for confirming that for me. I am new to the list and did do a
search though past messages but did not find this point (obvioulsy I did not
look hard enough).

Thanks again.

Regards,
Andy


"Mark Charette" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> > -----Original Message-----
> > From: Andy Higgins [mailto:[EMAIL PROTECTED]
> > Can anyone confirm whether
> > AOL (or any
> > other ISPs for that matter) change a user's IP address as seen by the
web
> > server (for eample through a proxy) within the same session?
>
> It's been pointed out and confirmed many, many times here. An IP is not
> useful for authentication in the general case (you may have a specific
case
> on an intranet, but major players like AOL put everything through load
> balancing proxies that change from request to request).

--- End Message ---
--- Begin Message ---
On Saturday 27 December 2003 10:54 am, Andy Higgins wrote:

> 1. At the time of login will the login code need to check if the clients
> browser accepts cookies and if not then append the SID as described? If so,
> do you perhaps have a sample piece of code that does this?

No, php does this for you.  Thats why I gave the explanation of the value of 
SID when browsers accept, or dont accept cookies.

Sample code
<?php

session_start();
if (SID === '')
{
    echo 'Cookie Exists';
}
else
{
    echo 'Cookie doesnt exist';
}

echo '<p><a href="' . $_SERVER['PHP_SELF'] . '?' . SID . '">CLICK ME</a></p>';

?>

If the browser does accept cookies, on the first page load, it will report 
"Cookie doesn't exist" because the cookie wont become available till the next 
page load.  After the initial page load, it will report "Cookie Exists".
If the browser does not accept cookies, it will always say "Cookie doesnt 
exists".

> 2. Am I correct in understanding that if the client has logged in (with no
> cookies enabled i.e. the SID needs to be passed) and the site contains
> other static pages (that cannot pass the SID) that if the client browses
> any of these static pages and then returns to a page that required the
> client to be logged that they will have to log in again?

Yes that is correct.  The session id must stay in all urls within the site.
If you are able to direct them to a static page, you should still be able to 
pass the SID in the url/form/iframe/etc they click.

> 3. For forms, where the SID need to be passed, do you pass this as a hidden
> form variable or do you do it on the URL?
>

I have it passing in the form's action attribute, so it stays in $_GET domain 
like regular links.
echo '<form action="foo.php' . SID . '" method="post">

--- End Message ---
--- Begin Message ---
Hi Gerard,

Thank you for your assistance you have been of enormous help.

Regards,
Andy

"Gerard Samuel" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> On Saturday 27 December 2003 10:54 am, Andy Higgins wrote:
>
> > 1. At the time of login will the login code need to check if the clients
> > browser accepts cookies and if not then append the SID as described? If
so,
> > do you perhaps have a sample piece of code that does this?
>
> No, php does this for you.  Thats why I gave the explanation of the value
of
> SID when browsers accept, or dont accept cookies.
>
> Sample code
> <?php
>
> session_start();
> if (SID === '')
> {
>     echo 'Cookie Exists';
> }
> else
> {
>     echo 'Cookie doesnt exist';
> }
>
> echo '<p><a href="' . $_SERVER['PHP_SELF'] . '?' . SID . '">CLICK
ME</a></p>';
>
> ?>
>
> If the browser does accept cookies, on the first page load, it will report
> "Cookie doesn't exist" because the cookie wont become available till the
next
> page load.  After the initial page load, it will report "Cookie Exists".
> If the browser does not accept cookies, it will always say "Cookie doesnt
> exists".
>
> > 2. Am I correct in understanding that if the client has logged in (with
no
> > cookies enabled i.e. the SID needs to be passed) and the site contains
> > other static pages (that cannot pass the SID) that if the client browses
> > any of these static pages and then returns to a page that required the
> > client to be logged that they will have to log in again?
>
> Yes that is correct.  The session id must stay in all urls within the
site.
> If you are able to direct them to a static page, you should still be able
to
> pass the SID in the url/form/iframe/etc they click.
>
> > 3. For forms, where the SID need to be passed, do you pass this as a
hidden
> > form variable or do you do it on the URL?
> >
>
> I have it passing in the form's action attribute, so it stays in $_GET
domain
> like regular links.
> echo '<form action="foo.php' . SID . '" method="post">

--- End Message ---
--- Begin Message ---
somebody please tell me how can i get the mails from
this list in digest mode.
--Jayanta

__________________________________
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing.
http://photos.yahoo.com/

--- End Message ---
--- Begin Message ---
Go to http://www.php.net/mailing-lists.php and check the box of your choice.
Or, subscribe to the newsgroup.

Jim

"Jayanta Debnath" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> somebody please tell me how can i get the mails from
> this list in digest mode.
> --Jayanta
>
> __________________________________
> Do you Yahoo!?
> New Yahoo! Photos - easier uploading and sharing.
> http://photos.yahoo.com/

--- End Message ---
--- Begin Message ---
Hi PhpTeam,

Iam runing PHP 4.3.0 on Apache server.

Iam expiriencing following problem when managing session:

1) I start session and register session variable by setting $_SESSION:

        session_start();
        $_SESSION["session_referer"] = "abc.com";

2) The above step does not register the variable "session_referer".
    I have following code in another page altogether:

        session_start();

        if(isset($_SESSION["session_referer"])) {
           go to abc.com;
        }
        else {
           // CONTROL ALWAYS GETS HERE
           go to xyz.com;
        }

3) However if I redirect immediately after (1) the variable is
    registered properly!!? and the first "if" condition in (2) gets
    satisfied.

4) I use session_register then there is no problem at all. Only thing is 
                                I get a Notice that this is no more an advised 
method.


What is the reason behind this behaviour?

With regards,
Aniruddha Deshpande



!-- Virus-Free Mail Using PostMaster AvAc & QuickHeal Engine --!



-------------------------------------------------
QuantumLink Communications Pvt Ltd, Mumbai, India



-------------------------------------------------
QuantumLink Communications Pvt Ltd, Mumbai, India

--- End Message ---
--- Begin Message ---
Hi Aniruddha,

Try using

session_start();
$HTTP_SESSION_VARS['session_referer'] = "abc.com";

and

if (session_is_registered('session_referer'))
go to abc.com;

Regards,
Andy


"Aniruddha" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi PhpTeam,
>
> Iam runing PHP 4.3.0 on Apache server.
>
> Iam expiriencing following problem when managing session:
>
> 1) I start session and register session variable by setting $_SESSION:
>
>         session_start();
>         $_SESSION["session_referer"] = "abc.com";
>
> 2) The above step does not register the variable "session_referer".
>     I have following code in another page altogether:
>
>         session_start();
>
>         if(isset($_SESSION["session_referer"])) {
>    go to abc.com;
>         }
>         else {
>    // CONTROL ALWAYS GETS HERE
>    go to xyz.com;
>         }
>
> 3) However if I redirect immediately after (1) the variable is
>     registered properly!!? and the first "if" condition in (2) gets
>     satisfied.
>
> 4) I use session_register then there is no problem at all. Only thing is
>                         I get a Notice that this is no more an advised
> method.
>
>
> What is the reason behind this behaviour?
>
> With regards,
> Aniruddha Deshpande
>
>
>
> !-- Virus-Free Mail Using PostMaster AvAc & QuickHeal Engine --!
>
>
>
> -------------------------------------------------
> QuantumLink Communications Pvt Ltd, Mumbai, India
>
>
>
> -------------------------------------------------
> QuantumLink Communications Pvt Ltd, Mumbai, India

--- End Message ---
--- Begin Message ---
Hi.

I have made a script in php that calls a java program.
This java program will make a connection to a
PostgreSQL db and do some operations. That java
program works just fine if I run it on a console, but
when it is php to runing it, it gives some errors
related to the charset encoding.
The error that apears in "error.log" of Apache is the
following:

Java.sql.SQLException: ERROR:  Could not convert UTF-8
to ISO8859-1

I think that the problem is than Apache or PHP is
runing the java program with UTF-8 encoding, while it
should be running with iso8859-1.

Does anyone knows how to solve this problem?

Thanks.
Pedro Salgueiro.

__________________________________
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing.
http://photos.yahoo.com/

--- End Message ---
--- Begin Message ---
Ryan --

...and then Ryan A said...
% 
% Hi guys,
% Its not 5am here and have started on a blasted problem where am feeling like
% a maths dumbass...the old noodle is just not working, any help appreciated.

*grin*


% 
% Problem, selling 4 packages rangeing from $27.50-$99.00 a month...the
% subscriber can change anytime he wants from one package to the other
% (upgrade), if so I have to calculate how many days he has is with us and
% then he just pays the balance...

In my opinion, you're making this way too complex.  Divide each month at
the 15th and credit 'em half if they've only used part of the first half.
It's enough that you're letting them change plans with no extra fees or
anything else :-)


HTH & HAND & Happy Holidays

:-D
-- 
David T-G                      * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, "Science and Health"
http://justpickone.org/davidtg/      Shpx gur Pbzzhavpngvbaf Qrprapl Npg!

Attachment: pgp00001.pgp
Description: PGP signature


--- End Message ---
--- Begin Message ---
Hi all,

I'm trying to change the string, for example,

$string = "11.abcd.32.efgh.53.ijk";

to

11.abcd.

32.efgh.

53.ijk.

with ereg_replace.

Like 

ereg_replace("\.[0-9]","<BR>",$string);

How can I recover the original characters 
after replacing them with <BR> 
in ereg_replace? 

ereg_replace("\.[0-9]","<BR>\\0",$string) gives me the
wrong result like:

11.abcd.

32.efgh.

53.ijk.


thank you in advance.

Joshua 

--- End Message ---
--- Begin Message ---
On Sat, 27 Dec 2003, Joshua wrote:
> I'm trying to change the string, for example,
>
> $string = "11.abcd.32.efgh.53.ijk";
> to
> 
> 11.abcd.
> 32.efgh.
> 53.ijk.
> 
> with ereg_replace. Like 
> ereg_replace("\.[0-9]","<BR>",$string);
> How can I recover the original characters after replacing them with <BR>
> in ereg_replace?
> 
> ereg_replace("\.[0-9]","<BR>\\0",$string) gives me the
> wrong result like:
> 
> 11.abcd.
> 32.efgh.
> 53.ijk.

Since the output you want and the output you didn't want are identical in
your post, it was hard to tell what you were trying to do, but...

I think this is what you want..
ereg_replace("(\.)([0-9])","\\1<br>\\2",$string);
(minus the last decimal point, missing from your original string)

-- 
Kelly Hallman
// Ultrafancy

--- End Message ---
--- Begin Message --- Hello,

I have a function that is meant to check if an image is greater than
a certain width and height, and if it is, downsample it. The checking
part works fine. Downsampling is not happening though. Here's what I've got
(btw, $file = "/somedirectory/photo.jpg"):

$src_img=imagecreatefromJPEG($file);
$dst_img=imagecreatetruecolor($new_width,$new_height);

imagecopyresampled($dst_img,$src_img,0,0,0,0,$new_width,$new_height,$siz e[0],$size[1]);
imagejpeg($dst_img,$file,$img_quality);

Any ideas?

Thanks.

...Rene
--- End Message ---

Reply via email to