php-general Digest 8 Jun 2003 16:02:27 -0000 Issue 2105

Topics (messages 150628 through 150672):

thumbnail program
        150628 by: Artoo
        150630 by: Philip Olson
        150631 by: John W. Holmes
        150634 by: Artoo
        150637 by: Philip Olson

Re: fsockopen and SSL
        150629 by: Philip Olson

Re: file upload script
        150632 by: Philip Olson

XML Parser Problem
        150633 by: Dustin Pate
        150635 by: Philip Olson
        150639 by: Dustin Pate

help with php_pdf?
        150636 by: Pawl Rachet

Re: Using register_globals
        150638 by: Don Read
        150640 by: Philip Olson
        150653 by: Don Read
        150655 by: Philip Olson

HARDWARE ID WITH PHP
        150641 by: nabil

popen() in 4.3.2
        150642 by: Jeff Harris
        150643 by: Philip Olson
        150645 by: Jeff Harris

Re: TIMESTAMP -> Y-m-d
        150644 by: Don Read

Re: Newman's Problem with Images.
        150646 by: Don Read

FILE UPLOAD Q
        150647 by: nabil
        150648 by: Philip Olson

remote file moddatetime
        150649 by: Warren Vail

Newman Asks, Changeing to CAPS?
        150650 by: Philip J. Newman

Re: Newman Isn't trying very hard
        150651 by: Jean-Christian Imbeault
        150652 by: Jean-Christian Imbeault

Checking for Valid Charactors.
        150654 by: Philip J. Newman
        150657 by: Jason Wong
        150659 by: Philip J. Newman
        150670 by: John W. Holmes

SESSION ISSUES
        150656 by: Dale
        150658 by: Jason k Larson
        150671 by: John W. Holmes

A Question with heredoc
        150660 by: Simon Coggins

project users manual howto
        150661 by: daniel.electroteque.org
        150664 by: Armand Turpel

HELP PLEASE
        150662 by: nabil

Re: PATH_TRANSLATED
        150663 by: Øystein Håland

Re: use print
        150665 by: ãÖÑ
        150667 by: Jean-Christian Imbeault

Linux question with mysql
        150666 by: AzFLSite
        150668 by: Jean-Christian Imbeault

Re: Sorry, I cannot run apxs
        150669 by: Pentothal

Re: How to determine if output buffering is on?
        150672 by: Shawn McKenzie

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 ---
Anyone know of a good free thumbnail program that can be called from a PHP
script using the exec() call or something similar?

Thanks



--- End Message ---
--- Begin Message ---
On Sat, 7 Jun 2003, Artoo wrote:

> Anyone know of a good free thumbnail program that can be called from a PHP
> script using the exec() call or something similar?

By far, the most popular are the tools offered by 
ImageMagick, such as mogrify:

  http://www.imagemagick.org/www/mogrify.html

Regards,
Philip


--- End Message ---
--- Begin Message ---
> Anyone know of a good free thumbnail program that can be called from a
PHP
> script using the exec() call or something similar?

Netpbm is used by Gallery. Works very well. 

---John W. Holmes...

Amazon Wishlist: http://www.amazon.com/o/registry/3BEXC84AB3A5E

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



--- End Message ---
--- Begin Message ---
thanks.  I'll give that a try.  Happen to know where to get sample code that
uses this program?

"Philip Olson" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>
> On Sat, 7 Jun 2003, Artoo wrote:
>
> > Anyone know of a good free thumbnail program that can be called from a
PHP
> > script using the exec() call or something similar?
>
> By far, the most popular are the tools offered by
> ImageMagick, such as mogrify:
>
>   http://www.imagemagick.org/www/mogrify.html
>
> Regards,
> Philip
>



--- End Message ---
--- Begin Message ---
On Sun, 8 Jun 2003, Artoo wrote:

> thanks.  I'll give that a try.  Happen to know where to get sample code that
> uses this program?

After doing a google search for the terms mogrify php:

  http://www.google.com/search?q=mogrify+php

The first result was this article, it appears to touch
on the subject:
  
  Resizing Images with PHP and Mogrify
  http://www.phpbuilder.com/columns/michael20020712.php3

I'm sure there are many more examples around, and
including PHP in the search field of google is very 
much optional.  But, I guess this all depends on your
knowledge of PHP...  Maybe thumbnail is another good
search term to throw into the mix.

Regards,
Philip

> "Philip Olson" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> >
> > On Sat, 7 Jun 2003, Artoo wrote:
> >
> > > Anyone know of a good free thumbnail program that can be called from a
> PHP
> > > script using the exec() call or something similar?
> >
> > By far, the most popular are the tools offered by
> > ImageMagick, such as mogrify:
> >
> >   http://www.imagemagick.org/www/mogrify.html
> >
> > Regards,
> > Philip
> >
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


--- End Message ---
--- Begin Message ---
[snip]
> but I get following error:
> 
> Warning: fsockopen() [function.fsockopen]: no SSL support in this build
> in
> /usr/home/trivisions/html/sextoymerchant.com/payment/checkout_confirm.ph
> p on line 64
> 
> So does this mean that my PHP installation does not support SSL, and
> that I have to recompile PHP again?
> 
> I looked at the PHP installation configure options but did not see
> anything regarding SSL, so how would I install this?

>From the manual:

  php.net/fsockopen

  "As of PHP 4.3.0, if you have compiled in OpenSSL support, you
   may prefix the hostname with either 'ssl://' or 'tls://' to 
   use an SSL or TLS client connection over TCP/IP to connect 
   to the remote host."

  php.net/openssl

  "To use PHP's OpenSSL support you must also compile PHP
    --with-openssl[=DIR]."

Regards,
Philip




--- End Message ---
--- Begin Message ---
By no errors, do you mean you have a PHP version greater
than PHP 4.2.0 and checked the ['error'] code, and it
has a value of 0?  Are you sure you want the filename
to be $file_name?  I doubt you do.

Regards,
Philip

ref: http://www.php.net/features.file-upload

On Sat, 7 Jun 2003, Rodney Green wrote:

> Hello. I'm attempting to upload a file using the script below and I'm not
> having any success. The temp directory I'm using does exist and is
> writeable. When I browse for the file then hit the send button it appears to
> be working then displays the form again with no errors. I look for the file
> on the server and it isn't there. Any advice on how to get this working?
> 
> Thanks!
> Rod
> 
> 
> ---------------------------------------------------------------
> 
> <html>
> <head>
> <title>Listing 9.14 A file upload script</title>
> </head>
> <?php
> $file_dir = "/home/corrdev/htdocs/php24/scrap/uploads";
> $file_url = "http://corros.colo.hosteurope.com/dev/php24/scrap/uploads";;
> 
> foreach( $HTTP_POST_FILES as $file_name => $file_array ) {
>  print "path: ".$file_array['tmp_name']."<br>\n";
>  print "name: ".$file_array['name']."<br>\n";
>  print "type: ".$file_array['type']."<br>\n";
>  print "size: ".$file_array['size']."<br>\n";
> 
>  if ( is_uploaded_file( $file_array['tmp_name'] )
>   && $file_array['type'] == "image/gif" ) {
>   move_uploaded_file( $file_array['tmp_name'], "$file_dir/$file_name")
>    or die ("Couldn't copy");
>   print "<img src=\"$file_url/$file_name\"><p>\n\n";
>  }
> }
> 
> ?>
> <body>
> <form enctype="multipart/form-data" method="POST">
> <input type="hidden" name="MAX_FILE_SIZE" value="51200">
> <input type="file" name="fupload"><br>
> <input type="submit" value="Send file!">
> </form>
> </body>
> </html>
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


--- End Message ---
--- Begin Message ---
Fatal error: Call to undefined function: xml_parser_create() in
/home/httpd/rootdir/sstats/includes/XPath.class.php on line 1410

I now get this error on my phpsysinfo page.  I have changed nothing in my
install except for updating recently.  My Linux Flavor is Gentoo if that
helps.  If you need further information, just ask. ;)

D



--- End Message ---
--- Begin Message ---
On Sun, 8 Jun 2003, Dustin Pate wrote:

> Fatal error: Call to undefined function: xml_parser_create() in
> /home/httpd/rootdir/sstats/includes/XPath.class.php on line 1410
> 
> I now get this error on my phpsysinfo page.  I have changed nothing in my
> install except for updating recently.  My Linux Flavor is Gentoo if that
> helps.  If you need further information, just ask. ;)

Your new PHP lacks XML support, otherwise this (and all
the other php.net/xml functions) will be defined.  Look
at a call to phpinfo(), you should see something like
--disable-xml in the configure line, or maybe it's 
shared and not included...  Anyway, bottom line is, your
PHP must now lack XML support.

Regards,
Philip


--- End Message ---
--- Begin Message ---
Thank you.  I checked my php_info() and sure enough --disable_xml is
present.  Are there any Gentoo Users out there having this problem as well?
Any Gentoo Users out there that might be able to help me work out a
solution? I have 'xml' and 'xml2' in my make.conf use flags.

D

> On Sun, 8 Jun 2003, Dustin Pate wrote:
>
> > Fatal error: Call to undefined function: xml_parser_create() in
> > /home/httpd/rootdir/sstats/includes/XPath.class.php on line 1410
> >
> > I now get this error on my phpsysinfo page.  I have changed nothing in
my
> > install except for updating recently.  My Linux Flavor is Gentoo if that
> > helps.  If you need further information, just ask. ;)
>
> Your new PHP lacks XML support, otherwise this (and all
> the other php.net/xml functions) will be defined.  Look
> at a call to phpinfo(), you should see something like
> --disable-xml in the configure line, or maybe it's
> shared and not included...  Anyway, bottom line is, your
> PHP must now lack XML support.
>
> Regards,
> Philip
>



--- End Message ---
--- Begin Message --- Hi, I just installed PHP 4.3.2 and tried to run php_pdf. I found that I was able to generate a pdf in memory using pdf_open_file($pdf), but when I tried to generate a real file using pdf_open_file($pdf,$filename) nothing happened, no file was generated. What's going on? Just as a sanity check I did an fopen($filename,"w") and that worked fine. I did replace my existing php.ini with the new php.ini-recommended, but I don't think I'm missing anything there.

Thanks in advance for your help.

_________________________________________________________________
MSN 8 with e-mail virus protection service: 2 months FREE* http://join.msn.com/?page=features/virus



--- End Message ---
--- Begin Message ---
On 04-Jun-2003 Jason Wong wrote:

> In case 1, a malicious person can bypass your password checks by passing 
> admin=1 in the URL.
> 
>> As Rasmus has correctly pointed out, the usage of "register_globals=off"
>> per se cannot be considered a security measure. If you don't initialize
>> and/or check *all* user-supported variables, you're dead. It's as simple
>> as that. Is it annoying? Maybe. Is it necessary? *yes*
> 
> I tend to think of it as a safety net.
> 
> Of course the problems with case 1 could be prevented by explicitly 
> initialising the variables ...
> 
>   if ($user == 'me' && $password == 'correct') {
>     $admin = TRUE; }
>   else {
>     $admin = FALSE;
>   } 
> 

True. If everybody initialized variables or PHP errored out on 
undeclared vars then the question wouldn't have come up.

> ... and extra meticulous coding:
> 
>   if ($admin === TRUE) { list_all_members_sordid_details(); }
> 

Using a global like that could be an example of problem code.
Sensitive stuff should be within a well defined routine:

function isadmin() {
    global $PHP_AUTH_USER, $PHP_AUTH_PW;
    static $admlogin=FALSE, $didit=FALSE;

    if ($didit)
        return($admlogin);

    $didit=TRUE;
    if ((strcmp($PHP_AUTH_USER, ADMINNAME) |
     strcmp($PHP_AUTH_PW, ADMINPASS)) == 0 )
        $admlogin=TRUE;

    return($admlogin);
}

...

if (isadmin()) ...


<rant>

register_globals=off won't make good code any better --it's just 
a safety net for the sloppy coders.

The real lesson is: Don't be (or hire) a sloppy programmer.

I understand why the PHP team made reg_g=off as the default. I don't 
like it, but i understand why.

The main thing I don't like is that it seems to coddle the LCD of 
bad code.

A craftsman rarely learns good practice if s/he is insulated from the
results of bad practice.

</rant>

IMHO, of course.

Regards,
-- 
Don Read                                       [EMAIL PROTECTED]
-- It's always darkest before the dawn. So if you are going to 
   steal the neighbor's newspaper, that's the time to do it.

--- End Message ---
--- Begin Message ---
[snip]
> <rant>
> 
> register_globals=off won't make good code any better --it's just 
> a safety net for the sloppy coders.
[snip]

In some sense, register_globals = off makes both bad and
good code better, because it means less pollution.   So
many unused variables get defined with register_globals
on and this means wasted memory/resources.  Pollution 
makes any environment worse!  Granted this isn't what you
meant, but still... ;)

Regards,
Philip



--- End Message ---
--- Begin Message ---
On 08-Jun-2003 Philip Olson wrote:
> [snip]
>> <rant>
>> 
>> register_globals=off won't make good code any better --it's just 
>> a safety net for the sloppy coders.
> [snip]
> 
> In some sense, register_globals = off makes both bad and
> good code better, because it means less pollution.   So
> many unused variables get defined with register_globals
> on and this means wasted memory/resources.  Pollution 
> makes any environment worse!  Granted this isn't what you
> meant, but still... ;)
> 

Also true. 

On namespace pollution  --based on some of the replies I've seen on the
list, there's a sizable number of neophyte (and too many veteran) coders
that are starting scripts with:

<?php
extract($_GET); extract($_POST); extract($_COOKIE);
...

And so far, I don't recall anybody mention that you need to
unset($admin, $internal_var, $nukenewyork, ...) afterwards.

So nothing's really changed. 
Bad code will mysteriously go tits-up (or worse) and good code will 
keep on cranking.

No matter what register_globals= is set to.

Regards,
-- 
Don Read                                       [EMAIL PROTECTED]
-- It's always darkest before the dawn. So if you are going to 
   steal the neighbor's newspaper, that's the time to do it.

--- End Message ---
--- Begin Message ---
> On 08-Jun-2003 Philip Olson wrote:
> > [snip]
> >> <rant>
> >> 
> >> register_globals=off won't make good code any better --it's just 
> >> a safety net for the sloppy coders.
> > [snip]
> > 
> > In some sense, register_globals = off makes both bad and
> > good code better, because it means less pollution.   So
> > many unused variables get defined with register_globals
> > on and this means wasted memory/resources.  Pollution 
> > makes any environment worse!  Granted this isn't what you
> > meant, but still... ;)
> > 
> 
> Also true. 
> 
> On namespace pollution  --based on some of the replies I've seen on the
> list, there's a sizable number of neophyte (and too many veteran) coders
> that are starting scripts with:
> 
> <?php
> extract($_GET); extract($_POST); extract($_COOKIE);
> ...
> 
> And so far, I don't recall anybody mention that you need to
> unset($admin, $internal_var, $nukenewyork, ...) afterwards.
> 
> So nothing's really changed. 
> Bad code will mysteriously go tits-up (or worse) and good code will 
> keep on cranking.
> 
> No matter what register_globals= is set to.

Anyone that would suggest using extract() like that would
only do so to quickly make a register_globals dependent
script work (using .htaccess would be preferred there). I
doubt people actually do that for new code, well, at least 
anyone with half a brain.

Regards,
Philip


--- End Message ---
--- Begin Message ---
Can anyone tell me if i can get the Hardisk serial number, by  php code?



--- End Message ---
--- Begin Message ---
My webhost just upgraded to php 4.3.2, and now I have a problem with
popen. I'm opening an output buffer then piping it through htmltidy to
make nice looking output.

<?php
ob_start();
// Other unimportant coding goes here

 $str=addslashes(ob_get_contents());
 $fp=popen("echo \"" . $str . "\" | /bin/tidy - config /my/home/htmlrc", "r");
 @$newstr=fread($fp, 999999);
 ob_end_clean();
 header("Last-Modified: " . $gmt_modtime);
 header( "Content-length: " . strlen( $newstr ) );
 echo stripslashes($newstr);
?>


This code worked perfectly before the upgrade, now "strlen( $newstr )" is
only getting back 4096 bytes. Is anybody else having this issue, and how
can I fix this? I don't see any configuration setting that looks like it
fits to this situation. It is running under redhat with Apache/1.3.27

Thanks, Jeff
--
Registered Linux user #304026. "lynx -source
http://jharris.rallycentral.us/jharris.asc | gpg --import" Key fingerprint
= 52FC 20BD 025A 8C13 5FC6 68C6 9CF9 46C2 B089 0FED Responses to this
message should conform to RFC 1855.



--- End Message ---
--- Begin Message ---
PHP 4.3.0-1 has a bug that made your previous code "work",
have a look at the fread() docs for why, here's a quote:

  "Note:  When reading from network streams or pipes, such
   as those returned when reading remote files or from 
   popen() and proc_open(), reading will stop after a packet 
   is available.  This means that you should collect the data 
   together in chunks as shown in the example below."

It goes on to show that you must loop threw it to get
fread() to do what you want in the below code.  Although,
the example it eludes to is wrong (a correct example will
show when the manual next builds), you get the point... :)

Regards,
Philip


On Sat, 7 Jun 2003, Jeff Harris wrote:

> My webhost just upgraded to php 4.3.2, and now I have a problem with
> popen. I'm opening an output buffer then piping it through htmltidy to
> make nice looking output.
> 
> <?php
> ob_start();
> // Other unimportant coding goes here
> 
>  $str=addslashes(ob_get_contents());
>  $fp=popen("echo \"" . $str . "\" | /bin/tidy - config /my/home/htmlrc", "r");
>  @$newstr=fread($fp, 999999);
>  ob_end_clean();
>  header("Last-Modified: " . $gmt_modtime);
>  header( "Content-length: " . strlen( $newstr ) );
>  echo stripslashes($newstr);
> ?>
> 
> 
> This code worked perfectly before the upgrade, now "strlen( $newstr )" is
> only getting back 4096 bytes. Is anybody else having this issue, and how
> can I fix this? I don't see any configuration setting that looks like it
> fits to this situation. It is running under redhat with Apache/1.3.27
> 
> Thanks, Jeff
> --
> Registered Linux user #304026. "lynx -source
> http://jharris.rallycentral.us/jharris.asc | gpg --import" Key fingerprint
> = 52FC 20BD 025A 8C13 5FC6 68C6 9CF9 46C2 B089 0FED Responses to this
> message should conform to RFC 1855.
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


--- End Message ---
--- Begin Message ---
Wow. 6 minutes for a response. Of course, I thought my error was in the
popen(), not fread(), so I didn't even check there. I've just fixed the
code, and it works! Thanks, Philip.


On Jun 8, 2003, "Philip Olson" claimed that:

|
|PHP 4.3.0-1 has a bug that made your previous code "work",
|have a look at the fread() docs for why, here's a quote:
|
|  "Note:  When reading from network streams or pipes, such
|   as those returned when reading remote files or from
|   popen() and proc_open(), reading will stop after a packet
|   is available.  This means that you should collect the data
|   together in chunks as shown in the example below."
|
|It goes on to show that you must loop threw it to get
|fread() to do what you want in the below code.  Although,
|the example it eludes to is wrong (a correct example will
|show when the manual next builds), you get the point... :)
|
|Regards,
|Philip
|
|
|On Sat, 7 Jun 2003, Jeff Harris wrote:
|
|> My webhost just upgraded to php 4.3.2, and now I have a problem with
|> popen. I'm opening an output buffer then piping it through htmltidy to
|> make nice looking output.
|>
|> <?php
|> ob_start();
|> // Other unimportant coding goes here
|>
|>  $str=addslashes(ob_get_contents());
|>  $fp=popen("echo \"" . $str . "\" | /bin/tidy - config /my/home/htmlrc", "r");
|>  @$newstr=fread($fp, 999999);
|>  ob_end_clean();
|>  header("Last-Modified: " . $gmt_modtime);
|>  header( "Content-length: " . strlen( $newstr ) );
|>  echo stripslashes($newstr);
|> ?>
|>
|>
|> This code worked perfectly before the upgrade, now "strlen( $newstr )" is
|> only getting back 4096 bytes. Is anybody else having this issue, and how
|> can I fix this? I don't see any configuration setting that looks like it
|> fits to this situation. It is running under redhat with Apache/1.3.27
|>
|> Thanks, Jeff
|> --

-- 
Registered Linux user #304026.
"lynx -source http://jharris.rallycentral.us/jharris.asc | gpg --import"
Key fingerprint = 52FC 20BD 025A 8C13 5FC6  68C6 9CF9 46C2 B089 0FED
Responses to this message should conform to RFC 1855.



--- End Message ---
--- Begin Message ---
On 05-Jun-2003 nabil wrote:
> Please help me how to print a timestamp string retrived from the
> database,
> and print it as YYYY-MM-DD
> 

MySQL ?

http://www.mysql.com/doc/en/Date_and_time_functions.html

-- 
Don Read                                       [EMAIL PROTECTED]
-- It's always darkest before the dawn. So if you are going to 
   steal the neighbor's newspaper, that's the time to do it.

--- End Message ---
--- Begin Message ---
On 05-Jun-2003 Philip J. Newman wrote:
> My problem is this:
> 
> I have a site that has 3 levels of access.
> 
> 1,2,3  ....
> 
> when i upload files to say $unixtimestamp/image1.jpg anyone can list the
> images in this directory $unixtimestamp/.  I would like to hide the
> images out side the doc root ... is this possable .. so i can load
> something like /image/image.php?no=1 and it loads
> $unixtimestamp/image1.jpg if the access level is right .. else it would
> load nothing .... 
> 
> Any Ideas where to start?
> 
> 

http://marc.theaimsgroup.com/?l=php-general

search on Subject: 'Images out side the wwwroot'

Regards,
-- 
Don Read                                       [EMAIL PROTECTED]
-- It's always darkest before the dawn. So if you are going to 
   steal the neighbor's newspaper, that's the time to do it.

--- End Message ---
--- Begin Message ---
Please help me , I want to make any user on my website to submit his CV , or
any file to a temp folder, the following script create a "fupload" file ,
and I don't want to dump the original in it, I want to upload the file as it
is, with its extension...

by example
////

<html>
<head>
<title>Listing 9.14 A file upload script</title>
</head>
<?php

$file_dir = "C:\\Inetpub\\wwwroot\\temps\\uploads";
$file_url = "http://localhost/temps\uploads";;

foreach( $HTTP_POST_FILES as $file_name => $file_array ) {
 print "path: ".$file_array['tmp_name']."<br>\n";
 print "name: ".$file_array['name']."<br>\n";
 print "type: ".$file_array['type']."<br>\n";
 print "size: ".$file_array['size']."<br>\n";

 if ( is_uploaded_file( $file_array['tmp_name'] )
  && $file_array['type'] == "text/plain" ) {
  move_uploaded_file( $file_array['tmp_name'], "$file_dir/$file_name")
   or die ("Couldn't copy");
  print "<img src=\"$file_url/$file_name\"><p>\n\n";
 }
}

?>
<body>
<form enctype="multipart/form-data" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="51200">
<input type="file" name="fupload"><br>
<input type="submit" value="Send file!">
</form>
</body>
</html>


/////



--- End Message ---
--- Begin Message ---
That article is pretty old, and the code sucks.  
Read this instead:

  http://www.php.net/features.file-upload

It will explain everything.

Regards,
Philip


On Sun, 8 Jun 2003, nabil wrote:

> Please help me , I want to make any user on my website to submit his CV , or
> any file to a temp folder, the following script create a "fupload" file ,
> and I don't want to dump the original in it, I want to upload the file as it
> is, with its extension...
> 
> by example
> ////
> 
> <html>
> <head>
> <title>Listing 9.14 A file upload script</title>
> </head>
> <?php
> 
> $file_dir = "C:\\Inetpub\\wwwroot\\temps\\uploads";
> $file_url = "http://localhost/temps\uploads";;
> 
> foreach( $HTTP_POST_FILES as $file_name => $file_array ) {
>  print "path: ".$file_array['tmp_name']."<br>\n";
>  print "name: ".$file_array['name']."<br>\n";
>  print "type: ".$file_array['type']."<br>\n";
>  print "size: ".$file_array['size']."<br>\n";
> 
>  if ( is_uploaded_file( $file_array['tmp_name'] )
>   && $file_array['type'] == "text/plain" ) {
>   move_uploaded_file( $file_array['tmp_name'], "$file_dir/$file_name")
>    or die ("Couldn't copy");
>   print "<img src=\"$file_url/$file_name\"><p>\n\n";
>  }
> }
> 
> ?>
> <body>
> <form enctype="multipart/form-data" method="POST">
> <input type="hidden" name="MAX_FILE_SIZE" value="51200">
> <input type="file" name="fupload"><br>
> <input type="submit" value="Send file!">
> </form>
> </body>
> </html>
> 
> 
> /////
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


--- End Message ---
--- Begin Message ---
I am trying to upload a file using php's ftp functions between two RedHat
7.3 systems.  I'd like to make sure the destination file has the same
modification date as the source file, so that I can later compare to see if
it has been modified on the remote machine, but not sure how to approach
this.  I tried to use the SITE command to pass a touch command, but that
didn't work.
Other than the obvious places, where do I go from here?

thanks in advance,

Warren Vail
[EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
Is there a way of changing only the 1st letter of a string to caps and the rest to 
lower?

eg: foo bar 
      to
      Foo Bar

??

/ Phil
PhilipNZ.com
[EMAIL PROTECTED]

--- End Message ---
--- Begin Message --- Philip J. Newman wrote:
Is there a way of changing only the 1st letter of a string to caps and the rest to lower?

eg: foo bar to
Foo Bar

Newman, search the PHP documentation before posting will you?


What you want is the function called ucwords()

http://jp.php.net/manual/en/function.ucwords.php

Jc


--- End Message ---
--- Begin Message --- Philip J. Newman wrote:
Is there a way of changing only the 1st letter of a string to caps and the rest to lower?

eg: foo bar to
Foo Bar

Newman, search the PHP documentation before posting will you?


What you want is the function called ucwords()

http://jp.php.net/manual/en/function.ucwords.php

Jc


--- End Message ---
--- Begin Message ---
I would liek to check for 0-9 and . charactors i'm using ...

$email = "60.00";

if eregi("^[0-9.])?$",$email) {

echo"valid";

} else {

echo"not valid";

}

Its not working well. umm ... help ...

--- End Message ---
--- Begin Message ---
On Sunday 08 June 2003 16:22, Philip J. Newman wrote:
> I would liek to check for 0-9 and . charactors i'm using ...
>
> $email = "60.00";
>
> if eregi("^[0-9.])?$",$email) {
>
> echo"valid";
>
> } else {
>
> echo"not valid";
>
> }
>
> Its not working well. umm ... help ...

  eregi("^([0-9.])*$", $string)

will match:
  an empty string
  a string containing only 0-9 and periods

It is better for you to learn the preg_*() functions instead of the ereg*() 
ones.

-- 
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
------------------------------------------
/*
This fortune is false.
*/


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

----- Original Message -----
From: "Jason Wong" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, June 08, 2003 8:57 PM
Subject: Re: [PHP] Checking for Valid Charactors.


> On Sunday 08 June 2003 16:22, Philip J. Newman wrote:
> > I would liek to check for 0-9 and . charactors i'm using ...
> >
> > $email = "60.00";
> >
> > if eregi("^[0-9.])?$",$email) {
> >
> > echo"valid";
> >
> > } else {
> >
> > echo"not valid";
> >
> > }
> >
> > Its not working well. umm ... help ...
>
>   eregi("^([0-9.])*$", $string)
>
> will match:
>   an empty string
>   a string containing only 0-9 and periods
>
> It is better for you to learn the preg_*() functions instead of the
ereg*()
> ones.
>
> --
> 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
> ------------------------------------------
> /*
> This fortune is false.
> */
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>



--- End Message ---
--- Begin Message ---
> From: Jason Wong [mailto:[EMAIL PROTECTED]
> > On Sunday 08 June 2003 16:22, Philip J. Newman wrote:
> > I would liek to check for 0-9 and . charactors i'm using ...
> >
> > $email = "60.00";
> >
> > if eregi("^[0-9.])?$",$email) {
> >
> > echo"valid";
> >
> > } else {
> >
> > echo"not valid";
> >
> > }
> >
> > Its not working well. umm ... help ...
> 
>   eregi("^([0-9.])*$", $string)
> 
> will match:
>   an empty string
>   a string containing only 0-9 and periods
> 
> It is better for you to learn the preg_*() functions instead of the
> ereg*()
> ones.

FYI, that code will also allow a string such as "99.4.3....223...04..."

If that's not desirable, you could look into using the is_float() or
is_numeric() functions, or a regex such as:

if(preg_match('/^[0-9]*\.?[0-9]+$/',$string))
{ echo "good"; }
else
{ echo "bad"; }

That will allow text/numbers with or without a period. 

---John W. Holmes...

Amazon Wishlist: http://www.amazon.com/o/registry/3BEXC84AB3A5E

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



--- End Message ---
--- Begin Message ---
HELP? I AM ABOUT TO PULL MY HAIR OUT?

I have already spent time reading over the online php manual and I still
can't figure a way around this issue. I notice that when I start a session
and I create session variables, those variables are attached to the specific
domain. For example:

both of the urls point to the same place:

http://www.test.com/start.php

http://ww2.test.com/start.php

I have noticed however that if you create a session variable in the
following file http://www.test.com/start.php
and try to access from a file http://www2.test.com/access.php the variable
will not exist.

The reason I am asking all these questions is that in my code I need the
ability to do a re-direct to a secure site such as https://secure.test.com
but still maintain all of the session variables and keep the same session
open.

Any ideas?

Thanks,
Dale



--- End Message ---
--- Begin Message --- http://us2.php.net/manual/en/function.session-set-cookie-params.php

set the domain strictly to "test.com" not "subdomain.test.com" etc etc

--
Jason k Larson



Dale wrote:

HELP? I AM ABOUT TO PULL MY HAIR OUT?

I have already spent time reading over the online php manual and I still
can't figure a way around this issue. I notice that when I start a session
and I create session variables, those variables are attached to the specific
domain. For example:

both of the urls point to the same place:

http://www.test.com/start.php

http://ww2.test.com/start.php

I have noticed however that if you create a session variable in the
following file http://www.test.com/start.php
and try to access from a file http://www2.test.com/access.php the variable
will not exist.

The reason I am asking all these questions is that in my code I need the
ability to do a re-direct to a secure site such as https://secure.test.com
but still maintain all of the session variables and keep the same session
open.

Any ideas?

Thanks,
Dale





--- End Message ---
--- Begin Message ---
> HELP? I AM ABOUT TO PULL MY HAIR OUT?

I can't tell from here... move closer to the monitor. 
 
> I have already spent time reading over the online php manual and I
still
> can't figure a way around this issue. I notice that when I start a
session
> and I create session variables, those variables are attached to the
> specific
> domain. For example:
> 
> both of the urls point to the same place:
> 
> http://www.test.com/start.php
> 
> http://ww2.test.com/start.php
> 
> I have noticed however that if you create a session variable in the
> following file http://www.test.com/start.php
> and try to access from a file http://www2.test.com/access.php the
variable
> will not exist.
> 
> The reason I am asking all these questions is that in my code I need
the
> ability to do a re-direct to a secure site such as
https://secure.test.com
> but still maintain all of the session variables and keep the same
session
> open.

Session IDs are passed in cookies. Cookies are, by default, set to the
current domain. So a cookie set on 'www.test.com' will not be available
to 'ww2.test.com'. 

You can try to adjust the cookie domain property to 'test.com' like
someone else mentioned, or pass the session ID in the URL when linking
to the other domain. This will only work if both domains use the same
directory for storing session files, though. 

---John W. Holmes...

Amazon Wishlist: http://www.amazon.com/o/registry/3BEXC84AB3A5E

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



--- End Message ---
--- Begin Message ---
Hi
I'm writing a wrapper for some mailman archives and i'm trying to put
them message into a variable as in:

$body = <<<EOF
text here.....
EOF;

But I'm getting an error because of some charactors. ^L to be
specific. If the text contains a control char I get:

Code:
<pre>                                                       
<?                                                       
$test = <<<EOF  
line 1  
^L              
line 2  
EOF;            
echo $test;                 
?>                      
</pre>   

Error:
Warning: Unexpected character in input: '' (ASCII=12) state=5 in
test.html on line 6

Is there any way I can stop it complaining about it. Or is there
another way I can put the the text into the string (it's done via a
template file and a string substitution). The contents could be
anything so I thougth heredoc would work..

Thanks in advance.. I'm not on the list so please reply to me directly.

Regards
Simon

-- 
Simon Coggins (SAGE-AU Member)                Email: [EMAIL PROTECTED]
Network and System Management Officer         Phone: +61-2-4221-3775
Information Technology Systems (ITS)          Mobile: 0408 115861
University of Wollongong, 2522, Australia     Fax:   +61-2-4229-1985


--- End Message ---
--- Begin Message ---
hi there i have nearly completed a project in php and need to find
different approaches in creating user manuals , is there any tutorials or
howtos out there and i am not talkin about phpdoc this is code doc level i
need to find a good approach at creating the users level documentation let
me know thanks.



--- End Message ---
--- Begin Message ---
With phpdoc you can also make user level docs. Read the manual.



----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, June 08, 2003 11:38 AM
Subject: [PHP] project users manual howto


> hi there i have nearly completed a project in php and need to find
> different approaches in creating user manuals , is there any tutorials or
> howtos out there and i am not talkin about phpdoc this is code doc level i
> need to find a good approach at creating the users level documentation let
> me know thanks.
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
>



--- End Message ---
--- Begin Message ---
AGES AND TRYING TO FIND A GOOD RSS CREATOR , PLEASE HELP, NOTE THAT I TRIED
http://www.phpclasses.org  . PHP Classes Repository

      BUT I DIDN'T MANAGE

      PLEASE HELP ME



--- End Message ---
--- Begin Message ---
"Dvdmandt" <[EMAIL PROTECTED]> skrev i meddelandet
news:[EMAIL PROTECTED]
> Are you sure it doesn't work? I thought it didn't at first, that variable
> doesn't exist unless you call the script with a index.php/dir/file.txt if
> you get what I mean... This was my case, pretty long ago so maybe things
> have changed...

I'm sure and I'm sure it works on the Linux box where my pages is placed.
This is not a question of writing a fuctional code, but writing correct
code! In my perspective that means platform independent!
(btw: the problem occure i my update script:
 if (date("M",filemtime($_SERVER['PATH_TRANSLATED']))=="Jan") {......}
)

> "ØYstein HåLand" <[EMAIL PROTECTED]> skrev i meddelandet
> news:[EMAIL PROTECTED]
> > Is there some way to retrieve the phpvariable PATH_TRANSLATED on my
local
> > win2k+Apache2+php4.3.2 box?
> > Using phpinfo() does not show PATH_TRANSLATED
> >
> >
>
>



--- End Message ---
--- Begin Message ---
thanks to replay
I wont to print to paper printer 


--- End Message ---
--- Begin Message --- مضë wrote:
thanks to replay
I wont to print to paper printer

If you mean to have the user print to a paper printer what he sees in his web browser then that has nothing to do with PHP.


Printing from a web browser is controlled by the web browser. PHP cannot affect the way a web browser prints.

Did I understand you question correctly?

Jean-Christian Imbeault


--- End Message ---
--- Begin Message ---
I just installed the rpm for mysql 4 on Redhat 7.1.
Now the service is running, but I cannot go to a
command line and type in mysql to get to the mysql
command prompt. Did I install it wrong? Do I need to
add a path like you would in windows (Enviroment
Paths)?

Thanks
Silly

__________________________________
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com

--- End Message ---
--- Begin Message --- Azflsite wrote:

You just high jacked someone else's thread. Please don't do that.

I just installed the rpm for mysql 4 on Redhat 7.1.
Now the service is running, but I cannot go to a
command line and type in mysql to get to the mysql
command prompt. Did I install it wrong? Do I need to
add a path like you would in windows (Enviroment
Paths)?

Furthermore this is a PHP list ... for MySQL support you would be much better off posting to a MySQL list no? ;)


Unless of course there *was* something related to PHP in your question that I somehow missed?

Jean-Christian Imbeault


--- End Message ---
--- Begin Message ---
"Philip Olson" wrote:

> What do these commands output?
>
> # /usr/sbin/httpd -v

Server version: Apache/2.0.46
Server built:   Jun  8 2003 02:59:44

> # /usr/sbin/apxs -q SBINDIR

apxs -q SBINDIR
/usr/sbin
apxs:Error: /usr/bin/apr-config not found!.

> # /usr/sbin/apxs -q TARGET

/usr/sbin/apxs -q TARGET
httpd
apxs:Error: /usr/bin/apr-config not found!.

It looks like my apxr relies on apr-config.
I've extracted an apxs from a previous rpm and it looks like
configure is working now.


Thanks a lot.



--- End Message ---
--- Begin Message ---
Thanks Leif.  I hoping to get something for vers of PHP < 4.2.  From my
earlier post:

The following never echos STARTING!!!

ob_end_flush();
    if(ob_get_contents() == FALSE) {
        echo "STARTING!!!";
        ob_start();
    }

also tried:  if(ob_get_contents() === FALSE)
and: if(!ob_get_contents())
and:  if(ob_get_contents() == "")

But I do get the following notice at the ob_end_flush(); line which tells me
that output buffering is not on:

Notice: ob_end_flush() [ref.outcontrol]: failed to delete buffer default
output handler.

Thanks!
Shawn

"Leif K-Brooks" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Yay, a hack!  The correct answer is ob_get_level().
>
> Jim Lucas wrote:
>
> >output some html and then try and do an header() redirect.
> >
> >if it works, then some sort of buffering is turned on.
> >
> >if it fails and tells you that output has already been sent to the
browser,
> >then it isn't turned on.
> >
> >Jim Lucas
> >----- Original Message -----
> >From: "Shawn McKenzie" <[EMAIL PROTECTED]>
> >To: <[EMAIL PROTECTED]>
> >Sent: Saturday, June 07, 2003 7:39 AM
> >Subject: [PHP] How to determine if output buffering is on?
> >
> >
> >
> >
> >>O.K.  so how can I determine if output buffering has been started???
> >>
> >>Thanks!
> >>Shawn
> >>
> >>
> >>
> >>--
> >>PHP General Mailing List (http://www.php.net/)
> >>To unsubscribe, visit: http://www.php.net/unsub.php
> >>
> >>
> >>
> >>
> >
> >
> >
> >
>
> -- 
> The above message is encrypted with double rot13 encoding.  Any
unauthorized attempt to decrypt it will be prosecuted to the full extent of
the law.
>
>




--- End Message ---

Reply via email to