php-general Digest 30 Jul 2005 12:17:02 -0000 Issue 3596

Topics (messages 219647 through 219669):

Automated Numerical Filenames for Directory
        219647 by: Smittie
        219659 by: Smittie
        219664 by: Kevin Waterson

Re: PHP code in a MySQL record
        219648 by: André Medeiros

How to generate MD5 passwords
        219649 by: Michelle Konzack
        219650 by: Martin B. Nielsen
        219667 by: Michelle Konzack

exec nor shell_exec not doing as expected.
        219651 by: leonski

exec / shell_exec issues
        219652 by: leonski
        219653 by: Robert Cummings
        219654 by: leonski
        219655 by: Jason Wong
        219656 by: leonski
        219657 by: Robert Cummings
        219658 by: leonski
        219660 by: Jason Wong
        219661 by: Robert Cummings
        219662 by: leonski
        219663 by: leonski

Re: PHP noobie
        219665 by: Bob Stia

Do I need to recompile Apache2 "--with-apxs" for PayPal PHP SDK?
        219666 by: John Hicks

Re: Dropdown Building Function
        219668 by: Satyam

error checking woes
        219669 by: Jack Jackson

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 ---
Hi everybody

Have this headache and hope there is someone that can help:

I need to generate numerical filenames in a directory, first filename being
20001.php

The next filename should be 20002.php etc.- no problem and easy enough

BUT, if you have files in the directory ;

20001.php
20002.php
20003.php
20004.php
20005.php

and you delete 20002.php, then the nexttime a new file is generated it
should be 20002.php and not 20006.php

Any ideas?

Thanks

Smittie






--- End Message ---
--- Begin Message ---
Okay - figured it out and have it working now

Thanks

----- Original Message -----
From: "Smittie" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: 28 July 2005 10:29
Subject: Automated Numerical Filenames for Directory


> Hi everybody
>
> Have this headache and hope there is someone that can help:
>
> I need to generate numerical filenames in a directory, first filename
being
> 20001.php
>
> The next filename should be 20002.php etc.- no problem and easy enough
>
> BUT, if you have files in the directory ;
>
> 20001.php
> 20002.php
> 20003.php
> 20004.php
> 20005.php
>
> and you delete 20002.php, then the nexttime a new file is generated it
> should be 20002.php and not 20006.php
>
> Any ideas?
>
> Thanks
>
> Smittie
>
>
>
>
>
>

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

> Okay - figured it out and have it working now

What was your solution?

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 ---
Either what Kris says, or you can use a templating engine.

See Smarty (http://smarty.php.net)

On 7/29/05, Kristen G. Thorson <[EMAIL PROTECTED]> wrote:
> Is there a particular reason you need *PHP* in the database?  If not,
> then use a placeholder system of some sort ( like #var# ) and str_replace():
> 
> while( $row=mysql_fetch_row($result) ) {
>     echo str_replace( '#var#', $that_var, $row['entry'] );
> }
> 
> 
> 
> kgt
> 
> 
> 
> 
> Nathaniel Hall wrote:
> 
> >I am working on a project that uses an index.php page.  Depending on the
> >variable in the URL, a different php page is included.  I have a
> >config.php that contains variables that are accessible from any page.
> >That is the easy part.
> >
> >I have some pages pulling HTML out of a database. I would like to be
> >able to reference some of the variables in the config.php in the
> >database blob field.  Here is an example:
> >
> >[EMAIL PROTECTED]
> >------
> ><html><head>...etc
> ><?php
> >       include 'config.php';
> >       if (blabla) {
> >               include "thispage.php";
> >       } else {
> >               include "thatpage.php";
> >       }
> >?>
> >
> >config.php
> >------
> ><?php
> >       $this_var=1;
> >       $that_var="Nothing";
> >?>
> >
> >test.php
> >------
> ><?php
> >       $query="SELECT * from table";
> >       $result=mysql_query($query) or die ("Cannot process query");
> >       $row=mysql_fetch_row($result);
> >       echo $row[1];
> >?>
> >
> >MySQL record:
> >------
> >id,year,month,day,entry
> >
> >1,2005,01,01,This is a test<br><? echo $that_var; ?>
> >
> >_____________________________
> >I have tried using <br>&gt;? echo $that_var; ?&lt; and I have tried
> >escaping everything, but that still didn't work.  Any ideas?
> >
> >Nathaniel Hall
> >[EMAIL PROTECTED]
> >
> >
> >
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
>

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

I like to generate md5 password but I have not found a command
or something like this to generate it.  Curently I am using

    $PASSMD5=exec("echo $PASSCLEAR" |md5sum")

Is there a better way ?

Greetings
Michelle

-- 
Linux-User #280138 with the Linux Counter, http://counter.li.org/
Michelle Konzack   Apt. 917                  ICQ #328449886
                   50, rue de Soultz         MSM LinuxMichi
0033/3/88452356    67100 Strasbourg/France   IRC #Debian (irc.icq.com)

Attachment: signature.pgp
Description: Digital signature


--- End Message ---
--- Begin Message ---
Are you maybe looking for something like this:

<?
$passwords = "test";
$pass = md5($passwords);
echo $pass;
?>

The above will output: 098f6bcd4621d373cade4e832627b4f6 as MD5 hash value.
For more info, http://se2.php.net/manual/en/function.md5.php

Best regards,
Martin

-----Original Message-----
From: Michelle Konzack [mailto:[EMAIL PROTECTED] 
Sent: 30. juli 2005 03:03
To: php-general
Subject: [PHP] How to generate MD5 passwords

Hello *,

I like to generate md5 password but I have not found a command
or something like this to generate it.  Curently I am using

    $PASSMD5=exec("echo $PASSCLEAR" |md5sum")

Is there a better way ?

Greetings
Michelle

-- 
Linux-User #280138 with the Linux Counter, http://counter.li.org/
Michelle Konzack   Apt. 917                  ICQ #328449886
                   50, rue de Soultz         MSM LinuxMichi
0033/3/88452356    67100 Strasbourg/France   IRC #Debian (irc.icq.com)

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

Am 2005-07-30 03:14:35, schrieb Martin B. Nielsen:
> Are you maybe looking for something like this:
> 
> <?
> $passwords = "test";
> $pass = md5($passwords);
          ^^^^^^^^^^^^^^^
        I was missing this.
> echo $pass;
> ?>
> 
> The above will output: 098f6bcd4621d373cade4e832627b4f6 as MD5 hash value.
> For more info, http://se2.php.net/manual/en/function.md5.php

It is exactly what I was searchin for.

> Best regards,
> Martin

Thanks and nice Weekend
Michelle

-- 
Linux-User #280138 with the Linux Counter, http://counter.li.org/
Michelle Konzack   Apt. 917                  ICQ #328449886
                   50, rue de Soultz         MSM LinuxMichi
0033/3/88452356    67100 Strasbourg/France   IRC #Debian (irc.icq.com)

Attachment: signature.pgp
Description: Digital signature


--- End Message ---
--- Begin Message ---
Greetings.

I've practically worn my eyeballs out trying to figure out a problem and in desperation am posting here in the hope for familiar eyes to guide me, so thanks in advance.

check out this code section:

if (file_exists($imagefile)) {
$execstring = escapeshellarg("/usr/local/bin/mogrify ".$imagefile." -resize 95x72! ");
    }
    else echo ("sorry there was a problem with that file");
// then....2>&1 is assisting the debug
$op = shell_exec($execstring.' 2>&1');
    echo $op;

pretty simple - uses the ImageMagick: mogrify. Funny enough it doesn't work. The output is:

sh: line 1: /usr/local/bin/mogrify /tmp/phpS1KCen -resize 320x240! : No such file or directory sh: line 1: /usr/local/bin/mogrify /tmp/phpS1KCen -resize 95x72! : No such file or directory

beats me how it gets inside the if, if it doesn't exist!

I have also tried ImageMagick:convert executable with a generated tempfile using tempnam() and the file is created in /tmp as expected, but is not filled by the convert - it stays empty, fails and doesn't get cleaned up.

I cannot give a link to php.ini as its not on a public server. But Safe mode is Off, file size limits are OK as $imagefile can be displayed to the screen prior to the shell_exec call.

I also tried using GD instead of ImageMagick and could not get imagecreatetruecolor to work either.

OS is OS X on my laptop, entropy build of PHP as "Apache/1.3.29 (Darwin) PHP/5.0.4"

I really do not know if this is a PHP, Apache or OS issue. Permissions are not it, I'm sure, and the user is www quite capable of writing into and reading from tmp, so there is no issue there.

If anybody can tell me what *anything* about this problem, I'd be greatful.

leonski.

--- End Message ---
--- Begin Message ---
Greetings.

I've practically worn my eyeballs out trying to figure out a problem and in desperation am posting here in the hope for familiar eyes to guide me, so thanks in advance.

check out this code section:

if (file_exists($imagefile)) {
$execstring = escapeshellarg("/usr/local/bin/mogrify ".$imagefile." -resize 95x72! ");
    }
    else echo ("sorry there was a problem with that file");
// then....2>&1 is assisting the debug
$op = shell_exec($execstring.' 2>&1');
    echo $op;

pretty simple - uses the ImageMagick: mogrify. Funny enough it doesn't work. The output is:

sh: line 1: /usr/local/bin/mogrify /tmp/phpS1KCen -resize 320x240! : No such file or directory sh: line 1: /usr/local/bin/mogrify /tmp/phpS1KCen -resize 95x72! : No such file or directory

beats me how it gets inside the if, if it doesn't exist!

I have also tried ImageMagick:convert executable with a generated tempfile using tempnam() and the file is created in /tmp as expected, but is not filled by the convert - it stays empty, fails and doesn't get cleaned up.

I cannot give a link to php.ini as its not on a public server. But Safe mode is Off, file size limits are OK as $imagefile can be displayed to the screen prior to the shell_exec call.

I also tried using GD instead of ImageMagick and could not get imagecreatetruecolor to work either.

OS is OS X on my laptop, entropy build of PHP as "Apache/1.3.29 (Darwin) PHP/5.0.4"

I really do not know if this is a PHP, Apache or OS issue. Permissions are not it, I'm sure, and the user is www quite capable of writing into and reading from tmp, so there is no issue there.

If anybody can tell me what *anything* about this problem, I'd be greatful.

leonski.

--- End Message ---
--- Begin Message ---
On Fri, 2005-07-29 at 20:49, leonski wrote:
> Greetings.
> 
> I've practically worn my eyeballs out trying to figure out a problem and 
> in desperation am posting here in the hope for familiar eyes to guide 
> me, so thanks in advance.
> 
> check out this code section:
> 
> if (file_exists($imagefile)) {
>      $execstring = escapeshellarg("/usr/local/bin/mogrify ".$imagefile." 

Ummm, looks to me like your escaping the entire command instead of just
individual arguments. Check if that's your problem.

Cheers,
Rob.

> -resize 95x72! ");
>      }
>      else echo ("sorry there was a problem with that file");
> // then....2>&1 is assisting the debug
> $op = shell_exec($execstring.' 2>&1');
>      echo $op;
> 
> pretty simple - uses the ImageMagick: mogrify. Funny enough it doesn't 
> work. The output is:
> 
>   sh: line 1: /usr/local/bin/mogrify /tmp/phpS1KCen -resize 320x240! : 
> No such file or directory sh: line 1: /usr/local/bin/mogrify 
> /tmp/phpS1KCen -resize 95x72! : No such file or directory
> 
> beats me how it gets inside the if, if it doesn't exist!
> 
> I have also tried ImageMagick:convert executable with a generated 
> tempfile using tempnam() and the file is created in /tmp as expected, 
> but is not filled by the convert - it stays empty, fails and doesn't get 
>   cleaned up.
> 
> I cannot give a link to php.ini as its not on a public server. But Safe 
> mode is Off, file size limits are OK as $imagefile can be displayed to 
> the screen prior to the shell_exec call.
> 
> I also tried using GD instead of ImageMagick and could not get 
> imagecreatetruecolor to work either.
> 
> OS is OS X on my laptop, entropy build of PHP as "Apache/1.3.29 (Darwin) 
> PHP/5.0.4"
> 
> I really do not know if this is a PHP, Apache or OS issue. Permissions 
> are not it, I'm sure, and the user is www quite capable of writing into 
> and reading from tmp, so there is no issue there.
> 
> If anybody can tell me what *anything* about this problem, I'd be greatful.
> 
> leonski.
-- 
.------------------------------------------------------------.
| 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 ---
Robert Cummings wrote:
On Fri, 2005-07-29 at 20:49, leonski wrote:

Greetings.

I've practically worn my eyeballs out trying to figure out a problem and in desperation am posting here in the hope for familiar eyes to guide me, so thanks in advance.

check out this code section:

if (file_exists($imagefile)) {
$execstring = escapeshellarg("/usr/local/bin/mogrify ".$imagefile."


Ummm, looks to me like your escaping the entire command instead of just
individual arguments. Check if that's your problem.

Cheers,
Rob.

I'm getting the same result whether escapeshellarg is there or not :-(

I am a bit suspect that I've missed a compile time directive, as I used a pre-compiled version of Marc Liyanage (what a dude btw). Maybe the --bindir directive?

I just don't know enough about it and am having trouble finding docs on it - any more ideas Robert?

Thanks.
leonski.

--- End Message ---
--- Begin Message ---
On Saturday 30 July 2005 08:49, leonski wrote:

>   sh: line 1: /usr/local/bin/mogrify /tmp/phpS1KCen -resize 320x240! :
> No such file or directory sh: line 1: /usr/local/bin/mogrify
> /tmp/phpS1KCen -resize 95x72! : No such file or directory
>
> beats me how it gets inside the if, if it doesn't exist!

I think the error message is trying to tell you that 
"/usr/local/bin/mogrify" does not exist.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
New Year Resolution: Ignore top posted posts

--- End Message ---
--- Begin Message ---
Jason Wong wrote:
On Saturday 30 July 2005 08:49, leonski wrote:


 sh: line 1: /usr/local/bin/mogrify /tmp/phpS1KCen -resize 320x240! :
No such file or directory sh: line 1: /usr/local/bin/mogrify
/tmp/phpS1KCen -resize 95x72! : No such file or directory

beats me how it gets inside the if, if it doesn't exist!


I think the error message is trying to tell you that "/usr/local/bin/mogrify" does not exist.

:-( yeah it does and it works under the terminal (nicely I might add, thanks ImageMagick).
leonski.

--- End Message ---
--- Begin Message ---
On Fri, 2005-07-29 at 22:17, leonski wrote:
> Jason Wong wrote:
> > On Saturday 30 July 2005 08:49, leonski wrote:
> > 
> > 
> >>  sh: line 1: /usr/local/bin/mogrify /tmp/phpS1KCen -resize 320x240! :
> >>No such file or directory sh: line 1: /usr/local/bin/mogrify
> >>/tmp/phpS1KCen -resize 95x72! : No such file or directory
> >>
> >>beats me how it gets inside the if, if it doesn't exist!
> > 
> > 
> > I think the error message is trying to tell you that 
> > "/usr/local/bin/mogrify" does not exist.
> > 
> :-( yeah it does and it works under the terminal (nicely I might add, 
> thanks ImageMagick).
> leonski.

Because you've used escapeshellargs() (or whatever it is) it's probably
treating the entire parameter to exec() (excluding the string
concatenation for output redirection) as the command to execute. I know
you said  you tried it otherwise but try the following:

if( file_exists( $imagefile ) )
{
    $arg = escapeshellarg( $imagefile );
    exec( "/usr/local/bin/mogrify $arg -resize 95x72 ");
}

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 ---
Robert Cummings wrote:
On Fri, 2005-07-29 at 22:17, leonski wrote:

Jason Wong wrote:

On Saturday 30 July 2005 08:49, leonski wrote:



sh: line 1: /usr/local/bin/mogrify /tmp/phpS1KCen -resize 320x240! :
No such file or directory sh: line 1: /usr/local/bin/mogrify
/tmp/phpS1KCen -resize 95x72! : No such file or directory

beats me how it gets inside the if, if it doesn't exist!


I think the error message is trying to tell you that "/usr/local/bin/mogrify" does not exist.


:-( yeah it does and it works under the terminal (nicely I might add, thanks ImageMagick).
leonski.


Because you've used escapeshellargs() (or whatever it is) it's probably
treating the entire parameter to exec() (excluding the string
concatenation for output redirection) as the command to execute. I know
you said  you tried it otherwise but try the following:

if( file_exists( $imagefile ) )
{
    $arg = escapeshellarg( $imagefile );
    exec( "/usr/local/bin/mogrify $arg -resize 95x72 ");
}

Cheers,
Rob.

did:

if( file_exists( $imagefile ) )
            {
                $arg = escapeshellarg( $imagefile );
                echo $str= "/usr/local/bin/mogrify $arg -resize 95x72 ";
                exec($str);
            }

added a line so I could see the string....

got:

/usr/local/bin/mogrify '/tmp/phpPdCiGS' -resize 95x72
Warning: fopen('/tmp/phpPdCiGS') [function.fopen]: failed to open stream: No such file or directory in /Library/WebServer/Documents/build2/admin/classes/class_upload.php on line 254

so again - how does it get past the file_exists if it doesn't?!!!

keep it coming Robert....;-)

leonski.

--- End Message ---
--- Begin Message ---
On Saturday 30 July 2005 10:17, leonski wrote:
> Jason Wong wrote:
> > On Saturday 30 July 2005 08:49, leonski wrote:
> >>  sh: line 1: /usr/local/bin/mogrify /tmp/phpS1KCen -resize 320x240!
> >> : No such file or directory sh: line 1: /usr/local/bin/mogrify
> >> /tmp/phpS1KCen -resize 95x72! : No such file or directory
> >>
> >>beats me how it gets inside the if, if it doesn't exist!
> >
> > I think the error message is trying to tell you that
> > "/usr/local/bin/mogrify" does not exist.
> >
> :-( yeah it does and it works under the terminal (nicely I might add,

That error certainly does not come from mogrify. Just perform these simple 
tests:

1) /usr/local/bin/command-that-does-not-exist

2) mogrify file-that-does-not-exist; #assume mogrify in $PATH

As Robert has pointed out, it is probably telling you that the file 
"/usr/local/bin/mogrify /tmp/phpS1KCen -resize 320x240!" does not exist.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
New Year Resolution: Ignore top posted posts

--- End Message ---
--- Begin Message ---
On Fri, 2005-07-29 at 22:45, leonski wrote:
> Robert Cummings wrote:
> > On Fri, 2005-07-29 at 22:17, leonski wrote:
> > 
> >>Jason Wong wrote:
> >>
> >>>On Saturday 30 July 2005 08:49, leonski wrote:
> >>>
> >>>
> >>>
> >>>> sh: line 1: /usr/local/bin/mogrify /tmp/phpS1KCen -resize 320x240! :
> >>>>No such file or directory sh: line 1: /usr/local/bin/mogrify
> >>>>/tmp/phpS1KCen -resize 95x72! : No such file or directory
> >>>>
> >>>>beats me how it gets inside the if, if it doesn't exist!
> >>>
> >>>
> >>>I think the error message is trying to tell you that 
> >>>"/usr/local/bin/mogrify" does not exist.
> >>>
> >>
> >>:-( yeah it does and it works under the terminal (nicely I might add, 
> >>thanks ImageMagick).
> >>leonski.
> > 
> > 
> > Because you've used escapeshellargs() (or whatever it is) it's probably
> > treating the entire parameter to exec() (excluding the string
> > concatenation for output redirection) as the command to execute. I know
> > you said  you tried it otherwise but try the following:
> > 
> > if( file_exists( $imagefile ) )
> > {
> >     $arg = escapeshellarg( $imagefile );
> >     exec( "/usr/local/bin/mogrify $arg -resize 95x72 ");
> > }
> > 
> > Cheers,
> > Rob.
> 
> did:
>
> if( file_exists( $imagefile ) )
>              {
>                  $arg = escapeshellarg( $imagefile );
>                  echo $str= "/usr/local/bin/mogrify $arg -resize 95x72 ";
>                  exec($str);
>              }
> 
> added a line so I could see the string....
> 
> got:
> 
> /usr/local/bin/mogrify '/tmp/phpPdCiGS' -resize 95x72
> Warning: fopen('/tmp/phpPdCiGS') [function.fopen]: failed to open 
> stream: No such file or directory in 
> /Library/WebServer/Documents/build2/admin/classes/class_upload.php on 
> line 254
> 
> so again - how does it get past the file_exists if it doesn't?!!!
> 
> keep it coming Robert....;-)

Aaaaah, but the above error is a completely different error than you
were posting previously, so we've moved past the first error which was
as I suspected.

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 --- WAIT - DISREGARD THAT LAST POST - I forgot to // some other debug lines - the output is inconsistent with what I was testing (Robert's code) - I'll do better.....


leonski wrote:
Robert Cummings wrote:

On Fri, 2005-07-29 at 22:17, leonski wrote:

Jason Wong wrote:

On Saturday 30 July 2005 08:49, leonski wrote:



sh: line 1: /usr/local/bin/mogrify /tmp/phpS1KCen -resize 320x240! :
No such file or directory sh: line 1: /usr/local/bin/mogrify
/tmp/phpS1KCen -resize 95x72! : No such file or directory

beats me how it gets inside the if, if it doesn't exist!



I think the error message is trying to tell you that "/usr/local/bin/mogrify" does not exist.


:-( yeah it does and it works under the terminal (nicely I might add, thanks ImageMagick).
leonski.



Because you've used escapeshellargs() (or whatever it is) it's probably
treating the entire parameter to exec() (excluding the string
concatenation for output redirection) as the command to execute. I know
you said  you tried it otherwise but try the following:

if( file_exists( $imagefile ) )
{
    $arg = escapeshellarg( $imagefile );
    exec( "/usr/local/bin/mogrify $arg -resize 95x72 ");
}

Cheers,
Rob.


did:

if( file_exists( $imagefile ) )
            {
                $arg = escapeshellarg( $imagefile );
                echo $str= "/usr/local/bin/mogrify $arg -resize 95x72 ";
                exec($str);
            }

added a line so I could see the string....

got:

/usr/local/bin/mogrify '/tmp/phpPdCiGS' -resize 95x72
Warning: fopen('/tmp/phpPdCiGS') [function.fopen]: failed to open stream: No such file or directory in /Library/WebServer/Documents/build2/admin/classes/class_upload.php on line 254

so again - how does it get past the file_exists if it doesn't?!!!

keep it coming Robert....;-)

leonski.

--- End Message ---
--- Begin Message ---
Robert Cummings wrote:
On Fri, 2005-07-29 at 22:45, leonski wrote:

Robert Cummings wrote:

On Fri, 2005-07-29 at 22:17, leonski wrote:


Jason Wong wrote:


On Saturday 30 July 2005 08:49, leonski wrote:




sh: line 1: /usr/local/bin/mogrify /tmp/phpS1KCen -resize 320x240! :
No such file or directory sh: line 1: /usr/local/bin/mogrify
/tmp/phpS1KCen -resize 95x72! : No such file or directory

beats me how it gets inside the if, if it doesn't exist!


I think the error message is trying to tell you that "/usr/local/bin/mogrify" does not exist.


:-( yeah it does and it works under the terminal (nicely I might add, thanks ImageMagick).
leonski.


Because you've used escapeshellargs() (or whatever it is) it's probably
treating the entire parameter to exec() (excluding the string
concatenation for output redirection) as the command to execute. I know
you said  you tried it otherwise but try the following:

if( file_exists( $imagefile ) )
{
   $arg = escapeshellarg( $imagefile );
   exec( "/usr/local/bin/mogrify $arg -resize 95x72 ");
}

Cheers,
Rob.

did:

if( file_exists( $imagefile ) )
            {
                $arg = escapeshellarg( $imagefile );
                echo $str= "/usr/local/bin/mogrify $arg -resize 95x72 ";
                exec($str);
            }

added a line so I could see the string....

got:

/usr/local/bin/mogrify '/tmp/phpPdCiGS' -resize 95x72
Warning: fopen('/tmp/phpPdCiGS') [function.fopen]: failed to open stream: No such file or directory in /Library/WebServer/Documents/build2/admin/classes/class_upload.php on line 254

so again - how does it get past the file_exists if it doesn't?!!!

keep it coming Robert....;-)


Aaaaah, but the above error is a completely different error than you
were posting previously, so we've moved past the first error which was
as I suspected.

Cheers,
Rob.
Indeed you are very right - it seems mogrify is working, but I'm stuffing up something else.....

I've just tried this using convert instead of mogrify so I can interject and grab the image as its being written to /tmp. - I checked out what Jason was saying too and he is also very right - the errors were obviously not mogrify errors (der! on my part).

Turns out now it WORKS (since I'm escaping correctly now)!!!!

My eyball sockets thank you both. In a great Aussie tradition I'd buy you a beer or three if you were here!
Could also substitute coffee, pepsi max etc depending on preferred poison.

Thanks soooooo much.

I only hope to be able to spot these issues as rapidly as you guys and give back to the community too.

Cheers,
leonski.

--- End Message ---
--- Begin Message ---
On Friday 29 July 2005 02:55, Jochem Maas wrote:
> Bob Stia wrote:
> > Hello PHP list
> >
> > First allow me to apologize if this is the wrong place for this and
> > direct me to the proper place. (be nice now!)
>
> this list is really for people who are programmning in php.
> as you describe it your looking for a php solution as an end user,
> so no this is not really the right place - although I couldn't
> really say where you would be better off.

......<snip much>...........
>
Hello PHP people,

First of all let me thank all of the kind people who replied to my call 
for help and intruded into your domain, and there were many of you. It 
is much appreciated. I scrutinized all of your replies and have gained 
some knowledge from your replies.

Some of you have offered help privately and I may well call upon your 
expertise. May I reserve the right to return to this list with a few 
questions???

Thanks again,
Bob S.

  

--- End Message ---
--- Begin Message ---
I'm trying to install and configure PayPal Website Payments Pro using
the PayPal PHP SDK.

The first step in the SDK Quickstart instructions is:
Enable Apache modules and APXS (Apache Extension Tool)
In your Apache root directory, run:
../configure ?enable-mod=so --with-apxs /usr/local/apache/bin/apxs (sic)

I think of the  ./configure directive as a precursor to compiling with
"make," yet there is no mention made of running "make".

I'm running RHEL 4.1 with Apache 2 precompiled. I can see that modules
are enabled, but I'm guessing it wasn't compiled with apxs since I
just installed apxs 10 minutes ago. (FWIW, it's part of the
httpd-devel package.)

But, then, when I search the Apache site, I see no mention of a
"--with-apxs" directive for Apache 2 (only for Apache 1.3). So I'm
thinking the instructions may be a little off. Is there such a
directive for Apache 2?

So I'm wondering if this step is really necessary. I hate to futz with
a perfectly fine Red Hat installation if it isn't.

Does anyone know how PayPal uses apxs? Does it actually build its own
module to be loaded into apache? If I proceed without recompiling
Apache, how will I be able to tell if my existing installation of
Apache is inadequate?

Any help would be appreciated. Thanks.

--- End Message ---
--- Begin Message ---
"Jack Jackson" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Aaron,
> Thanks for showing me this it is very cool indeed.
>
> However maybe I am being dumb and obdurate but what I am really trying to 
> do is build some of these things myself (with, thankfully, help)


Perhaps this can help.  I'm sorry the doc is in Spanish, but the code is not 
so large.

There are two funtions, one to load the data for a dropdown list 
(CargaCombo) and the other to show it.  The reason for this is that a single 
combo might be used in two or more places within a web page so this allow 
for reusability, plus it allows for the display of combos not generated from 
the database but from a plain handcoded  array, such as a list of month 
names.

CargaCombo expects an SQL statement.  It will assume the first field is the 
key of the dropdown box.  It will then concatenate every field from the 
second to whichever to make the description.

MuestraCombo will display the dropdown from an array.  It will assume the 
key of the array to be the value attribute of the <option> tag and the value 
of the array to be the description.  The first parameter is the name of the 
<select> tag, the third the key value of the item to be pre-selected and the 
fourth an array of events for the object.  This last one has to be in the 
form of  eventName  => action.

For example:

MuestraCombo('SomeName', array(0=>'No',1=>'Yes'),1,array('onClick' => 
'doSomething();'));


Satyam



/**
 *  Esta función devuelve un array que se puede usar en [EMAIL PROTECTED] 
MuestraCombo 
MuestraCombo} para mostrar un combobox.
 *
 *  La función toma una instrucción de SQL y con ella arma un array donde el 
primer campo que encuentra lo usa como
 *  clave dentro del array y los campos subsiguientes como valor.  Si 
hubiera más de dos campos, concatenará los valores
 *  de los campos desde el segundo en adelante separándolos con barra 
vertical para asignar como valor a la clave dada
 *  por el primer campo. Usualmente se usa con una tabla del tipo Codigo ==> 
Descripción
 *
 *  @param string $sql Instrucción de selección de SQL, debe proveer al 
menos dos campos.
 *  @return array Array con una entrada por registro obtenido, usando el 
campo 0 como clave y los subsiguientes como valor
 */
function &CargaCombo($sql){
     $result = mysql_query($sql) or die ('Error en la consulta: ' . 
mysql_error() . "\r\n<br>$sql");
     while ($line = mysql_fetch_row($result)){
         $s = '';
         for ($i = 1;$i < mysql_num_fields($result);$i++) $s .= ' | ' . 
$line[$i];
         $combo[$line[0]] = substr($s, 3);
         }

     return $combo;
     mysql_free_result($result);
    }
/**
 *  Emite el código HTML correspondiente a un ComboBox usando el array que 
se indica.
 *
 *  El array puede haber sido obtenido mediante
 *  [EMAIL PROTECTED] CargaCombo CargaCombo}, o generado por otro medio.
 *  Por cada item del array emitirá un <samp>&lt;option&gt;</samp> con 
<samp>value</samp> igual a la clave y el texto
 *  a mostrar igual al valor correspondiente a esa clave.
 *
 *  @param string $Nombre Nombre que se le dará al control
 *  @param array $Combo Array donde aparecen los valores a mostrar
 *  @param mixed $Default Clave del item que deberá aparecer seleccionado 
inicialmente
 *  @param array $Eventos Array de acciones por eventos a ser asignadas a 
este control.
 *   El array debe estar estructurado con el nombre del evento como clave y 
la acción asociada como dato.
 */

function MuestraCombo($Nombre, $Combo, $Default = null, $Eventos = null){
     echo '<Select size=1 name="' , $Nombre ,'"';
     if ($Eventos){
         foreach($Eventos as $OnEvent => $Funcion){
             echo ' ',  $OnEvent, '="', $Funcion , '"';
             }
         }
     echo '>', CRLF;

     foreach ($Combo as $key => $value){
         echo '<Option value="'
    , htmlentities($key)
   , '"';
         If ($key == $Default Or (Is_Null($key) And Is_Null($Default))) echo 
' selected ';
         echo '>', $value , '</option>', CRLF;
         }
     echo '</Select>',CRLF;
    } 

--- End Message ---
--- Begin Message ---
Hi,
Now that the drop down is working properly (thanks!!), I am trying to validate, and having LOTS of trouble. After being ceaselessly derided last night on an irc channel for my dimwitedness, I am still not any closer.

The code which works is this:

function GetQuestionsDropdown($cat){
//first get all the questions

$sql = "SELECT * FROM questions WHERE questions.q_cat=$cat AND questions.q_style=1";

$result = mysql_query($sql);
        //now one-by-one go through the questions
        while($row = mysql_fetch_assoc($result)) {
                
                //if the form has been submitted, and the question unanswered
                //highlight this whole question and answer block in red.
                if ($message[$row['q_name']] == 1){
                        echo "<div class='error'>";
                        }
                
                //Make a question set div wrapper
                echo "<div class='q_set'>\n";
                //State the question
                echo "<div class='question'>";
                echo $row['q_text'] . "</div>";
                echo "\n\n";
                echo " <div class='answer'>";
                echo "\n";
                
                //Create the dropdown for the answers
                echo '  <select name="' . $row['q_name'] . '">';
                echo "\n";
                
                //get all of the answers for THIS question
        $ans_sql = "select * from answers where answers.q_id=" . $row['q_id'];
        $ans_result = mysql_query($ans_sql);

                echo "    <option value=\"\">Select from this list</option>\n";
        while($ans_row = mysql_fetch_assoc($ans_result)) {
                
                //list the answers for THIS question
                echo "    <option ";
                echo "value=\"" . $ans_row['a_id'] . "\"";

                if  ($row['q_name'] == $ans_row['a_id']) {
                        echo " selected";
                        }

                echo ">" . $ans_row['a_answer'] . "</option>";
                echo "\n";
                }
                echo '  </select>' . "\n" . ' </div>' . "\n";
                echo "</div><!--q_set-->\n\n";
                //If there *was* an error div, close it
                if (sizeof($message[$row['q_name']])){
                        echo "</div><!--/error-->";
                        }
        }
    }//function GetQuestionsDropdown


NOW I have to validate after it's submitted. I am trying to look and see, if $_POST[$row['q_name']] is empty then make message of the same name = 1, so if

   if(empty($_POST['partners'])) {
       $message['partners'] = '1'
}

Then when I restate the dropdown function, and it shows the questions again, those error checking things I built in will
        a) show a div class=error around questions with a message
b) pre-select the previously selected answers (because I have put in the thing in the dropdown which says

 if ($row['q_name'] == $ans_row['a_id']) { echo " selected";}


The validate code I was trying, the subject of such howling on IRC (and I know it doesn't work, but not why) was:

function ValidatePost($cat){
        //first get the q_names
$sql = "SELECT * FROM questions WHERE q_cat=$cat";
$result = mysql_query($sql);

//go through the question set
        while($row = mysql_fetch_assoc($result)) {
        
          if(empty($_POST[$row['q_name']])){
        
          $message[$row['q_name']] == "1";
          }
        }
}//function ValidatePost

Can anyone tell me what I am doing wrong?

Thanks!
JJ

--- End Message ---

Reply via email to