php-general Digest 14 May 2007 09:03:19 -0000 Issue 4790

Topics (messages 254899 through 254913):

Re: php5 include() problem
        254899 by: Tijnema !
        254902 by: Myron Turner
        254904 by: Richard Davey
        254909 by: Al

Re: Question
        254900 by: Robert Cummings
        254903 by: WeberSites LTD

Re: GET variable unexpectedly assigned to session variable
        254901 by: Robert Cummings

Re: Passing an array as a hidden variable
        254905 by: WeberSites LTD

session destroy callback (onSessionDestroy event)
        254906 by: Emil Ivanov

Re: Making code public -- What steps to take? GPL?
        254907 by: Micky Hulse
        254908 by: Daniel Brown
        254910 by: Micky Hulse
        254912 by: Larry Garfield

Re: scrolling HTML tables
        254911 by: Larry Garfield

escapeshellarg
        254913 by: Mohamed CHAARI

Administrivia:

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

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

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


----------------------------------------------------------------------
--- Begin Message ---
On 5/13/07, Al <[EMAIL PROTECTED]> wrote:
I've got a cgi file in my cgi-bin folder that I'm calling with include(). It 
worked with php4.

My shared host just upgraded to my server to php5.2.0 and the function doesn't 
work.  I can't tell if the problem is a
php5 or server configuration [which may have changed during the upgrade] issue.

If I call the file as a URL directly, it works.
http://www.foo.org/cgi-bin/file.cgi?dir=/test&perms=0755

file.cgi chmods the designated directory's permissions.  It's a cgi with a php 
shebang #!/usr/bin/php

A simple file_exists() shows the file exists OK, TRUE.

I've tried using both syntaxes.

include("/home/foo/public_html/cgi-bin/file.cgi?dir=test&perms=0755");

include("www.foo.org/cgi-bin/file.cgi?dir=test&perms=0755");

Here is the error msg:
> Warning: include(/home/foo/public_html/cgi-bin/file.cgi?dir=/test&perms=0755)
[function.include]: failed to open stream: No such file or directory in 
/home/foo/public_html/EditPage/cgi_file_test.php
on line 15

Bottom line:  It appears include() is not working right, for whatever reason.

Anyone have any ideas?

Thanks, Al........


What the heck are you trying to do?
You want the cgi file to be executed? Or is there PHP code in the cgi file?
If you want the first, you should look at exec() or system() or such.
If there's PHP code, there's no sense in passing variables to the CGI
script, and if you remove the variables it will work.

Tijnema

--- End Message ---
--- Begin Message ---
Tijnema ! wrote:
On 5/13/07, Al <[EMAIL PROTECTED]> wrote:
I've got a cgi file in my cgi-bin folder that I'm calling with include(). It worked with php4.

My shared host just upgraded to my server to php5.2.0 and the function doesn't work. I can't tell if the problem is a php5 or server configuration [which may have changed during the upgrade] issue.

If I call the file as a URL directly, it works.
http://www.foo.org/cgi-bin/file.cgi?dir=/test&perms=0755

file.cgi chmods the designated directory's permissions. It's a cgi with a php shebang #!/usr/bin/php

A simple file_exists() shows the file exists OK, TRUE.

I've tried using both syntaxes.

include("/home/foo/public_html/cgi-bin/file.cgi?dir=test&perms=0755");

include("www.foo.org/cgi-bin/file.cgi?dir=test&perms=0755");

Here is the error msg:
> Warning: include(/home/foo/public_html/cgi-bin/file.cgi?dir=/test&perms=0755) [function.include]: failed to open stream: No such file or directory in /home/foo/public_html/EditPage/cgi_file_test.php
on line 15

Bottom line: It appears include() is not working right, for whatever reason.

Anyone have any ideas?

Thanks, Al........


What the heck are you trying to do?
You want the cgi file to be executed? Or is there PHP code in the cgi file?
If you want the first, you should look at exec() or system() or such.
If there's PHP code, there's no sense in passing variables to the CGI
script, and if you remove the variables it will work.

Tijnema

See the examples on this page:  http://ca.php.net/include/
What you probably want to do is to change the cgi script to php and then give the full url, incuding http.

--

_____________________
Myron Turner
http://www.room535.org
http://www.bstatzero.org
http://www.mturner.org/XML_PullParser/

--- End Message ---
--- Begin Message ---
Al wrote:

I've got a cgi file in my cgi-bin folder that I'm calling with include(). It worked with php4.

My shared host just upgraded to my server to php5.2.0 and the function doesn't work. I can't tell if the problem is a php5 or server configuration [which may have changed during the upgrade] issue.

If I call the file as a URL directly, it works.
http://www.foo.org/cgi-bin/file.cgi?dir=/test&perms=0755

Check if the new configuration of PHP allows HTTP calls. Include, require, fopen, etc are traditionally for local file-system files. Obviously you're calling it via HTTP so you get the parsed output and not the source code of the CGI script, but if your host has disabled URL opens with PHP 5 then it would explain why it no longer works.

Cheers,

Rich
--
Zend Certified Engineer
http://www.corephp.co.uk

"Never trust a computer you can't throw out of a window"

--- End Message ---
--- Begin Message ---
Is there an alternate way to execute a php in cgi-bin so it can do a chmod() on site 
directories as the "owner"?

My approach was the only way I could think of.  Given the obvious problem(s), 
it appears that it may not be a good choice.


Richard Davey wrote:
Al wrote:

I've got a cgi file in my cgi-bin folder that I'm calling with include(). It worked with php4.

My shared host just upgraded to my server to php5.2.0 and the function doesn't work. I can't tell if the problem is a php5 or server configuration [which may have changed during the upgrade] issue.

If I call the file as a URL directly, it works.
http://www.foo.org/cgi-bin/file.cgi?dir=/test&perms=0755

Check if the new configuration of PHP allows HTTP calls. Include, require, fopen, etc are traditionally for local file-system files. Obviously you're calling it via HTTP so you get the parsed output and not the source code of the CGI script, but if your host has disabled URL opens with PHP 5 then it would explain why it no longer works.

Cheers,

Rich

--- End Message ---
--- Begin Message ---
On Sun, 2007-05-13 at 00:33 -0500, Richard Lynch wrote:
>
> Here's your cookie:
> http://l-i-e.com/cookie.php
> :-)

Bah, I was hoping for something a bit more tasty :/  ;)

> PS
> Does the one where I juke the URL to just be iwant.xyz work right at
> least?...

Yep.

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.          |
`------------------------------------------------------------'

--- End Message ---
--- Begin Message ---
Notice the 1st code example :

http://www.php-code-search.com/?q=how%20to%20force%20the%20user%20to%20downl
oad%20a%20file

berber 

-----Original Message-----
From: Dusan Novakovic [mailto:[EMAIL PROTECTED] 
Sent: Sunday, May 13, 2007 2:19 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Question

Hi!
I need a script which will run pop-up menu with the "Save As" button when I
click on a link  (e.g. <a href="file.txt">Click</a> ) so that I could save
that file on my computer. In the example I wrote file.txt file opens in
browser, which I don`t want to happen.
I would be very grateful if someone could send me a possible solution to
this problem.

DuĊĦan



--
made by Dusan

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

--- End Message ---
--- Begin Message ---
On Sun, 2007-05-13 at 02:05 -0500, Richard Lynch wrote:
> On Thu, May 10, 2007 2:00 pm, Robert Cummings wrote:
> > BTW, what's the point of abbreviating short words like "user" to "usr"
> > and "type" to "typ"?
> 
> Mayb his 'e' ky is brokn?

Mayb his 'o' ky t sinc h shrtnd form to frm.

Prbbly h jst hs n vrsn t vwls.

Chrs,
Rb.

Ps. In case that was as incomprehensible as code created
    by abbreviators that I've had the displeasure to come
    across it says:

    "Maybe his 'o' key too since he shortened form to frm."

    "Probably he just has an aversion to vowels."

-- 
.------------------------------------------------------------.
| 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.          |
`------------------------------------------------------------'

--- End Message ---
--- Begin Message ---
Check out the 1st code example : 

http://www.php-code-search.com/?q=how%20to%20pass%20an%20array%20from%20one

berber 

-----Original Message-----
From: Richard Lynch [mailto:[EMAIL PROTECTED] 
Sent: Sunday, May 13, 2007 6:58 AM
To: Todd Cary
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Passing an array as a hidden variable



On Fri, May 11, 2007 11:53 pm, Todd Cary wrote:
> When I use the following syntax, the 2 dimensional array loses it's 
> contents.  Can an array be passed this way?
>
>    <? echo '<input type="hidden" name="attend_ary_save" value=' .
> $attend_ary_save .'>'; ?>

No.

You'll just get "Array" back.

You can do a few things:

<?php
  foreach($attend_ary_save as $k1 => $v1){
    foreach($v1 as $k2 => $v2){
      ?><input type="hidden" name="attend_ary_save[<?php echo $k1?>][<?php
echo $k2?>]" value="<?php echo $v2?>" /><?php
    }
  }
?>
Actually, you should wrap htmlentities() around each value being echo-ed
out.

Another option is to http://php.net/serialize the data before you send it to
HTML, and then (duh) unserialize it when it comes back.

Or, be REALLY smart, and use session_start() and just put the array in
$_SESSION and don't send data back-n-forth over HTTP, which is A) expensive,
and B) subject to user tampering, and C) inefficient.

Actually, A and C technically depend on your bandwidth versus hard drive
speed, or wherever you store you session data, so, in theory, it could be
cheaper or more efficient to use HTTP...  But I sure doubt it in any real
world hardware setup.

PS Just FYI, internally, PHP's session data is just serialized the same way
you'd do it for HTTP.

--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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

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

I need to do some clean-up when the session is destroyed or values are 
removed from it (expired).

using session_set_save_handler does not work for me, as I don't want to 
rewrite session handling, I just need to be notified when a value is 
destroyed.

Regards,
Emil Ivanov

P.S. I'm dealing with temporary pictures, saved on the disk and their path 
stored into the session and I need to delete them when they are no longer 
needed. 

--- End Message ---
--- Begin Message ---
Crayon Shin Chan wrote:
Don't forget the MIT license allows people to incorporate your code into commercial products and sell for profit without having to give anything back (money/improved code/etc).

Hi Cayon, thanks for clarification.

I just woke up, so I have not had a chance to really research the best option for my code... Hmm, a part of me does not mind the things you say above, but another part of me wonders if it would be best to restrict the commercial usage of it.

Heheh, well, either way, thanks for the help. I appreciate it.

Have a great day.
Cheers,
Micky



--
Wishlists: <http://snipurl.com/1gqpj>
   Switch: <http://browsehappy.com/>
     BCC?: <http://snipurl.com/w6f8>
       My: <http://del.icio.us/mhulse>

--- End Message ---
--- Begin Message ---
   The biggest thing to remember is that a license is like a key.... it's
meant to keep an honest man honest, but won't stop someone who is intent on
taking what they want for a profit.



On 5/13/07, Micky Hulse <[EMAIL PROTECTED]> wrote:

Crayon Shin Chan wrote:
> Don't forget the MIT license allows people to incorporate your code into
> commercial products and sell for profit without having to give anything
> back (money/improved code/etc).

Hi Cayon, thanks for clarification.

I just woke up, so I have not had a chance to really research the best
option for my code... Hmm, a part of me does not mind the things you say
above, but another part of me wonders if it would be best to restrict
the commercial usage of it.

Heheh, well, either way, thanks for the help. I appreciate it.

Have a great day.
Cheers,
Micky



--
Wishlists: <http://snipurl.com/1gqpj>
    Switch: <http://browsehappy.com/>
      BCC?: <http://snipurl.com/w6f8>
        My: <http://del.icio.us/mhulse>

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




--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

--- End Message ---
--- Begin Message ---
Daniel Brown wrote:
   Right, I alluded to that, but perhaps I should've said that exactly, as
it may bother some people.  In my case, it doesn't bother me in the least,
just as I use LAMP (all open source) to make a living.

Oh, I think I understood that. But there is always room for clarifications. :D

Thanks Daniel,
Cheers,
Micky

--
Wishlists: <http://snipurl.com/1gqpj>
   Switch: <http://browsehappy.com/>
     BCC?: <http://snipurl.com/w6f8>
       My: <http://del.icio.us/mhulse>

--- End Message ---
--- Begin Message ---
Beware also that if you have an "advertising clause" that requires your name 
to stay on it, then you could be preventing GPLed projects from using it.  
The GPL is incompatible with "advertising clause" licenses.  That's why the 
PHP License, for instance, is GPL-incompatible.  (GPL is the most widely used 
Free Software / Open Source license by a very wide margin.)

If you're OK with both open source and proprietary usage, then consider the 
LGPL.  It's compatible both directions, only requiring modifications to your 
code specifically to be shared.  The modern BSD license is even more 
permissable.  It doesn't have a mandatory advertising clause, but IME if you 
have a good drop-in module that has a "copyright Me and released under the 
LGPL, see home page here" type message most people won't bother taking it 
out.  

The people who would try to take credit for your code wouldn't care what 
license it was under in the first place anyway.  

Thank you for sharing your code!

On Sunday 13 May 2007, Daniel Brown wrote:
>     Right, I alluded to that, but perhaps I should've said that exactly, as
> it may bother some people.  In my case, it doesn't bother me in the least,
> just as I use LAMP (all open source) to make a living.
>
> On 5/13/07, Crayon Shin Chan <[EMAIL PROTECTED]> wrote:
> > On Sunday 13 May 2007 21:17, Micky Hulse wrote:
> > > I will definitely read-up on the MIT license after I get some zzZZzz's!
> >
> > Don't forget the MIT license allows people to incorporate your code into
> > commercial products and sell for profit without having to give anything
> > back (money/improved code/etc).
> >
> > --
> > Crayon
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php


-- 
Larry Garfield                  AIM: LOLG42
[EMAIL PROTECTED]               ICQ: 6817012

"If nature has made any one thing less susceptible than all others of 
exclusive property, it is the action of the thinking power called an idea, 
which an individual may exclusively possess as long as he keeps it to 
himself; but the moment it is divulged, it forces itself into the possession 
of every one, and the receiver cannot dispossess himself of it."  -- Thomas 
Jefferson

--- End Message ---
--- Begin Message ---
I usually say go ahead and use thead and tbody for semantic completeness.  If 
you're doing anything funky with Javascript, then you can "group" table rows 
by having multiple table bodies (yes, that's legal!) and then operate on each 
tbody separately.

Don't waste time with tfoot.  It's broken.  Completely.  The W3C had this 
brilliant idea to require tfoot to go before tbody, so if you have a footer 
row it appears before the body unless you have a browser that knows to shift 
it to the end of the table, out of lexical order.  Such a browser does not 
exist.  It's completely backward-incompatible.  It's one of the dumbtest 
things the W3C has ever done.

But yeah, tbody and thead are fine, go ahead and use those. :-)  If nothing 
else they're useful for when you start manipulating the table with 
Javascript.

On Sunday 13 May 2007, Richard Lynch wrote:
> On Thu, May 10, 2007 11:45 am, C.R.Vegelin wrote:
> > I hope it's not the wrong place to ask, but has anyone experience with
> > scrolling HTML tables ?
>
> Actually, it *is* the wrong place to ask... :-v
>
> > According http://www.w3schools.com/tags/tag_thead.asp
> > "The thead, tfoot and tbody elements enable you to group rows in a
> > table.
> >  When you create a table, you might want to have a header row, some
> > rows with data, and a row with totals at bottom.
> >  This division enables browsers to support scrolling of table bodies
> > independently of the table header and footer."
> >
> > I don't want to reinvent the wheel in own software.
> > Or is it better to ignore these tags because of bad browser support ?
>
> I've never seen any browser do anything useful with these goofy tags...
>
> But the Designers seem to luv them...
>
> If you really want scrolling, you'd better put them in a DIV or
> IFRAME, I think.
>
> --
> Some people have a "gift" link here.
> Know what I want?
> I want you to buy a CD from some indie artist.
> http://cdbaby.com/browse/from/lynch
> Yeah, I get a buck. So?


-- 
Larry Garfield                  AIM: LOLG42
[EMAIL PROTECTED]               ICQ: 6817012

"If nature has made any one thing less susceptible than all others of 
exclusive property, it is the action of the thinking power called an idea, 
which an individual may exclusively possess as long as he keeps it to 
himself; but the moment it is divulged, it forces itself into the possession 
of every one, and the receiver cannot dispossess himself of it."  -- Thomas 
Jefferson

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

I have to execute an external command, with an argument (filename or directory name) given by user input (via a form), ie something like this:

exec('ls $_POST[...]')

what do you think about using escapeshellarg() function in this case ? can I rely on it to have a secure solution ? or is there a risk ? ...


thank you.


--
---
--Mohamed CHAARI   (mailto : [EMAIL PROTECTED])
STMicroelectronics - Tunis - HPC/STS Division
Phone: (+216) 70 10 52 09 - TINA: 157 5209

--- End Message ---

Reply via email to