php-general Digest 19 May 2006 17:23:16 -0000 Issue 4137

Topics (messages 236475 through 236507):

Re: Wikimedia - cookies
        236475 by: Chris Rukas
        236476 by: Chris
        236477 by: Richard Lynch
        236500 by: Anthony Ettinger

Re: Session Not Being Passed?
        236478 by: Richard Lynch
        236479 by: Scott Hurring
        236480 by: php.metro.cx

Encryption Advice
        236481 by: Lawrence Kennon
        236482 by: Scott Hurring
        236485 by: Jim Moseby

PHP & JavaScript
        236483 by: Jay Blanchard
        236484 by: Daniel Orner
        236486 by: John Nichel
        236487 by: Jay Blanchard
        236488 by: Angelo Zanetti
        236489 by: Kristen G. Thorson
        236490 by: Daniel Orner
        236491 by: Jay Blanchard
        236492 by: Jochem Maas
        236493 by: Dave Goodchild
        236494 by: John Nichel
        236495 by: php.metro.cx
        236496 by: Dave Goodchild
        236498 by: John Nichel
        236501 by: php.metro.cx
        236503 by: Jay Blanchard

PHP Proxy Support
        236497 by: Vedanta Barooah

Running two versions of PHP locally
        236499 by: Phillip S. Baker
        236502 by: php.metro.cx
        236505 by: Scott Hurring
        236506 by: Eric Butera

Re: Sparse 1.0b - framework for MySQL programs
        236504 by: Daniel Orner
        236507 by: Kevin Waterson

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:
        php-general@lists.php.net


----------------------------------------------------------------------
--- Begin Message --- Hmm, didn't think about it until you said database, but storing an RSS feed in mysql woudl probably be easier than parsing an xml file.. :)

Thanks

And downloaded wikimedia from wikimedia.com :p Not much help there from what I can get, but I'll try some more. :)

Thanks again.

--- End Message ---
--- Begin Message ---
Chris Rukas wrote:
I'm not sure where I should go for wiki community though :-\. I wanted to try and contact the Text_Wiki or the Text_Wiki_Mediawiki or the Yawiki guy(I think the same as the Text_Wiki) for this information but PEAR said talk on this channel. Any recomendations on where I can go to ask my question?

Always CC the mailing list.

Where did you download wikimedia from?

Also, I'm working on a simple program for editing/making/deleting items in an RSS Feed(2.0). Are there programs that already do this for me to study/learn off of. I've seen a few that make an entire RSS feed, but not one for maintaining one.

Depends where your content is coming from.

If it's coming from a database, simply don't include the fields you don't want to appear in the feed.

--
Postgresql & php tutorials
http://www.designmagick.com/

--- End Message ---
--- Begin Message ---
On Thu, May 18, 2006 10:39 pm, Christopher wrote:
> I've built a front-end to display information from a wikimedia
> database
> that uses Text_Wiki and Text_Wiki_Mediawiki, but I can't seem to
> figure
> out how the wiki keeps track of its cookies and such. I would like to
> expand this to front-end so if it can pick up someone has logged into
> the
> wiki before, and allow them more options.
>
> Does anyone know how the wikimedia cookies are stored and how I can
> access
> them?
>
> Sorry if this is something extremely simple, I'm still a bit of a noob
> :)

While it's remotely possible somebody here uses WikiMedia and knows
the answer it's not really a "General PHP" type of question...

Your best options are:

Ask the WikiMedia folks.

Install LiveHTTPHeaders in Firefox and see what Cookies you get.

Configure your browser to prompt you for all Cookies and see what
Cookies you get.

HTH

-- 
Like Music?
http://l-i-e.com/artists.htm

--- End Message ---
--- Begin Message ---
On 5/18/06, Richard Lynch <[EMAIL PROTECTED]> wrote:
On Thu, May 18, 2006 10:39 pm, Christopher wrote:
> I've built a front-end to display information from a wikimedia
> database
> that uses Text_Wiki and Text_Wiki_Mediawiki, but I can't seem to
> figure
> out how the wiki keeps track of its cookies and such. I would like to
> expand this to front-end so if it can pick up someone has logged into
> the
> wiki before, and allow them more options.
>
> Does anyone know how the wikimedia cookies are stored and how I can
> access
> them?
>
> Sorry if this is something extremely simple, I'm still a bit of a noob
> :)

While it's remotely possible somebody here uses WikiMedia and knows
the answer it's not really a "General PHP" type of question...

Your best options are:

Ask the WikiMedia folks.

Install LiveHTTPHeaders in Firefox and see what Cookies you get.

Configure your browser to prompt you for all Cookies and see what
Cookies you get.

HTH


mediawiki.org
#mediawiki on irc.freenode.net




--
Anthony Ettinger
Signature: http://chovy.dyndns.org/hcard.html

--- End Message ---
--- Begin Message ---
On Thu, May 18, 2006 9:23 pm, Mark Sargent wrote:
> <?php
> setcookie('username', 'Joe', time()+60);

Because Microsoft engineers are incapable of reading and following a
spec correctly, you will have to supply a "path" along with that
time-out.  The best default path to use is "/"

You can have no time-out and no path, or both, but not just time-out.

> session_start();
> $_SESSION['authuser']=1;
> ?>
> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
> <html>
> <head>
> <meta content="text/html; charset=UTF-8" http-equiv="content-type">

For REAL browsers, you should send the content-type with a charset in
the headers as well.

Only something goofy like IE is going to ignore the headers and look
at a META tag instead.

Again, MS doesn't follow specs.  Surprise.

To be super-pedantic, it's also probably better to use:
<meta ... />
so the tag closes itself in the new-school XHTML CSS blah blah blah
buzzword way.

> <title>Movie 1</title>
> </head>
> <body>
> <?php
>     $favMovie=urlencode("Life Of Brian");
>     echo "<a
> href='http://localhost/moviesite.php?favMovie=$favMovie'>";

Errr.

localhost is going to end up being THEIR localhost, which is, like,
their own computer where the browser is, which is very very very
unlikely to have your moviesite.php script on it, if you see what I
mean...

Unless YOU are running this on your own desktop or something.

And even then, you probably should use $_SERVER['PHP_SELF'] or
something instead of localhost, because if you move this script to a
freshly-installed Windows box, they don't actually set up localhost as
127.0.0.1 in some versions of Windows -- You have to dig around in
god-knows-which-directory to find the hosts.sam file (.sam is for
sample) and then copy it and edit it and then re-boot (cuz it's
Windows) to get localhost defined.

Did I mention that MS engineers don't follow specs?

>     echo "Click here to see information about my favourite movie!";
>     echo "</a>";
> ?>
> </body>
> </html>
>
>
> which points to this page,

Well, you WANT it to point to that page, but it probably doesn't, as
noted above...

> <?php
> session_start;

You kinda need the function call here with () and everything.

Otherwise, what happens is:
#1. PHP "sees" an undefined constant, and assumes you meant:
'session_start';

#2. PHP issues an E_NOTICE error, but your default error_reporting in
php.ini is probably set to E_ALL ~ E_NOTICE which is *BAD* but there
it is, the old default.

#3. So this statement turns into a rather goofy non-operational
statement that does NOTHING but is, in fact, accepted as a valid PHP
staement, for reasons beyond my ken:
'session_start';
is valid syntax.
God only knows *WHY* it's valid, mind, but it's valid.

> //Check the user has logged in with a valid password
> if ($_SESSION['authuser']!=1) {
>       echo "Sorry, you're not authorized to access this page";
>       exit();
>       }
> ?>
> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
> <html>
> <head>
> <meta content="text/html; charset=UTF-8" http-equiv="content-type">
> <title>My Movie Site - <?php echo $_REQUEST['favMovie'] ?></title>

You really SHOULD clean that variable.

You are wide open for a cross-site scripting attack:
http://phpsec.org/

> </head>
> <body>
> <?php
>     echo "Welcome to our site, ";
>     echo $_COOKIE['username'];

Ditto.

>     echo "! <br>";
>     echo "My favourite movie is ";
>     echo $_REQUEST['favMovie'];

Again.

>     echo "<br>";
>     $movieRate=5;
>     echo "My movie rating for this movie is: ";
>     echo  $movieRate;
> ?>
> </body>
> </html>
>
> But, I get the error message as if the session is not set,
>
> Sorry, you're not authorized to access this page
>
> but it is set, statically, in the 1st code. I have /my_temp_dir set as
> session.save_path,
>
> session.save_path = "/my_temp_dir"
>
> and have set user/group to htdocs and given permission for htdocs to
> write to /my_temp_dir,
>
> [EMAIL PROTECTED] my_temp_dir]$ ls -al /my_temp_dir
> total 24
> drwxr-xr-x  2 htdocs htdocs 4096 May 19 12:08 .
> drwxr-xr-x 24 root   root   4096 May 19 12:04 ..
> -rw-------  1 htdocs htdocs   13 May 19 12:08
> sess_69e7ffdaf855da229f4b067668b0f89d
>
> and it has a session file there as you can see. Is my code wrong,
> perhaps? I'm following Beginning PHP, Apache, MySQL Web Development.
> Cheers.

Also, you should realize that your setcookie isn't really doing much
but send an extra cookie to the browser, which will ANNOY those of us
who monitor cookies before accepting them -- It's just as easy to
store $_SESSION['username'] and use that instead, relying on the PHP
Cookie for the session to work for you, instead of managing your own
Cookie on top of the PHP session cookie.

For homework, you have to change your php.ini file from E_ALL ~
E_NOTICE to just plain E_ALL :-)

You'll be better off in the long run, even if it seems picuyane in the
short run.

-- 
Like Music?
http://l-i-e.com/artists.htm

--- End Message ---
--- Begin Message ---
On 5/19/06, Richard Lynch <[EMAIL PROTECTED]> wrote:

On Thu, May 18, 2006 9:23 pm, Mark Sargent wrote:
> <title>Movie 1</title>
> </head>
> <body>
> <?php
>     $favMovie=urlencode("Life Of Brian");
>     echo "<a
> href='http://localhost/moviesite.php?favMovie=$favMovie'>";

Errr.

localhost is going to end up being THEIR localhost, which is, like,
their own computer where the browser is, which is very very very
unlikely to have your moviesite.php script on it, if you see what I
mean...

Unless YOU are running this on your own desktop or something.


I almost never use a server name for this reason.  If you simply use an
absolute path, it'll point to whatever machine (local dev, live server,
etc...) it happens to be running on without you having to care.

i.e. <a href='/moviesite.php?favMovie=$favMovie'>

--
Scott Hurring [scott dot hurring dot lists at gmail dot com]
http://hurring.com/

--- End Message ---
--- Begin Message ---
Scott Hurring wrote:
> On 5/19/06, Richard Lynch <[EMAIL PROTECTED]> wrote:
>> On Thu, May 18, 2006 9:23 pm, Mark Sargent wrote:
>> > <title>Movie 1</title>
>> > </head>
>> > <body>
>> > <?php
>> >     $favMovie=urlencode("Life Of Brian");
>> >     echo "<a
>> > href='http://localhost/moviesite.php?favMovie=$favMovie'>";
>>
>> Errr.
>>
>> localhost is going to end up being THEIR localhost, which is, like,
>> their own computer where the browser is, which is very very very
>> unlikely to have your moviesite.php script on it, if you see what I
>> mean...
>>
>> Unless YOU are running this on your own desktop or something.
>>
>>
> I almost never use a server name for this reason.  If you simply use an
> absolute path, it'll point to whatever machine (local dev, live server,
> etc...) it happens to be running on without you having to care.
> 
> i.e. <a href='/moviesite.php?favMovie=$favMovie'>

Which of course breaks if you decide to put the whole-shebang in a
subdirectory (unless you specify the base in your html head).

Personally, I prefer to deduce the path from the autoglobals (such
as $SERVER['REQUEST_URI'] and friends), or to have it set in a
central place (config.inc or whatever you use), so that i can move
the whole app into a subdirectory if i want to.

Gr,

Koen

--- End Message ---
--- Begin Message ---
For an ecommerce site where sensitive data is stored
either in files, or in a database, have you used some
form of encryption to protect your customer's data? 

I have a client who currently uses a Perl scripted
shopping cart that stores orders (including credit
card numbers) in plain text files on a shared server.
The security of these files depends purely on the
user/file system security measures enforced by the
hosting company (which I think is a reasonably good
company, but still I don't see it as being
sufficiently secure).

I am going to rewrite the shopping cart using PHP and
was looking into ways to protect the data. Using GNU
Privacy Guard (gpg) seemed like the ideal method
because I could store the client's public key on the
server to encrypt orders and the customer could then
download the encrypted files and decrypt them on his
PC with his private key (the client manually submits
orders through his "store front" merchant account). I
know this is a somewhat archaic procedure but it works
sufficiently well for this client.

However the hosting company won't support gpg so that
leaves me with PHP mcrypt functions which I think
would work very well, except for on thing - how to
protect the secret key which now has to be on the
server? 

Any ideas/suggestions/experience along that line?

Thanks in advance,

Lawrence Kennon 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

--- End Message ---
--- Begin Message ---
On 5/19/06, Lawrence Kennon <[EMAIL PROTECTED]> wrote:

For an ecommerce site where sensitive data is stored
either in files, or in a database, have you used some
form of encryption to protect your customer's data?

I have a client who currently uses a Perl scripted
shopping cart that stores orders (including credit
card numbers) in plain text files on a shared server.
The security of these files depends purely on the
user/file system security measures enforced by the
hosting company (which I think is a reasonably good
company, but still I don't see it as being
sufficiently secure).

I am going to rewrite the shopping cart using PHP and
was looking into ways to protect the data. Using GNU
Privacy Guard (gpg) seemed like the ideal method
because I could store the client's public key on the
server to encrypt orders and the customer could then
download the encrypted files and decrypt them on his
PC with his private key (the client manually submits
orders through his "store front" merchant account). I
know this is a somewhat archaic procedure but it works
sufficiently well for this client.

However the hosting company won't support gpg so that
leaves me with PHP mcrypt functions which I think
would work very well, except for on thing - how to
protect the secret key which now has to be on the
server?

Any ideas/suggestions/experience along that line?

Thanks in advance,

Lawrence Kennon



Lawrence, from the very start, if you're on a shared-server, security is
going to be compromised to a large degree.  Hopefully your server at least
uses suexec or suphp to prevent other people's scripts reading your data.
If not, i'd say look for a new host immediately.

As for your private key.  Step 1 is to definitely keep it outside your
doc_root, Step 2 is to give it really restrictive permissions like 400 or
600.  I'm not entirely sure how much you can really do above that on a
shared server.

If you can convince your clients that security is a top-priority on this
project, talk about getting a dedicated box so that your first-level of
defense is simply "nobody else is on the box", then you can worry a little
bit less about your private key being stolen.

--
Scott Hurring [scott dot hurring dot lists at gmail dot com]
http://hurring.com/

--- End Message ---
--- Begin Message ---
> 
> For an ecommerce site where sensitive data is stored
> either in files, or in a database, have you used some
> form of encryption to protect your customer's data? 
> 
> I have a client who currently uses a Perl scripted
> shopping cart that stores orders (including credit
> card numbers) in plain text files on a shared server.

I assume you want to be able to unencrypt the credit card number for later
use, so a 1 way encryption method will not suffice.  In that case, I don't
know of a way to securly store this data in the environment you describe.
If someone gained access to you data, they would also likely have access to
your code and could therefore figure out how to unencrypt it.

That said, my first piece of advice: Never, ever store credit card numbers.
You are opening yourself up to a huge world of hurt by doing so.   Unless
you can come up with a reason (you probably can't) that you absolutely MUST
store credit card numbers on a shared server, don't do it.

> The security of these files depends purely on the
> user/file system security measures enforced by the
> hosting company (which I think is a reasonably good
> company, but still I don't see it as being
> sufficiently secure).

You are willing to risk bazillion dollar lawsuits on the "sufficiently
secure" file permissions of a "reasonably good" company?  I would suggest,
at minimum, getting a dedicated box with a well-known hosting company if you
are going to store credit card numbers.  At least then, you can enforce you
own security policies, and be reasonably sure you are the only one digging
around on the box.

> I am going to rewrite the shopping cart using PHP and
> was looking into ways to protect the data. Using GNU
> Privacy Guard (gpg) seemed like the ideal method
> because I could store the client's public key on the
> server to encrypt orders and the customer could then
> download the encrypted files and decrypt them on his
> PC with his private key (the client manually submits
> orders through his "store front" merchant account). I
> know this is a somewhat archaic procedure but it works
> sufficiently well for this client.

If you are going to rewrite the shopping cart application, why not look into
some ready-made ones.  http://www.oscommerce.com , a complete, free online
store, comes to mind immediately.  There are many others.  Search the
archives of this list if you're interested.  Why reinvent the wheel?  :)

> However the hosting company won't support gpg so that
> leaves me with PHP mcrypt functions which I think
> would work very well, except for on thing - how to
> protect the secret key which now has to be on the
> server? 

On a shared server, you can't really protect it, but you can take some steps
to make it as difficult to get as possible.  Storing it outside of webroot
and giving it restrictive permissions would be good first steps.

You don't really go into much detail about your application.  But, if you
search the archives of this list for 'credit card', you will find some
really compelling reasons NOT to ever store credit card numbers.  If the
reason you are doing so is purely for customer convienience, you should
probably reevaluate that position.

JM

--- End Message ---
--- Begin Message ---
Can they play nicely together?

For instance I have a small JavaScript sniplet that will check certain
checkboxes if a radio button is selected. Since I have a fair amount of
checkboxes I want to put them in an array all their own so I use the
XHTML syntax w/brackets;

<input type="checkbox" name="list37[]" value="7" />

Suddenly JavaScript doesn't care for the object and throws an error
(take the brackets out and it works fine for JS, but PHP cannot see all
of the values). I have Googled for this but think that my search term(s)
are failing me because the condition is hard to describe.  Would someone
please point me in the right direction?

Thanks!

--- End Message ---
--- Begin Message ---
Jay Blanchard wrote:
Can they play nicely together?

For instance I have a small JavaScript sniplet that will check certain
checkboxes if a radio button is selected. Since I have a fair amount of
checkboxes I want to put them in an array all their own so I use the
XHTML syntax w/brackets;

<input type="checkbox" name="list37[]" value="7" />

Suddenly JavaScript doesn't care for the object and throws an error
(take the brackets out and it works fine for JS, but PHP cannot see all
of the values). I have Googled for this but think that my search term(s)
are failing me because the condition is hard to describe.  Would someone
please point me in the right direction?

Thanks!

What kind of error does it throw? What function are you using to access the object?

--Daniel

--- End Message ---
--- Begin Message ---
Jay Blanchard wrote:
Can they play nicely together?

For instance I have a small JavaScript sniplet that will check certain
checkboxes if a radio button is selected. Since I have a fair amount of
checkboxes I want to put them in an array all their own so I use the
XHTML syntax w/brackets;

<input type="checkbox" name="list37[]" value="7" />

Suddenly JavaScript doesn't care for the object and throws an error
(take the brackets out and it works fine for JS, but PHP cannot see all
of the values). I have Googled for this but think that my search term(s)
are failing me because the condition is hard to describe.  Would someone
please point me in the right direction?

Thanks!


I don't remember exactaly what I had to do, but I remember quoting it somehow made it work with JS. Something like...

document.formname.elements['list37[]']

I *think*.

--
John C. Nichel IV
Programmer/System Admin (ÜberGeek)
Dot Com Holdings of Buffalo
716.856.9675
[EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
[el snipo]
> For instance I have a small JavaScript sniplet that will check certain
> checkboxes if a radio button is selected. Since I have a fair amount
of
> checkboxes I want to put them in an array all their own so I use the
> XHTML syntax w/brackets;
> 
> <input type="checkbox" name="list37[]" value="7" />
> 
> Suddenly JavaScript doesn't care for the object and throws an error
> (take the brackets out and it works fine for JS, but PHP cannot see
all
> of the values). I have Googled for this but think that my search
term(s)
> are failing me because the condition is hard to describe.  Would
someone
> please point me in the right direction?
> 
> Thanks!

        What kind of error does it throw? What function are you using to
access 
the object?
[/el snipo]

function checkAll(field){
   for (i = 0; i < field.length; i++){
      field[i].checked = true;
   }
}

'length' is null or not an object

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

Daniel Orner wrote:
Jay Blanchard wrote:

Can they play nicely together?

For instance I have a small JavaScript sniplet that will check certain
checkboxes if a radio button is selected. Since I have a fair amount of
checkboxes I want to put them in an array all their own so I use the
XHTML syntax w/brackets;

<input type="checkbox" name="list37[]" value="7" />

Suddenly JavaScript doesn't care for the object and throws an error
(take the brackets out and it works fine for JS, but PHP cannot see all
of the values). I have Googled for this but think that my search term(s)
are failing me because the condition is hard to describe.  Would someone
please point me in the right direction?

Thanks!


What kind of error does it throw? What function are you using to access the object?

--Daniel



if u declare is like name="list37" doesnt PHP get that as an array even though 
it doesnt have the square brackets?

--- End Message ---
--- Begin Message ---
> -----Original Message-----
> From: Jay Blanchard [mailto:[EMAIL PROTECTED]
> Sent: Friday, May 19, 2006 10:34 AM
> To: php-general@lists.php.net
> Subject: [PHP] PHP & JavaScript


 
> <input type="checkbox" name="list37[]" value="7" />
> 
> Suddenly JavaScript doesn't care for the object and throws an error
> (take the brackets out and it works fine for JS, but PHP cannot see
all
> of the values). I have Googled for this but think that my search
term(s)
> are failing me because the condition is hard to describe.  Would
someone
> please point me in the right direction?


I ran into this problem once too and had a terrible time finding an
answer.  I started finding some stuff with the following search terms:

php checkbox array javascript entity reference

Which brought up a page in the manual.  It had two helpful notes:

http://us2.php.net/variables.external



kgt

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

function checkAll(field){
   for (i = 0; i < field.length; i++){
      field[i].checked = true;
   }
}

'length' is null or not an object
   Where is this being called from? Checkboxes don't have a "length"...

if u declare is like name="list37" doesnt PHP get that as an array even though it doesnt have the square brackets?
No, you need the square brackets to return an array of values. Otherwise you'll only get the first one.

--Daniel

Jay Blanchard wrote:
[el snipo]
For instance I have a small JavaScript sniplet that will check certain
checkboxes if a radio button is selected. Since I have a fair amount
of
checkboxes I want to put them in an array all their own so I use the
XHTML syntax w/brackets;

<input type="checkbox" name="list37[]" value="7" />

Suddenly JavaScript doesn't care for the object and throws an error
(take the brackets out and it works fine for JS, but PHP cannot see
all
of the values). I have Googled for this but think that my search
term(s)
are failing me because the condition is hard to describe.  Would
someone
please point me in the right direction?

Thanks!

        What kind of error does it throw? What function are you using to
access the object?
[/el snipo]

function checkAll(field){
   for (i = 0; i < field.length; i++){
      field[i].checked = true;
   }
}

'length' is null or not an object


--- End Message ---
--- Begin Message ---
[snip]
http://us2.php.net/variables.external
[/snip]

BINGO! We have a winner!

It can be as simple as adding an id to each checkbox;

<input type="checkbox" id="list37" name="list37[]" value="4" />

By doing this I did not have to change the function or the function
calls. JS recognizes the boxes by id, PHP recognizes the array.

There were some other more complex solutions listed.....but I believe in
KISS....

--- End Message ---
--- Begin Message ---
John Nichel wrote:
Jay Blanchard wrote:

Can they play nicely together?

For instance I have a small JavaScript sniplet that will check certain
checkboxes if a radio button is selected. Since I have a fair amount of
checkboxes I want to put them in an array all their own so I use the
XHTML syntax w/brackets;

<input type="checkbox" name="list37[]" value="7" />

Suddenly JavaScript doesn't care for the object and throws an error
(take the brackets out and it works fine for JS, but PHP cannot see all
of the values). I have Googled for this but think that my search term(s)
are failing me because the condition is hard to describe.  Would someone
please point me in the right direction?

Thanks!


I don't remember exactaly what I had to do, but I remember quoting it somehow made it work with JS. Something like...

document.formname.elements['list37[]']

I *think*.

I think you think right = pretty sure about that actually :-)




--- End Message ---
--- Begin Message ---
Could you not use an id for the object as well as a name?

--- End Message ---
--- Begin Message ---
Angelo Zanetti wrote:

Daniel Orner wrote:
Jay Blanchard wrote:

Can they play nicely together?

For instance I have a small JavaScript sniplet that will check certain
checkboxes if a radio button is selected. Since I have a fair amount of
checkboxes I want to put them in an array all their own so I use the
XHTML syntax w/brackets;

<input type="checkbox" name="list37[]" value="7" />

Suddenly JavaScript doesn't care for the object and throws an error
(take the brackets out and it works fine for JS, but PHP cannot see all
of the values). I have Googled for this but think that my search term(s)
are failing me because the condition is hard to describe.  Would someone
please point me in the right direction?

Thanks!


What kind of error does it throw? What function are you using to access the object?

--Daniel



if u declare is like name="list37" doesnt PHP get that as an array even though it doesnt have the square brackets?


Nope.  Test it.

--
John C. Nichel IV
Programmer/System Admin (ÜberGeek)
Dot Com Holdings of Buffalo
716.856.9675
[EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
Jay Blanchard wrote:
> [snip]
> http://us2.php.net/variables.external
> [/snip]
> 
> BINGO! We have a winner!
> 
> It can be as simple as adding an id to each checkbox;
> 
> <input type="checkbox" id="list37" name="list37[]" value="4" />
> 
> By doing this I did not have to change the function or the function
> calls. JS recognizes the boxes by id, PHP recognizes the array.
> 
> There were some other more complex solutions listed.....but I believe in
> KISS....
> 

Shouldn't ID's on xhtml tags be unique? Or is this special because
of the array construction?

Gr,

Koen

--- End Message ---
--- Begin Message ---
I think it's a case of using id for javascript, not for css...






--
http://www.web-buddha.co.uk

dynamic web programming from Reigate, Surrey UK (php, mysql, xhtml, css)

look out for project karma, our new venture, coming soon!

--- End Message ---
--- Begin Message ---
Jay Blanchard wrote:
[snip]
http://us2.php.net/variables.external
[/snip]

BINGO! We have a winner!

It can be as simple as adding an id to each checkbox;

<input type="checkbox" id="list37" name="list37[]" value="4" />

By doing this I did not have to change the function or the function
calls. JS recognizes the boxes by id, PHP recognizes the array.

There were some other more complex solutions listed.....but I believe in
KISS....


Next time, RTFM!  :-p

--
John C. Nichel IV
Programmer/System Admin (ÜberGeek)
Dot Com Holdings of Buffalo
716.856.9675
[EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
Dave Goodchild wrote:
> I think it's a case of using id for javascript, not for css...

Call me a purist, but quoting http://www.w3.org/TR/xhtml1/ (and you
can probably find likewise paragraphs in other xhtml specs, all
stemming from the basic XML property that id's are unique):

"4.10. The elements with 'id' and 'name' attributes

HTML 4 defined the name attribute for the elements a, applet, form,
frame, iframe, img, and map. HTML 4 also introduced the id
attribute. Both of these attributes are designed to be used as
fragment identifiers.

In XML, fragment identifiers are of type ID, and there can only be a
single attribute of type ID per element. Therefore, in XHTML 1.0 the
id attribute is defined to be of type ID. In order to ensure that
XHTML 1.0 documents are well-structured XML documents, XHTML 1.0
documents MUST use the id attribute when defining fragment
identifiers on the elements listed above. See the HTML Compatibility
Guidelines for information on ensuring such anchors are backward
compatible when serving XHTML documents as media type text/html.

Note that in XHTML 1.0, the name attribute of these elements is
formally deprecated, and will be removed in a subsequent version of
XHTML."

So, using the same ID produces non-valid documents if you ask me.

Best,

Koen

--- End Message ---
--- Begin Message ---
[snip]
So, using the same ID produces non-valid documents if you ask me.
[/snip]

This is correct, and in order to properly validate I changed it to
transitional instead of strict. This is an internal app....if it were
external I would do this differently for sure

--- End Message ---
--- Begin Message ---
Hello Good People,

I am not sure if the feature exists, but would not it be a good idea
if the proxy configurations for php can be globally set - say for
example in the php.ini , .... having a global proxy configuration will
allow php scripts to access external resources from within a firewall
.....

A good use case might be - I write a CMS that syndicates RSS feeds
from the internet but is itself located in a intranet behind a http://
proxy... as of now, I manually do it in my code for every script - so
it makes by job easier if there is a global config set up some where?

Similarly, it would be also good to have proxy  support for https, ftp, ... etc

Any workarounds and suggestions are welcome :)

Cheers!
- vedanta




--
*~:~*~:~*~:~*~:~*~:~*~:~*~:~*~:~*~:~*~:~*
Vedanta Barooah

--- End Message ---
--- Begin Message ---
Greetings Gents,

I am interested in running two versions of of PHP.
I want to see if I can get my boss to buy into migrating to PHP 5.

I want to set it up locally.

Locally I am running apache on a windows XP box with PHP 4.

I would like I would like to be able to set up PHP 5 as well on the server and have some folders/virtual hosts set up in php 4 and others in php 5?

Is this possible?
How would I go about doing it?

Thanks

Phillip

--- End Message ---
--- Begin Message ---
Phillip S. Baker wrote:
> I am interested in running two versions of of PHP.
> I want to see if I can get my boss to buy into migrating to PHP 5.
> 
> I want to set it up locally.
> 
> Locally I am running apache on a windows XP box with PHP 4.
> 
> I would like I would like to be able to set up PHP 5 as well on the
> server and have some folders/virtual hosts set up in php 4 and others in
> php 5?
> 
> Is this possible?
> How would I go about doing it?

Set up one as module, the other as CGI (or both as CGI of course).

google will provide you with many many pointers on this subject, eg:

http://www.gentoo.org/proj/en/php/php4-php5-configuration.xml

Gr,

Koen

--- End Message ---
--- Begin Message ---
I wrote up a little HOWTO on my site on getting PHP4 (as module) and PHP5
(as cgi) running concurrently.  Maybe it'll help

http://hurring.com/howto/php4_and_php5/

On 5/19/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:

Phillip S. Baker wrote:
> I am interested in running two versions of of PHP.
> I want to see if I can get my boss to buy into migrating to PHP 5.
>
> I want to set it up locally.
>
> Locally I am running apache on a windows XP box with PHP 4.
>
> I would like I would like to be able to set up PHP 5 as well on the
> server and have some folders/virtual hosts set up in php 4 and others in
> php 5?
>
> Is this possible?
> How would I go about doing it?

Set up one as module, the other as CGI (or both as CGI of course).

google will provide you with many many pointers on this subject, eg:

http://www.gentoo.org/proj/en /php/php4-php5-configuration.xml

Gr,

Koen

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




--
Scott Hurring [scott dot hurring dot lists at gmail dot com]
http://hurring.com/

--- End Message ---
--- Begin Message ---
On 5/19/06, Phillip S. Baker <[EMAIL PROTECTED]> wrote:
Greetings Gents,

I am interested in running two versions of of PHP.
I want to see if I can get my boss to buy into migrating to PHP 5.

I want to set it up locally.

Locally I am running apache on a windows XP box with PHP 4.

I would like I would like to be able to set up PHP 5 as well on the
server and have some folders/virtual hosts set up in php 4 and others in
php 5?

Is this possible?
How would I go about doing it?

Thanks

Phillip

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


Another alternative... Since you're on Windows you might look into
trying XAMPP (http://www.apachefriends.org/en/xampp.html).  They have
a batch file that you can run to switch from php4 to php5 whenever you
like.

--- End Message ---
--- Begin Message --- So does anyone have any good ideas about other places for me to announce this? I'd like to get the good word out. 8-)

--Daniel

--- End Message ---
--- Begin Message ---
This one time, at band camp, Jochem Maas <[EMAIL PROTECTED]> wrote:


> does it run on php5?

does it run on php6-dev?

Kevin

-- 
"Democracy is two wolves and a lamb voting on what to have for lunch. 
Liberty is a well-armed lamb contesting the vote."

--- End Message ---

Reply via email to