php-general Digest 18 May 2006 04:41:22 -0000 Issue 4134

Topics (messages 236354 through 236375):

Re: Ajax (xmlHttpRequest) and session_start() problem.
        236354 by: Mathijs

Re: Security Concerns with Uploaded Images:
        236355 by: Richard Collyer

Re: Regex Help for URL's
        236356 by: Kevin Waterson

Handling Large Check Box Data
        236357 by: Rahul S. Johari
        236359 by: Brad Bonkoski
        236360 by: Martin Alterisio
        236361 by: Jochem Maas
        236363 by: Kevin Murphy

Fast search
        236358 by: René Fournier
        236362 by: Robin Vickery
        236364 by: Evan Priestley
        236366 by: Robert Cummings

Simple XML array count??
        236365 by: Jay Paulson

Getting rid of "Web page has expired" (POSTDATA error)
        236367 by: Nicolas Verhaeghe

Re: Warning: chmod(): Operation not permitted ?
        236368 by: tedd
        236369 by: Brady Mitchell

Re: Converting characters
        236370 by: Ligaya Turmelle

Need help calling PHP page from another server.
        236371 by: Robert Filipovich

Add Multiple Items, Qty to Cart from html form
        236372 by: Andras Kende

Re: 404 After Setting session.save_path to /tmp
        236373 by: Chris
        236374 by: Mark Sargent
        236375 by: Chris

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 ---
Thank you very much :D.

Ill just create an class which will handle this :).
It works like a charm..

Thx.


Thomas Munz wrote:
session_write_close();

Ex:

session_start();
$asdf = $_SESSION; //-- get all datas
session_write_close(); //-- close session

on Wednesday 17 May 2006 16:36, Mathijs wrote:
Robert Cummings wrote:
On Wed, 2006-05-17 at 10:11, Mathijs wrote:
I Have an very strange problem.

When i execute an very simple Ajax request to an PHP script wich just
print one line and i put an sleep(20) infront of it, it works perfectly
when i refresh the page.

BUT..
When i put session_start() at the top, i can't refresh the page anymore.
It won't refresh untill the server responed.

When i remove the session_start(), i can refresh anytime i want.

Is this a know problem?
Does someone knows an solution?
PHP sessions use locking to avoid race conditions. So you sleep for 20
seconds keeps the lock for just as long, this has the effect of blocking
all other scripts for the same session. To avoid this, grab the session
data you need, and close the session as fast as possible. Additionally,
it's probably a very bad idea to keep the web server waiting for 20
seconds for no good reason. Why not have your javascript do the waiting?

Cheers,
Rob.
This whas just an test example i talked about.
irl, i have an script that does an search on the server for texts in files.

This search goes through an ajax request.
The page that is requested uses $_SESSION.
Therefore i need session_start().

This search can take a while, and if i want to refresh the page, because
i want to have an other search or whatever, i just can't.
This because, for some reason, when session_start() gets called, it
locks the refreshing capeabileties of the browser.

Also, you say to close the session, mabye a stupid question, but how????

If you need more info, just ask :)..

Thx for the quick reply :).

Kind Regards,


---
avast! Antivirus: Inbound message clean.
Virus Database (VPS): 0620-0, 05/15/2006
Tested on: 5/17/2006 6:37:16 PM
avast! - copyright (c) 1988-2006 ALWIL Software.
http://www.avast.com





---
avast! Antivirus: Outbound message clean.
Virus Database (VPS): 0620-0, 05/15/2006
Tested on: 5/17/2006 6:38:04 PM
avast! - copyright (c) 1988-2006 ALWIL Software.
http://www.avast.com

--- End Message ---
--- Begin Message ---
Richard Lynch wrote:
On Mon, May 15, 2006 1:58 am, Jason Wong wrote:
2) the uploaded file is a "script" (perl/php/python/etc)

In the case of (2), if the script relies on its shebang line to
execute

Not necessarily -- What if I upload an "image" file named
"badscript.php" and then I surf to it, after it's in your /images
directory?

Couldn't you just use the apache directory option to make sure that php can't be executed from the /images directory... wonder if that is possible.

Cheers
Richard

--- End Message ---
--- Begin Message ---
This one time, at band camp, "Robert Samuel White" <[EMAIL PROTECTED]> wrote:

> Don't be rude.  I've already don't all of that.  Nothing came up.  I've been
> programming for 20 years (since I was 11 years old) so I'm not a slacker
> when it comes to learning new things, however, I have always found regular
> expressions to be extremely difficult.  Someone here might have the answer I
> need, and if so, I'd appreciate a response.  If you don't know the answer,
> don't reply.  Simple enough, don't you think?

Sorry, I missed most of this...
>From what I gather you wish to extract urls from text?
if so..
function getLinks($string){
  // regex to get the links
  preg_match_all("|http:?([^\"' >]+)|i", $string, $arrayoflinks);
  return $arrayoflinks;
}

Also check out this on line tutorial for regex geared towards PHP
http://phpro.org/tutorials/Introduction-to-PHP-Regular-Expressions.html

Kind regards
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 ---
--- Begin Message ---
Ave,

I¹m a little confused as to what¹s the best way to handle this.
I have a form which, apart from lots of other fields, has a set of 25 ­ 30
Check Boxes, each of which asks the user for some kind of information which
the user can check or leave unchecked.
The information each Check Box collects will also appear in the ³Listing²
for users to view once the user has completed & submitted the form.
Furthermore, there is an Advanced Search also available to users which will
also provide the same 25 - 30 check boxes which define the search criteria.
I¹m not sure what¹s the best, most efficient way to do this.

The tedious way to do this is to make 30 fields in the mySQL database, and
if the check box is checked, the data goes into the corresponding field...
And similarly listing the data from the field if field is non-empty.... And
similarly including each field in the Search options.

I want suggestions for a better/faster way to do this. I did think about
creating a single field and storing the data from each Œchecked¹ check box
as comma separated values in the single field. I¹m not sure how to do that
and if that¹s the best way.... But even if I can, I¹m not sure how to get
the data to display separately out of that field in the Listings view and
more importantly how to include that data in the Search options.

Any help would be appreciated.

Thanks, 

Rahul S. Johari
Coordinator, Internet & Administration
Informed Marketing Services Inc.
500 Federal Street, Suite 201
Troy NY 12180

Tel: (518) 687-6700 x154
Fax: (518) 687-6799
Email: [EMAIL PROTECTED]
http://www.informed-sources.com


--- End Message ---
--- Begin Message --- Well, listing all the values in a comma separated list in the DB would be fairly simple to parse, check out:
http://www.php.net/manual/en/function.explode.php

As far as what is better depends on many things...
1). Maintaining the code, might be better to have each check box have its own field, will certainly cut down on development/debugging. 2). Performance...don't know if it is faster for PHP to parse through a comma separated list or parse through a larger DB record set. I guess if this is really important to you, you might want to attempt both ways to see on performance.

-Brad



Rahul S. Johari wrote:

Ave,

I¹m a little confused as to what¹s the best way to handle this.
I have a form which, apart from lots of other fields, has a set of 25 ­ 30
Check Boxes, each of which asks the user for some kind of information which
the user can check or leave unchecked.
The information each Check Box collects will also appear in the ³Listing²
for users to view once the user has completed & submitted the form.
Furthermore, there is an Advanced Search also available to users which will
also provide the same 25 - 30 check boxes which define the search criteria.
I¹m not sure what¹s the best, most efficient way to do this.

The tedious way to do this is to make 30 fields in the mySQL database, and
if the check box is checked, the data goes into the corresponding field...
And similarly listing the data from the field if field is non-empty.... And
similarly including each field in the Search options.

I want suggestions for a better/faster way to do this. I did think about
creating a single field and storing the data from each Œchecked¹ check box
as comma separated values in the single field. I¹m not sure how to do that
and if that¹s the best way.... But even if I can, I¹m not sure how to get
the data to display separately out of that field in the Listings view and
more importantly how to include that data in the Search options.

Any help would be appreciated.

Thanks,
Rahul S. Johari
Coordinator, Internet & Administration
Informed Marketing Services Inc.
500 Federal Street, Suite 201
Troy NY 12180

Tel: (518) 687-6700 x154
Fax: (518) 687-6799
Email: [EMAIL PROTECTED]
http://www.informed-sources.com



--- End Message ---
--- Begin Message ---
2006/5/17, Rahul S. Johari <[EMAIL PROTECTED]>:

Ave,

I¹m a little confused as to what¹s the best way to handle this.
I have a form which, apart from lots of other fields, has a set of 25 ­ 30
Check Boxes, each of which asks the user for some kind of information
which
the user can check or leave unchecked.
The information each Check Box collects will also appear in the ³Listing²
for users to view once the user has completed & submitted the form.
Furthermore, there is an Advanced Search also available to users which
will
also provide the same 25 - 30 check boxes which define the search
criteria.
I¹m not sure what¹s the best, most efficient way to do this.

The tedious way to do this is to make 30 fields in the mySQL database, and

if the check box is checked, the data goes into the corresponding field...
And similarly listing the data from the field if field is non-empty....
And
similarly including each field in the Search options.

I want suggestions for a better/faster way to do this. I did think about
creating a single field and storing the data from each Œchecked¹ check box
as comma separated values in the single field. I¹m not sure how to do that

and if that¹s the best way.... But even if I can, I¹m not sure how to get
the data to display separately out of that field in the Listings view and
more importantly how to include that data in the Search options.

Any help would be appreciated.

Thanks,

Rahul S. Johari
Coordinator, Internet & Administration
Informed Marketing Services Inc.
500 Federal Street, Suite 201
Troy NY 12180

Tel: (518) 687-6700 x154
Fax: (518) 687-6799
Email: [EMAIL PROTECTED]
http://www.informed-sources.com




You should consider using MySQL special column type SET:

http://dev.mysql.com/doc/refman/5.1/en/set.html

Or encoding each checkbox status as a binary bit in an integer (which is
what MySQL does when using a SET column).

--- End Message ---
--- Begin Message ---
Martin Alterisio wrote:
2006/5/17, Rahul S. Johari <[EMAIL PROTECTED]>:


...





You should consider using MySQL special column type SET:

http://dev.mysql.com/doc/refman/5.1/en/set.html

Or encoding each checkbox status as a binary bit in an integer

I was going to suggest this also- if nothing else it would be a cool
way to learn a bit (pun intended :-) about bitmask/bitfields/bitwise-operations.



--- End Message ---
--- Begin Message --- I did something similar recently. Basically I have one MySQL field to handle several dozen checkboxes, my situation though was where the checkboxes are numerically sequential though so I am not sure if this helps. I also had only a couple hours to do this from start to finish so I am sure there is a better way, but maybe this helps.

I wrote a function that generates the row of checkboxes, then a function that combines them all into one field and so the status of every checkbox is in one field.


Function generates the checkboxes and checks in the array if that checkbox is checked or not.

function row_generator($row,$number,$array)
{
        echo "\n<tr>";
        echo "\n\t<th align=\"center\" valign=\"top\">Row $row</th>";
        
        $i = 1;
        while ($i <= "$number")
        {

                if ($i < "10")
                {       $row_number = "{$row}-0{$i}"; }
                else
                {       $row_number = "{$row}-{$i}";  }
                
                echo "\n\t<td align=\"center\" valign=\"top\">";
echo "<input type=\"checkbox\" name=\"$row_number\" id=\"$row_number \"";
                
                if (strstr($array,$row_number) === FALSE)
                {       echo "";      }
                else
                {       echo " CHECKED";      }
                
                echo ">";
                echo "<br>";
                echo $i;
                echo "</td>";
                $i++;
                
        }
        echo "\n</tr>";
}

In use:

        $seats = $row['seats'];
        row_generator("A","23",$seats);

Collect the posted Data and then later this gets input into a database

$poster_A = "";
        $i = 1;
        while ($i <= "30")
        {
                if ($i < "10")             
                {       $r = "0{$i}"; }
                else
                {       $r = $i;        }
                if (isset($_POST["A-$r"]))
                {       $poster_A .= "A-$r";  
                        $poster_A .= ":";     }
                $i++;
        }

        $seats = ("{$poster_A}{$poster_B}.... etc");
        $query = "UPDATE seating_chart SET
                                seats = '$seats'
                                WHERE season = '2006'";


--
Kevin Murphy
Webmaster: Information and Marketing Services
Western Nevada Community College
www.wncc.edu
775-445-3326


On May 17, 2006, at 11:21 AM, Rahul S. Johari wrote:

Ave,

I’m a little confused as to what’s the best way to handle this.
I have a form which, apart from lots of other fields, has a set of 25 – 30 Check Boxes, each of which asks the user for some kind of information which
the user can check or leave unchecked.
The information each Check Box collects will also appear in the “Listing”
for users to view once the user has completed & submitted the form.
Furthermore, there is an Advanced Search also available to users which will also provide the same 25 - 30 check boxes which define the search criteria.
I’m not sure what’s the best, most efficient way to do this.

The tedious way to do this is to make 30 fields in the mySQL database, and if the check box is checked, the data goes into the corresponding field... And similarly listing the data from the field if field is non- empty.... And
similarly including each field in the Search options.

I want suggestions for a better/faster way to do this. I did think about creating a single field and storing the data from each ‘checked’ check box as comma separated values in the single field. I’m not sure how to do that and if that’s the best way.... But even if I can, I’m not sure how to get the data to display separately out of that field in the Listings view and
more importantly how to include that data in the Search options.

Any help would be appreciated.

Thanks,

Rahul S. Johari
Coordinator, Internet & Administration
Informed Marketing Services Inc.
500 Federal Street, Suite 201
Troy NY 12180

Tel: (518) 687-6700 x154
Fax: (518) 687-6799
Email: [EMAIL PROTECTED]
http://www.informed-sources.com


--- End Message ---
--- Begin Message --- Looking for suggestions on the most compute-efficient way to search variable-length strings (~200 characters) for the occurrence of one of about 100 possible needles. In other words:



$needles = array ( 1 => "Hello Jim" , 2 => "Yellow Banana" , 3 => "Red Car", ... etc .... (100 elements)

$haystack = "Once upon a time there was a programming language that everyone loved. Its name was PHP, and the people that worked with it also liked Yellow Bananas. One day...";



Now perhaps I'm blind, but I can't see an obvious string or array function that simply allows you to use an array as a needle while searching a string haystack. What I'm really looking for is something like the reverse of in_array.

The obvious thing would be to loop through the needles and run substr_count on the haystack... But is there a faster way?

...Rene

--- End Message ---
--- Begin Message ---
On 17/05/06, René Fournier <[EMAIL PROTECTED]> wrote:
Looking for suggestions on the most compute-efficient way to search
variable-length strings (~200 characters) for the occurrence of one
of about 100 possible needles. In other words:




$needles = array ( 1 => "Hello Jim" , 2 => "Yellow Banana" , 3 =>
"Red Car", ... etc .... (100 elements)

$haystack = "Once upon a time there was a programming language that
everyone loved. Its name was PHP, and the people that worked with it
also liked Yellow Bananas. One day...";


What version of php?

If you're using php5  then you could do:

<?php
  $count = 0;
  str_replace($needles, '', $haystack, $count);
  if ($count)  { /* there was a match */ }
?>

-robin

--- End Message ---
--- Begin Message --- You can make a pretty effective time/memory tradeoff -- particularly if your array of patterns is relatively fixed -- but unless you re- implement this in C, it will probably be slower than a brute force approach with the str* functions unless you are searching for a fairly huge number of needles.

Below, I build a tree of pattern matches, which you navigate branch- by-branch by using successive letters of the pattern. So, after the tree is built, the index $tree[ 'h' ][ 'a' ][ 't' ] exists and has the value `true'. To search the string, you push cursors onto a stack, advance them as you advance through the string, and destroy them when they hit a dead end.

This has a worst case of O( N^2 ) (on the length of the string), which happens when you search for patterns like "hhhhhhhhhhhhhhhha" and "hhhhhhhhhhhhhhhhb" in the string "hhhhhhhhhhhhhhhhh". The average case for random or typical strings should be very close to O ( N ). Critically, search time is a function only of the length of the string, not of the number of patterns. Memory usage is also only a function of the size of the character set and the length of the longest pattern, not of the total number of patterns.

This particular implementation has some nice side-effects; uncomment the var_dump() line and note how 'pirate' and 'firm' have been optimized out of the tree in favor of 'pir' and 'fir'.

Evan

<?php

    $pattern = array(
         'hat'
        ,'hut'
        ,'blue dog'
        ,'blue cat'
        ,'pirate'
        ,'pir'
        ,'fir'
        ,'firm'
        );

    $tree = array( );
    foreach( $pattern as $str ) {
        $len = strlen( $str );
        $cursor =& $tree;
        for( $ii = 0; $ii < $len; $ii++ ) {
            if( !isset( $cursor[ $str[ $ii ] ] ) ) {
                $cursor[ $str[ $ii ] ] = array( );
                }
            $cursor =& $cursor[ $str[ $ii ] ];
            if( $cursor === true ) break;
            }
        $cursor = true;
        }

/* var_dump ( $tree ); */

$corpus = 'lorem ipsum dolor sur amet pi blue do he hi h fipir slog';
    $clen   = strlen( $corpus );

    $stack  = array( );
    for( $ii = 0; $ii < $clen; $ii++ ) {
        $c = $corpus[ $ii ];
        foreach( $stack as $k => $_ ) {
            if( isset( $stack[ $k ][ $c ] ) ) {
                if( $stack[ $k ][ $c ] === true ) {
                    die( 'Matched at position '.$ii );
                    }
                $stack[ $k ] =& $stack[ $k ][ $c ];
                }
            else {
                unset( $stack[ $k ] );
                }
            }
        if( isset( $tree[ $c ] ) ) {
            $stack[] =& $tree[ $c ];
            }
        }
    die( 'Did not find a match.' );

?>



On May 17, 2006, at 12:37 PM, René Fournier wrote:

Looking for suggestions on the most compute-efficient way to search variable-length strings (~200 characters) for the occurrence of one of about 100 possible needles. In other words:



$needles = array ( 1 => "Hello Jim" , 2 => "Yellow Banana" , 3 => "Red Car", ... etc .... (100 elements)

$haystack = "Once upon a time there was a programming language that everyone loved. Its name was PHP, and the people that worked with it also liked Yellow Bananas. One day...";



Now perhaps I'm blind, but I can't see an obvious string or array function that simply allows you to use an array as a needle while searching a string haystack. What I'm really looking for is something like the reverse of in_array.

The obvious thing would be to loop through the needles and run substr_count on the haystack... But is there a faster way?

...Rene

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

--- End Message ---
--- Begin Message ---
On Wed, 2006-05-17 at 16:38, Robin Vickery wrote:
> On 17/05/06, René Fournier <[EMAIL PROTECTED]> wrote:
> > Looking for suggestions on the most compute-efficient way to search
> > variable-length strings (~200 characters) for the occurrence of one
> > of about 100 possible needles. In other words:
> 
> >
> >
> >
> > $needles = array ( 1 => "Hello Jim" , 2 => "Yellow Banana" , 3 =>
> > "Red Car", ... etc .... (100 elements)
> >
> > $haystack = "Once upon a time there was a programming language that
> > everyone loved. Its name was PHP, and the people that worked with it
> > also liked Yellow Bananas. One day...";
> >
> 
> What version of php?
> 
> If you're using php5  then you could do:
> 
> <?php
>    $count = 0;
>    str_replace($needles, '', $haystack, $count);
>    if ($count)  { /* there was a match */ }
> ?>

Surely you meant strpos( $haystack, $needle ) ???

Incidentally do you need to match on words beginnings or endings? For
instance should 'put' match all of the following:

    I put the apple core in the compost.
    Someone always puts the fire out.
    The car sputtered and died.

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 ---
I'm using SimpleXML to go through a Google search result and I'm not quite
understanding something.  The variable $xml->RES->R is an array of 9 items
and each item is an object containing information (see var dump below).  So
when I try to do count($xml->RES->R); it returns a number or 1 instead a
number of 10.  Also, when I do a print_r($xml->RES->R); all I get is a dump
of $xml->RES->R[0] and not the rest of the array.  I'm not quite sure what
is going on?  I'm using PHP 5.0.4 maybe there's a bug?

SimpleXMLElement Object
(
    [TM] => 0.081574
    [Q] => benefits
    [PARAM] => Array
        (
            [0] => SimpleXMLElement Object
                (
                )

            [1] => SimpleXMLElement Object
                (
                )

            [2] => SimpleXMLElement Object
                (
                )

            [3] => SimpleXMLElement Object
                (
                )

            [4] => SimpleXMLElement Object
                (
                )

            [5] => SimpleXMLElement Object
                (
                )

            [6] => SimpleXMLElement Object
                (
                )

            [7] => SimpleXMLElement Object
                (
                )

            [8] => SimpleXMLElement Object
                (
                )

        )

    [RES] => SimpleXMLElement Object
        (
            [M] => 1830
            [FI] => SimpleXMLElement Object
                (
                )

            [NB] => SimpleXMLElement Object
                (
                    [NU] =>
/search?q=benefits&site=default_collection&hl=en&lr=&ie=UTF-8&output=xml_no_
dtd&client=default_frontend&access=p&sort=date:D:L:d1&start=10&sa=N
                )

            [R] => Array
                (
                    [0] => SimpleXMLElement Object
                        (
                            [U] => http://benefits/
                            [UD] => http://benefits/
                            [UE] => http://benefits/
                            [T] => <b>Benefits</b>
                            [RK] => 10
                            [FS] => SimpleXMLElement Object
                                (
                                )

                            [S] => Home, <b>Benefits</b> Forms Jobs Training
Locations, Who We Are E-Info Publications EVA<br> Team Websites. <b>...</b>
2006 <b>Benefits</b> Vote. <b>Benefits</b> Links. <b>Benefits</b> Websites.
<b>...</b>  
                            [LANG] => en
                            [HAS] => SimpleXMLElement Object
                                (
                                    [L] => SimpleXMLElement Object
                                        (
                                        )

                                    [C] => SimpleXMLElement Object
                                        (
                                        )

                                )

                        )

                    [1] => SimpleXMLElement Object
                        (
                            [U] => http://benefits/benefits_websites.html
                            [UD] => http://benefits/benefits_websites.html
                            [UE] => http://benefits/benefits_websites.html
                            [T] => <b>Benefits</b>

                            [RK] => 9
                            [CRAWLDATE] =>  17 May 2006
                            [FS] => SimpleXMLElement Object
                                (
                                )

                            [S] => Home, <b>Benefits</b> Forms Jobs Training
Locations, Who We Are E-Info Publications<br> EVA Team Websites.
<b>Benefits</b> Websites.  <b>...</b>
                            [LANG] => en
                            [HAS] => SimpleXMLElement Object
                                (
                                    [L] => SimpleXMLElement Object
                                        (
                                        )

                                    [C] => SimpleXMLElement Object
                                        (
                                        )

                                )

                            [HN] => /benefits
                        )

                    [2] => SimpleXMLElement Object
                        (
                            [U] => http://www..com/jobs//benefits.html
                            [UD] => http://www..com/jobs//benefits.html
                            [UE] => http://www..com/jobs//benefits.html
                            [T] => Whole Foods : Jobs : North Atlantic
Region Career Opportunities
                            [RK] => 10
                            [CRAWLDATE] =>  15 May 2006
                            [FS] => SimpleXMLElement Object
                                (
                                )

                            [S] => <b>...</b>  <b>Benefits</b> Summary.
<b>...</b> The <b>Benefits</b> of a Unique Culture. At<br>  <b>...</b>
success. Medical Care <b>Benefits</b>. Available after <b>...</b>
                            [LANG] => en
                            [HAS] => SimpleXMLElement Object
                                (
                                    [L] => SimpleXMLElement Object
                                        (
                                        )

                                    [C] => SimpleXMLElement Object
                                        (
                                        )

                                )

                        )

                    [3] => SimpleXMLElement Object
                        (
                            [U] => http://www..com/jobs/uk/benefits.html
                            [UD] => http://www..com/jobs/uk/benefits.html
                            [UE] => http://www..com/jobs/uk/benefits.html
                            [T] =>  : Jobs : United Kingdom Career
Opportunities
                            [RK] => 9
                            [CRAWLDATE] =>  15 May 2006
                            [FS] => SimpleXMLElement Object
                                (
                                )

                            [S] => <b>...</b> <b>Benefits</b> Summary.
Current <b>benefits</b>:<br> Gain <b>...</b> of new <b>benefits</b>. The
<b>Benefits</b> of a Unique Culture. <b>...</b>
                            [LANG] => en
                            [HAS] => SimpleXMLElement Object
                                (
                                    [L] => SimpleXMLElement Object
                                        (
                                        )

                                    [C] => SimpleXMLElement Object
                                        (
                                        )

                                )

                        )

                    [4] => SimpleXMLElement Object
                        (
                            [U] => http://training/bene_guide.pdf
                            [UD] => http://training/bene_guide.pdf
                            [UE] => http:///training/bene_guide.pdf
                            [T] => 2004 <b>benefits</b> trainer guide
                            [RK] => 6
                            [FS] => SimpleXMLElement Object
                                (
                                )

                            [S] => Page 1. <b>Benefits</b> Orientation
Trainer¹s Guide 2004 <b>...</b> 2 0 0 4 <b>BENEFITS</b> Orientation n<br>
Trainer ¹s Guide 4 <b>Benefits</b> Orientation WORKBOOK at n Updated 1.1.04
Page 5. <b>...</b> 
                            [LANG] => en
                            [HAS] => SimpleXMLElement Object
                                (
                                    [L] => SimpleXMLElement Object
                                        (
                                        )

                                    [C] => SimpleXMLElement Object
                                        (
                                        )

                                )

                        )

                    [5] => SimpleXMLElement Object
                        (
                            [U] => http://training/mw_sta_benefits.ppt
                            [UD] => http://training/mw_sta_benefits.ppt
                            [UE] => http://training/mw_sta_benefits.ppt
                            [T] => Orientation Presentation
                            [RK] => 6
                            [FS] => SimpleXMLElement Object
                                (
                                )

                            [S] => <b>...</b> 7-2, Oct 99. Basic
<b>Benefits</b>. Available to Everyone. Credit Union. <b>...</b>
<b>Benefits</b> Requiring<br> Team Membership. 7-4, Oct 99. <b>Benefits</b>
Requiring Team Membership. Šcontinued <b>...</b>
                            [LANG] => en
                            [HAS] => SimpleXMLElement Object
                                (
                                    [L] => SimpleXMLElement Object
                                        (
                                        )

                                    [C] => SimpleXMLElement Object
                                        (
                                        )

                                )

                            [HN] => /training
                        )

                    [6] => SimpleXMLElement Object
                        (
                            [U] =>
http://publications/innerviews/benefits0305.html
                            [UD] =>
http://publications/innerviews/benefits0305.html
                            [UE] =>
http://publications/innerviews/benefits0305.html
                            [T] => Publications
                            [RK] => 5
                            [FS] => SimpleXMLElement Object
                                (
                                )

                            [S] => YOUR <b>BENEFITS</b>. How&#39;s everyone
doing with their New Year&#39;s resolutions to<br> eat better, lose some
extra pounds or quit smoking?... Here <b>...</b>
                            [LANG] => en
                            [HAS] => SimpleXMLElement Object
                                (
                                    [L] => SimpleXMLElement Object
                                        (
                                        )

                                    [C] => SimpleXMLElement Object
                                        (
                                        )

                                )

                        )

                    [7] => SimpleXMLElement Object
                        (
                            [U] =>
http://publications/innerviews/benefits0204.html
                            [UD] =>
http://publications/innerviews/benefits0204.html
                            [UE] =>
http://publications/innerviews/benefits0204.html
                            [T] => Publications
                            [RK] => 4
                            [FS] => SimpleXMLElement Object
                                (
                                )

                            [S] => <b>Benefits</b> News. National
<b>Benefits</b> &amp; Compensation Team Medical Card ID Numbers<br>
Beginning January 1, 2004, UnitedHealthcare (UHC) will <b>...</b>
                            [LANG] => en
                            [HAS] => SimpleXMLElement Object
                                (
                                    [L] => SimpleXMLElement Object
                                        (
                                        )

                                    [C] => SimpleXMLElement Object
                                        (
                                        )

                                )

                            [HN] => /publications/innerviews
                        )

                    [8] => SimpleXMLElement Object
                        (
                            [U] =>
http://www..com/cgi-bin/print10pt.cgi?url=/jobs//benefits.html
                            [UD] =>
http://www..com/cgi-bin/print10pt.cgi?url=/jobs//benefits.html
                            [UE] =>
http://www..com/cgi-bin/print10pt.cgi%3Furl%3D/jobs//benefits.html
                            [T] =>
www.wholefoodsmarket.com/jobs/northatlantic/<b>benefits</b>.html
                            [RK] => 4
                            [CRAWLDATE] =>  16 May 2006
                            [FS] => SimpleXMLElement Object
                                (
                                )

                            [S] => <b>...</b> /<b>benefits</b>.html.
<b>Benefits</b> Summary. <b>...</b> The <b>Benefits</b> of<br> a Unique
Culture. <b>...</b> success. Medical Care <b>Benefits</b>. Available after
<b>...</b>  
                            [LANG] => en
                            [HAS] => SimpleXMLElement Object
                                (
                                    [L] => SimpleXMLElement Object
                                        (
                                        )

                                    [C] => SimpleXMLElement Object
                                        (
                                        )

                                )

                        )

                    [9] => SimpleXMLElement Object
                        (
                            [U] =>
http://www..com/cgi-bin/print10pt.cgi?url=/jobs/uk/benefits.html
                            [UD] =>
http://www..com/cgi-bin/print10pt.cgi?url=/jobs/uk/benefits.html
                            [UE] =>
http://www..com/cgi-bin/print10pt.cgi%3Furl%3D/jobs/uk/benefits.html
                            [T] => www..com/jobs/uk/<b>benefits</b>.html
                            [RK] => 4
                            [CRAWLDATE] =>  16 May 2006
                            [FS] => SimpleXMLElement Object
                                (
                                )

                            [S] => URL:
http://www..com/jobs/uk/<b>benefits</b>.html.  <b>Benefits</b> Summary.
<b>...</b> The <b>Benefits</b> of a Unique Culture. <b>...</b>
                            [LANG] => en
                            [HAS] => SimpleXMLElement Object
                                (
                                    [L] => SimpleXMLElement Object
                                        (
                                        )

                                    [C] => SimpleXMLElement Object
                                        (
                                        )

                                )

                            [HN] => www..com/cgi-bin/print10pt.cgi
                        )

                )

        )

)

--- End Message ---
--- Begin Message ---
I am having an issue with certain pages preventing the user from going back
to the previous page.

The message given by Firefox is: "The page you are trying to view contains
PSTDATA that has expired from cache".

This happens in the case of an HTML form using the POST method but also a
query object in the URL.

In this case: index.php?id=shopping_cart in my URL, along with a bunch of
form data you carry from page to page in a shopping cart (quantities, what
to remove, addresses, payment info, etc...)

Is this due to the fact that I am mixing POST and query objects or is it
something else?

I already tried adding the following but it does not help:

header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");

Thanks for your help!

--- End Message ---
--- Begin Message ---
At 11:18 AM -0400 5/17/06, John Nichel wrote:
tedd wrote:
Hi (please insert your preference):

This should be simple, but I'm having problems.

I have a program that uploads an image file and then tries to set the permissions for the image (to be altered later). However, I get a "Warning: chmod(): Operation not permitted" error when trying to set the permission, what gives? If my program created the file, shouldn't it have permission to set the files permissions?

What am I not understanding?

Without seeing code, permissions of the directories, what sticky bits might or might not be set, etc., you could not be understanding many things....or just one....who knows.

I read all of your Google links, but no help. Just another example of how Google is not the answer.

In any event, my code is pretty simple, just:

chmod($url, 0755);  //where $url is the file I want to change.

The error I receive is noted above in the subject line.

The permissions of the directories vary, but the folder that has the file I want to change permissions is currently set at 0777.

In doing a lstat() of both the parent program that created the file and the child file shows that they both have the identical uid and gid (i.e., the same user and group id's).

Now, everything I've read, says:

chmod() changes the permission of the specified file with the following caveat.

"chmod() can only change the permissions of files that are owned by the user running the command. In most cases, this is the user that the web server runs on."

That confuses me, because who's the user here? Is it just the system administrator or the application?

And if it is just the system administrator, then can't the system admin change anything he/she wants anyway? What's the point of having uid and gid's if a program can't change the permissions of a sibling file?

I have tons of references as to what php filesystem functions are available, but I need a good reference as to what permissions are and how they actually can be changed in php -- does anyone have one a good reference OR care to explain?

As it is now, I know how ride the horse, but I can't get the gate open.

Thanks.

tedd

--
------------------------------------------------------------------------------------
http://sperling.com  http://ancientstones.com  http://earthstones.com

--- End Message ---
--- Begin Message ---
> "chmod() can only change the permissions of files that are owned by 
> the user running the command. In most cases, this is the user that 
> the web server runs on."
> 
> That confuses me, because who's the user here? Is it just the system 
> administrator or the application?

This is the user that Apache (or whatever webserver) is running as.  If
you're using Apache, look at your httpd.conf file to find out who that
user is.  If you're creating files successfully, you can just look at
the owner of that file to find out who it is.

Is safe_mode enabled?

>From the manual (http://us3.php.net/chmod):

Note:  When safe mode is enabled, PHP checks whether the files or
directories you are about to operate on have the same UID (owner) as the
script that is being executed. In addition, you cannot set the SUID,
SGID and sticky bits.

So, if you're running in safe mode, the php file, and the files that you
need to modify have to be owned by the same user.

Say you have process.php which is operating on the uploaded files, and
it is owned by the jondoe user.  The files that you wanted to chmod()
would also have to be owned by jondoe, which is probably not the case.
Apache is often run under the apache, www, or nobody user.

HTH,

Brady

--- End Message ---
--- Begin Message ---
Jonas Rosling wrote:
Hi,
the PHP newbie is here again asking questions.
Is there anyway in PHP to convert none international characters so the are
displayed correct?
In my case I have lots of data in the database with å,ä and ö.

Thanks // Jonas

Have you looked at the mbstring or iconv extensions?

--

life is a game... so have fun.

--- End Message ---
--- Begin Message ---
I am using a chat program and trying to call the status page from another
server and the graphic that the page returns does not show up.

It works if you are calling from the webserver that the chat program is
working so i feel it is some type of config problem or security issue.

http://www.hidho.com/chattest.htm is the page that uses the code

<a href="javascript:pophelp('
http://chat.siuprem.com/siupchat/client.php',500,500)"><img src="
http://chat.siuprem.com/siupchat/statusimage.php";></a> and it works on
http://chat.siuprem.com/siupchat/chattest.htm which is the windows IIS
sesrver where PHP is running.

Any help would be great.

/Robert

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

I trying to add multiple items to a shopping cart with selectable quantity and price form text field like..

apple   : qty: [__]  price: [__]
orange : qty: [__]  price: [__]
<Add Items to Cart>


I could add multiple items with checkboxes but without selecting quantity and price..

if (isset($_POST['itemschecked'])) {
foreach($_POST['itemschecked'] as $itemschecked => $checkeditems ){
AddItem($checkeditems, 1);
}

Any help is appreciated..

Thanks,

Andras
--- End Message ---
--- Begin Message ---
Mark Sargent wrote:
Chris wrote:

Sounds like you're using the wrong script to restart apache.

What command are you using?

service httpd restart

Rebooting will most likely pick up the /etc/init.d/apache or /etc/init.d/httpd script.

Have this in /etc/rc.local on Fedora 5,

startApache=/usr/local/apache2/bin/apachectl
if [ -f "$startApache" ] ; then
        $startApache start
fi

and I see that I have left off start at the end of startApache.

There's your problem.

service httpd restart

will most likely restart /usr/sbin/httpd.

That's not the same as /usr/local/apache2

Remove the rpm to save confusion next time:

rpm -e httpd

then when you need to restart, always use the /usr/local/apache2/bin/apachectl file.

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

--- End Message ---
--- Begin Message ---
Chris wrote:
There's your problem.

service httpd restart

will most likely restart /usr/sbin/httpd.

That's not the same as /usr/local/apache2

Remove the rpm to save confusion next time:

rpm -e httpd

then when you need to restart, always use the /usr/local/apache2/bin/apachectl file.
Hi All,

weird, as I distinctly left out installing any type of servers when initially installing FC5. Cheers.

Mark Sargent

--- End Message ---
--- Begin Message ---
Mark Sargent wrote:
Chris wrote:

There's your problem.

service httpd restart

will most likely restart /usr/sbin/httpd.

That's not the same as /usr/local/apache2

Remove the rpm to save confusion next time:

rpm -e httpd

then when you need to restart, always use the /usr/local/apache2/bin/apachectl file.

Hi All,

weird, as I distinctly left out installing any type of servers when initially installing FC5. Cheers.

In my experience redhat and fedora don't really listen to what you want properly. What the hell does pcmcia have to do with a server installation?

You need to check it each time you install.

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

--- End Message ---

Reply via email to