php-general Digest 1 Aug 2005 03:23:28 -0000 Issue 3599

Topics (messages 219707 through 219729):

Re: Help with a Parse Error
        219707 by: Edward Vermillion
        219708 by: Tom Chubb
        219710 by: Jochem Maas
        219713 by: Tom Chubb
        219717 by: Jochem Maas
        219720 by: Jochem Maas

xsltprocessor
        219709 by: Allan Jardine
        219712 by: Jochem Maas
        219714 by: Allan Jardine
        219715 by: Allan Jardine

Re: error checking woes- SOLVED
        219711 by: Jack Jackson

Amazon Web Services 4 wrapper
        219716 by: Paul Waring

PDF < FDF < $_POST
        219718 by: Sam Smith

Re: input type=file problem                                                     
           (Maybe 0T)
        219719 by: David Dorward
        219721 by: Jochem Maas

Re: Running a PHP script everyday [SOLVED]
        219722 by: sub.pudlz.com

Re: Running a PHP script everyday
        219723 by: Raj Shekhar

Re: Question on exec() to call a php script from a php script
        219724 by: Raj Shekhar

Performace and segfault errors with Php5 + Apache 1.3.x + linux-2.6.x
        219725 by: Edwin Barrios

Re: preg_match_all question
        219726 by: Ethilien

what is this: dirname(__FILE__)?
        219727 by: Sam Smith
        219728 by: Robert Cummings

Re: Calendar program like on php.net
        219729 by: Roger Thomas

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 ---
Tom Chubb wrote:
I am trying to create my own news system and to start with I'm using
static news pages until I get the db working properly.
I'm using the following code:

<?php if(!isset($_GET['id'])) { $article="$id.php" if (file_exists($article)) { include $article; } else { echo "The article you've requested does not exist!"; }
}
else { echo "You did not select an article"; } ?>

I am testing using the following links...

www.myurl.co.uk/index.php
www.myurl.co.uk/index.php?id=1
www.myurl.co.uk/index.php?id=2

When I try the first one, I'd expect it to say you did not select an
article, but it says


Notice: Undefined variable: id in
/home/5217/tomchubb/public_html/index.php on line 15
The article you've requested does not exist
When I try the third link, I would expect it to say  The article
you've requested does not exist! but it says:

Parse error: parse error in /home/5217/tomchubb/public_html/index.php on line 16

Lines 15 & 16 are:
if (file_exists($article)) { include $article; } else { echo "The article you've requested does not exist!"; }

I don't understand why this isn't working and I've tried looking into
this for 2 hours!
Can anyone tell me where I'm going wrong please?

Thanks,

Tom
What I notice is that the first error says it's on line 15, then you give lines 15 and 16 in the second example but line 15 doesn't have "id" in it. Are you sure your looking at the right lines? Try posting the whole script and maybe someone can catch the problem.
--- End Message ---
--- Begin Message ---
I have changed it a bit, and don't have the old code now!!!
I saw a post which identified a problem using isset when $var = ""; as
it returns true, so I changed my code to use...

if ($_GET['id'] != "")
{       $article="$id.php";
                if (file_exists($article)) { include $article; } 
                else    { echo "The article you've requested does not exist!"; }
}
else {
echo "No article selected"; 
}

This works fine, except that when the url is www.mysite.com/index.php
I get the following error...

Notice: Undefined index: id in
/home/5217/tomchubb/public_html/index.php on line 14
No article selected 

I kmow this will disappear when I turn off error reporting, but how
can I suppress it properly?


On 31/07/05, Edward Vermillion <[EMAIL PROTECTED]> wrote:
> Tom Chubb wrote:
> > I am trying to create my own news system and to start with I'm using
> > static news pages until I get the db working properly.
> > I'm using the following code:
> >
> > <?php
> > if(!isset($_GET['id']))
> > {     $article="$id.php"
> >               if (file_exists($article)) { include $article; }
> >               else    { echo "The article you've requested does not 
> > exist!"; }
> > }
> >       else { echo "You did not select an article"; }
> > ?>
> >
> > I am testing using the following links...
> >
> > www.myurl.co.uk/index.php
> > www.myurl.co.uk/index.php?id=1
> > www.myurl.co.uk/index.php?id=2
> >
> > When I try the first one, I'd expect it to say you did not select an
> > article, but it says
> >
> >
> > Notice: Undefined variable: id in
> > /home/5217/tomchubb/public_html/index.php on line 15
> > The article you've requested does not exist
> >
> >
> > When I try the third link, I would expect it to say  The article
> > you've requested does not exist! but it says:
> >
> > Parse error: parse error in /home/5217/tomchubb/public_html/index.php on 
> > line 16
> >
> > Lines 15 & 16 are:
> > if (file_exists($article)) { include $article; }
> > else  { echo "The article you've requested does not exist!"; }
> >
> > I don't understand why this isn't working and I've tried looking into
> > this for 2 hours!
> > Can anyone tell me where I'm going wrong please?
> >
> > Thanks,
> >
> > Tom
> What I notice is that the first error says it's on line 15, then you
> give lines 15 and 16 in the second example but line 15 doesn't have "id"
> in it. Are you sure your looking at the right lines? Try posting the
> whole script and maybe someone can catch the problem.
> 


-- 
Tom Chubb
[EMAIL PROTECTED]
07915 053312

--- End Message ---
--- Begin Message ---
Tom Chubb wrote:
I have changed it a bit, and don't have the old code now!!!
I saw a post which identified a problem using isset when $var = ""; as
it returns true, so I changed my code to use...


the fact that you are using $id suggests you have register_globals on
- not recommended practice. and mixing using of auto registered globals ($id)
and the equivelant $_GET index ($_GET['id']) is going to lead to confusion
somewhere do the line.

if ($_GET['id'] != "")
{       $article="$id.php";
if (file_exists($article)) { include $article; } else { echo "The article you've requested does not exist!"; }
}
else {
echo "No article selected"; }

you hint that the id must always be an integer.... so sanitize your data as 
such.
to avoid nasty things happening, try like so:

if ($cleanID = intval( $_GET['id'] )) {         
        $article = "$cleanID.php";
        if (file_exists($article)) {
                include $article;
        } else {
                echo "The article you've requested does not exist!";
        }
} else {
        echo "No article selected";
}



This works fine, except that when the url is www.mysite.com/index.php
I get the following error...

Notice: Undefined index: id in
/home/5217/tomchubb/public_html/index.php on line 14
No article selected
I kmow this will disappear when I turn off error reporting, but how
can I suppress it properly?


On 31/07/05, Edward Vermillion <[EMAIL PROTECTED]> wrote:

Tom Chubb wrote:

I am trying to create my own news system and to start with I'm using
static news pages until I get the db working properly.
I'm using the following code:

<?php
if(!isset($_GET['id']))
{     $article="$id.php"
             if (file_exists($article)) { include $article; }
             else    { echo "The article you've requested does not exist!"; }
}
     else { echo "You did not select an article"; }
?>

I am testing using the following links...

www.myurl.co.uk/index.php
www.myurl.co.uk/index.php?id=1
www.myurl.co.uk/index.php?id=2

When I try the first one, I'd expect it to say you did not select an
article, but it says


Notice: Undefined variable: id in
/home/5217/tomchubb/public_html/index.php on line 15
The article you've requested does not exist


When I try the third link, I would expect it to say  The article
you've requested does not exist! but it says:

Parse error: parse error in /home/5217/tomchubb/public_html/index.php on line 16

Lines 15 & 16 are:
if (file_exists($article)) { include $article; }
else  { echo "The article you've requested does not exist!"; }

I don't understand why this isn't working and I've tried looking into
this for 2 hours!
Can anyone tell me where I'm going wrong please?

Thanks,

Tom

What I notice is that the first error says it's on line 15, then you
give lines 15 and 16 in the second example but line 15 doesn't have "id"
in it. Are you sure your looking at the right lines? Try posting the
whole script and maybe someone can catch the problem.





--- End Message ---
--- Begin Message ---
Thanks Jochem, useful info.
I've changed that now, but why is there still an Undefined index: id error?
Any ideas?


On 31/07/05, Jochem Maas <[EMAIL PROTECTED]> wrote:
> Tom Chubb wrote:
> > I have changed it a bit, and don't have the old code now!!!
> > I saw a post which identified a problem using isset when $var = ""; as
> > it returns true, so I changed my code to use...
> >
> 
> the fact that you are using $id suggests you have register_globals on
> - not recommended practice. and mixing using of auto registered globals ($id)
> and the equivelant $_GET index ($_GET['id']) is going to lead to confusion
> somewhere do the line.
> 
> > if ($_GET['id'] != "")
> > {     $article="$id.php";
> >               if (file_exists($article)) { include $article; }
> >               else    { echo "The article you've requested does not 
> > exist!"; }
> > }
> > else {
> > echo "No article selected";
> > }
> 
> you hint that the id must always be an integer.... so sanitize your data as 
> such.
> to avoid nasty things happening, try like so:
> 
> if ($cleanID = intval( $_GET['id'] )) {
>        $article = "$cleanID.php";
>        if (file_exists($article)) {
>                include $article;
>        } else {
>                echo "The article you've requested does not exist!";
>        }
> } else {
>        echo "No article selected";
> }
> 
> 
> >
> > This works fine, except that when the url is www.mysite.com/index.php
> > I get the following error...
> >
> > Notice: Undefined index: id in
> > /home/5217/tomchubb/public_html/index.php on line 14
> > No article selected
> >
> > I kmow this will disappear when I turn off error reporting, but how
> > can I suppress it properly?
> >
> >
> > On 31/07/05, Edward Vermillion <[EMAIL PROTECTED]> wrote:
> >
> >>Tom Chubb wrote:
> >>
> >>>I am trying to create my own news system and to start with I'm using
> >>>static news pages until I get the db working properly.
> >>>I'm using the following code:
> >>>
> >>><?php
> >>>if(!isset($_GET['id']))
> >>>{     $article="$id.php"
> >>>              if (file_exists($article)) { include $article; }
> >>>              else    { echo "The article you've requested does not 
> >>> exist!"; }
> >>>}
> >>>      else { echo "You did not select an article"; }
> >>>?>
> >>>
> >>>I am testing using the following links...
> >>>
> >>>www.myurl.co.uk/index.php
> >>>www.myurl.co.uk/index.php?id=1
> >>>www.myurl.co.uk/index.php?id=2
> >>>
> >>>When I try the first one, I'd expect it to say you did not select an
> >>>article, but it says
> >>>
> >>>
> >>>Notice: Undefined variable: id in
> >>>/home/5217/tomchubb/public_html/index.php on line 15
> >>>The article you've requested does not exist
> >>>
> >>>
> >>>When I try the third link, I would expect it to say  The article
> >>>you've requested does not exist! but it says:
> >>>
> >>>Parse error: parse error in /home/5217/tomchubb/public_html/index.php on 
> >>>line 16
> >>>
> >>>Lines 15 & 16 are:
> >>>if (file_exists($article)) { include $article; }
> >>>else  { echo "The article you've requested does not exist!"; }
> >>>
> >>>I don't understand why this isn't working and I've tried looking into
> >>>this for 2 hours!
> >>>Can anyone tell me where I'm going wrong please?
> >>>
> >>>Thanks,
> >>>
> >>>Tom
> >>
> >>What I notice is that the first error says it's on line 15, then you
> >>give lines 15 and 16 in the second example but line 15 doesn't have "id"
> >>in it. Are you sure your looking at the right lines? Try posting the
> >>whole script and maybe someone can catch the problem.
> >>
> >
> >
> >
> 
> 


-- 
Tom Chubb
[EMAIL PROTECTED]
07915 053312

--- End Message ---
--- Begin Message ---
Tom Chubb wrote:
Thanks Jochem, useful info.
I've changed that now, but why is there still an Undefined index: id error?

its a notice technically not an error.
and its showing up because you have error reporting set to show notices.
to be really purist/correct do it something like this:

if (isset($_GET['id']) && ($cleanID = intval( $_GET['id'] ))) {
        $article = "$cleanID.php";
        if (file_exists($article)) {
                include $article;
        } else {
                echo "The article you've requested does not exist!";
        }
} else {
        echo "No article selected";
}

or you can suppress the notice with a @ (know what you are doing when
you use the @ symbol), e.g.:

if ($cleanID = intval( @$_GET['id'] )) {
        $article = "$cleanID.php";
        if (file_exists($article)) {
                include $article;
        } else {
                echo "The article you've requested does not exist!";
        }
} else {
        echo "No article selected";
}

Any ideas?


On 31/07/05, Jochem Maas <[EMAIL PROTECTED]> wrote:

Tom Chubb wrote:

I have changed it a bit, and don't have the old code now!!!
I saw a post which identified a problem using isset when $var = ""; as
it returns true, so I changed my code to use...


the fact that you are using $id suggests you have register_globals on
- not recommended practice. and mixing using of auto registered globals ($id)
and the equivelant $_GET index ($_GET['id']) is going to lead to confusion
somewhere do the line.


if ($_GET['id'] != "")
{     $article="$id.php";
             if (file_exists($article)) { include $article; }
             else    { echo "The article you've requested does not exist!"; }
}
else {
echo "No article selected";
}

you hint that the id must always be an integer.... so sanitize your data as 
such.
to avoid nasty things happening, try like so:

if ($cleanID = intval( $_GET['id'] )) {
      $article = "$cleanID.php";
      if (file_exists($article)) {
              include $article;
      } else {
              echo "The article you've requested does not exist!";
      }
} else {
      echo "No article selected";
}



This works fine, except that when the url is www.mysite.com/index.php
I get the following error...

Notice: Undefined index: id in
/home/5217/tomchubb/public_html/index.php on line 14
No article selected

I kmow this will disappear when I turn off error reporting, but how
can I suppress it properly?


On 31/07/05, Edward Vermillion <[EMAIL PROTECTED]> wrote:


Tom Chubb wrote:


I am trying to create my own news system and to start with I'm using
static news pages until I get the db working properly.
I'm using the following code:

<?php
if(!isset($_GET['id']))
{     $article="$id.php"
            if (file_exists($article)) { include $article; }
            else    { echo "The article you've requested does not exist!"; }
}
    else { echo "You did not select an article"; }
?>

I am testing using the following links...

www.myurl.co.uk/index.php
www.myurl.co.uk/index.php?id=1
www.myurl.co.uk/index.php?id=2

When I try the first one, I'd expect it to say you did not select an
article, but it says


Notice: Undefined variable: id in
/home/5217/tomchubb/public_html/index.php on line 15
The article you've requested does not exist


When I try the third link, I would expect it to say  The article
you've requested does not exist! but it says:

Parse error: parse error in /home/5217/tomchubb/public_html/index.php on line 16

Lines 15 & 16 are:
if (file_exists($article)) { include $article; }
else  { echo "The article you've requested does not exist!"; }

I don't understand why this isn't working and I've tried looking into
this for 2 hours!
Can anyone tell me where I'm going wrong please?

Thanks,

Tom

What I notice is that the first error says it's on line 15, then you
give lines 15 and 16 in the second example but line 15 doesn't have "id"
in it. Are you sure your looking at the right lines? Try posting the
whole script and maybe someone can catch the problem.








--- End Message ---
--- Begin Message ---
Tom Chubb wrote:
The purist method is what I wanted.

dev'ing with E_ALL is a good thing, but turn off E_NOTICE on productions 
sites... IMHO
in fact make sure your production sites don't output any php errors at all 
(even if they occur!),
sure log them, but don't show - it makes it just a little harder for hackers 
(as in shitheads
who feel the need to try and crack you site - rather than the oldschool 
meaning) to
hack you.

I know it sounds a bit silly, but I would like to be able to run all

not silly at all. :-)

my scripts with error reporting set to e_all without any
notices/errors.
What you've shown me is perfect, so thanks for your help.
T

On 31/07/05, Jochem Maas <[EMAIL PROTECTED]> wrote:

Tom Chubb wrote:

Thanks Jochem, useful info.
I've changed that now, but why is there still an Undefined index: id error?

its a notice technically not an error.
and its showing up because you have error reporting set to show notices.
to be really purist/correct do it something like this:

if (isset($_GET['id']) && ($cleanID = intval( $_GET['id'] ))) {
       $article = "$cleanID.php";
       if (file_exists($article)) {
               include $article;
       } else {
               echo "The article you've requested does not exist!";
       }
} else {
      echo "No article selected";
}

or you can suppress the notice with a @ (know what you are doing when
you use the @ symbol), e.g.:

if ($cleanID = intval( @$_GET['id'] )) {
       $article = "$cleanID.php";
       if (file_exists($article)) {
               include $article;
       } else {
               echo "The article you've requested does not exist!";
       }
} else {
      echo "No article selected";
}


Any ideas?


On 31/07/05, Jochem Maas <[EMAIL PROTECTED]> wrote:


Tom Chubb wrote:


I have changed it a bit, and don't have the old code now!!!
I saw a post which identified a problem using isset when $var = ""; as
it returns true, so I changed my code to use...


the fact that you are using $id suggests you have register_globals on
- not recommended practice. and mixing using of auto registered globals ($id)
and the equivelant $_GET index ($_GET['id']) is going to lead to confusion
somewhere do the line.



if ($_GET['id'] != "")
{     $article="$id.php";
            if (file_exists($article)) { include $article; }
            else    { echo "The article you've requested does not exist!"; }
}
else {
echo "No article selected";
}

you hint that the id must always be an integer.... so sanitize your data as 
such.
to avoid nasty things happening, try like so:

if ($cleanID = intval( $_GET['id'] )) {
     $article = "$cleanID.php";
     if (file_exists($article)) {
             include $article;
     } else {
             echo "The article you've requested does not exist!";
     }
} else {
     echo "No article selected";
}




This works fine, except that when the url is www.mysite.com/index.php
I get the following error...

Notice: Undefined index: id in
/home/5217/tomchubb/public_html/index.php on line 14
No article selected

I kmow this will disappear when I turn off error reporting, but how
can I suppress it properly?


On 31/07/05, Edward Vermillion <[EMAIL PROTECTED]> wrote:



Tom Chubb wrote:



I am trying to create my own news system and to start with I'm using
static news pages until I get the db working properly.
I'm using the following code:

<?php
if(!isset($_GET['id']))
{     $article="$id.php"
           if (file_exists($article)) { include $article; }
           else    { echo "The article you've requested does not exist!"; }
}
   else { echo "You did not select an article"; }
?>

I am testing using the following links...

www.myurl.co.uk/index.php
www.myurl.co.uk/index.php?id=1
www.myurl.co.uk/index.php?id=2

When I try the first one, I'd expect it to say you did not select an
article, but it says


Notice: Undefined variable: id in
/home/5217/tomchubb/public_html/index.php on line 15
The article you've requested does not exist


When I try the third link, I would expect it to say  The article
you've requested does not exist! but it says:

Parse error: parse error in /home/5217/tomchubb/public_html/index.php on line 16

Lines 15 & 16 are:
if (file_exists($article)) { include $article; }
else  { echo "The article you've requested does not exist!"; }

I don't understand why this isn't working and I've tried looking into
this for 2 hours!
Can anyone tell me where I'm going wrong please?

Thanks,

Tom

What I notice is that the first error says it's on line 15, then you
give lines 15 and 16 in the second example but line 15 doesn't have "id"
in it. Are you sure your looking at the right lines? Try posting the
whole script and maybe someone can catch the problem.









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

I'm having a real problem with applying an xslt transform to a selected part of an xml document. I load the xml document using simplexml_load_file, and the same with the xsl file. Using the xpath function for simplexml I select a part of the xml document and store it in a different variable. I then apply the xml transform to that variable, however the transform actually applies to the whole xml document, rather than just the selected part in the new variable. I can't figure out why it does this. Does anyone know? The code I'm used is below.

   $xml = simplexml_load_file ( 'simple_test.xml' );

    if ( isset ( $_GET['s'] ) && isset ( $_GET['ss'] ) )
foreach ( $xml->xpath( "//[EMAIL PROTECTED]'".$_GET['s']."']/ [EMAIL PROTECTED]'".$_GET['ss']."']" ) as $subsection)
            $content = $subsection;

    $xsl = simplexml_load_file( 'simple_test.xsl' );
    $proc = new XsltProcessor();
    $proc->importStylesheet($xsl);
    echo $proc->transformToXML($content);

Thanks for any help
Allan

--- End Message ---
--- Begin Message ---
Allan Jardine wrote:
Hello all,

I'm having a real problem with applying an xslt transform to a selected part of an xml document. I load the xml document using simplexml_load_file, and the same with the xsl file. Using the xpath function for simplexml I select a part of the xml document and store it in a different variable. I then apply the xml transform to that variable, however the transform actually applies to the whole xml document, rather than just the selected part in the new variable. I can't figure out why it does this. Does anyone know? The code I'm used is below.

   $xml = simplexml_load_file ( 'simple_test.xml' );

    if ( isset ( $_GET['s'] ) && isset ( $_GET['ss'] ) )
foreach ( $xml->xpath( "//[EMAIL PROTECTED]'".$_GET['s']."']/ [EMAIL PROTECTED]'".$_GET['ss']."']" ) as $subsection)
            $content = $subsection;

    $xsl = simplexml_load_file( 'simple_test.xsl' );
    $proc = new XsltProcessor();
    $proc->importStylesheet($xsl);
    echo $proc->transformToXML($content);

you might start by using some braces to explicitly delineate the
if and foreach block? ...personally I'm not sure exactly what your code
should be doing.


Thanks for any help
Allan


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

you might start by using some braces to explicitly delineate the
if and foreach block? ...personally I'm not sure exactly what your code
should be doing.

Putting the brackets in doesn't make any difference. That part of the code appears to work perfectly - what it does is scan through the xml document looking for a 'section' tag with the attribute id equal to the get variable 's' and with a 'subsection' tag with attribute id equal to the get variable 'ss'. Doing echo $content->asXML(); right after the if and foreach shows that the $content variable does indeed hold the right content.

The problem is then applying the xsl transform to what is in that variable. It appears to transform everything in $xml, rather than just what is in $content.

   $xml = simplexml_load_file ( 'simple_test.xml' );
    if ( isset ( $_GET['s'] ) && isset ( $_GET['ss'] ) ) {
foreach ( $xml->xpath( "//[EMAIL PROTECTED]'".$_GET['s']."']/ [EMAIL PROTECTED]'".$_GET['ss']."']" ) as $subsection) {
            $content = $subsection;
        }
    }
    $xsl = simplexml_load_file( 'simple_test.xsl' );
    $proc = new XsltProcessor();
    $proc->importStylesheet($xsl);
    echo $proc->transformToXML($content);

Thanks
Allan

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

The problem is then applying the xsl transform to what is in that variable. It appears to transform everything in $xml, rather than just what is in $content.

Managed to solve my own problem... Using:

$content = $proc->transformToXML(DomDocument::loadXML($content));

To create an xml dom model that can be operated on by the xslt processor. I still have no idea why it would spit out the whole xml document if its not done like that - but never mind...

Thanks
Allan

--- End Message ---
--- Begin Message --- I did the smart thing last night: nothing. I read some PHP books and then realized that the answer to my error checking was a lot less complex, once again, than I had initially suspected. I finally ended up with:


 //error checking
foreach($_POST as $qname=>$value) {
    if(empty($value)){
        $message[$qname]=1;
    }
}


I cannot believe what I started with and what I ended up with.

Thanks as usual for the help!!

--- End Message ---
--- Begin Message ---
Does anyone know of an open source wrapper class for the Amazon Web
Services API (version 4)? The only ones I can find are either years out
of date (such as Amazon_Services in PEAR) and so no longer work, or they
require me to parse the XML myself. All I want is something relatively
simple that I can give my developer token and a search term (99% of the
time this will be the ISBN of a book) and get back a data structure
(preferably an associative array) with the product information.

Thanks in advance,

Paul

-- 
Rogue Tory
http://www.roguetory.org.uk

Attachment: pgpgO5VH6L6Fm.pgp
Description: PGP signature


--- End Message ---
--- Begin Message ---
I need PHP fill out the form fields and prepare for download a PDF from an
HTML form submission.

One way would be to use a PDF with pre-configured form fields where an FDF
is created from PHP. The FDF 'merges' with the PDF when the FDF is opened.

I got all that from: <http://koivi.com/fill-pdf-form-fields/>.

I have the scripts from koivi.com producing the FDF correctly but I don't
know what to do with it next. The target PDF would need to be downloaded
first because when you open the FDF is says, "hey where's the target."

fdf_open looked promising but the fdftk is not compiled in on the server.


Thanks

--- End Message ---
--- Begin Message ---
Ryan A wrote:
> The problem is, if she has tried to upload a pic at the same time and
> screwed up on the date of birth I am unable
> to send back the value of the FILE box so that too get populated... I
> tried setting a VALUE="path/file" but that
> does not work.

As has already been pointed out, you can't set the value of the file input.
What you can do though is to keep the image uploaded the first time round,
and send back a form adding a "Keep existing upload" (perhaps along with a
thumbnail of the image), thus saving the user from uploading the image over
and over until they fill in the rest of the form correctly.

-- 
David Dorward       <http://blog.dorward.me.uk/>   <http://dorward.me.uk/>
                     Home is where the ~/.bashrc is

--- End Message ---
--- Begin Message ---
David Dorward wrote:
Ryan A wrote:

The problem is, if she has tried to upload a pic at the same time and
screwed up on the date of birth I am unable
to send back the value of the FILE box so that too get populated... I
tried setting a VALUE="path/file" but that
does not work.


As has already been pointed out, you can't set the value of the file input.
What you can do though is to keep the image uploaded the first time round,
and send back a form adding a "Keep existing upload" (perhaps along with a
thumbnail of the image), thus saving the user from uploading the image over
and over until they fill in the rest of the form correctly.


alternatively break the form in 2. step 1 fill in all the required stuff, when 
that
passes you checks present step 2, namely a file upload box.

--- End Message ---
--- Begin Message ---
What a convoluted mess.

Rather than using the shebang at the begging of the PHP file I had to put it
in the cron command
"/usr/local/bin/php public_html/wap/mailer/dailylist.php"

It will now run.

But then I had to slightly redesign the HTMLMimeMail code. I had to define
some of it as functions and include the file as a function definition rather
than include the direct code. I also had to change my include statements to
this "include "public_html/wap/mailer/sending.php";" With this type of
include I can no longer run it from a browser, but I really didn't want to
do that anyways.

Thanks for all your help.

Andrew Darrow
Kronos1 Productions
www.pudlz.com


----- Original Message ----- 
From: "Miles Thompson" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; <[email protected]>
Sent: Saturday, July 30, 2005 5:57 PM
Subject: Re: [PHP] Running a PHP script everyday


>
> If you're on Windows, use Task Manager and have it start an instance of a
> web browser, with your URL and script passed to it.
> or
> Cron job on server, if you have that level of access.
>
> Miles
>
>
> At 01:17 PM 7/30/2005, [EMAIL PROTECTED] wrote:
> >I have a PHP script that I need to run once a day.  I have it currently
> >setup so that I just run it from my cell phone, but I would prefer
something
> >automated. I'd looked into a cron job, but that just looks like it's for
> >doing linux command line stuff on my host.
> >
> >I also thought about writing a never ending while loop with an if
statement
> >that checks to see if it's time to run the script, then when it is time,
it
> >runs. Then checks to see if it's time again.
> >
> >But even assuming I could get it working, do I really want to have a PHP
> >script that runs all the time. This could be bad if it ate up all the CPU
on
> >my server. I'm not even sure I have access rights to kill the process
once I
> >start it.
> >
> >Any suggestions?
> >
> >Andrew Darrow
> >Kronos1 Productions
> >www.pudlz.com
>
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
>
>
> -- 
> No virus found in this incoming message.
> Checked by AVG Anti-Virus.
> Version: 7.0.338 / Virus Database: 267.9.7/60 - Release Date: 7/28/2005
>
>

--- End Message ---
--- Begin Message ---
<[EMAIL PROTECTED]> writes:

> My host uses cPanel. When I setup the crontab it e-mails me back this
> response:
> 
> /bin/sh: public_html/wap/mailer/dailylist.php: /usr/bin/php
> : bad interpreter: No such file or directory
> 
> I'm assuming that it means it can't find "/user/bin/php"
> 
> I ran a "whereis php" through a cronjob and got this:

Try "which php" instead.  

Another option would be to put the php script in the  decomentroot of
your server.  Schedule a cron job on any of your desktop/dev machines
to wget that php script.  

-- 
Raj Shekhar                        
blog : http://rajshekhar.net/blog  home : http://rajshekhar.net
Disclaimer : http://rajshekhar.net/disclaimer 

--- End Message ---
--- Begin Message ---
"Liang ZHONG" <[EMAIL PROTECTED]> writes:

> If my php is configured as (
> http://liang.ns2user.info/php/info-train06.htm) an apache 2.0 filter
> module. The php is invoked by apache on request of http client. Can I
> do an exec() to call another php script to run in the background? If
> yes, how?
> 

This page might be of help http://in2.php.net/manual/en/ref.pcntl.php
Though I am quite sure there is an easier way to accomplish whatever
you are trying to do by running a background process


-- 
Raj Shekhar                        
blog : http://rajshekhar.net/blog  home : http://rajshekhar.net
Disclaimer : http://rajshekhar.net/disclaimer 

--- End Message ---
--- Begin Message ---
i'am developing  a web framework SifEngine (Secure Web Inteface
framework) that implement MVC applaying the security ideas from
http://phpsec.org. I'am using DomXML, Sqlite, Mcrypt and PostgreSql.

After  of post my development on the internet ( i have been thinking
to post on PEAR ), i made simple tests of aplications with my
framework. During the implementation, i used Slackware 10.1 with
kernel 2.4.29 + php5.0.4 + Apache 1.3.2, with no problems. I didn't
detect  performace problems or segfaults by apache.  Then i decided to
do the same test but with kernel 2.6.10, wating that no problems
occur. However my expectation, on this new configuration all the
aplications develped with my framework, had performance issues or in
the worst situation produce apache forks  to be restarted, or a lot of
apache forks.

i don't undestand why this occur, i try to use valigrand to verify
memorie lacks without results.

Someone can help me, with this problem !

On this moment i'm using SIfEngine, to implement my proyects only on
kernel 2.4.x !

Thanks !

Atte:
Edwin Hernan Barrios Nuñez
iBand Networks Ltda.
www.iband.net

--- End Message ---
--- Begin Message --- Actually, I meant what is an actual example of a link it will match. like <a href="something.htm">text</a> for example.

Chris Bruce wrote:
It matches any link with the exception of https links.

On Jul 20, 2005, at 3:36 PM, Ethilien wrote:

I don't see anything in this regex that would prevent https from being matched, since you don't specify the pattern of the actual url at all.

What is an example of a link that it will match?

Chris Bruce wrote:

Hello,
I am using the following to do link replacing:
preg_match_all("/<\s*a\s+[^>]*href\s*=\s*[\"']?([^\"' >]+)[\"' >]/isU",$file[$x],$matches); It works great for all but 'https' links. I am not that versed in regular expressions. Would anyone know what I need to put in there so that it will match on https links?
Thanks,
Chris

--- End Message ---
--- Begin Message ---
I don't recognize this something(__SOMETHING__) format. I know what it's
doing but I don't know how it's doing it.

The whole thing is "$fdf_dir=dirname(__FILE__).'/results';" and of course
it's setting that var $fdf_dir to the path to a file.

Is there something significant about the double underscores "__"?

Why the parentheses, it's not a function?

Sorry lame question but I don't know this.

Thanks 

--- End Message ---
--- Begin Message ---
On Sun, 2005-07-31 at 20:04, Sam Smith wrote:
> I don't recognize this something(__SOMETHING__) format. I know what it's
> doing but I don't know how it's doing it.

Constants of the type __SOMETHING__ are historical constants for
retrieving contextual information about the source code in which the
constant is found. For instance __FILE__ indicates the name of the
source file in which the __FILE__ constant is found. This nomenclature
dates back to at least C and is probably kept for historical reasons
since everyone knows C is da bomb!

> The whole thing is "$fdf_dir=dirname(__FILE__).'/results';" and of course
> it's setting that var $fdf_dir to the path to a file.

This means it's setting $fdf_dir to the path to a file called "results"
that is in the same directory as the source file containing __FILE__.

> Is there something significant about the double underscores "__"?

Yep as stated above :) There are numberous such constants such as
__LINE__ to retrieve the current source code line number (very useful
for debugging at times), __CLASS__, __FUNCTION__ etc.

> Why the parentheses, it's not a function?

dirname() is a function.

> Sorry lame question but I don't know this.

RTFM ;)

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 ---
Quoting Jim Moseby <[EMAIL PROTECTED]>:

> I'd repost the link for you, but I've already deleted it.  Sorry. Look back 
> through the archives.
> 
> JM
> 

I searched for 'Jim Moseby calendar' in the general and Dev mailing list but no 
go. Anty clue?

--
Roger




---------------------------------------------------
Sign Up for free Email at http://ureg.home.net.my/
---------------------------------------------------

--- End Message ---

Reply via email to