|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
php-general-digest-help_at_lists.php.net
Date: Sun Aug 25 2002 - 22:54:38 CDT
php-general Digest 26 Aug 2002 03:54:38 -0000 Issue 1547
Topics (messages 114059 through 114096):
Re: trouble with function
114059 by: Michael Sims
114062 by: Justin French
Re: Base64 and MS Word cutting and pasting.
114060 by: Dennis Moore
test ;)
114061 by: Vortec
register_globals off or on, why on
114063 by: Peter J. Schoenster
114064 by: Rasmus Lerdorf
Re: GD lib. image quality!
114065 by: Dave at Sinewaves.net
114070 by: Jason Reid
114083 by: Rasmus Lerdorf
MySQL PASSWORD() Question
114066 by: Tony Harrison
if/else & mail() problem..
114067 by: eriol
114068 by: Tony Harrison
114069 by: eriol
114075 by: eriol
Re: Count number of rows in table.
114071 by: salamander
114072 by: Chris Shiflett
upload file
114073 by: Daniel Guerrier
114074 by: eriol
114076 by: Chris Shiflett
114077 by: Daniel Guerrier
What's the trick ?
114078 by: N. Pari Purna Chand
Can someone - anyone see my error?
114079 by: JohnP
114080 by: David Freeman
114087 by: Seairth Jacobs
114089 by: Eric Pignot
114091 by: Jason Reid
Help with matchng strings
114081 by: rdkurth.starband.net
114082 by: Rasmus Lerdorf
114085 by: rdkurth.starband.net
114086 by: Bas Jobsen
Numbers to Roman Numerals - Native PHP Function?
114084 by: Dave at Sinewaves.net
Doing system things with PHP
114088 by: Liam MacKenzie
114090 by: Eric Pignot
114092 by: Chris Shiflett
Call to undefined function mysql_connect()
114093 by: hugh danaher
114096 by: . Edwin
Only show certain files in directory
114094 by: rdkurth.starband.net
114095 by: Justin Garrett
Administrivia:
To subscribe to the digest, e-mail:
php-general-digest-subscribe
lists.php.net
To unsubscribe from the digest, e-mail:
php-general-digest-unsubscribe
lists.php.net
To post to the list, e-mail:
php-general
lists.php.net
----------------------------------------------------------------------
attached mail follows:
On Sun, 25 Aug 2002 10:49:00 -0500, you wrote:
>static $myrow;
>if($myrow = mysql_fetch_array($result)) {
[...]
Oops. We want to remember the position of the result set, so it's
$result that should be static, not $myrow. In addition, you'll have
to put a check at the top of the function to see if $result is still
valid, and to have it not re-run the query if it is. Otherwise you'll
get the first row back every time. Come to thing of it, it's probably
just easier to get all the songs back at once and then do a foreach.
:-)
attached mail follows:
Thanks for all your help :)
Justin
on 26/08/02 1:55 AM, Michael Sims (mhsims
midsouth.rr.com) wrote:
> On Sun, 25 Aug 2002 10:49:00 -0500, you wrote:
>
>> static $myrow;
>> if($myrow = mysql_fetch_array($result)) {
> [...]
>
> Oops. We want to remember the position of the result set, so it's
> $result that should be static, not $myrow. In addition, you'll have
> to put a check at the top of the function to see if $result is still
> valid, and to have it not re-run the query if it is. Otherwise you'll
> get the first row back every time. Come to thing of it, it's probably
> just easier to get all the songs back at once and then do a foreach.
> :-)
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
attached mail follows:
I've isolated the problem with MS Word and MS Wordpad; The problem does not
occur when pasting from Notepad. I want to make sure that all the text is
ASCII before converting to MIME encoding. This shoul alleviate the problems
that are occuring.
Thanks,
/dkm
----- Original Message -----
From: "
Edwin" <copperwalls
hotmail.com>
To: <dmoore
ravens-nest.com>
Cc: <php-general
lists.php.net>
Sent: Saturday, August 24, 2002 6:37 PM
Subject: Re: [PHP] Base64 and MS Word cutting and pasting.
> Just some ideas.
>
> First, to check if it's really the pasted text from MS Word that is really
> causing the problem, paste the text from MS Word to a text editor like
> "notepad" THEN from "notepad" copy and paste to the <textarea> and see if
> the problem is still there.
>
> If it's still there, well, that means it's a different problem.
>
> Perhaps, it's about the "quotes and apostrophes" that you've mention so
> it'd be better to check the manual. See addslashes() or stripslashes().
>
> Or, the problem could be something else. But, I don't really think it's
> because the pasted text is from MS Word... (Pasted text to the textarea
> should have been already converted...)
>
> - E
>
> >
> >I have an application which uses the <textarea> tag for users to input
> data. This works fine. However, some users are using MS Word to generate
> the text and then cutting and pasting into the <textarea>. This works
fine
> as well.
> >
> >However, I am encountering a problem when the application mails the
> submitted content. Everything is viewed fine throught the web. We are
> MIME encoding the message using base64 functions. The problem is that not
> all email clients are decoding the MS Word pasted content properly.
> Quotes and apostrophes are not being decoded properly.
> >
> >I assume the problem is that the MS Word pasted content is not ASCII.
I
> need to convert this content to ASCII before we encode the MIME message.
> >
> >Do you have any ideas?
> >
> >/dkm
>
>
>
>
> _________________________________________________________________
> $B%&%#%k%9%a!<%k!"LBOG%a!<%kBP:v$J$i(B MSN Hotmail http://www.hotmail.com/JA
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
Just wanna test this list.
attached mail follows:
Hi,
I'm working on a site where I'm using geeklog
http://geeklog.sourceforge.net/
It has the requirement that
> "Geeklog needs the register_globals variable turned on in order to work.
> Since PHP 4.2.0, the default for register_globals is "off". To fix it,
> simply add the following line to your php.ini file
Is this not *wrong*. It sounds to me like fake laziness. Nothing drives
me bonkers more than trying to track down a variable that is inherited
from who knows where.
Perhaps I'm missing something. I've recently worked on a lot of PHP
code written by others and it's a nightmare trying to track down where
a variable is defined and where it's value might be changed. Perhaps
there is some tool I can use to trace this. I dunno.
Am I correct in my aversion to globals or I am I missing their true
value and perhaps some tools I could use when working on apps that have
more than 50 php files floating all over the place and no
documentation.
Peter
---------------------------
"Reality is that which, when you stop believing in it, doesn't go
away".
-- Philip K. Dick
attached mail follows:
> I'm working on a site where I'm using geeklog
> http://geeklog.sourceforge.net/
>
> It has the requirement that
>
> > "Geeklog needs the register_globals variable turned on in order to work.
> > Since PHP 4.2.0, the default for register_globals is "off". To fix it,
> > simply add the following line to your php.ini file
>
> Is this not *wrong*. It sounds to me like fake laziness. Nothing drives
> me bonkers more than trying to track down a variable that is inherited
> from who knows where.
If you initialize all your local variables, there is nothing wrong with
having register_globals on. Well-written apps run quite nicely and
securely with them on. The reason to turn them off is to protect yourself
from crappy code.
-Rasmus
attached mail follows:
imageCreate will create an image, but its palette will be very limited, so
when you try to copy your photo onto it, it will maintain the palette of the
original picture. Obviously, this is not what you want, since the picture
comes out looking all grey and faded (probably 8-16 colors!).
What works for me is creating a blank image using imageCreate(), then saving
it as a temporary jpeg (using imageJpeg). This action will set the palette
of the image to a jpeg's palette (close to 16-bit or better colorspace). If
you imageCopyResized over this temp.jpg (which you need to create whenever
you run the script to ensure sizing is perfect), it will come out with the
full palette of colors.
Pseudo code:
<?
$dest_h = whatever your calculated destination height is;
$dest_w = whatever your calculated destination width is;
$src_h = height of original image;
$src_w = width of original image;
// create the blank limited-palette image
$base_image = imageCreate($dest_w, $dest_h);
// convert and save it to temp.jpg
imagejpeg($base_image, 'path/to/temp.jpg');
// get the image pointer to the temp jpeg
$image = imageCreateFromJpeg('path/to/temp.jpg');
// get the image pointer to the original image
$imageToResize = imageCreateFromJpeg('path/to/image_to_be_resized.jpg');
// resize the original image over temp.jpg
// since you have GD2, you could also use imageCopyResampled
imageCopyResized($image, $imageToResize, 0, 0, 0, 0, $dest_w, $dest_h,
$src_w, $src_h);
// values for output jpeg quality
$jpegQuality = 75;
// create the resized image
imageJpeg($image, 'path/to/thumbnail_name.jpg', $jpegQuality);
?>
Then all you have to do is a little cleanup with imageDestroy() and you
should have a nice looking thumbnail!
I usually add a line like this to the script to make sure everything went
smoothly:
<?
echo '<html><head><title>Thumbnail Generator</title>'
.'</head><body><img src="path/to/thumbnail_name.jpg">'
.'</body></html>';
?>
It lets me see the quality of the thumbnail the second the script completes.
Try it - you'll get perfect thumbnails every time. I used this technique
for all of the pictures at www.arkestraclandestina.com with GD1.6 - and all
of them actually had custom color profiles! Works like a charm.
I like this method because I can be sure that the script won't break on
sites with older PHP and GD versions - which is an important consideration
when you're deploying applications to other sites...
However! If you are sure it will only be run on a PHP4, GD2 system, you can
avoid all of the temp jpg madness altogether by just altering your code to
use imageCreateTrueColor() instead of imageCreate()!! ;P Easy as pie!
Dave
-----Original Message-----
From: Arcadius A. [mailto:ahouans
sh.cvut.cz]
Sent: Sunday, August 25, 2002 4:11 AM
To: php-general
lists.php.net
Subject: [PHP] GD lib. image quality!
Hello!
I wrote a little script for generation thumbnails of larger images....
<code>
$origImage = imageCreateFromJpeg($sourcePath."/".$currentImageName);
$thumbnail = imageCreate($thumbWidth,$thumbHeight);// create empty image
imageCopyResized($thumbnail,$origImage,0,0,0,0,$thumbWidth,$thumbHeight,imag
esX($origImage),imagesY($origImage));
imageJpeg($thumbnail, $targetPath."/".$thumbNamePrefix."_thumb.jpg"); //
Store it
imageDestroy($thumbnail); // cleanup
echo "<br>Image ".$targetPath."/".$thumbNamePrefix."_thumb.jpg"."
created successfully!";
</code>
then, I've noticed that the quality of the thumbnails created is very bad!
my "phpinfo()" page shows "2.0 or higher" as GD version
So, I'm wondering whether I'm doing something wrong in my code or whether
there exist a better library to use with PHP ... a library able to generate
good quality JPG files...
Thanks in advance.
Arcadius.
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
If you have GD2 I'd advise using imagecopyresampled, as I found using imagecopyresized often resulted in blue or grayish images, while imagecopyresampled resulted in normal looking images.
Jason Reid
jason
achost.ca
-- AC Host Canada www.achost.ca----- Original Message ----- From: "Dave at Sinewaves.net" <eightrack
earthlink.net> To: "Arcadius A." <ahouans
sh.cvut.cz>; <php-general
lists.php.net> Sent: Sunday, August 25, 2002 12:23 PM Subject: RE: [PHP] GD lib. image quality!
> imageCreate will create an image, but its palette will be very limited, so > when you try to copy your photo onto it, it will maintain the palette of the > original picture. Obviously, this is not what you want, since the picture > comes out looking all grey and faded (probably 8-16 colors!). > > What works for me is creating a blank image using imageCreate(), then saving > it as a temporary jpeg (using imageJpeg). This action will set the palette > of the image to a jpeg's palette (close to 16-bit or better colorspace). If > you imageCopyResized over this temp.jpg (which you need to create whenever > you run the script to ensure sizing is perfect), it will come out with the > full palette of colors. > > Pseudo code: > <? > $dest_h = whatever your calculated destination height is; > $dest_w = whatever your calculated destination width is; > > $src_h = height of original image; > $src_w = width of original image; > > // create the blank limited-palette image > $base_image = imageCreate($dest_w, $dest_h); > > // convert and save it to temp.jpg > imagejpeg($base_image, 'path/to/temp.jpg'); > > // get the image pointer to the temp jpeg > $image = imageCreateFromJpeg('path/to/temp.jpg'); > > // get the image pointer to the original image > $imageToResize = imageCreateFromJpeg('path/to/image_to_be_resized.jpg'); > > // resize the original image over temp.jpg > // since you have GD2, you could also use imageCopyResampled > imageCopyResized($image, $imageToResize, 0, 0, 0, 0, $dest_w, $dest_h, > $src_w, $src_h); > > // values for output jpeg quality > $jpegQuality = 75; > > // create the resized image > imageJpeg($image, 'path/to/thumbnail_name.jpg', $jpegQuality); > ?> > > > Then all you have to do is a little cleanup with imageDestroy() and you > should have a nice looking thumbnail! > > > I usually add a line like this to the script to make sure everything went > smoothly: > <? > echo '<html><head><title>Thumbnail Generator</title>' > .'</head><body><img src="path/to/thumbnail_name.jpg">' > .'</body></html>'; > ?> > > It lets me see the quality of the thumbnail the second the script completes. > > > Try it - you'll get perfect thumbnails every time. I used this technique > for all of the pictures at www.arkestraclandestina.com with GD1.6 - and all > of them actually had custom color profiles! Works like a charm. > > I like this method because I can be sure that the script won't break on > sites with older PHP and GD versions - which is an important consideration > when you're deploying applications to other sites... > > However! If you are sure it will only be run on a PHP4, GD2 system, you can > avoid all of the temp jpg madness altogether by just altering your code to > use imageCreateTrueColor() instead of imageCreate()!! ;P Easy as pie! > > Dave > > > > -----Original Message----- > From: Arcadius A. [mailto:ahouans
sh.cvut.cz] > Sent: Sunday, August 25, 2002 4:11 AM > To: php-general
lists.php.net > Subject: [PHP] GD lib. image quality! > > > Hello! > I wrote a little script for generation thumbnails of larger images.... > <code> > $origImage = imageCreateFromJpeg($sourcePath."/".$currentImageName); > $thumbnail = imageCreate($thumbWidth,$thumbHeight);// create empty image > > imageCopyResized($thumbnail,$origImage,0,0,0,0,$thumbWidth,$thumbHeight,imag > esX($origImage),imagesY($origImage)); > imageJpeg($thumbnail, $targetPath."/".$thumbNamePrefix."_thumb.jpg"); // > Store it > imageDestroy($thumbnail); // cleanup > echo "<br>Image ".$targetPath."/".$thumbNamePrefix."_thumb.jpg"." > created successfully!"; > > </code> > > then, I've noticed that the quality of the thumbnails created is very bad! > my "phpinfo()" page shows "2.0 or higher" as GD version > > So, I'm wondering whether I'm doing something wrong in my code or whether > there exist a better library to use with PHP ... a library able to generate > good quality JPG files... > > Thanks in advance. > > Arcadius. > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
imagecopyresize() just skips pixels in order to reduce it in size. imagecopyresampled() will take the average of adjacent pixels and therefore produce a much better scaled down image.
-Rasmus
On Sun, 25 Aug 2002, Jason Reid wrote:
> If you have GD2 I'd advise using imagecopyresampled, as I found using
> imagecopyresized often resulted in blue or grayish images, while
> imagecopyresampled resulted in normal looking images.
>
> Jason Reid
> jason
achost.ca
> --
> AC Host Canada
> www.achost.ca
>
> ----- Original Message -----
> From: "Dave at Sinewaves.net" <eightrack
earthlink.net>
> To: "Arcadius A." <ahouans
sh.cvut.cz>; <php-general
lists.php.net>
> Sent: Sunday, August 25, 2002 12:23 PM
> Subject: RE: [PHP] GD lib. image quality!
>
>
> > imageCreate will create an image, but its palette will be very limited, so
> > when you try to copy your photo onto it, it will maintain the palette of
> the
> > original picture. Obviously, this is not what you want, since the picture
> > comes out looking all grey and faded (probably 8-16 colors!).
> >
> > What works for me is creating a blank image using imageCreate(), then
> saving
> > it as a temporary jpeg (using imageJpeg). This action will set the palette
> > of the image to a jpeg's palette (close to 16-bit or better colorspace).
> If
> > you imageCopyResized over this temp.jpg (which you need to create whenever
> > you run the script to ensure sizing is perfect), it will come out with the
> > full palette of colors.
> >
> > Pseudo code:
> > <?
> > $dest_h = whatever your calculated destination height is;
> > $dest_w = whatever your calculated destination width is;
> >
> > $src_h = height of original image;
> > $src_w = width of original image;
> >
> > // create the blank limited-palette image
> > $base_image = imageCreate($dest_w, $dest_h);
> >
> > // convert and save it to temp.jpg
> > imagejpeg($base_image, 'path/to/temp.jpg');
> >
> > // get the image pointer to the temp jpeg
> > $image = imageCreateFromJpeg('path/to/temp.jpg');
> >
> > // get the image pointer to the original image
> > $imageToResize = imageCreateFromJpeg('path/to/image_to_be_resized.jpg');
> >
> > // resize the original image over temp.jpg
> > // since you have GD2, you could also use imageCopyResampled
> > imageCopyResized($image, $imageToResize, 0, 0, 0, 0, $dest_w, $dest_h,
> > $src_w, $src_h);
> >
> > // values for output jpeg quality
> > $jpegQuality = 75;
> >
> > // create the resized image
> > imageJpeg($image, 'path/to/thumbnail_name.jpg', $jpegQuality);
> > ?>
> >
> >
> > Then all you have to do is a little cleanup with imageDestroy() and you
> > should have a nice looking thumbnail!
> >
> >
> > I usually add a line like this to the script to make sure everything went
> > smoothly:
> > <?
> > echo '<html><head><title>Thumbnail Generator</title>'
> > .'</head><body><img src="path/to/thumbnail_name.jpg">'
> > .'</body></html>';
> > ?>
> >
> > It lets me see the quality of the thumbnail the second the script
> completes.
> >
> >
> > Try it - you'll get perfect thumbnails every time. I used this technique
> > for all of the pictures at www.arkestraclandestina.com with GD1.6 - and
> all
> > of them actually had custom color profiles! Works like a charm.
> >
> > I like this method because I can be sure that the script won't break on
> > sites with older PHP and GD versions - which is an important consideration
> > when you're deploying applications to other sites...
> >
> > However! If you are sure it will only be run on a PHP4, GD2 system, you
> can
> > avoid all of the temp jpg madness altogether by just altering your code to
> > use imageCreateTrueColor() instead of imageCreate()!! ;P Easy as pie!
> >
> > Dave
> >
> >
> >
> > -----Original Message-----
> > From: Arcadius A. [mailto:ahouans
sh.cvut.cz]
> > Sent: Sunday, August 25, 2002 4:11 AM
> > To: php-general
lists.php.net
> > Subject: [PHP] GD lib. image quality!
> >
> >
> > Hello!
> > I wrote a little script for generation thumbnails of larger images....
> > <code>
> > $origImage = imageCreateFromJpeg($sourcePath."/".$currentImageName);
> > $thumbnail = imageCreate($thumbWidth,$thumbHeight);// create empty
> image
> >
> >
> imageCopyResized($thumbnail,$origImage,0,0,0,0,$thumbWidth,$thumbHeight,imag
> > esX($origImage),imagesY($origImage));
> > imageJpeg($thumbnail, $targetPath."/".$thumbNamePrefix."_thumb.jpg");
> //
> > Store it
> > imageDestroy($thumbnail); // cleanup
> > echo "<br>Image ".$targetPath."/".$thumbNamePrefix."_thumb.jpg"."
> > created successfully!";
> >
> > </code>
> >
> > then, I've noticed that the quality of the thumbnails created is very bad!
> > my "phpinfo()" page shows "2.0 or higher" as GD version
> >
> > So, I'm wondering whether I'm doing something wrong in my code or whether
> > there exist a better library to use with PHP ... a library able to
> generate
> > good quality JPG files...
> >
> > Thanks in advance.
> >
> > Arcadius.
> >
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
attached mail follows:
If I insert a row's field's value using the PASSWORD() function, will I need to use it or another function to find that row using the same field?
---------------------------------------------
tony
cool-palace.com
http://www.cool-palace.com
attached mail follows:
I've got the following bit of code for an upload/feedback form.. Upload isn't a required field, but name, email and message are.. When someone submits this form with an upload used, it works fine.. But if an upload is excluded and they only fill in the required fields, I don't get an email..
I'm sure this has to do with the if/else statements, but I haven't been able to figure this out.. If anyone has a suggestion, help or can point me in the right direction, I'd appreciate it.. TIA..
Take care.. peace.. eriol
====
$info = NULL;
if(count($_FILES) > 0){
$allowed_types = array("text/plain","text/html");
$size_limit = "524288";
$file = $_FILES["file"]["name"];
$type = $_FILES["file"]["type"];
$size = $_FILES["file"]["size"];
$temp = $_FILES["file"]["tmp_name"];
$path_info = pathinfo($PATH_TRANSLATED);
$write_path = $path_info["dirname"] . "$uploadpath$uptime" . $file;
if ($file){
if ($size < $size_limit){
if (in_array($type,$allowed_types)){
if(move_uploaded_file($temp,$write_path)){
$info = "Thank you ".$_REQUEST['name']."\n";
if(!mail($email,$subject,$body,"Return-Path: <me
$SERVER_NAME>\r\n"
."From: me <me
$SERVER_NAME>\r\n"
."Reply-To: me
$SERVER_NAME\r\n"
."X-Mailer: $SERVER_NAME")){
if($_REQUEST["submit"]){
$null = "";
$name = $_REQUEST['name'];
$from = $_REQUEST['email'];
$message = $_REQUEST['message'];
}
echo "uh..";
}
}
else{
$info = "<b>$file</b> wasn't sent due to an error..";
}
}
else{
$info = "I do not accept <b>$type</b> type files..";
}
}
else{
$info = "Only files up to <b>$size_limit</b> bytes accepted..";
}
}
$info .="\n";
}
echo $info;
attached mail follows:
You need to give us the HTML for the form so we can comprehend the context of it all
"Eriol" <eriol
eriol.com> wrote in message
news:20020825185007.71946.qmail
pb1.pair.com...
> I've got the following bit of code for an upload/feedback form.. Upload
isn't a
> required field, but name, email and message are.. When someone submits
this form
> with an upload used, it works fine.. But if an upload is excluded and they
only
> fill in the required fields, I don't get an email..
>
> I'm sure this has to do with the if/else statements, but I haven't been
able to
> figure this out.. If anyone has a suggestion, help or can point me in the
right
> direction, I'd appreciate it.. TIA..
>
> Take care.. peace..
> eriol
>
> ====
>
> $info = NULL;
> if(count($_FILES) > 0){
> $allowed_types = array("text/plain","text/html");
> $size_limit = "524288";
> $file = $_FILES["file"]["name"];
> $type = $_FILES["file"]["type"];
> $size = $_FILES["file"]["size"];
> $temp = $_FILES["file"]["tmp_name"];
> $path_info = pathinfo($PATH_TRANSLATED);
> $write_path = $path_info["dirname"] . "$uploadpath$uptime" . $file;
> if ($file){
> if ($size < $size_limit){
> if (in_array($type,$allowed_types)){
> if(move_uploaded_file($temp,$write_path)){
> $info = "Thank you ".$_REQUEST['name']."\n";
> if(!mail($email,$subject,$body,"Return-Path:
<me
$SERVER_NAME>\r\n"
> ."From: me <me
$SERVER_NAME>\r\n"
> ."Reply-To: me
$SERVER_NAME\r\n"
> ."X-Mailer: $SERVER_NAME")){
> if($_REQUEST["submit"]){
> $null = "";
> $name = $_REQUEST['name'];
> $from = $_REQUEST['email'];
> $message = $_REQUEST['message'];
> }
> echo "uh..";
> }
> }
> else{
> $info = "<b>$file</b> wasn't sent due to an error..";
> }
> }
> else{
> $info = "I do not accept <b>$type</b> type files..";
> }
> }
> else{
> $info = "Only files up to <b>$size_limit</b> bytes accepted..";
> }
> }
> $info .="\n";
> }
> echo $info;
>
>
attached mail follows:
Sorry, I didn't figure it was needed, but here is the html info as requested.. Thanks..
<form action="<? echo $_SERVER['PHP_SELF'] ?>" method="post" enctype="multipart/form-data" name="contact" onsubmit="return verifyaddy()"> <table border="0" cellpadding="0" cellspacing="0" align="center"> <tr> <td align="left"> <font class="s"> <input type="hidden" name="MAX_FILE_SIZE" value="524288"/> Name: <br class="s"/> <input type="text" size="40" name="name" value="<? $_REQUEST['name']; ?>" class="file"/> <br class="s"/> Email: <br class="s"/> <input type="text" size="40" maxlength="255" name="email" value="<? $_REQUEST["email"] ?>" class="file"/> <br class="s"/> Upload: [ <a href="javascript:uploadinfo()">Information</a> ] <br class="s"/> <input type="file" size="27" name="file" class="file"/> <br class="s"/> Message: <br class="s"/> <textarea name="message" cols="40" rows="4" class="upload"><? $_REQUEST["message"]; ?></textarea> <br/> <br/> </font> </td> </tr> <tr> <td align="center"> <input type="submit" value="Submit" class="submit"/> </td> </tr> </table> </form>
Take care.. peace.. eriol
====
"Tony Harrison" <tonyh21
tharrison21.fsnet.co.uk> disgorged:
: You need to give us the HTML for the form so we can comprehend the context : of it all
attached mail follows:
I got this figured out already.. I was having a brain fart and just needed to move the IF statement with the mail() function further down past a few ELSE statements.. Thanks anyway..
Take care.. peace.. eriol
====
"Eriol" <eriol
eriol.com> disgorged:
: I've got the following bit of code for an upload/feedback form.. Upload isn't a : required field, but name, email and message are.. When someone submits this form : with an upload used, it works fine.. But if an upload is excluded and they only : fill in the required fields, I don't get an email.. : : I'm sure this has to do with the if/else statements, but I haven't been able to : figure this out.. If anyone has a suggestion, help or can point me in the right : direction, I'd appreciate it.. TIA.. : : [snip]
attached mail follows:
okay, so then a "select *" and then a num_rows ...
On Sunday, August 25, 2002, at 10:11 AM, Jason Wong wrote:
> On Sunday 25 August 2002 22:07, salamander wrote: >> or, you should be able to simply do this, without the cost of fetching >> the results: >> >> $result = mysql_query("SELECT count(*) FROM table WHERE"); >> $num_rows = mysql_num_rows($result); >> echo "$num_rows Rows\n"; > > No. This only returns 1 row regardless. "SELECT COUNT(*) FROM ..." only > returns a single row with a single column containing the row count. > Using > mysql_num_rows() on that will always return 1. > > -- > Jason Wong -> Gremlins Associates -> www.gremlins.com.hk > Open Source Software Systems Integrators > * Web Design & Hosting * Internet & Intranet Applications Development * > > /* > I'm going to Vietnam at the request of the White House. President > Johnson > says a war isn't really a war without my jokes. > -- Bob Hope > */ > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >
attached mail follows:
I think you were on the right track with your first response. Selecting a count(*) gives you the number of rows returned without the overhead of actually returning all of the rows to PHP. Most people will rename the count as something more easy to reference (and/or more descriptive) in the result set:
select count(*) as num_movies from movies where actor='Val Kilmer';
What Jason was trying to explain is that the data you are looking for is actually in the query you performed. You specifically queried for the number of rows. Your result set consists of a single row with a single element, num_movies.
Happy hacking.
Chris
salamander wrote:
> okay, so then a "select *" and then a num_rows ... > > On Sunday, August 25, 2002, at 10:11 AM, Jason Wong wrote: > >> On Sunday 25 August 2002 22:07, salamander wrote: >> >>> or, you should be able to simply do this, without the cost of fetching >>> the results: >>> >>> $result = mysql_query("SELECT count(*) FROM table WHERE"); >>> $num_rows = mysql_num_rows($result); >>> echo "$num_rows Rows\n"; >> >> No. This only returns 1 row regardless. "SELECT COUNT(*) FROM ..." only >> returns a single row with a single column containing the row count. >> Using >> mysql_num_rows() on that will always return 1. >
attached mail follows:
This should be very simple but it isn't working.
upload.html has this: <form action="upload2.php" method="POST" enctype="multipart/form-data">
<input type="file" name="userfile"> <input type="submit" name="submit" value="submit"> </form>
and
upload2.php has this: <?php
echo("in post"); echo($_POST['userfile]);
?>
Where is the file??
Thanks
__________________________________________________ Do You Yahoo!? Yahoo! Finance - Get real-time stock quotes http://finance.yahoo.com
attached mail follows:
Check these out:
http://www.php.net/manual/en/features.file-upload.php http://www.php.net/manual/en/function.move-uploaded-file.php
From the bit of code you posted, you're not declaring where an upload should actually go.. If you want it sent via email (attachment, not upload), that's another story, but if you want it sent to a directory within your site, the links above should be of some help..
Take care.. peace.. eriol
====
"Daniel Guerrier" <dan_guerrier
yahoo.com> disgorged:
: upload.html has this: : <form action="upload2.php" method="POST" enctype="multipart/form-data"> : <input type="file" name="userfile"> : <input type="submit" name="submit" value="submit"> : </form> : : and : : upload2.php has this: : <?php : echo("in post"); : echo($_POST['userfile]); : ?> : : Where is the file??
attached mail follows:
Daniel Guerrier wrote:
>echo($_POST['userfile]); >
Do you mean $_POST["userfile"] here? It looks like you're missing a quote.
attached mail follows:
Thanks
the quote wasn't the issue. Actually I shold have use $_FILE not $_POST .
--- Chris Shiflett <shiflett
php.net> wrote:
> Daniel Guerrier wrote:
>
> >echo($_POST['userfile]);
> >
>
> Do you mean $_POST["userfile"] here? It looks like
> you're missing a quote.
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
__________________________________________________ Do You Yahoo!? Yahoo! Finance - Get real-time stock quotes http://finance.yahoo.com
attached mail follows:
Hi guys,
Am writing a web based mailclient (obviously with PHP+IMAP), In the 'ReplyMail' script, inorder to add the "> " string at the beginning of everyline, I used the following code, <? $replymessage = $replymessage.str_replace("\n", "\n> ", htmlspecialchars(trim(imap_body($mbox, $msg)))); ?>
This is giving an output with one additional \n in the TEXTAREA, like below
<- strip -> >Hello Chandu,
>How are you. How is your coding going on.
>I'm on Mandrake 8.2.
>/Chandu <- End of strip ->
Any workarounds for this,
I hav seen the code of many PHP based IMAP client's but found out that all of those I checked are working in the same way as aboove. Squirrelmail is working as needed but I'm not able to locate where exactly the code I needed is, in those bulky files.
so as a last resort I've posted here.
/Chandu
attached mail follows:
Ok after being blasted for not looking on PHP.net first I have now returned none the wiser! :D
Here is the post file: --------------------------------- <form enctype="multipart/form-data" action="postbit.php" method="post"> <input type="hidden" name="5400" value="1000"> Send this file: <input name="userfile" type="file"> <input type="submit" value="Send File"> </form>
Here is the post handler file: ---------------------------------------- <?php // In PHP earlier then 4.1.0, $HTTP_POST_FILES should be used instead of $_FILES. if (is_uploaded_file($_FILES['userfile']['tmp_name'])) { copy($_FILES['userfile']['tmp_name'], "/home/thehobby/public_html/php/phpforums/uploads/"); } else { echo "Possible file upload attack. Filename: " . $_FILES['userfile']['name']; } /* ...or... */ move_uploaded_file($_FILES['userfile']['tmp_name'], "/home/thehobby/public_html/php/phpforums/uploads/"); ?>
And here is the error I get: ------------------------------------- Warning: Unable to create '/home/thehobby/public_html/php/phpforums/uploads/': Is a directory in /home/thehobby/public_html/php/phpforums/forums/postbit.php on line 4
Warning: Unable to create '/home/thehobby/public_html/php/phpforums/uploads/': Is a directory in /home/thehobby/public_html/php/phpforums/forums/postbit.php on line 9
Warning: Unable to move '/tmp/phpahcXwh' to '/home/thehobby/public_html/php/phpforums/uploads/' in /home/thehobby/public_html/php/phpforums/forums/postbit.php on line 9
Anyone know whats going on - PHP.net was of a absolutely no use and I am very new at file uploads - any help appreciated! Thanks - John
attached mail follows:
> And here is the error I get: > ------------------------------------- > Warning: Unable to create > '/home/thehobby/public_html/php/phpforums/uploads/': Is a
Does this directory exist? Does the user that your web server is running as have permission to write files in this directory?
> Anyone know whats going on - PHP.net was of a absolutely no > use and I am very new at file uploads - any help appreciated!
You might find that setting up a simple test page with the file upload and little else will help you. For starters you might even just set up a test page that echos back the name of the file and the temp name of the file - then you can see if your form is sending the right information. From there try moving your uploaded file and if this fails then you've either got a syntax problem with your code or you've got a permissions problem on the server.
http://www.php.net/manual/en/features.file-upload.php includes examples of doing a file upload and the comments following it include many useful tips. In the end, though, you're best move is probably to start simple and make sure it works before adding in all the other stuff that you might want to do.
CYA, Dave
attached mail follows:
I think you have to specify the destination file name as well. The destination directory is not enough.
--- Seairth Jacobs seairthseairth.com
"Johnp" <aerc
aerc.biz> wrote in message news:20020825215615.68241.qmail
pb1.pair.com... Ok after being blasted for not looking on PHP.net first I have now returned none the wiser! :D
Here is the post file: --------------------------------- <form enctype="multipart/form-data" action="postbit.php" method="post"> <input type="hidden" name="5400" value="1000"> Send this file: <input name="userfile" type="file"> <input type="submit" value="Send File"> </form>
Here is the post handler file: ---------------------------------------- <?php // In PHP earlier then 4.1.0, $HTTP_POST_FILES should be used instead of $_FILES. if (is_uploaded_file($_FILES['userfile']['tmp_name'])) { copy($_FILES['userfile']['tmp_name'], "/home/thehobby/public_html/php/phpforums/uploads/"); } else { echo "Possible file upload attack. Filename: " . $_FILES['userfile']['name']; } /* ...or... */ move_uploaded_file($_FILES['userfile']['tmp_name'], "/home/thehobby/public_html/php/phpforums/uploads/"); ?>
And here is the error I get: ------------------------------------- Warning: Unable to create '/home/thehobby/public_html/php/phpforums/uploads/': Is a directory in /home/thehobby/public_html/php/phpforums/forums/postbit.php on line 4
Warning: Unable to create '/home/thehobby/public_html/php/phpforums/uploads/': Is a directory in /home/thehobby/public_html/php/phpforums/forums/postbit.php on line 9
Warning: Unable to move '/tmp/phpahcXwh' to '/home/thehobby/public_html/php/phpforums/uploads/' in /home/thehobby/public_html/php/phpforums/forums/postbit.php on line 9
Anyone know whats going on - PHP.net was of a absolutely no use and I am very new at file uploads - any help appreciated! Thanks - John
attached mail follows:
> <form enctype="multipart/form-data" action="postbit.php" method="post"> > <input type="hidden" name="5400" value="1000"> > Send this file: <input name="userfile" type="file"> > <input type="submit" value="Send File"> > </form>
I am not really replying to your question, but just as a remark, in php, a variable needs to start with a letter or and underscire. (must be detailed in the doc) So I have absolutely no idea how PHP will interpret this line : <input type="hidden" name="5400" value="1000"> (and I would be curious to know how it actually does ! can you tell me ? )
bye
Eric
attached mail follows:
using register_globals=on and trying to echo out the $5400 errors as expected, but php sees the correct entry in the $_GET superglobal array as it should. running a simple foreach($_GET as $key => $val) returns a key of 5400 and a value of 1000 on a page with the querystring of page.php?5400=1000, so you should be able to pull that info into another variable correctly.
Jason Reid
jason
achost.ca
-- AC Host Canada www.achost.ca----- Original Message ----- From: "Eric Pignot" <eric.pignot
alinto.com> To: <php-general
lists.php.net> Sent: Sunday, August 25, 2002 7:24 PM Subject: [PHP] Re: Can someone - anyone see my error?
> > <form enctype="multipart/form-data" action="postbit.php" method="post"> > > <input type="hidden" name="5400" value="1000"> > > Send this file: <input name="userfile" type="file"> > > <input type="submit" value="Send File"> > > </form> > > I am not really replying to your question, but just as a remark, in php, a > variable needs to start with a letter or and underscire. (must be detailed > in the doc) > So I have absolutely no idea how PHP will interpret this line : > <input type="hidden" name="5400" value="1000"> > (and I would be curious to know how it actually does ! can you tell me ? ) > > bye > > Eric > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
I have two list one is listA and the other is listB I would like to take the values in listB and compare them with listA if any of them match then I what to create a new list listC and put the values that match in it. If they do not match I want the values to go into listD. I have been messing with this for three days and have not been able to get it to work. I have used foreach statements and array_search but what ever I try I just can't seam to get it. What I need is something like below. Could somebody please help.
If LISTB MATCHES LISTA If NO Match LISTA LISTB Make LISTC Make LISTD
test1 test4 test4 test1 test2 test6 test6 test2 test3 test8 test8 test3 test4 test5 test5 test7 test6 test9 test7 test8 test9
-- Best regards, rdkurth mailto:rdkurthstarband.net
attached mail follows:
array_intersect() will give you listC directly. Just feed it list A and B. Then you can take a copy of listA and do a foreach on the array_keys() of listC and unset() them. Now this copy with the removed elements becomes your listD
-Rasmus
On Sun, 25 Aug 2002 rdkurth
starband.net wrote:
>
> I have two list one is listA and the other is listB I would
> like to take the values in listB and compare them with listA if any of
> them match then I what to create a new list listC and put the values
> that match in it. If they do not match I want the values to go into listD.
> I have been messing with this for three days and have not been able to get
> it to work. I have used foreach statements and array_search but what ever
> I try I just can't seam to get it. What I need is something like below.
> Could somebody please help.
>
>
> If LISTB MATCHES LISTA If NO Match
> LISTA LISTB Make LISTC Make LISTD
>
>
> test1 test4 test4 test1
> test2 test6 test6 test2
> test3 test8 test8 test3
> test4 test5
> test5 test7
> test6 test9
> test7
> test8
> test9
>
>
> --
> Best regards,
> rdkurth mailto:rdkurth
starband.net
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
attached mail follows:
Hello Rasmus,
Ok I understand the array_intersect and have gotten that to work. I just don't understand the second part using the foreach and unset().
this is what I have it gives me three separate list
$listA="tester1 tester2 tester3 tester4 tester5 tester6 tester7 tester8 tester9"; $listB="tester4 tester6 tester8";
$arraylistA=explode(" ",$listA); $arraylistB=explode(" ",$listB);
$result = array_intersect ($arraylistA, $arraylistB);
foreach($arraylistA as $valueA){ echo "ValueA: $valueA<br>\n"; } echo "<br>"; foreach($arraylistB as $valueB){ echo "ValueB: $valueB<br>\n"; } echo "<br>"; foreach($result as $valueC){ echo "ValueC: $valueC<br>\n"; }
Sunday, August 25, 2002, 4:48:36 PM, you wrote:
RL> array_intersect() will give you listC directly. Just feed it list A and RL> B. Then you can take a copy of listA and do a foreach on the array_keys() RL> of listC and unset() them. Now this copy with the removed elements RL> becomes your listD
RL> -Rasmus
RL> On Sun, 25 Aug 2002 rdkurth
starband.net wrote:
>>
>> I have two list one is listA and the other is listB I would
>> like to take the values in listB and compare them with listA if any of
>> them match then I what to create a new list listC and put the values
>> that match in it. If they do not match I want the values to go into listD.
>> I have been messing with this for three days and have not been able to get
>> it to work. I have used foreach statements and array_search but what ever
>> I try I just can't seam to get it. What I need is something like below.
>> Could somebody please help.
>>
>>
>> If LISTB MATCHES LISTA If NO Match
>> LISTA LISTB Make LISTC Make LISTD
>>
>>
>> test1 test4 test4 test1
>> test2 test6 test6 test2
>> test3 test8 test8 test3
>> test4 test5
>> test5 test7
>> test6 test9
>> test7
>> test8
>> test9
>>
>>
>> --
>> Best regards,
>> rdkurth mailto:rdkurth
starband.net
>>
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
-- Best regards, rdkurth mailto:rdkurthstarband.net
attached mail follows:
$lista=array(1,2,3,4,5,6,7,8,9); $listb=array(4,6,8); $listc=array_intersect($lista,$listb); $listd=array_diff($lista,$listb);
Op maandag 26 augustus 2002 01:48, schreef Rasmus Lerdorf:
> array_intersect() will give you listC directly. Just feed it list A and
> B. Then you can take a copy of listA and do a foreach on the array_keys()
> of listC and unset() them. Now this copy with the removed elements
> becomes your listD
>
> -Rasmus
>
> On Sun, 25 Aug 2002 rdkurth
starband.net wrote:
> > I have two list one is listA and the other is listB I would
> > like to take the values in listB and compare them with listA if any of
> > them match then I what to create a new list listC and put the values
> > that match in it. If they do not match I want the values to go into
> > listD. I have been messing with this for three days and have not been
> > able to get it to work. I have used foreach statements and array_search
> > but what ever I try I just can't seam to get it. What I need is something
> > like below. Could somebody please help.
> >
> >
> > If LISTB MATCHES LISTA If NO Match
> > LISTA LISTB Make LISTC Make LISTD
> >
> >
> > test1 test4 test4 test1
> > test2 test6 test6 test2
> > test3 test8 test8 test3
> > test4 test5
> > test5 test7
> > test6 test9
> > test7
> > test8
> > test9
> >
> >
> > --
> > Best regards,
> > rdkurth mailto:rdkurth
starband.net
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
Does anyone know if there is a native function within PHP to convert numbers to roman numerals?
I could easily write a little convertor, but I was hoping there was an simple function - although I couldn't seem to find anything like that in the manual.
Dave
attached mail follows:
Hey all,
I need to restart apache using PHP. Is this possible? Or, ar least apply a modified config file...
PHP is running as nobody:nobody as is Apache.
Thanks, Liam
attached mail follows:
Hi !
there is no way to apply a config file to apache without restarting the webserver.... the only way I know (which really does not mean that it is the only one !), is to use the command "apachctl" or "httpd". But those command need to be launched as root, I think (try to login as root, then to a "su nobody", and try to launch apache like this. If it works, then a simple exec("apachctl restart") should be enough, check the syntax of exec() there : http://www.php.net/exec ).
If you need to be root to start apache, then you'll need to either build a script that changes user to root, and lauches "apachectl restart" once logged ( try the "sudo" command in your shell, it is available in any linux distribution, or try freshmeat.net ), or use the setuid bit so that any user can start httpd with root provilege (which would work but wouldn't be recommende. "man chmod" to know more about this).
regards
Eric
"Liam Mackenzie" <phplist
operationenigma.com> a écrit dans le message de
news: 008f01c24c98$895404c0$0e00a8c0
luke...
> Hey all,
>
> I need to restart apache using PHP. Is this possible?
> Or, ar least apply a modified config file...
>
> PHP is running as nobody:nobody as is Apache.
>
> Thanks,
> Liam
>
>
>
attached mail follows:
Yes, you can make Apache reload a config file without restarting. You must send it a SIGHUP:
kill -HUP `cat /var/run/httpd.pid`
If you execute this as nobody, I believe it will work, but I haven't tested it.
Also, I believe Apache will restart when given a "kill -1". If the above suggestions works, so will this.
Happy hacking.
Chris
Eric Pignot wrote:
>there is no way to apply a config file to apache without restarting the
>webserver....
>
>"Liam Mackenzie" <phplist
operationenigma.com> a écrit dans le message de
>news: 008f01c24c98$895404c0$0e00a8c0
luke...
>
>
>>I need to restart apache using PHP. Is this possible?
>>Or, ar least apply a modified config file...
>>
attached mail follows:
Help!
I am getting the following error message for : <? $link=mysql_connect("localhost","$user","$pass"); // line 34 ?>
Fatal error: Call to undefined function: mysql_connect() in /home/www/test.somename.org/aux/db-mod.php on line 34
I have used this call successfully on php v4.0.6, and am now trying it on a new install (which someone else did, as I haven't a clue in setting up a server) which is v4.1.1. Is mysql_connect a defunct command, or do I need to do something to enable its use?
Thanks for any help. Hugh
attached mail follows:
> >Help! > >I am getting the following error message for : ><? > $link=mysql_connect("localhost","$user","$pass"); // line 34 >?> > >Fatal error: Call to undefined function: mysql_connect() in /home/www/test.somename.org/aux/db-mod.php on line 34 > >I have used this call successfully on php v4.0.6, and am now trying it on a new install (which someone else did, as I haven't a clue in setting up a server) which is v4.1.1. Is mysql_connect a defunct command, or do I need to do something to enable its use?
Perhaps, if you check the manual you'll see if a certain function is already "defunct".
Checking mysql_connect() here,
http://www.php.net/manual/en/function.mysql-connect.php
shows that it's even "better" than before.
So, most probably, when the person who set up the server didn't include mysql support in php. It'd be better to ask the person to enable it.
BTW, you can do phpinfo() and see if mysql support is enabled or not. (Of course, you also need to check IF MySQL is even installed...)
- E
> >Thanks for any help. >Hugh > > > > > >
_________________________________________________________________ $B2q0wEPO?$OL5NA!&=<<B$7$?=PIJ%"%$%F%`$J$i(B MSN $B%*!<%/%7%g%s(B http://auction.msn.co.jp/
attached mail follows:
I am showing a directory of files and I don't what all the files to show on the screen. I was able to get the . and the .. not to show with what I have below but there are some other files in there that look like this mylist.confg. I don't want them to show in the directory list. I tried && $files != "*.config" but this did not work . Anybody have an suggestions
if ($handle = opendir('/path/to/list/directory')) { while (false !== ($files = readdir($handle))) { if ($files != "." && $files != "..") { echo $files; }
-- Best regards, rdkurth mailto:rdkurthstarband.net
attached mail follows:
There are several regular expression and string matching functions you could use.
http://www.php.net/manual/en/ref.strings.php http://www.php.net/manual/en/ref.pcre.php http://www.php.net/manual/en/ref.regex.php
Justin Garrett
<rdkurth
starband.net> wrote in message
news:176159517453.20020825202955
starband.net...
> I am showing a directory of files and I don't what all the files to
> show on the screen. I was able to get the . and the .. not to show
> with what I have below but there are some other files in there that look
> like this mylist.confg. I don't want them to show in the directory
> list. I tried && $files != "*.config" but this did not work .
> Anybody have an suggestions
>
> if ($handle = opendir('/path/to/list/directory')) {
> while (false !== ($files = readdir($handle))) {
> if ($files != "." && $files != "..") {
> echo $files;
> }
>
>
>
> --
> Best regards,
> rdkurth mailto:rdkurth
starband.net
>
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]