OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
php-general Digest 24 May 2007 19:36:55 -0000 Issue 4809

php-general-digest-helplists.php.net
Date: Thu May 24 2007 - 14:36:55 CDT


php-general Digest 24 May 2007 19:36:55 -0000 Issue 4809

Topics (messages 255494 through 255551):

instant messenger php + ajax
        255494 by: Marco Sottana
        255495 by: Darren Whitlen
        255496 by: Marco Sottana
        255497 by: Darren Whitlen
        255504 by: Marco Sottana

Re: help with multi dimensional arrays
        255498 by: Zoltán Németh

Re: Include file questions
        255499 by: "Miguel J. Jiménez"

Re: Form Processing Question - Empty Fields
        255500 by: Stut

Project Management
        255501 by: Christian Haensel
        255503 by: eoghan
        255505 by: Stut
        255507 by: Edward Kay
        255511 by: Christian Haensel
        255532 by: Dan McCullough

Re: Cannot access file on Network Drive (Windows 2003)
        255502 by: Stut
        255506 by: Stut
        255524 by: Rahul Sitaram Johari
        255525 by: Rahul Sitaram Johari
        255526 by: Stut
        255535 by: Rahul Sitaram Johari
        255536 by: Jared Farrish
        255538 by: Rahul Sitaram Johari
        255539 by: Jared Farrish
        255540 by: Rahul Sitaram Johari
        255541 by: Jared Farrish

[CSS] help with a orizzotal menu
        255508 by: Marco Sottana
        255509 by: Stut
        255510 by: Edward Kay

two php scripts with same $_SESSION variables
        255512 by: Jean-Christophe Roux
        255513 by: Stut
        255514 by: Darren Whitlen
        255515 by: Paul Scott
        255516 by: Jean-Christophe Roux
        255517 by: Darren Whitlen
        255518 by: Stut
        255519 by: Darren Whitlen
        255520 by: Stut
        255521 by: Edward Kay
        255523 by: Jochem Maas
        255527 by: Ford, Mike
        255529 by: Jean-Christophe Roux
        255530 by: Stut

php hosting-mediatemple/dreamhost
        255522 by: blackwater dev
        255528 by: Tijnema
        255550 by: Robert Cummings

Re: Form Validation Issues
        255531 by: Tijnema

Creating an executer
        255533 by: lists.dwsasia.com

Re: ftp_put() problem??
        255534 by: Al

Re: xsd:choice maxOccurs=unbounded, and element order
        255537 by: Caroline Maynard

Protecting MySQL Injection from PHP form
        255542 by: Jason Pruim
        255543 by: Jared Farrish
        255544 by: Stephen
        255545 by: Darren Whitlen
        255546 by: Jared Farrish

Check if Record was Entered Today.
        255547 by: Rahul Sitaram Johari
        255548 by: Jim Moseby
        255549 by: Dan Shirah

Question about using ftp_put() for copying files
        255551 by: Al

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscribelists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscribelists.php.net

To post to the list, e-mail:
        php-generallists.php.net

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

attached mail follows:


hi i am looking for an instant messenger for my web site
i would like to enable also not register user to chat to the other not register user in my web site..

where i can find a source code like this ?

attached mail follows:


Marco Sottana wrote:
> hi i am looking for an instant messenger for my web site
> i would like to enable also not register user to chat to the other not register user in my web site..
>
> where i can find a source code like this ?

Lots of the them out there.. google "php ajax chat"
My personal favourite though has to be http://yurivish.com/yshout/

Bare in mind though, any PHP webserver based chat, will have a HUGE
demand on the server. Check your bandwidth constantly, it's gonna increase.

Darren

attached mail follows:


i would like a one to one chat .. no one to everybody
----- Original Message -----
From: "Darren Whitlen" <darrensirdaz.com>
To: <php-generallists.php.net>
Sent: Thursday, May 24, 2007 10:05 AM
Subject: [PHP] Re: instant messenger php + ajax

> Marco Sottana wrote:
>> hi i am looking for an instant messenger for my web site
>> i would like to enable also not register user to chat to the other not
>> register user in my web site..
>>
>> where i can find a source code like this ?
>
> Lots of the them out there.. google "php ajax chat"
> My personal favourite though has to be http://yurivish.com/yshout/
>
> Bare in mind though, any PHP webserver based chat, will have a HUGE demand
> on the server. Check your bandwidth constantly, it's gonna increase.
>
> Darren
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>

attached mail follows:


Marco Sottana wrote:
> i would like a one to one chat .. no one to everybody
> ----- Original Message ----- From: "Darren Whitlen" <darrensirdaz.com>
> To: <php-generallists.php.net>
> Sent: Thursday, May 24, 2007 10:05 AM
> Subject: [PHP] Re: instant messenger php + ajax
>
>
>> Marco Sottana wrote:
>>> hi i am looking for an instant messenger for my web site
>>> i would like to enable also not register user to chat to the other
>>> not register user in my web site..
>>>
>>> where i can find a source code like this ?
>>
>> Lots of the them out there.. google "php ajax chat"
>> My personal favourite though has to be http://yurivish.com/yshout/
>>
>> Bare in mind though, any PHP webserver based chat, will have a HUGE
>> demand on the server. Check your bandwidth constantly, it's gonna
>> increase.
>>
>> Darren
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>>

So let me get the idea..
User comes onto the website, User talks to webmaster. Does the webmaster
want to talk to everybody at the same time? Or just to one user at a time?

Darren

attached mail follows:


----- Original Message -----
From: "Darren Whitlen" <darrensirdaz.com>
To: <php-generallists.php.net>
Sent: Thursday, May 24, 2007 10:19 AM
Subject: Re: [PHP] Re: instant messenger php + ajax

> Marco Sottana wrote:
>> i would like a one to one chat .. no one to everybody
>> ----- Original Message ----- From: "Darren Whitlen" <darrensirdaz.com>
>> To: <php-generallists.php.net>
>> Sent: Thursday, May 24, 2007 10:05 AM
>> Subject: [PHP] Re: instant messenger php + ajax
>>
>>
>>> Marco Sottana wrote:
>>>> hi i am looking for an instant messenger for my web site
>>>> i would like to enable also not register user to chat to the other not
>>>> register user in my web site..
>>>>
>>>> where i can find a source code like this ?
>>>
>>> Lots of the them out there.. google "php ajax chat"
>>> My personal favourite though has to be http://yurivish.com/yshout/
>>>
>>> Bare in mind though, any PHP webserver based chat, will have a HUGE
>>> demand on the server. Check your bandwidth constantly, it's gonna
>>> increase.
>>>
>>> Darren
>>>
>>> --
>>> PHP General Mailing List (http://www.php.net/)
>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>
>>>
>>>
>
>
> So let me get the idea..
> User comes onto the website, User talks to webmaster. Does the webmaster
> want to talk to everybody at the same time? Or just to one user at a time?

1)User come onto the website ..
2)website give at the user a name like "guest".rand(1,1000);
3)website show a list with all user into the website
4)user can click over a name of over user .. website open a popup

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

attached mail follows:


2007. 05. 23, szerda keltezéssel 22.59-kor James Lockie ezt írta:
> I get a syntax error on strlen.
>
>
> $newTypes = array();
> $newTypes[0] = array();
> $newTypes[0][0] = "Starting with"

you missed the ending ; on that line

greets
Zoltán Németh

> $newTypes[0][1] = strlen( $newTypes[0][0] );
>

attached mail follows:


Stephen escribió:
> 1) Does the filename extension matter? I prefer *.inc? It seems to work fine, but I only see others using *.php
>
> 2) Does the include file need an opening <?php and ending ?> ?
>
> Not big issues, but I am curious.
>
> Thanks
> Stephen
>
>
If you use .inc extension you will have to modify the apache so they do
not show:

     RedirectMatch 404 /^.*\.(inc)$/

Thus, if you try to access the file using the navigator it will show a
"Page not found" error :-D

--
Miguel J. Jiménez
Programador Senior
Área de Internet/XSL/PHP
migueljose.jimenezisotrol.com

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

ISOTROL
Edificio BLUENET, Avda. Isaac Newton nº3, 4ª planta.
Parque Tecnológico Cartuja '93, 41092 Sevilla (ESP).
Teléfono: +34 955 036 800 - Fax: +34 955 036 849
http://www.isotrol.com

"You let a political fight come between you and your best friend you
have in all the world. Do you realize how foolish that is? How ominous?
How can this country survive if friends can't rise above the quarrel".
Constance Hazard, North & South (book I)

attached mail follows:


Tijnema wrote:
> On 5/23/07, Stephen <stephen-drogers.com> wrote:
>> I have a script to process the post from a form.
>>
>> The form is used to upload photos and has fields for the filename,
>> alt text, caption and a checkbox to indicate if this photo is the main
>> page image rotation.
>>
>> I wanted to build a general routine to build the form to allow for a
>> varying number of photos to upload.
>>
>> I use main_image[] for the various checkboxes for each photo.
>>
>> I see that the checkbox is *not* set, I get nothing back, and if the
>> second photo is checked (and the first not checked), I get
>> main_image[0] = 'on'.
>>
>> And I see this happens for the caption[] array as well.
>>
>> This seems to me to be pretty ugly.
>>
>> Am I understanding this properly?
>>
>> Do I really have to use main_image1, main_image2....
>>
>> Thanks
>> Stephen
>>
>
> No, you don't need to, it's the way you write your HTML form.
>
> Again, this is Off topic, as this has nothing to do with PHP, but
> well, we are here to help people in general.

Worryingly I agree with Greg here - this is on-topic because it relates
to the way PHP processes GET and POST vars.

> As you didn't provided your code, I'm giving a general example which
> worked for my photo site, and should work for your example too. You
> should replace <foto_id_here> with the ID of the photo you want to be
> checked.
>
> <input type='checkbox' name='photos[]' value="<photo_id_here>"/>
>
> And now $_POST['photos'] will be an array with the values being the
> IDs of the checked photos.

That is indeed the solution, but I think it's important to explain why
this is happening.

Take the example where you have 3 checkboxes, named photo1, photo2 and
photo3. Say photo2 and photo3 are checked, the POST data will look like
this...

photo2=on&photo3=on

Now consider the same 3 checkboxes, but all named photos[]. Since the
browser knows nothing about the square brackets, it creates the POST
data in the same way...

photos[]=on&photos[]=on

Now you see the problem. Nothing in that data indicates which checkboxes
were checked. By doing what Tijnema suggests you would end up with...

photos[]=2&photos[]=3

Hopefully that explains why what you've implemented is doing what it's
doing and will help you avoid problems like this in future.

-Stut

attached mail follows:


Morning guys,

this is not exactly a PHP question, but as I am sure that I am talking to
more or less professional developers, I thought I might ask you.

As I am working on some... well, for my standards... huge project, I thought
that some kind of project management software would / could be helpful to
keep track of my ideas, tasks and so on. Right now I am using a huge chunk
of papers to keep track (as good as I can).

Has any of you any experience with good project management software? Best
would be OpenSource, of course :o) My boss doesn't want to spend a lot of
money ;o)

Cheers guys,

Chris from sunny germany

attached mail follows:


On 24 May 2007, at 10:26, Christian Haensel wrote:

> Morning guys,
>
> this is not exactly a PHP question, but as I am sure that I am
> talking to more or less professional developers, I thought I might
> ask you.
>
> As I am working on some... well, for my standards... huge project,
> I thought that some kind of project management software would /
> could be helpful to keep track of my ideas, tasks and so on. Right
> now I am using a huge chunk of papers to keep track (as good as I
> can).
>
> Has any of you any experience with good project management
> software? Best would be OpenSource, of course :o) My boss doesn't
> want to spend a lot of money ;o)
>
> Cheers guys,
>
> Chris from sunny germany

Hi Chris
You could try basecamp... one project is free I believe.
http://basecamphq.com/

attached mail follows:


Christian Haensel wrote:
> this is not exactly a PHP question, but as I am sure that I am talking
> to more or less professional developers, I thought I might ask you.
>
> As I am working on some... well, for my standards... huge project, I
> thought that some kind of project management software would / could be
> helpful to keep track of my ideas, tasks and so on. Right now I am using
> a huge chunk of papers to keep track (as good as I can).
>
> Has any of you any experience with good project management software?
> Best would be OpenSource, of course :o) My boss doesn't want to spend a
> lot of money ;o)

So very much not on-topic, and you knew that. Did you Google? At all?
There are lots of project management systems out there, and the best
ones will usually bubble up to the surface when you Google for open
source project management.

Personally I use Trac because it integrates very nicely with subversion
and provides the primary functionality I need (Wiki, tickets and
milestone tracking). It also has great extensibility if you need
something it doesn't provide by default.

But, like I said, off-topic. Now please Google your arse off.

-Stut

> Cheers guys,
>
> Chris from sunny germany

Oh, right, sorry...

Stut from Woyal Windsor!

attached mail follows:


> -----Original Message-----
> From: Christian Haensel [mailto:phpchftp.com]
> Sent: 24 May 2007 10:27
> To: php-generallists.php.net
> Subject: [PHP] Project Management
>
>
> Morning guys,
>
> this is not exactly a PHP question, but as I am sure that I am talking to
> more or less professional developers, I thought I might ask you.
>
> As I am working on some... well, for my standards... huge
> project, I thought
> that some kind of project management software would / could be helpful to
> keep track of my ideas, tasks and so on. Right now I am using a
> huge chunk
> of papers to keep track (as good as I can).
>
> Has any of you any experience with good project management software? Best
> would be OpenSource, of course :o) My boss doesn't want to spend a lot of
> money ;o)
>
> Cheers guys,
>
> Chris from sunny germany

If you're working on your own, I would think realistically about how much
you would use such software. I've used Basecamp, Trac, MS Project and others
in the past and find them a waste of time. My favourite tool is simply an A4
lab book. (I know this doesn't scale, but it fits the bill perfectly for
now).

For initial brainstorming/idea tracking, I do use FreeMind though.
http://freemind.sf.net

HTH, Edward

attached mail follows:


Hi Edward,

thanks for your comment. I use a lab book too... And already fille two of
them in the last 8 weeks .... I just wanna use the project management thing
to collect my ideas, and write a howto for "future generation developers"
who may have to deal with this thing once I am gone.

Stut,

yes sir, I've used google and had a look at those things. What I wanted was
to know what you guys use. There is nothing more valuable than the opinions
of other developers and to know what they use in their day to day job.

Aaaaanyhow, my arse is still on... so I better bugger off :oP

Cheers for your comments!

Chris

----- Original Message -----
From: "Edward Kay" <edwardlabhut.com>
To: <php-generallists.php.net>
Sent: Thursday, May 24, 2007 12:00 PM
Subject: RE: [PHP] Project Management

>
>
>> -----Original Message-----
>> From: Christian Haensel [mailto:phpchftp.com]
>> Sent: 24 May 2007 10:27
>> To: php-generallists.php.net
>> Subject: [PHP] Project Management
>>
>>
>> Morning guys,
>>
>> this is not exactly a PHP question, but as I am sure that I am talking to
>> more or less professional developers, I thought I might ask you.
>>
>> As I am working on some... well, for my standards... huge
>> project, I thought
>> that some kind of project management software would / could be helpful to
>> keep track of my ideas, tasks and so on. Right now I am using a
>> huge chunk
>> of papers to keep track (as good as I can).
>>
>> Has any of you any experience with good project management software? Best
>> would be OpenSource, of course :o) My boss doesn't want to spend a lot of
>> money ;o)
>>
>> Cheers guys,
>>
>> Chris from sunny germany
>
>
> If you're working on your own, I would think realistically about how much
> you would use such software. I've used Basecamp, Trac, MS Project and
> others
> in the past and find them a waste of time. My favourite tool is simply an
> A4
> lab book. (I know this doesn't scale, but it fits the bill perfectly for
> now).
>
> For initial brainstorming/idea tracking, I do use FreeMind though.
> http://freemind.sf.net
>
> HTH, Edward
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

attached mail follows:


On 5/24/07, Christian Haensel <phpchftp.com> wrote:
> Hi Edward,
>
> thanks for your comment. I use a lab book too... And already fille two of
> them in the last 8 weeks .... I just wanna use the project management thing
> to collect my ideas, and write a howto for "future generation developers"
> who may have to deal with this thing once I am gone.
>
> Stut,
>
> yes sir, I've used google and had a look at those things. What I wanted was
> to know what you guys use. There is nothing more valuable than the opinions
> of other developers and to know what they use in their day to day job.
>
> Aaaaanyhow, my arse is still on... so I better bugger off :oP
>
> Cheers for your comments!
>
> Chris
>
>
>
> ----- Original Message -----
> From: "Edward Kay" <edwardlabhut.com>
> To: <php-generallists.php.net>
> Sent: Thursday, May 24, 2007 12:00 PM
> Subject: RE: [PHP] Project Management
>
>
> >
> >
> >> -----Original Message-----
> >> From: Christian Haensel [mailto:phpchftp.com]
> >> Sent: 24 May 2007 10:27
> >> To: php-generallists.php.net
> >> Subject: [PHP] Project Management
> >>
> >>
> >> Morning guys,
> >>
> >> this is not exactly a PHP question, but as I am sure that I am talking to
> >> more or less professional developers, I thought I might ask you.
> >>
> >> As I am working on some... well, for my standards... huge
> >> project, I thought
> >> that some kind of project management software would / could be helpful to
> >> keep track of my ideas, tasks and so on. Right now I am using a
> >> huge chunk
> >> of papers to keep track (as good as I can).
> >>
> >> Has any of you any experience with good project management software? Best
> >> would be OpenSource, of course :o) My boss doesn't want to spend a lot of
> >> money ;o)
> >>
> >> Cheers guys,
> >>
> >> Chris from sunny germany
> >
> >
> > If you're working on your own, I would think realistically about how much
> > you would use such software. I've used Basecamp, Trac, MS Project and
> > others
> > in the past and find them a waste of time. My favourite tool is simply an
> > A4
> > lab book. (I know this doesn't scale, but it fits the bill perfectly for
> > now).
> >
> > For initial brainstorming/idea tracking, I do use FreeMind though.
> > http://freemind.sf.net
> >
> > HTH, Edward
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

attached mail follows:


Rahul Sitaram Johari wrote:
> Apache 2.2, PHP5 & mySQL 5 on Windows 2003.
> I have some files sitting on a Network Drive accessible on the Windows 2003
> Server. But my php script is not able to open the files.
>
> Let¹s say there¹s a database on X:\Transfer\test.dbf
> If I use:
>
> $db = dbase_open(³X:\Transfer\test.dbf², 0);
>
> It is not able to open the database. The X: Drive is a network drive.
> Any clues on how to make this happen?

I assume you've mapped drive X to the network share for the user that
Apache runs as? If not are you really surprised that it can't find that
file?

Try using the UNC path ("\\\\server\\share\\Transfer\\test.dbf") [note
double backslashes]. If that still doesn't work then it's likely a
permissions issue.

-Stut

attached mail follows:


Rahul Sitaram Johari wrote:
> I use a Mac OS X Server generally, where I mount network drives to a share
> point. Everything works therein. Recently I had a need to setup Apache Web
> Server, PHP & mySQL on a Windows 2003 Server we have in the office.
>
> There I used the same scripts I was running on Mac OS X to access files on a
> network drive. But in Windows 2003, I¹m not mounting anything on a share
> point, I¹m simply referring to the files using actual paths. Whether it¹s a
> direct X:\ kind of path, or a network path \\servername ... With or without
> backslashes.
>
> This is the first application I setup on the Windows Server to access files
> on a network drive.

Does the user Apache is running as have permission to access the network
at all? It's fairly common for services to lack that access for
(shockingly for Windows) security reasons. The easiest way to test it is
to stop the Apache service and run it manually as your user. If it works
like that then your problem is definitely permissions-related and you
should consult your sysadmin (or Google if you don't have one).

-Stut

> On 5/23/07 4:33 PM, "Jared Farrish" <farrishjgmail.com> wrote:
>
>> So you haven't been able to actually access the drive yet? Are you using any
>> other shared content on network drives that does currently work?
>>
>> On 5/23/07, Rahul Sitaram Johari <sleepwalkerrahulsjohari.com> wrote:
>>> I've been trying to run various entry level functions on the file, like
>>> file_exists(), isreadable() etcetera.... But no matter what I do, I pretty
>>> much get the "cannot open" warnings without much specification as to Why
>>> cannot open.
>>>
>>> So when I do the dbase_open() function, and I've tried all different
>>> combinations of paths, backslashes and all, I always get this:
>>>
>>> Warning: dbase_open() [function.dbase-open]: unable to open database
>>> test.dbf in ... *followed by whatever path I put in*.
>>>
>>> I'm still going to try some more testing using text files, but this is what
>>> I'm really get at.
>>>
>
>
>

attached mail follows:


Ave,

UNC paths didn't work, i.e., ("\\\\server\\share\\Transfer\\test.dbf").
I have no clue how to Run Apache as a particular User on Windows! I
installed Apache using the Installer available - but I really don't know
anything else 'user' related about Apache.

Both "SYSTEM" and the Computer I'm running all this on have Full Control
Permissions to the Network Share.

On 5/24/07 5:28 AM, "Stut" <stuttlegmail.com> wrote:

> I assume you've mapped drive X to the network share for the user that
> Apache runs as? If not are you really surprised that it can't find that
> file?
>
> Try using the UNC path ("\\\\server\\share\\Transfer\\test.dbf") [note
> double backslashes]. If that still doesn't work then it's likely a
> permissions issue.
>
> -Stut

attached mail follows:


How exactly do you run Apache manually as your own user on Windows 2003?

On 5/24/07 5:32 AM, "Stut" <stuttlegmail.com> wrote:

> Does the user Apache is running as have permission to access the network
> at all? It's fairly common for services to lack that access for
> (shockingly for Windows) security reasons. The easiest way to test it is
> to stop the Apache service and run it manually as your user. If it works
> like that then your problem is definitely permissions-related and you
> should consult your sysadmin (or Google if you don't have one).
>
> -Stut

attached mail follows:


Rahul Sitaram Johari wrote:
> How exactly do you run Apache manually as your own user on Windows 2003?

You read the Apache documentation for the version your're using on
Windows at http://httpd.apache.org/

-Stut

> On 5/24/07 5:32 AM, "Stut" <stuttlegmail.com> wrote:
>
>> Does the user Apache is running as have permission to access the network
>> at all? It's fairly common for services to lack that access for
>> (shockingly for Windows) security reasons. The easiest way to test it is
>> to stop the Apache service and run it manually as your user. If it works
>> like that then your problem is definitely permissions-related and you
>> should consult your sysadmin (or Google if you don't have one).
>>
>> -Stut
>
>

attached mail follows:


Ave,

Instead of going back & forth on various function & path tests, I wrote a
small code containing different suggested combinations of PATH and also the
gettype() as Jim had requested. Following is the Code and the Output.

Code:

$filename = 'X:\send\Transfer\LIVE\live.txt';
echo gettype($filename)."<br>";
if (file_exists($filename)) {
    echo "The file $filename Exists<br>";
} else {
    echo "The file $filename does NOT Exist<br><br>";
}

$filename1 = 'X:\\send\\Transfer\\LIVE\\live.txt';
echo gettype($filename1)."<br>";
if (file_exists($filename1)) {
    echo "The file $filename1 Exists<br>";
} else {
    echo "The file $filename1 does NOT Exist<br><br>";
}

$filename2 = 'X:/send/Transfer/LIVE/live.txt';
echo gettype($filename2)."<br>";
if (file_exists($filename2)) {
    echo "The file $filename2 Exists<br>";
} else {
    echo "The file $filename2 does NOT Exist<br><br>";
}

$filename3 = 'X://send//Transfer//LIVE//live.txt';
echo gettype($filename3)."<br>";
if (file_exists($filename3)) {
    echo "The file $filename3 Exists<br>";
} else {
    echo "The file $filename3 does NOT Exist<br><br>";
}

$filename4 = '\\Foresight\send\Transfer\LIVE\live.txt';
echo gettype($filename4)."<br>";
if (file_exists($filename4)) {
    echo "The file $filename4 Exists<br>";
} else {
    echo "The file $filename4 does NOT Exist<br><br>";
}

$filename5 = '\\\\Foresight\\send\\Transfer\\LIVE\\live.txt';
echo gettype($filename5)."<br>";
if (file_exists($filename5)) {
    echo "The file $filename5 Exists<br>";
} else {
    echo "The file $filename5 does NOT Exist<br><br>";
}

$filename6 = '//Foresight/send/Transfer/LIVE/live.txt';
echo gettype($filename6)."<br>";
if (file_exists($filename6)) {
    echo "The file $filename6 Exists<br>";
} else {
    echo "The file $filename6 does NOT Exist<br><br>";
}

$filename7 = '////Foresight//send//Transfer//LIVE//live.txt';
echo gettype($filename7)."<br>";
if (file_exists($filename7)) {
    echo "The file $filename7 Exists<br>";
} else {
    echo "The file $filename7 does NOT Exist<br><br>";
}

Output:

string
The file X:\send\Transfer\LIVE\live.txt does NOT Exist

string
The file X:\send\Transfer\LIVE\live.txt does NOT Exist

string
The file X:/send/Transfer/LIVE/live.txt does NOT Exist

string
The file X://send//Transfer//LIVE//live.txt does NOT Exist

string
The file \Foresight\send\Transfer\LIVE\live.txt does NOT Exist

string
The file \\Foresight\send\Transfer\LIVE\live.txt does NOT Exist

string
The file //Foresight/send/Transfer/LIVE/live.txt does NOT Exist

string
The file ////Foresight//send//Transfer//LIVE//live.txt does NOT Exist

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Rahul Sitaram Johari
CEO, Twenty Four Seventy Nine Inc.

W: http://www.rahulsjohari.com
E: sleepwalkerrahulsjohari.com

³I morti non sono piu soli ... The dead are no longer lonely²

attached mail follows:


Well, I'll say you've dramatically upped the ante by having an Apache server
on a windows box attempt to mount and read a file on a MacOS machine. Yipes!

So let me get this straight:

 * Apache is on Windows Server 2003.

 * PHP is running on Apache.

 * A folder containing scripts/data/both is on a MacOSX machine.

 * A user from frontierland knocks on PHP's front host.com:80 door and says,
"Please..."

 * PHP -> Apache: "Gimme gimme [resource P]"

 * Apache says, "Ok, let me get the data from location X."

 * Apache -> location X: "Pretty Please, gimme gimme."

 * location X -> Apache: "[barf]"

 * Apache -> PHP: "No luck."

========

Can you, from the Windows 2003 machine, manually access the folder/file that
you're asking PHP (through Apache) to access? Unless the service that Apache
is running under has permissions to communicate with the share resource
(location X), this will always fail.

Steps:
1) From Win2003 box, open My Computer and attempt to physically navigate to
the remote network share you attempting to access. If at all possible, use
the exact user permission set that Apache runs under. To determine this,
right-click on the bottom, right corner of the Win2003 desktop above the
time and select "Task Manager," Processes tab, click to sort on Image Name
tab, and look for Apache.exe. The user name associated with this executable
will be the permissions you will need to use.

2) If you cannot connect to the network resource, then at least you have a
permissions issue (it may be others, though). Get this working first.

3) If you can connect, open, read, write, and execute from this permission
set (user/group), then you're at least sure that the machines can talk.
Next, you will need to determine if the Apache UID permissions are acting up
(in Safe Mode, this is entirely possible, and a black art in itself...).

4) Once you've determine Win/Mac communications and Apache server
permissions aren't impeding the process, you can work on the actual script
issues which may be present.

Remember, the computers need to be able to communicate and interact, then
apache/IIS/other, then PHP. Verify the simplest potential problems first,
then work your way up into the place where the problem currently exists.
Getting Macs to be on speaking terms with Win machines, I would think, would
be a MAJOR headache if you've never done it before. One essentially speaks
Polish, while the other speaks Italian.

--
Jared Farrish
Intermediate Web Developer
Denton, Tx

Abraham Maslow: "If the only tool you have is a hammer, you tend to see
every problem as a nail." $$

attached mail follows:


On 5/24/07 11:04 AM, "Jared Farrish" <farrishjgmail.com> wrote:

> Well, I'll say you've dramatically upped the ante by having an Apache server
> on a windows box attempt to mount and read a file on a MacOS machine. Yipes!
>
> So let me get this straight:
>
> * Apache is on Windows Server 2003.
>
> * PHP is running on Apache.
>
> * A folder containing scripts/data/both is on a MacOSX machine.
>
> * A user from frontierland knocks on PHP's front host.com:80 door and says,
> "Please..."
>
> * PHP -> Apache: "Gimme gimme [resource P]"
>
> * Apache says, "Ok, let me get the data from location X."
>
> * Apache -> location X: "Pretty Please, gimme gimme."
>
> * location X -> Apache: "[barf]"
>
> * Apache -> PHP: "No luck."
>
> ========

Jared,

I think you got a little confused with a previous post of mine. Mac OS X is
Not in this scenario at all!!! So completely Eradicate it from this current
Scenario.

This is a complete PHP/Apache on Windows 2003 Scenario. That's it!

So what it is supposed to be is:

* PHP5 / Apache2.2 on Windows Server 2003
* Folder on another Windows Machine on the Network contains some files
(mapped as network drive "X:\")
* PHP trying to read file on X:\ from Apache on Windows 2003.

There's really nothing else to it.

> Can you, from the Windows 2003 machine, manually access the folder/file that
> you're asking PHP (through Apache) to access? Unless the service that Apache
> is running under has permissions to communicate with the share resource
> (location X), this will always fail.

Yes! Without any problems! I can easily navigate to the X: drive on that
Windows Machine, and do anything I want with files there. I have all
permissions.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Rahul Sitaram Johari
CEO, Twenty Four Seventy Nine Inc.

W: http://www.rahulsjohari.com
E: sleepwalkerrahulsjohari.com

³I morti non sono piu soli ... The dead are no longer lonely²

attached mail follows:


On 5/24/07, Rahul Sitaram Johari <sleepwalkerrahulsjohari.com> wrote:
>
> I think you got a little confused with a previous post of mine. Mac OS X
> is
> Not in this scenario at all!!! So completely Eradicate it from this
> current
> Scenario.
>
> This is a complete PHP/Apache on Windows 2003 Scenario. That's it!
>
> So what it is supposed to be is:
>
> * PHP5 / Apache2.2 on Windows Server 2003
> * Folder on another Windows Machine on the Network contains some files
> (mapped as network drive "X:\")
> * PHP trying to read file on X:\ from Apache on Windows 2003.

Ok, I was under the impression this was one Win2003 machine in a Mac
network.

There's really nothing else to it.

Heh.

> Can you, from the Windows 2003 machine, manually access the folder/file
> that
> > you're asking PHP (through Apache) to access? Unless the service that
> Apache
> > is running under has permissions to communicate with the share resource
> > (location X), this will always fail.
>
> Yes! Without any problems! I can easily navigate to the X: drive on that
> Windows Machine, and do anything I want with files there. I have all
> permissions.
>

Are you running Apache under a different (non-privileged) account on the
Win2003 machine? If Apache is running as a service with a different username
(with no extended access to network resources), you will need to get Apache
to run as a service under a user that can access the network resource. And I
still think you should use non-mapped addresses instead of mapped addresses,
since a mapping is just a localized version of a resource name alias.

If, after determing that Apache is running with the right permissions for
the owned processes to connect to and use a network shared resource, then
it's probably an Apache UID conflict (is PHP in safe mode?).
--
Jared Farrish
Intermediate Web Developer
Denton, Tx

Abraham Maslow: "If the only tool you have is a hammer, you tend to see
every problem as a nail." $$

attached mail follows:


You may have something here.
Problem is, I don¹t know how to mess with how & under what user Apache is
running ­ and no one else here does either so basically I have to figure
this one out! I would like to, as you suggested, try and ³get Apache to run
as a service under a user that can access the network resource².

I definitely agree about using non-mapped addresses and using the actual
Server Name addresses.

On 5/24/07 11:24 AM, "Jared Farrish" <farrishjgmail.com> wrote:
>
Are you running Apache under a different (non-privileged) account on the
Win2003 machine? If Apache is running as a service with a different username
(with no extended access to network resources), you will need to get Apache
to run as a service under a user that can access the network resource. And I
still think you should use non-mapped addresses instead of mapped addresses,
since a mapping is just a localized version of a resource name alias.

If, after determing that Apache is running with the right permissions for
the owned processes to connect to and use a network shared resource, then
it's probably an Apache UID conflict (is PHP in safe mode?).

attached mail follows:


On 5/24/07, Rahul Sitaram Johari <sleepwalkerrahulsjohari.com> wrote:
>
>
> You may have something here.
> Problem is, I don't know how to mess with how & under what user Apache is
> running – and no one else here does either so basically I have to figure
> this one out! I would like to, as you suggested, try and "get Apache to run
> as a service under a user that can access the network resource".
>

Well, I have already described how to do this two posting ago (and the
advice from another user was to read the Apache documentation...):

1) Go to Win2003 desktop
2) Right-click on bottom, right part of desktop (right on top of the clock).
3) Select 'Task Manager', click Processes Tab, sort Image Name by clicking
tab.
4) Find 'apache.exe' or some variation of.
5) Look at the username associated with the process.

If this is 'System' or something type of special user (or a basic user
without network privileges extended to it), then you will need to modify
this by:

1) Locate the My Computer link on your desktop.
2) Right-click on top of the link, select "Manage", choose 'Services and
Applications', and select Services.
3) Find the apache service, double click to open properties, click on the
'Log On' tab, and see what user it is setup to use.

If this is a system account, I would think you would need to change this to
a network account, preferably one for which the password will not expire...
If apache is not running as a service, then you will need to determine how
it is starting up, and modify that to run under a different process with
modified user permissions.

I definitely agree about using non-mapped addresses and using the actual
> Server Name addresses.
>

For ease on the eyes, mappings are great, but they are not reliable for
programming purposes, IMHO.

For the advanced PHP gurus on the list, is it accurate to characterize PHP
as relying on Apache for file manipulation? Is it accurately described as:

Process Request->PHP->Apache->[File System Poof!]->Apache->PHP->Process

??? Just making sure I have this characterization correct.

--
Jared Farrish
Intermediate Web Developer
Denton, Tx

Abraham Maslow: "If the only tool you have is a hammer, you tend to see
every problem as a nail." $$

attached mail follows:


hi i have this

<div id="nav"><ul><li><a href="/item1.php"><em>Menu item 1</em></a><ul><li><a href="/item1.1.php">Menu item 1.1</a></li><li><a href="/item1.2.php"><em>Menu item 1.2</em></a><ul><li><a href="/item1.2.1.php">Menu item 1.2.1</a></li><li><strong>Menu item 1.2.2</strong><ul><li><a href="/item1.2.2.1.php">Menu item 1.2.2.1</a></li><li><a href="/item1.2.2.2.php">Menu item 1.2.2.2</a></li></ul></li><li><a href="/item1.2.3.php">Menu item 1.2.3</a></li></ul></li><li><a href="/item1.3.php">Menu item 1.3</a></li></ul></li><li><a href="/item2.php">Menu item 2</a></li><li><a href="/item3.php">Menu item 3</a></li><li><a href="/item4.php">Menu item 4</a></li></ul></div>

i would like to add a css and/or a javascript to skin this menu as a orizzontal menu with submenu orizzontal under menu.. and subsubmenu orizzontal and under submenu..

thanks a lot

attached mail follows:


Marco Sottana wrote:
> hi i have this
>
> <div id="nav"><ul><li><a href="/item1.php"><em>Menu item
> 1</em></a><ul><li><a href="/item1.1.php">Menu item 1.1</a></li><li><a
> href="/item1.2.php"><em>Menu item 1.2</em></a><ul><li><a
> href="/item1.2.1.php">Menu item 1.2.1</a></li><li><strong>Menu item
> 1.2.2</strong><ul><li><a href="/item1.2.2.1.php">Menu item
> 1.2.2.1</a></li><li><a href="/item1.2.2.2.php">Menu item
> 1.2.2.2</a></li></ul></li><li><a href="/item1.2.3.php">Menu item
> 1.2.3</a></li></ul></li><li><a href="/item1.3.php">Menu item
> 1.3</a></li></ul></li><li><a href="/item2.php">Menu item
> 2</a></li><li><a href="/item3.php">Menu item 3</a></li><li><a
> href="/item4.php">Menu item 4</a></li></ul></div>
>
> i would like to add a css and/or a javascript to skin this menu as a
> orizzontal menu with submenu orizzontal under menu.. and subsubmenu
> orizzontal and under submenu..

Adding [CSS] to the subject does not make this on-topic. Please try a
CSS mailing list.

-Stut

attached mail follows:


> -----Original Message-----
> From: Marco Sottana [mailto:marco.sottanaq-web.it]
> Sent: 24 May 2007 11:32
> To: php-generallists.php.net
> Subject: [PHP] [CSS] help with a orizzotal menu
>
>
> hi i have this
>
> <div id="nav"><ul><li><a href="/item1.php"><em>Menu item
> 1</em></a><ul><li><a href="/item1.1.php">Menu item
> 1.1</a></li><li><a href="/item1.2.php"><em>Menu item
> 1.2</em></a><ul><li><a href="/item1.2.1.php">Menu item
> 1.2.1</a></li><li><strong>Menu item 1.2.2</strong><ul><li><a
> href="/item1.2.2.1.php">Menu item 1.2.2.1</a></li><li><a
> href="/item1.2.2.2.php">Menu item
> 1.2.2.2</a></li></ul></li><li><a href="/item1.2.3.php">Menu item
> 1.2.3</a></li></ul></li><li><a href="/item1.3.php">Menu item
> 1.3</a></li></ul></li><li><a href="/item2.php">Menu item
> 2</a></li><li><a href="/item3.php">Menu item 3</a></li><li><a
> href="/item4.php">Menu item 4</a></li></ul></div>
>
> i would like to add a css and/or a javascript to skin this menu
> as a orizzontal menu with submenu orizzontal under menu.. and
> subsubmenu orizzontal and under submenu..
>
> thanks a lot
>

This is a PHP list. Your question has nothing to do with PHP. STFW.

Edward

PS: I think you mean 'horizontal' not 'orizzontal'. This is not a criticism,
but it may help you use better search terms.

attached mail follows:


Hello,
I have folder A with the following php script:
<?php
session_start();
$_SESSION['dummy']=10;
echo $_SESSION['dummy'];
?>
in folder B (same level as A), there is
<?php
session_start();
echo $_SESSION['dummy'];
?>
when running the script in B, in can see the value 10. How can I make sure that the $_SESSION['dummy'] is not shared between the two scripts? I could change the name but that would not be convenient.

Thank you

 
____________________________________________________________________________________
We won't tell. Get more on shows you hate to love
(and love to hate): Yahoo! TV's Guilty Pleasures list.
http://tv.yahoo.com/collections/265

attached mail follows:


Jean-Christophe Roux wrote:
> I have folder A with the following php script:
> <?php
> session_start();
> $_SESSION['dummy']=10;
> echo $_SESSION['dummy'];
> ?>
> in folder B (same level as A), there is
> <?php
> session_start();
> echo $_SESSION['dummy'];
> ?>
> when running the script in B, in can see the value 10. How can I make sure that the $_SESSION['dummy'] is not shared between the two scripts? I could change the name but that would not be convenient.

You'll have to change the name. The whole point of sessions is to allow
scripts to share variables between requests.

-Stut

attached mail follows:


Jean-Christophe Roux wrote:
> Hello,
> I have folder A with the following php script:
> <?php
> session_start();
> $_SESSION['dummy']=10;
> echo $_SESSION['dummy'];
> ?>
> in folder B (same level as A), there is
> <?php
> session_start();
> echo $_SESSION['dummy'];
> ?>
> when running the script in B, in can see the value 10. How can I make sure that the $_SESSION['dummy'] is not shared between the two scripts? I could change the name but that would not be convenient.
>
> Thank you
>
>
>
>
>
>
>
>
> ____________________________________________________________________________________
> We won't tell. Get more on shows you hate to love
> (and love to hate): Yahoo! TV's Guilty Pleasures list.
> http://tv.yahoo.com/collections/265

Session vars are available for every script that is run after the
session has started. If you want to stop the session for te remainder of
the script, you can use session_write_close().

http://uk2.php.net/session

Darren

attached mail follows:


On Thu, 2007-05-24 at 04:23 -0700, Jean-Christophe Roux wrote:
> when running the script in B, in can see the value 10. How can I make sure that the $_SESSION['dummy'] is not shared between the two scripts? I could change the name but that would not be convenient.
>

I think you are missing the point of using sessions completely.
There is a way, however, and that would be to set the dummy session
variable to an empty array and then kill off the session.

--Paul

All Email originating from UWC is covered by disclaimer http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm

attached mail follows:


Hello,

Thank you for the answers. The issue is that the same codes are in folders A and B. When they are run from two different browsers, I am getting the behavior I 'd like to see with two session ids being created and therefore no sharing of $_SESSION variables. But when the two apps are opened inside the same browser, the $_SESSION variables are shared and that makes sense because session_id() returns the same value. It would be be nice that when the app in A is running and the user starts the app in B, in the same browser widow, the server and php are instructed to realize that this is a brand new session and assign a new session_id() which would solve my problem. Is there a way to achieve that?

Regards,

----- Original Message ----
From: Stut <stuttlegmail.com>
To: Jean-Christophe Roux <jcxxryahoo.com>
Cc: php-generallists.php.net
Sent: Thursday, May 24, 2007 7:34:24 AM
Subject: Re: [PHP] two php scripts with same $_SESSION variables

Jean-Christophe Roux wrote:
> I have folder A with the following php script:
> <?php
> session_start();
> $_SESSION['dummy']=10;
> echo $_SESSION['dummy'];
> ?>
> in folder B (same level as A), there is
> <?php
> session_start();
> echo $_SESSION['dummy'];
> ?>
> when running the script in B, in can see the value 10. How can I make sure that the $_SESSION['dummy'] is not shared between the two scripts? I could change the name but that would not be convenient.

You'll have to change the name. The whole point of sessions is to allow
scripts to share variables between requests.

-Stut

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

 
____________________________________________________________________________________
8:00? 8:25? 8:40? Find a flick in no time
with the Yahoo! Search movie showtime shortcut.
http://tools.search.yahoo.com/shortcuts/#news

attached mail follows:


Jean-Christophe Roux wrote:
> Hello,
>
> Thank you for the answers. The issue is that the same codes are in folders A and B. When they are run from two different browsers, I am getting the behavior I 'd like to see with two session ids being created and therefore no sharing of $_SESSION variables. But when the two apps are opened inside the same browser, the $_SESSION variables are shared and that makes sense because session_id() returns the same value. It would be be nice that when the app in A is running and the user starts the app in B, in the same browser widow, the server and php are instructed to realize that this is a brand new session and assign a new session_id() which would solve my problem. Is there a way to achieve that?
>
> Regards,
>
>
>
>
> ----- Original Message ----
> From: Stut <stuttlegmail.com>
> To: Jean-Christophe Roux <jcxxryahoo.com>
> Cc: php-generallists.php.net
> Sent: Thursday, May 24, 2007 7:34:24 AM
> Subject: Re: [PHP] two php scripts with same $_SESSION variables
>
> Jean-Christophe Roux wrote:
>> I have folder A with the following php script:
>> <?php
>> session_start();
>> $_SESSION['dummy']=10;
>> echo $_SESSION['dummy'];
>> ?>
>> in folder B (same level as A), there is
>> <?php
>> session_start();
>> echo $_SESSION['dummy'];
>> ?>
>> when running the script in B, in can see the value 10. How can I make sure that the $_SESSION['dummy'] is not shared between the two scripts? I could change the name but that would not be convenient.
>
> You'll have to change the name. The whole point of sessions is to allow
> scripts to share variables between requests.
>
> -Stut
>

So what your saying, is that.. you want a webpage open twice but with
different session_id? The only way to do that would be to create a
session_id yourself, eg. session_id(time().rand(0,1000));
Then pass that id through your scripts via POST or GET, start the
session using that ID. You can then start as many sessions as you like.

Darren

attached mail follows:


Jean-Christophe Roux wrote:
> Thank you for the answers. The issue is that the same codes are in
> folders A and B. When they are run from two different browsers, I am
> getting the behavior I 'd like to see with two session ids being created
> and therefore no sharing of $_SESSION variables. But when the two apps
> are opened inside the same browser, the $_SESSION variables are shared
> and that makes sense because session_id() returns the same value. It
> would be be nice that when the app in A is running and the user starts
> the app in B, in the same browser widow, the server and php are
> instructed to realize that this is a brand new session and assign a new
> session_id() which would solve my problem. Is there a way to achieve that?

It's frickin' annoying!
Why?
Please don't top post!

What you're wanting to do can be achieved by setting the path on the
session cookies. You may be able to do this by calling ini_set to change
session.cookie_path before calling session_start.

-Stut

> ----- Original Message ----
> From: Stut <stuttlegmail.com>
> To: Jean-Christophe Roux <jcxxryahoo.com>
> Cc: php-generallists.php.net
> Sent: Thursday, May 24, 2007 7:34:24 AM
> Subject: Re: [PHP] two php scripts with same $_SESSION variables
>
> Jean-Christophe Roux wrote:
> > I have folder A with the following php script:
> > <?php
> > session_start();
> > $_SESSION['dummy']=10;
> > echo $_SESSION['dummy'];
> > ?>
> > in folder B (same level as A), there is
> > <?php
> > session_start();
> > echo $_SESSION['dummy'];
> > ?>
> > when running the script in B, in can see the value 10. How can I make
> sure that the $_SESSION['dummy'] is not shared between the two scripts?
> I could change the name but that would not be convenient.
>
> You'll have to change the name. The whole point of sessions is to allow
> scripts to share variables between requests.
>
> -Stut
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
> ------------------------------------------------------------------------
> Get your own web address.
> <http://us.rd.yahoo.com/evt=49678/*http://smallbusiness.yahoo.com/domains/?p=BESTDEAL>
> Have a HUGE year through Yahoo! Small Business. <
> http://us.rd.yahoo.com/evt=49678/*http://smallbusiness.yahoo.com/domains/?p=BESTDEAL>

attached mail follows:


Stut wrote:
> Jean-Christophe Roux wrote:
>> Thank you for the answers. The issue is that the same codes are in
>> folders A and B. When they are run from two different browsers, I am
>> getting the behavior I 'd like to see with two session ids being
>> created and therefore no sharing of $_SESSION variables. But when the
>> two apps are opened inside the same browser, the $_SESSION variables
>> are shared and that makes sense because session_id() returns the same
>> value. It would be be nice that when the app in A is running and the
>> user starts the app in B, in the same browser widow, the server and
>> php are instructed to realize that this is a brand new session and
>> assign a new session_id() which would solve my problem. Is there a
>> way to achieve that?
>
> It's frickin' annoying!
> Why?
> Please don't top post!
>
> What you're wanting to do can be achieved by setting the path on the
> session cookies. You may be able to do this by calling ini_set to change
> session.cookie_path before calling session_start.
>
> -Stut
>
>> ----- Original Message ----
>> From: Stut <stuttlegmail.com>
>> To: Jean-Christophe Roux <jcxxryahoo.com>
>> Cc: php-generallists.php.net
>> Sent: Thursday, May 24, 2007 7:34:24 AM
>> Subject: Re: [PHP] two php scripts with same $_SESSION variables
>>
>> Jean-Christophe Roux wrote:
>> > I have folder A with the following php script:
>> > <?php
>> > session_start();
>> > $_SESSION['dummy']=10;
>> > echo $_SESSION['dummy'];
>> > ?>
>> > in folder B (same level as A), there is
>> > <?php
>> > session_start();
>> > echo $_SESSION['dummy'];
>> > ?>
>> > when running the script in B, in can see the value 10. How can I
>> make sure that the $_SESSION['dummy'] is not shared between the two
>> scripts? I could change the name but that would not be convenient.
>>
>> You'll have to change the name. The whole point of sessions is to allow
>> scripts to share variables between requests.
>>
>> -Stut
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>>
>> ------------------------------------------------------------------------
>> Get your own web address.
>> <http://us.rd.yahoo.com/evt=49678/*http://smallbusiness.yahoo.com/domains/?p=BESTDEAL>
>>
>> Have a HUGE year through Yahoo! Small Business. <
>> http://us.rd.yahoo.com/evt=49678/*http://smallbusiness.yahoo.com/domains/?p=BESTDEAL>
>>

Stut..
I've only been here one day, and I think I'm right in saying that your
the one around here that gets annoyed really easy ;)

attached mail follows:


Darren Whitlen wrote:
> Stut..
> I've only been here one day, and I think I'm right in saying that your
> the one around here that gets annoyed really easy ;)

Not really, I just tend to be a bit more vocal about it.

-Stut

attached mail follows:


> Stut..
> I've only been here one day, and I think I'm right in saying that your
> the one around here that gets annoyed really easy ;)

I don't think Stut gets annoyed more than any of the others on this list.
Please remember though that

a) Stut's answers tend to be very high quality and
b) Top posting is damn annoying. (Maybe this should be point (a)...)

Edward

attached mail follows:


Darren Whitlen wrote:
> Stut wrote:

...

>
> Stut..
> I've only been here one day, and I think I'm right in saying that your
> the one around here that gets annoyed really easy ;)

when he goes quiet - that's when it's time to worry ;-)

attached mail follows:


On 24 May 2007 13:22, Jean-Christophe Roux wrote:

> Hello,
>
> Thank you for the answers. The issue is that the same codes
> are in folders A and B. When they are run from two different
> browsers, I am getting the behavior I 'd like to see with two
> session ids being created and therefore no sharing of
> $_SESSION variables. But when the two apps are opened inside
> the same browser, the $_SESSION variables are shared and that
> makes sense because session_id() returns the same value. It
> would be be nice that when the app in A is running and the
> user starts the app in B, in the same browser widow, the
> server and php are instructed to realize that this is a brand
> new session and assign a new session_id() which would solve
> my problem. Is there a way to achieve that?

I think that what you want is a different session *name* for each application.

To get this, just call session_name() with the appropriate value immediately before every session_start(). For example, for the files in A you could use:

   session_name('SESSID_A');
   session_start();

whilst those in B would have:

   session_name('SESSID_B');
   session_start();

Cheers!

Mike

---------------------------------------------------------------------
Mike Ford, Electronic Information Services Adviser,
JG125, The Headingley Library,
James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS, LS6 3QS, United Kingdom
Email: m.fordleedsmet.ac.uk
Tel: +44 113 812 4730 Fax: +44 113 812 3211

To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm

attached mail follows:


Stut wrote
>What you're wanting to do can be achieved by setting the path on the
>session cookies. You may be able to do this by calling ini_set to change
>session.cookie_path before calling session_start.

ini_set('session.cookie_path', '/A/');
session_start();
That's a good solution; it works fine. Thank you

Mike wrote
>To get this, just call session_name() with the appropriate value immediately before every session_start().

session_name('SESSID_A');
session_start();
That's a good solution; it works fine. Thank you

Are those two solutions equivalent or are there circumstances where one would be better than the other?
Regards,
JCR
"who will never top post again"

 
____________________________________________________________________________________
Sucker-punch spam with award-winning protection.
Try the free Yahoo! Mail Beta.
http://advision.webevents.yahoo.com/mailbeta/features_spam.html

attached mail follows:


Jean-Christophe Roux wrote:
> Stut wrote
> >What you're wanting to do can be achieved by setting the path on the
> >session cookies. You may be able to do this by calling ini_set to change
> >session.cookie_path before calling session_start.
>
> ini_set('session.cookie_path', '/A/');
> session_start();
> That's a good solution; it works fine. Thank you
>
> Mike wrote
> >To get this, just call session_name() with the appropriate value
> immediately before every session_start().
>
> session_name('SESSID_A');
> session_start();
> That's a good solution; it works fine. Thank you
>
> Are those two solutions equivalent or are there circumstances where one
> would be better than the other?

Changing the session name is better, and I'm kicking myself for not
thinking of it. It's more portable because you won't have to change the
code if you move it to another location.

-Stut

attached mail follows:


Forgive me if this is a bit off topic but I currenly have several sites
hosted with dreamhost, it's cheap and well prone to be slow. Does anyone
have experience with mediatemple? I would just be running php/mysql sites.

Thanks!

attached mail follows:


On 5/24/07, blackwater dev <blackwaterdevgmail.com> wrote:
> Forgive me if this is a bit off topic but I currenly have several sites
> hosted with dreamhost, it's cheap and well prone to be slow. Does anyone
> have experience with mediatemple? I would just be running php/mysql sites.
>
> Thanks!
>
I don't have experience with both, but I can recommend dapx.com, fast
and cheap. Buying the hosting itself is sometimes a little bit slow,
but it's worth.
It has a very nice PHP configuration, safe_mode off, open_basedir on, etc.

Tijnema

attached mail follows:


On Thu, 2007-05-24 at 09:04 -0400, blackwater dev wrote:
> Forgive me if this is a bit off topic but I currenly have several sites
> hosted with dreamhost, it's cheap and well prone to be slow. Does anyone
> have experience with mediatemple? I would just be running php/mysql sites.

One of my customers uses mediatemple. I've had good experience with
their Dedicated Virtual Server solution. I recently migrated their old
MT server to the new setup that uses CentOS 4.4, PHP 4.3.9, and MySQL
4.1.20. It's nice because it's a completely isolated Virtual Server with
root access to configure things as you please. Since they use the free
CentOS it's easy to compile stuff in a VMWare clone and migrate the
binaries over. General admin goes through Plesk which is pretty much
idiot proof.

Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'

attached mail follows:


On 5/23/07, Crayon Shin Chan <crayon.shin.chan.ukgmail.com> wrote:
> On Thursday 24 May 2007 00:51, Greg Donald wrote:
>
> > As I watch PHP de-evolve into Java, I find myself wanting something
> > lighter weight and with a smaller syntax.
>
> PHP has long since spawned into something uncontrollable. Compare the
> number of functions (and its aliases) to eg Ruby. The string functions in
> particular are absolutely bloated, eg ltrim, trim & rtrim - WTF. Why not
> just have trim() and have the option of specifying whether
> left/right/both? The same goes for the case-sensitive and
> case-insensitive versions of functions.
>
> --
> Crayon

Yeah, for case-insensitive functions would a bool be a lot better,
like the strstr function, the current syntax is (also for the
case-insensitive function stristr):
string strstr ( string $haystack, string $needle )
It would be a lot better to have it like this:
string strstr ( string $haystack, string $needle, bool $case_sensitive )

The trim functions are fine for me..

Tijnema

attached mail follows:


Hi,

Summary:

1. I execute script1 that will run in the background (daemon)
2. script1 needs to execute script2 and capture STDERR, STDOUT and
exitcode from script2 if script2 exits before SIGTERM is received.
3. If I send SIGTERM to script1 it should kill script2, and write to
DB (or log file some information that it was stopped)

Simple, isn't it? But I cannot seam to get it to work. Anyone with
some example code that does the same thing?

=========

More complex description

I have some scripts (perl, c, php, or anything else) that simple
independent scripts that do some stuff and output STDOUT and STDERR
and exit with an exitcode. There scripts will be kept like this, and
will not change their behavior.

Now I need to control them and also log their STDOUT, STDERR and
exitcode. Ok, that far I have come, so that I am logging the STDOUT,
STDERR and exitcode. What I am doing is that I have created an
executer that takes care of this and writing it to DB.

Now I need to add a functionality so that when the executer receives a
SIGTERM signal it should kill the script (that was started with a
exec() call, and then log some information to the DB (that the script
was killed etc).

I have registered the signal SIGTERM with pcntl_signal(SIGTERM,
"sig_handler"). When I am testing I just write some info to a file
when the signal is received. I created a simple testing script with a
while(true) loop and then send the signal to the script and it
successfully writes the information to the logflie.

Ok, now I instead of a while(true) loop make an exec() call to a
script (that is running for ever) and send the signal, then it does
not write to the file as it is supposed to. I guess it is because the
script is busy running the exec command.

I tried to then exec() it in the background. The problem there is that
it becomes a daemon and then I cannot know what that script is doing,
and it will not send any SIGCHLD to the parent, or it does, but to
init. Or actually there will be a SIGCHLD sent, as the exec() will
open its own shell, and then the shell will exit and we get the
SIGCHLD from the shell instead of the executed script.

Is there any way to get the "child" process PID when you exec() and
send it to the background? But then, how can I capture the exitcode?
The STDERR and STDOUT is fine as I can direct it to a file and get it
from there.

I have a really ugly workarounds: I could append an dummy variable to
the execution of the script and then do a grep of the ps -ef to get
the PID of that script.

/Peter

attached mail follows:


Can anyone explain what's going on. This works; but, I don't understand it.

Two folks pointed out I had my $remote and $local files reversed. I fixed that; but, it still didn't work.

This does work:

$source_dir is the absolute path i.e., /home/xxxxx/public_html/EditPage

ftp_chdir($dist_dir); //$dist_dir is simply relative to $_SERVER[document_root]; i.e., /test

ftp_put($conn_id, $dist, $source, flag];

Al wrote:
> Can anyone help with this. On a Linux/Apache server.
>
> I want to simply copy a file with ftp_put() from one dir to another.
>
> To make certain I'm pointing to the correct dirs, I'm using this:
> print_r(ftp_nlist($conn_id, FTP_EP_DIR)); //It is the correct dir
> print_r(ftp_nlist($conn_id, $rpdir)); //It is the correct dir
>
> Then I'm:
> ftp_put($conn_id, FTP_EP_DIR .'/' . $file, $rpdir. '/' . $file, FTP_ASCII);
>
> Error msg:
> Warning: ftp_put(/home/xxxxx/public_html/test/EditPageIndexer.php)
> [function.ftp-put]: failed to open stream: No such file or directory in
> /home/xxxxx/public_html/EditPage/ep_functions.inc on line 227
>
> And the files are not copied.
>
> Owner and permissions are correct. I can make a new dir [mkdir()] in
> the destination dir without a problem.
>
> Manual is confusing when it calls the files "remote" and "local".
>
> Thanks....

attached mail follows:


Simon Detheridge wrote:
>
> Incidentally, the full-blown (and rather complicated I'm afraid)
> schema/wsdl for what I'm *actually* trying to do is at
> http://www.widgit.com/cml/symgate.wsdl if that helps.

404

attached mail follows:


Hi Everyone,

I think I have found away to prevent SQL code injection into my
database and just wanted to get everyones comments on my method.

<?PHP
include 'defaults.php';

// Setting error message variable to nothing
$errmsg = "";

// Check form info
if (!isset($_POST['FName']) || empty($_POST['FName']))
$errmsg .="<P>Please enter your name</P>";
if (!isset($_POST['LName']) || empty($_POST['LName']))
$errmsg .="<P>Please enter your address</P>";
if (!isset($_POST['Add1']) || empty($_POST['Add1']))
$errmsg .="<P>Please enter your city</P>";
if (!isset($_POST['City']) || empty($_POST['City']))
$errmsg .="<P>Please enter your state</P>";
if (!isset($_POST['State']) || empty($_POST['State']))
$errmsg .="<P>Please enter your zip code</P>";
if (!isset($_POST['Zip']) || empty($_POST['Zip']))
$errmsg .="<P>Please include your zipe code</P>";
if (!isset($_POST['subName']) || empty($_POST['subName']))
$errmsg .="<P> Please enter your submitter name</P>";

// Tell script what to do if there is a error message
if ($errmsg!= "") {
echo $errmsg;
echo "<a href=\"javascript:history.back();\">Please go back and fill
out the missing fields</a>";
exit;
} else {
echo "<p>success: all fields were filled out</p>";
}

$FName= $_POST['FName'];
$LName= $_POST['LName'];
$Add1= $_POST['Add1'];
$Add2= $_POST['Add2'];
$City= $_POST['City'];
$State= $_POST['State'];
$Zip= $_POST['Zip'];
$Date= $_SERVER['REQUEST_TIME'];
$Record= "\t";
$subName= $_POST['subName'];
$subEmail= $_POST['subEmail'];
$subPhone= $_POST['subPhone'];
$chkMember=serialize($_POST['chkMember']);
$chkAdd=serialize($_POST['chkAdd']);
$chkDel=serialize($_POST['chkDel']);

echo "$FName First Name<BR>";
$link = mysqli_connect($server, $username, $password, $database)
     or die('Could not connect: ' . mysql_error());
echo 'Connected successfully <BR>';
//mysqil_select_db('legion') or die('Could not select database' .
mysql_error());
echo 'DB selected <BR>';

//Create the statement
$stmt = mysqli_prepare($link, "INSERT INTO current VALUES
(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
mysqli_stmt_bind_param($stmt, 'sssssssssssssss', $FName, $LName,
$Add1, $Add2, $City, $State, $Zip, $Date, $Record, $subName,
$subEmail, $subPhone, $chkMember, $chkAdd, $chkDel);
//Add the record
mysqli_stmt_execute($stmt);
printf("%d Row Inserted.\n", mysqli_stmt_affected_rows($stmt));

//Close the statement
mysqli_stmt_close($stmt);

?>

The reason I am echoing $FName just above the link was a debugging
tool to make sure that it was filling at least SOME of the field
properly before inserting them into the database.

Also, just for planning purposes, I do plan on adding authentication
to the form (Which I think I can do and track with sessions) but I
have alot more reading to do before I can get that right.

One other thing... What I did to test it was in the $FName field I
typed: "Jason"; "SELECT * FROM table"; and it inserted the value, but
didn't execute the code, Am I correct in thinking that I'm fairly
safe from the bad people and the stupid users?

attached mail follows:


I'm not sure exactly what kind of sanitization you think you're doing, but
if all you do is check to see if it's empty (empty() implements isset(),
empty() checks to see if it's set, then if it evaluates to an empty
variable), that's not much sanitization.

What you need to do is check for SQL injections, which means you need to
sanitize GPC (GET, POST, COOKIES) to prevent the following (only a
demonstration):

SELECT `colname` FROM `tablename` WHERE id='$variable' LIMIT 0,10

What happens if $variable is equal to:

$variable = $_POST['somedata'];

And $_POST['somedata'] ~ " 'INSERT INTO users
VALUES('name','password','AdminGroup')' ";

This is an example of a possible SQL injection (which means unknown SQL code
is running through your script access). The way to prevent this is to escape
single quotes before insert/select, and also turn all html entities into
escaped values (so that someone cannot put a <script></script> block into
the signature for their user, for example).

The good thing is, there are numerous help sites online that describe how to
do this. Generally, you're better off wrapping your SQL commands into a
class or at least a series of functions, so that you can implement your
sanitization once and use it for all database interactions.

Google: http://www.google.com/search?q=php+sanitize+sql+statement
PHP.net: http://www.php.net/manual/en/security.database.sql-injection.php

--
Jared Farrish
Intermediate Web Developer
Denton, Tx

Abraham Maslow: "If the only tool you have is a hammer, you tend to see
every problem as a nail." $$

attached mail follows:


Jason Pruim <japruimraoset.com> wrote: Hi Everyone,

I think I have found away to prevent SQL code injection into my
database and just wanted to get everyones comments on my method.

  
 Am I correct in thinking that I'm fairly
safe from the bad people and the stupid users?

   
   
  You need to consider someone entering scripts that could do bad things when the data is sent to a web site. You use the function htmlspecialchars() for this (or one of its siblings).
   
  You should also use mysql_real_eascape_string() on any data being inserted into your database.
   
  But you must deal with magic quotes first. If they are enabled, I remove them from my posted variables as the first step.
   
  Cheers
  Stephen

attached mail follows:


Jason Pruim wrote:
> Hi Everyone,
>
> I think I have found away to prevent SQL code injection into my database
> and just wanted to get everyones comments on my method.
>
> <?PHP
> include 'defaults.php';
>
> // Setting error message variable to nothing
> $errmsg = "";
>
> // Check form info
> if (!isset($_POST['FName']) || empty($_POST['FName'])) $errmsg
> .="<P>Please enter your name</P>";
> if (!isset($_POST['LName']) || empty($_POST['LName'])) $errmsg
> .="<P>Please enter your address</P>";
> if (!isset($_POST['Add1']) || empty($_POST['Add1'])) $errmsg
> .="<P>Please enter your city</P>";
> if (!isset($_POST['City']) || empty($_POST['City'])) $errmsg
> .="<P>Please enter your state</P>";
> if (!isset($_POST['State']) || empty($_POST['State'])) $errmsg
> .="<P>Please enter your zip code</P>";
> if (!isset($_POST['Zip']) || empty($_POST['Zip'])) $errmsg .="<P>Please
> include your zipe code</P>";
> if (!isset($_POST['subName']) || empty($_POST['subName'])) $errmsg
> .="<P> Please enter your submitter name</P>";
>
>
> // Tell script what to do if there is a error message
> if ($errmsg!= "") {
> echo $errmsg;
> echo "<a href=\"javascript:history.back();\">Please go back and fill out
> the missing fields</a>";
> exit;
> } else {
> echo "<p>success: all fields were filled out</p>";
> }
>
>
> $FName= $_POST['FName'];
> $LName= $_POST['LName'];
> $Add1= $_POST['Add1'];
> $Add2= $_POST['Add2'];
> $City= $_POST['City'];
> $State= $_POST['State'];
> $Zip= $_POST['Zip'];
> $Date= $_SERVER['REQUEST_TIME'];
> $Record= "\t";
> $subName= $_POST['subName'];
> $subEmail= $_POST['subEmail'];
> $subPhone= $_POST['subPhone'];
> $chkMember=serialize($_POST['chkMember']);
> $chkAdd=serialize($_POST['chkAdd']);
> $chkDel=serialize($_POST['chkDel']);
>
>
>
> echo "$FName First Name<BR>";
> $link = mysqli_connect($server, $username, $password, $database)
> or die('Could not connect: ' . mysql_error());
> echo 'Connected successfully <BR>';
> //mysqil_select_db('legion') or die('Could not select database' .
> mysql_error());
> echo 'DB selected <BR>';
>
>
> //Create the statement
> $stmt = mysqli_prepare($link, "INSERT INTO current VALUES
> (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
> mysqli_stmt_bind_param($stmt, 'sssssssssssssss', $FName, $LName,$Add1,
> $Add2, $City, $State, $Zip, $Date, $Record, $subName, $subEmail,
> $subPhone, $chkMember, $chkAdd, $chkDel);
> //Add the record
> mysqli_stmt_execute($stmt);
> printf("%d Row Inserted.\n", mysqli_stmt_affected_rows($stmt));
>
> //Close the statement
> mysqli_stmt_close($stmt);
>
>
>
> ?>
>
> The reason I am echoing $FName just above the link was a debugging tool
> to make sure that it was filling at least SOME of the field properly
> before inserting them into the database.
>
> Also, just for planning purposes, I do plan on adding authentication to
> the form (Which I think I can do and track with sessions) but I have
> alot more reading to do before I can get that right.
>
> One other thing... What I did to test it was in the $FName field I
> typed: "Jason"; "SELECT * FROM table"; and it inserted the value, but
> didn't execute the code, Am I correct in thinking that I'm fairly safe
> from the bad people and the stupid users?

I cannot see any sql-injection protection in your code anywhere? Seems
as your using mysqli, take a look at the mysqli_real_escape_string()
function. You need to run each _POST variable throught it.

        $FName = mysqli_real_escape_string($_POST['FName']);

Or if your post data only contains data to be entered into the database,
you might consider running everything through the function to make
things easier:

        foreach($_POST as $k => $v)
                $_POST[$k] = mysqli_real_escape_string($v);

Darren

attached mail follows:


Also, you should be checking against type (expecting a number? a boolean
value? a string?) and then checking against expected length requirements
(such as firstname can only be 80 characters long max, so maybe check for

<code>
if (strlen($var) > 80) {
    do something;
}
</code>

In unit testing, you build your objects first against types and perform
object checks using type verification and expected element attributes (such
as length, non-null values, etc...). If someone is posting a string of 8000
letters into a field that is supposed to contain a number two letters long,
before it is stored, maybe you manage that...

On 5/24/07, Jared Farrish <farrishjgmail.com> wrote:
>
> I'm not sure exactly what kind of sanitization you think you're doing, but