Re: [PHP] Message Post with File Attachment
Search the manual for "File Uploads"... there's an excellent code example, plus user-cont notes, etc etc. In other words, read the manual before asking :) Justin French on 25/08/02 5:27 AM, JohnP ([EMAIL PROTECTED]) wrote: > > Ok gang here is the problem - I need to allow the user to post a message with > a title and allow them to upload a file as well - the message and title need > to post to the db which is pretty cut and dry but since I have never worked > with uploading before I do not know how to allow the user to upload files - > can anyone help? Right now I have a form setup with all three fields but I'm > not sure where to go from here? Thanks - > JohnP > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Open a new window by code
*sigh* This gets asked EVERY DAY on the list. 1. search the archives before posting 2. PHP is server-side, so there's no way it can interact with the client-side... try javascript Justin French on 25/08/02 4:38 PM, Alva Chew ([EMAIL PROTECTED]) wrote: > Hi, > > Does anyone know how can i open a new browser window by PHP code? > > Thanks and regards. > Alva Chew > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: Re[4]: [PHP] Pulling data out of browser address bar
try $REQUEST_URI The URI which was given in order to access this page; for instance, '/index.html'. Paul Roberts http://www.paul-roberts.com [EMAIL PROTECTED] - Original Message - From: <[EMAIL PROTECTED]> To: "php-general" <[EMAIL PROTECTED]> Sent: Friday, August 23, 2002 10:54 PM Subject: Re[4]: [PHP] Pulling data out of browser address bar > This is close to what I want but I don't what to redirect them I just > want to get what is in the URL so I can but it in a variable to use on > the web page. I have a lot of domain names all pointing to one domain > and I want to be able to put "WELCOME TO TheDomannamethaytypedin.com" at the top of > the page depending on what domain they typed into the URL. They will > not be coming from another page they will most likely be typing the > URL in > > Friday, August 23, 2002, 2:22:21 PM, you wrote: > > > SJNHBe> This probably isn't doing what you want but it will illustrate how to get > SJNHBe> the location. > > SJNHBe> > SJNHBe> > > SJNHBe> > > SJNHBe> Bascially you call checklocation with the url they should be at, if they > SJNHBe> aren't at that url it will redirect them to their URL. > > SJNHBe> I use this script by placing and onLoad event in the tag, an example > SJNHBe> is SJNHBe> onLoad="checklocation('http://www.yoursite.com/login.php')"> > > > SJNHBe> I created this script because some people were only going to yoursite.com > SJNHBe> instead of www.yoursite.com, this caused sessions not to work because the > SJNHBe> browser was not sending the cookies with the request because the cookies > SJNHBe> were for www.yoursite.com. > > SJNHBe> Jason > SJNHBe> -Original Message- > SJNHBe> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] > SJNHBe> Sent: Friday, August 23, 2002 3:24 PM > SJNHBe> To: php-general > SJNHBe> Subject: Re[2]: [PHP] Pulling data out of browser address bar > > SJNHBe> Hello Kevin, > SJNHBe> I don't what to know where that came from I what to know what is in > SJNHBe> the Address bar of the browser. They might not be coming from anywhere > SJNHBe> they might have just typed the url in. I will look at doing it with > SJNHBe> Javascript > > SJNHBe> Friday, August 23, 2002, 1:21:10 PM, you wrote: > > > KS>> You can do it with Javascript but there's no need. $HTTP_REFERER is > SJNHBe> what > KS>> you want. It'll tell you where your users are coming from. So you'll > SJNHBe> know > KS>> if they have been redirected from one your other domains. > KS>> -Kevin > > KS>> - Original Message - > KS>> From: <[EMAIL PROTECTED]> > KS>> To: "php-general" <[EMAIL PROTECTED]> > KS>> Sent: Friday, August 23, 2002 2:19 PM > KS>> Subject: [PHP] Pulling data out of browser address bar > > > >>> Is there any way to tell what was typed in the browser to get to the > >>> web page. > >>> What I have is domain names that forward to a main domain and I > >>> want to know what they typed in the browser to get to the main domain. > >>> The way it is forwarded the browser retains what ever was typed > >>> in the address bar. How can I pull what was typed into the address bar > >>> this info into the web page. > >>> > >>> > >>> > >>> -- > >>> Best regards, > >>> rdkurth mailto:[EMAIL PROTECTED] > >>> > >>> > >>> -- > >>> PHP General Mailing List (http://www.php.net/) > >>> To unsubscribe, visit: http://www.php.net/unsub.php > >>> > > > > > > > > > -- > Best regards, > rdkurthmailto:[EMAIL PROTECTED] > > > -- > 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
[PHP] Apache module failure
root@epona:/etc# apachectl start Syntax error on line 14 of /etc/httpd.conf: Cannot load /usr/lib/libphp4.so into server: /usr/lib/libphp4.so: undefined symbol: alloc_globals /usr/sbin/apachectl start: httpd could not be started root@epona:/etc# head -n 14 /etc/httpd.conf | tail -n 1 LoadModule php4_module lib/libphp4.so Installation process used: ./configure --prefix=/usr --sysconfdir=/etc --without-mysql --with-pgsql --enable-memory-limit --with-zlib --with-bz2 --with-openssl --with-config-file-path=/etc --enable-track-vars --enable-bcmath --enable-calendar --with-gdbm --with-gmp --with-apxs=/usr/sbin/apxs && make && make install PHP version: 4.2.2 Apache version: 1.3.26 compiled as follows: ./configure --prefix=/usr --sysconfdir=/etc --mandir=/usr/share/man --localstatedir=/var --libexecdir=/usr/lib --datadir=/var/www/default --with-layout=GNU --enable-module=so --enable-module=speling --enable-module=unique_id --enable-module=usertrack --enable-module=vhost_alias --enable-module=log_agent --enable-module=info && make && make install root@epona:/etc# ldd /usr/lib/libphp4.so libdl.so.2 => /lib/libdl.so.2 (0x4016a000) libpq.so.2 => /usr/lib/libpq.so.2 (0x4016e000) libgmp.so.3 => /usr/lib/libgmp.so.3 (0x40182000) libgdbm.so.2 => /usr/lib/libgdbm.so.2 (0x401bb000) libbz2.so.1.0 => /lib/libbz2.so.1.0 (0x401c1000) libz.so.1 => /usr/lib/libz.so.1 (0x401d1000) libcrypt.so.1 => /lib/libcrypt.so.1 (0x401e2000) libssl.so.0.9.6 => /usr/lib/libssl.so.0.9.6 (0x4020f000) libcrypto.so.0.9.6 => /usr/lib/libcrypto.so.0.9.6 (0x4024) libresolv.so.2 => /lib/libresolv.so.2 (0x4030f000) libm.so.6 => /lib/libm.so.6 (0x40322000) libnsl.so.1 => /lib/libnsl.so.1 (0x40345000) libc.so.6 => /lib/libc.so.6 (0x4035b000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x8000) I would much rather be using Apache 2.0.40, however PHP would not build at all with --with-apxs2=/usr/sbin/apxs on another machine with Apache 2.0.40 installed. In any case, I really need to get something working. Any advice is appreciated. -- Casey Allen Shobe / Network Security Analyst & PHP Developer SecureWorks, Inc. / 404.327.6339 x169 / Fax: 404.728.0144 [EMAIL PROTECTED] / http://www.secureworks.net Content is my own and does not necessarily represent my company. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Additional: [PHP] Apache module failure
On Sunday 25 August 2002 06:10 am, Casey Allen Shobe wrote: > I would much rather be using Apache 2.0.40, however PHP would not build at > all with --with-apxs2=/usr/sbin/apxs on another machine with Apache 2.0.40 > installed. I was stupid in saying that without mentioning any further detail...here follows what I should have mentioned previously: package php:/usr/src/php/php-4.2.2> ./configure --prefix=/usr --sysconfdir=/etc --without-mysql --with-pgsql --enable-memory-limit --with-zlib --with-bz2 --with-openssl --with-config-file-path=/etc --enable-track-vars --enable-bcmath --enable-calendar --with-gdbm --with-gmp --with-apxs2=/usr/sbin/apxs [...configure completes successfully...] package php:/usr/src/php/php-4.2.2> make [...snip...] Making all in apache2filter make[2]: Entering directory `/usr/src/php/php-4.2.2/sapi/apache2filter' make[3]: Entering directory `/usr/src/php/php-4.2.2/sapi/apache2filter' /bin/sh /usr/src/php/php-4.2.2/libtool --silent --mode=compile gcc -I. -I/usr/src/php/php-4.2.2/sapi/apache2filter -I/usr/src/php/php-4.2.2/main -I/usr/src/php/php-4.2.2 -I/usr/include/apache2 -I/usr/src/php/php-4.2.2/Zend -I/usr/src/php/php-4.2.2/ext/xml/expat -D_REENTRANT -I/usr/src/php/php-4.2.2/TSRM -O3 -march=i686 -mcpu=i686 -funroll-loops -ffast-math -pthread -DZTS -prefer-pic -c sapi_apache2.c sapi_apache2.c: In function `php_register_hook': sapi_apache2.c:534: warning: passing arg 3 of `ap_register_output_filter' makes pointer from integer without a cast sapi_apache2.c:534: too few arguments to function `ap_register_output_filter' sapi_apache2.c:535: warning: passing arg 3 of `ap_register_input_filter' makes pointer from integer without a cast sapi_apache2.c:535: too few arguments to function `ap_register_input_filter' make[3]: *** [sapi_apache2.lo] Error 1 make[3]: Leaving directory `/usr/src/php/php-4.2.2/sapi/apache2filter' make[2]: *** [all-recursive] Error 1 make[2]: Leaving directory `/usr/src/php/php-4.2.2/sapi/apache2filter' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/usr/src/php/php-4.2.2/sapi' make: *** [all-recursive] Error 1 package php:/usr/src/php/php-4.2.2> Again, thanks in advance for any advice. -- Casey Allen Shobe / Network Security Analyst & PHP Developer SecureWorks, Inc. / 404.327.6339 x169 / Fax: 404.728.0144 [EMAIL PROTECTED] / http://www.secureworks.net Content is my own and does not necessarily represent my company. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] need to find a way to remove similar keys
hi i am trying to find a possible way to remove similar id keys and pass back just each different one , for example i have a photo gallery each photo has a userID key of who the photo was taken by i would like to grab all the id for each photo and pass back just one result of the different people who have taken the photos so i append them all like 1, 1, 1, 1, 2, 1, 2, 1, 3 and i just want to get back 1, 2, 3 keys? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: need to find a way to remove similar keys
sorry i found array_unique , so then how could i append the keys out of mysql bak into one array ? "Electroteque" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > hi i am trying to find a possible way to remove similar id keys and pass > back just each different one , for example i have a photo gallery each photo > has a userID key of who the photo was taken by i would like to grab all the > id for each photo and pass back just one result of the different people who > have taken the photos > > so i append them all like 1, 1, 1, 1, 2, 1, 2, 1, 3 and i just want to get > back 1, 2, 3 keys? > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] GD lib. image quality!
Hello! I wrote a little script for generation thumbnails of larger images $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 "Image ".$targetPath."/".$thumbNamePrefix."_thumb.jpg"." created successfully!"; 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] Re: need to find a way to remove similar keys
never mind SELECT DISTINCT u.user_name, u.email, p.userID FROM user u LEFT JOIN photos p on p.userID=u.user_id WHERE p.galleryID='$galleryID' heh "Electroteque" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > hi i am trying to find a possible way to remove similar id keys and pass > back just each different one , for example i have a photo gallery each photo > has a userID key of who the photo was taken by i would like to grab all the > id for each photo and pass back just one result of the different people who > have taken the photos > > so i append them all like 1, 1, 1, 1, 2, 1, 2, 1, 3 and i just want to get > back 1, 2, 3 keys? > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Count number of rows in table.
And do I need to use any other functions like mysql_fetch_row() ? "Martín marqués" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]... > On Sáb 24 Ago 2002 11:19, Tony Harrison wrote: > > How would I count the number of rows in a mysql table with a WHERE clause? > > select count(*) from table_name WHERE . > > Saludos... :-) > > -- > Porqué usar una base de datos relacional cualquiera, > si podés usar PostgreSQL? > - > Martín Marqués |[EMAIL PROTECTED] > Programador, Administrador, DBA | Centro de Telematica >Universidad Nacional > del Litoral > - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] problem with using link variables
Hello, I am sending variables via a link to another page eg. $provservdesc If the variable provnum contains text such as: hello & there Then only the word hello is passed on to agencydet.php. I have tried using htmlspecialchars and htmlentities but still I have the same problem. What I am trying to achieve is to be able to display hello & there on the agencydet.php page when it is shown in the browser. Thanks, Ivan
Re: [PHP] problem with using link variables
> If the variable provnum contains text such as: hello & there urlencode($provnum); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: problem with using link variables
See the URL functions at http://www.php.net/manual/en/ref.url.php IMHO, you'd need some encoding Arcadius "Ivan Carey" <[EMAIL PROTECTED]> wrote in message 006b01c24c2f$8d291950$0201a8c0@ivan">news:006b01c24c2f$8d291950$0201a8c0@ivan... Hello, I am sending variables via a link to another page eg. $provservdesc If the variable provnum contains text such as: hello & there Then only the word hello is passed on to agencydet.php. I have tried using htmlspecialchars and htmlentities but still I have the same problem. What I am trying to achieve is to be able to display hello & there on the agencydet.php page when it is shown in the browser. Thanks, Ivan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] known bugs in current CHM, contribution appreciated!
Hi! I would like to ask you guys again, who have problems with the current CHM edition to help us make all them go away. We already corrected the example display problem, but some guys reported bugs about the context menu positioning and the page display process also has some bugs in IE6. The bug descriptions and contribution requests are available at http://weblabor.hu/php-doc-chm/#knownbugs Please contribute to this great project if you have some JS experience and the appropriate software to test. I am not going to upgrade to IE6 myself, that is for sure, sorry. As far as I can see, the context menu positioning is OK logically, but some reports keep posted to the CHM list. The page display problems are simply bugs in IE, and we need to find a workaround. For those who tested iframetests.zip I have released a new version so please test again! Thanks for your help and contribution to the PHP community, Goba -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Count number of rows in table.
>>> On Sáb 24 Ago 2002 11:19, Tony Harrison wrote: >>> How would I count the number of rows in a mysql table with a WHERE >>> clause? > > >> "Martín marqués" <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED]... > > select count(*) from table_name WHERE . > > >From: "Tony Harrison" <[EMAIL PROTECTED]> > Sent: Saturday, August 24, 2002 5:54 PM > Subject: Re: [PHP] Count number of rows in table. > > And do I need to use any other functions like mysql_fetch_row() ? > Yes. It's a regular sql statement, so you must fetch the results. $sql = "select count(*) from table_name WHERE ."; $result = mysql_query($sql) or die(mysql_error); $row = mysql_fetch_row($result); $rowCount=$row[0]; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Count number of rows in table.
> $sql = "select count(*) from table_name WHERE ."; > $result = mysql_query($sql) or die(mysql_error); > $row = mysql_fetch_row($result); > $rowCount=$row[0]; or $sql = "select count(*) from table_name WHERE ."; $result = mysql_query($sql) or die(mysql_error); $rowCount=mysql_result($result); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] uploading problems...please help
On Sunday 25 August 2002 05:53, Brian & Shannon Windsor wrote: > I'm trying to upload files from my PC to my website. The code is a little > nuts, but it's all I got to work locally, butonce I take the code to the > web I get this message. Can anyone tell me what I'm doing wrong? > > I'm trying to upload a file, strip all the information so as to just use > the name of the file to store in the database. I'm using explode and > array_pop for this, but I'm sure there's a better way. The problem seems > to be in writing the file to the web server. I changed the permissions on > the directories, so I don't think that's the problem. Please help. Why is it that everyone likes to write their own upload routine? There is a perfectly good example in the manual that (a) works, (b) shows how it _should_ be done. Try using that as a starting point and adapt it to your particular situation. -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* Many people are desperately looking for some wise advice which will recommend that they do what they want to do. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Count number of rows in table.
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"; >> $sql = "select count(*) from table_name WHERE ."; >> $result = mysql_query($sql) or die(mysql_error); >> $row = mysql_fetch_row($result); >> $rowCount=$row[0]; > or > $sql = "select count(*) from table_name WHERE ."; > $result = mysql_query($sql) or die(mysql_error); > $rowCount=mysql_result($result); > > -- > 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
Re: [PHP] register globals on in stand alone php installation?
On Saturday 24 August 2002 16:52, Andy wrote: > I do have a command line php version installed and I need to switch > register globals to on for this install. Where do I find this php.ini > regarding this installation. There is also a web-php installation running > where I do have a php.ini for. I hope there is a way to seperate those two > installations. When you configure/compile php you can specify where you want php to look for php.ini. -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* Nobody knows what goes between his cold toes and his warm ears. -- Roy Harper */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Dynamically Downloading Data
Randy, Try using a View, or a Temp Table in your database. This keeps the data "available" in a specified form. Best regards, Andrew Hill OpenLink Software On Sunday, August 25, 2002, at 12:23 AM, Randy Johnson wrote: > Hello, > > Is it possible to select data from a database and have it be available > for > download without actually creating a file on the server? > > Randy > > > > -- > 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
Re: [PHP] Count number of rows in table.
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
[PHP] trouble with function
Hi, This is the first time I've REALLY tackled multi-dimensional arrays, in conjunctions with functions. I like the way this code works: So I built a function which returns a multi-dimensional array: $v) { $$k = $v; } $songs["$id"] = array( 'title' => "$title", 'writers' => "$writers", 'video' => "$video", 'artist_id' => "$artist_id" ); } return $songs; } } ?> I can then do: ... and it prints the results I'm expecting. All good. However, I was hoping to use it in a similar way that I use mysql in the above code... something like: But it's just running through an infinite loop. Perhaps mysql_fetch_array() is doing something magic??? Perhaps I need to return something different in my function? I guess I could do it as a foreach()... Justin French -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: GD lib. image quality!
its not a gd 2 issue , i cant even get gd2 to compile with php 4.2.2, no idea why i've installed gd2 fine imageJpeg($thumbnail, $targetPath."/".$thumbNamePrefix."_thumb.jpg",100); that'll give it a quality of 100 , even still i notice its pretty bad , i need to use the bicubicresampled gd2 function just need it compiled correctly , how did you get gd2 to work ? "Arcadius A." <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hello! > I wrote a little script for generation thumbnails of larger images > > $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 "Image ".$targetPath."/".$thumbNamePrefix."_thumb.jpg"." > created successfully!"; > > > > 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
Re: [PHP] trouble with function
Everytime you call the function, it re-runs the sql, and gives you the same list. The only time it wouldn't do that was if the id wasn't found. You could probably change the function to a class, where the constuctor ran the sql, and then you had another method to get the next entry. - Original Message - From: "Justin French" <[EMAIL PROTECTED]> To: "php" <[EMAIL PROTECTED]> Sent: Sunday, August 25, 2002 11:12 AM Subject: [PHP] trouble with function > Hi, > > This is the first time I've REALLY tackled multi-dimensional arrays, in > conjunctions with functions. > > I like the way this code works: > > $sql = "select from"; > $result = mysql_result($sql); > while($myrow = mysql_fetch_array($result)) > { > echo $myrow['colname']; > } > ?> > > So I built a function which returns a multi-dimensional array: > > function getSongByArtist($artist_id,$order='title ASC') > { > > $sql = " > SELECT * > FROM songs > WHERE artist_id='{$artist_id}' > ORDER BY {$order} > "; > $result = mysql_query($sql); > if(!$result) > { > return 0; > } > else > { > while($myrow = mysql_fetch_array($result)) > { > foreach($myrow as $k => $v) > { $$k = $v; } > > $songs["$id"] = array( > 'title' => "$title", > 'writers' => "$writers", > 'video' => "$video", > 'artist_id' => "$artist_id" > ); > } > return $songs; > } > } > ?> > > I can then do: > $songs = getSongByArtist(4); > print_r($song); > ?> > ... and it prints the results I'm expecting. All good. > > > However, I was hoping to use it in a similar way that I use mysql in the > above code... something like: > while($song = getSongByArtist(4)) > { > echo song['title']; > echo song['writers']; > echo song['video']; > echo song['artist_id']; > } > ?> > > But it's just running through an infinite loop. Perhaps mysql_fetch_array() > is doing something magic??? Perhaps I need to return something different in > my function? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Attachements
Fongming schrieb: > Hi: > > the following is my easy way to send MIME mail with a > attach files. It worked for my own mailing system. > > //---Make sure if a file upload or not... > > if(!empty($my_file)) > { > > copy($my_file,"files/$my_file_name"); > $fp=fopen("files/$my_file_name","r"); > //---compose the > MIME > > $version="MIME-Version: 1.0 \n"; //declair the version > $boundary ="b".md5(uniqid(time())); //make the boundary > $body_message=$content.$bottom."\n\n--$boundary \n"; > $my_add_file="Content-Type: ".$my_file_type.";\n > name=\"".$my_file_name."\"\n". > "Content-Disposition: attachment; \n > filename=\"$my_file_name\" \n". > "Content-Transfer-Encoding: base64 \n\n"; > $the_file_content= chunk_split(base64_encode(fread > ($fp,filesize("files/$my_file_name"; > //use base64 method to encode the file. > $my_add_file .= $the_file_content; //the file > content added. > > // > $the_part="Content-Type: multipart/mixed; ". > "boundary = $boundary \n\n". > "This is a MIME encoded mesaage. \n\n-- > $boundary\n\n"; > $the_part2="Content-Type: multipart/alternative; ". > " boundary = $boundary ". > " \n\n--$boundary"; > > $mime .="From: ".$main_address."\n"; > $mime .="Cc: ".$other_address."\n"; > $mime .=$version; > $mime .=$the_part; > $mime .=$body_message; > $mime .=$my_add_file; > $mime .="--$boundary-- \n"; > > mail($main_address,$title,"",$mime); > ?> > > alert("you succeed to send a MIME mail"); > location.href="list.php"; > > } > > - > This mail sent through IMP: http://web.horde.org/imp/ Looks like a have to have a directory with write permissions where people can upload their files to. Isn't that sort of a security risk? Olli -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] trouble with function
On Mon, 26 Aug 2002 01:12:56 +1000, you wrote: >However, I was hoping to use it in a similar way that I use mysql in the >above code... something like: >while($song = getSongByArtist(4)) >{ >echo song['title']; >echo song['writers']; >echo song['video']; >echo song['artist_id']; >} >?> > >But it's just running through an infinite loop. Perhaps mysql_fetch_array() >is doing something magic??? Perhaps I need to return something different in >my function? Your function (which I've snipped for space considerations) is populating a multidimensional array with an entire result set. So if your artist as 4 songs, you'll get a 2 dimensional array where the first dimension has 4 elements. (For that reason, your function really needs to be caled getsongSbyartist, since it gets all the songs an artist has.) In the code above you want to treat your function as if it's returning a one dimensional array containing only one row from the result set. You're right, you could get the return value from your function, then use: $songs = getSongByArtist(4); foreach($songs as $id => $song) { echo song['title']; ... } But if you really want to use it in a similar fashion to the way mysql_fetch_array() works, you're going to have to change what your function returns. You can use a static variable to store the state of the result set inside your function, and only return one row at a time. For example: static $myrow; if($myrow = mysql_fetch_array($result)) { foreach($myrow as $k => $v) { $$k = $v; } $song = array ( 'title' => ...); return $song; } else { return false; } That way your function remembers the position of the result set between calls, and returns one song at a time, until there are no more left, and then it returns false. I haven't tested the above, but it should behave the way you expect. HTH -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
php-general Digest 25 Aug 2002 15:45:34 -0000 Issue 1546
php-general Digest 25 Aug 2002 15:45:34 - Issue 1546 Topics (messages 114024 through 114058): Dynamically Downloading Data 114024 by: Randy Johnson 114052 by: salamander Re: Base64 and MS Word cutting and pasting. 114025 by: Manuel Lemos Re: Recent discovered mail security bug in php 114026 by: Manuel Lemos 114027 by: Randy Johnson 114030 by: Manuel Lemos Re: moving content from one database to another, help 114028 by: Richard Lynch Session woes 114029 by: Matthew Nock Open a new window by code 114031 by: Alva Chew 114032 by: Dan Harrington 114034 by: Justin French Re: Message Post with File Attachment 114033 by: Justin French Re: Pulling data out of browser address bar 114035 by: Paul Roberts Apache module failure 114036 by: Casey Allen Shobe Additional: [PHP] Apache module failure 114037 by: Casey Allen Shobe need to find a way to remove similar keys 114038 by: electroteque 114039 by: electroteque 114041 by: electroteque GD lib. image quality! 114040 by: Arcadius A. 114055 by: electroteque Re: Count number of rows in table. 114042 by: Tony Harrison 114047 by: Matt 114048 by: Bas Jobsen 114050 by: salamander 114053 by: Jason Wong problem with using link variables 114043 by: Ivan Carey 114044 by: Bas Jobsen 114045 by: Arcadius A. known bugs in current CHM, contribution appreciated! 114046 by: Gabor Hojtsy Re: uploading problems...please help 114049 by: Jason Wong Re: register globals on in stand alone php installation? 114051 by: Jason Wong trouble with function 114054 by: Justin French 114056 by: Matt 114058 by: Michael Sims Re: Attachements 114057 by: Oliver Witt 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 --- Hello, Is it possible to select data from a database and have it be available for download without actually creating a file on the server? Randy --- End Message --- --- Begin Message --- Randy, Try using a View, or a Temp Table in your database. This keeps the data "available" in a specified form. Best regards, Andrew Hill OpenLink Software On Sunday, August 25, 2002, at 12:23 AM, Randy Johnson wrote: > Hello, > > Is it possible to select data from a database and have it be available > for > download without actually creating a file on the server? > > Randy > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > --- End Message --- --- Begin Message --- Hello, On 08/24/2002 07:17 PM, Dennis Moore wrote: > I have an application which uses the 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 . 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? You should not be using base64 but rather quoted-printable with the right character encoding headers. If you do not know how to do it, take a look at this class and examples to see how to specify the encoding: http://www.phpclasses.org/mimemessage -- Regards, Manuel Lemos --- End Message --- --- Begin Message --- Hello. On 08/24/2002 04:32 PM, Robert Mena wrote: > Hi, > > After reading the security announcement I'd like to > know two things : What security announcement? > > a) If i use another MTA (such as qmail) am I still > vulnerable ? > > b) What's the impact of the second vulnerability > (called open relay) ? This sounds like an e-mail setup problem, not something to do with PHP. -- Regards, Manuel Lemos --- End Message --- --- Begin Message --- He may be referring to this: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Product: PHP Version: 4.x up to 4.2.2 Vendor: http://www.php.net/ Author: Wojciech Purczynski <[EMAIL PROTECTED]> Date: June 13, 2002 Updated: August 23, 2002 Released: August 21, 2002 Issue: == Two vulnerabilities exists in mail() PHP function. The first one allows to execute any program/script bypassing safe_mode restriction, the second one may give an open-relay sc
Re: [PHP] trouble with function
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
Re: [PHP] Base64 and MS Word cutting and pasting.
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" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> 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 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 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 . 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] test ;)
Just wanna test this list.
Re: [PHP] trouble with function
Thanks for all your help :) Justin on 26/08/02 1:55 AM, Michael Sims ([EMAIL PROTECTED]) 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 > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] register_globals off or on, why on
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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] register_globals off or on, why on
> 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
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: 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: Thumbnail Generator' .'' .''; ?> 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:[EMAIL PROTECTED]] Sent: Sunday, August 25, 2002 4:11 AM To: [EMAIL PROTECTED] Subject: [PHP] GD lib. image quality! Hello! I wrote a little script for generation thumbnails of larger images $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 "Image ".$targetPath."/".$thumbNamePrefix."_thumb.jpg"." created successfully!"; 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
[PHP] MySQL PASSWORD() Question
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? - [EMAIL PROTECTED] http://www.cool-palace.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] if/else & mail() problem..
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: \r\n" ."From: me \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 = "$file wasn't sent due to an error.."; } } else{ $info = "I do not accept $type type files.."; } } else{ $info = "Only files up to $size_limit bytes accepted.."; } } $info .="\n"; } echo $info; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: if/else & mail() problem..
You need to give us the HTML for the form so we can comprehend the context of it all "Eriol" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > 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: \r\n" > ."From: me \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 = "$file wasn't sent due to an error.."; > } > } > else{ > $info = "I do not accept $type type files.."; > } > } > else{ > $info = "Only files up to $size_limit bytes accepted.."; > } > } > $info .="\n"; > } > echo $info; > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: if/else & mail() problem..
Sorry, I didn't figure it was needed, but here is the html info as requested.. Thanks.. Name: Email: " class="file"/> Upload: [ Information ] Message: Take care.. peace.. eriol "Tony Harrison" <[EMAIL PROTECTED]> disgorged: : You need to give us the HTML for the form so we can comprehend the context : of it all -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] GD lib. image quality!
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 [EMAIL PROTECTED] -- AC Host Canada www.achost.ca - Original Message - From: "Dave at Sinewaves.net" <[EMAIL PROTECTED]> To: "Arcadius A." <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> 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 'Thumbnail Generator' > .'' > .''; > ?> > > 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:[EMAIL PROTECTED]] > Sent: Sunday, August 25, 2002 4:11 AM > To: [EMAIL PROTECTED] > Subject: [PHP] GD lib. image quality! > > > Hello! > I wrote a little script for generation thumbnails of larger images > > $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 "Image ".$targetPath."/".$thumbNamePrefix."_thumb.jpg"." > created successfully!"; > > > > 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
Re: [PHP] Count number of rows in table.
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 > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Count number of rows in table.
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. > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] upload file
This should be very simple but it isn't working. upload.html has this: and upload2.php has this: Where is the file?? Thanks __ Do You Yahoo!? Yahoo! Finance - Get real-time stock quotes http://finance.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: upload file
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" <[EMAIL PROTECTED]> disgorged: : upload.html has this: : : : : : : and : : upload2.php has this: : : : Where is the file?? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: if/else & mail() problem..
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" <[EMAIL PROTECTED]> 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] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] upload file
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
Re: [PHP] upload file
Thanks the quote wasn't the issue. Actually I shold have use $_FILE not $_POST . --- Chris Shiflett <[EMAIL PROTECTED]> 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] What's the trick ?
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, ", 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Can someone - anyone see my error?
Ok after being blasted for not looking on PHP.net first I have now returned none the wiser! :D Here is the post file: - Send this file: Here is the post handler file: 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
RE: [PHP] Can someone - anyone see my error?
> 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Help with matchng strings
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:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help with matchng strings
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 [EMAIL PROTECTED] 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:[EMAIL PROTECTED] > > > -- > 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
RE: [PHP] GD lib. image quality!
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 > [EMAIL PROTECTED] > -- > AC Host Canada > www.achost.ca > > - Original Message - > From: "Dave at Sinewaves.net" <[EMAIL PROTECTED]> > To: "Arcadius A." <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> > 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 'Thumbnail Generator' > > .'' > > .''; > > ?> > > > > 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:[EMAIL PROTECTED]] > > Sent: Sunday, August 25, 2002 4:11 AM > > To: [EMAIL PROTECTED] > > Subject: [PHP] GD lib. image quality! > > > > > > Hello! > > I wrote a little script for generation thumbnails of larger images > > > > $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 "Image ".$targetPath."/".$thumbNamePrefix."_thumb.jpg"." > > created successfully!"; > > > > > > > > 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 > > > > > > -- > > PH
[PHP] Numbers to Roman Numerals - Native PHP Function?
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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[2]: [PHP] Help with matchng strings
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\n"; } echo ""; foreach($arraylistB as $valueB){ echo "ValueB: $valueB\n"; } echo ""; foreach($result as $valueC){ echo "ValueC: $valueC\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 [EMAIL PROTECTED] 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:[EMAIL PROTECTED] >> >> >> -- >> PHP General Mailing List (http://www.php.net/) >> To unsubscribe, visit: http://www.php.net/unsub.php >> -- Best regards, rdkurthmailto:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help with matchng strings
$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 [EMAIL PROTECTED] 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:[EMAIL PROTECTED] > > > > > > -- > > 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
[PHP] Re: Can someone - anyone see my error?
I think you have to specify the destination file name as well. The destination directory is not enough. --- Seairth Jacobs [EMAIL PROTECTED] "Johnp" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Ok after being blasted for not looking on PHP.net first I have now returned none the wiser! :D Here is the post file: - Send this file: Here is the post handler file: 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Doing system things with PHP
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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Can someone - anyone see my error?
> > > Send this file: > > 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 : (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
[PHP] Re: Doing system things with PHP
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" <[EMAIL PROTECTED]> a écrit dans le message de news: 008f01c24c98$895404c0$[EMAIL PROTECTED] > 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 > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Can someone - anyone see my error?
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 [EMAIL PROTECTED] -- AC Host Canada www.achost.ca - Original Message - From: "Eric Pignot" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Sunday, August 25, 2002 7:24 PM Subject: [PHP] Re: Can someone - anyone see my error? > > > > > > Send this file: > > > > > > 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 : > > (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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Doing system things with PHP
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" <[EMAIL PROTECTED]> a écrit dans le message de >news: 008f01c24c98$895404c0$[EMAIL PROTECTED] > > >>I need to restart apache using PHP. Is this possible? >>Or, ar least apply a modified config file... >> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Call to undefined function mysql_connect()
Help! I am getting the following error message for : 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
[PHP] Only show certain files in directory
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:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Only show certain files in directory
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 <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > 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:[EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Call to undefined function mysql_connect()
> >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!&=
php-general Digest 26 Aug 2002 03:54:38 -0000 Issue 1547
php-general Digest 26 Aug 2002 03:54:38 - 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: [EMAIL PROTECTED] To unsubscribe from the digest, e-mail: [EMAIL PROTECTED] To post to the list, e-mail: [EMAIL PROTECTED] -- --- Begin Message --- 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. :-) --- End Message --- --- Begin Message --- Thanks for all your help :) Justin on 26/08/02 1:55 AM, Michael Sims ([EMAIL PROTECTED]) 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 > --- End Message --- --- Begin Message --- 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" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> 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 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 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 . This works fine > as well. > > > >However, I am encountering a problem when the application mails the > s
Re: [PHP] Re: Can someone - anyone see my error?
Just curious... Have you tried it with POSTed variables? As in the case mentioned? Just wondering... Anyway, I'll try it myself later... - E > >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 >[EMAIL PROTECTED] >-- >AC Host Canada >www.achost.ca > >- Original Message - >From: "Eric Pignot" <[EMAIL PROTECTED]> >To: <[EMAIL PROTECTED]> >Sent: Sunday, August 25, 2002 7:24 PM >Subject: [PHP] Re: Can someone - anyone see my error? > > > > > > > > > > > Send this file: > > > > > > > > > > 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 : > > > > (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 > > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php _ $B%O%$%;%s%9$J>&IJ$r5$7Z$K9XF~(B MSN $B%7%g%C%T%s%0(B http://shopping.msn.co.jp/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Base64 and MS Word cutting and pasting.
I see. It seems like, asking the users to copy from Word to Notepad then to the textarea is not really an option so I guess you really need to find a way how to fix it. How about Manuel Lemos' advice posted earlier? BTW, I was just wondering if you've also considered that the problem might be on the mail client side itself. Because you said that "not all mail clients..." so at least on some it worked. When you said that with Notepad there's no problem, did you mean that ALL mail clients worked as you expected? Also, I wonder what these "pasted text" are. Perhaps, you can give some samples? I don't really think that I can be of so much help but I'm just curious... - E PS Just in case you haven't seen it. I think, there's a related topic discussed in phpbuilder.com. Here's the address: http://www.phpbuilder.com/columns/kartic2807.php3 > >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" <[EMAIL PROTECTED]> >To: <[EMAIL PROTECTED]> >Cc: <[EMAIL PROTECTED]> >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 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 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 . 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 > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php > _ $B$+$o$$$/$FL{2w$J%$%i%9%HK~:\(B MSN $B%-%c%i%/%?!<(B http://character.msn.co.jp/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Call to undefined function mysql_connect()
Thanks Edwin, I'll forward your notes to my new host. I also checked the archives and find that there's an extension=mysql.so snip that needs to go in the php.ini file, and I'll forward this to my host too. Thanks, Hugh - Original Message - From: "@ Edwin" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Sunday, August 25, 2002 8:54 PM Subject: Re: [PHP] Call to undefined function mysql_connect() > > > > >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!&=< http://auction.msn.co.jp/ > > > -- > 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
RE: [PHP] Call to undefined function mysql_connect()
do a php_info() on a page and check the mysql propeties in there.. might give you a clue.. > -Original Message- > From: hugh danaher [mailto:[EMAIL PROTECTED]] > Sent: Monday, 26 August 2002 1:18 PM > To: php > Subject: [PHP] Call to undefined function mysql_connect() > > > 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 > > > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Blank db entry??
Ok I have a script done but it does not work - If there is no info in the db row I need the script to detect that and enter a number - the problem I am having is that if the row is empty it will return nothing - is there a function or something else that you can use to return true if a db row is completly empty?? Thanks - JohnP
[PHP] Re: Blank db entry??
Forgot to add one thing - I don't need to add the new number after detection to the db but rather just print it out "Johnp" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Ok I have a script done but it does not work - If there is no info in the db row I need the script to detect that and enter a number - the problem I am having is that if the row is empty it will return nothing - is there a function or something else that you can use to return true if a db row is completly empty?? Thanks - JohnP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP and LDAP over SSL
On Fri, Aug 23, 2002 at 11:52:11AM -0500, Curtis Robinson wrote: > So, I see that php does not have the CA. But, I have no clue as to where > to define the location of the CA in the php configuration. So, does > anyone know how I can configure this option? Are you using OpenLDAP? The below is only valid for OpenLDAP. When you tested on the command line, didn't you modify your ldap.conf? Anyway, in ldap.conf you can specify: TLS_CACERT /path/to/ca.crt Make sure that this file is readable by your webserver. You might also want to specify the following in .ldaprc (in the users home directory): TLS_CERT /path/to/client.crt TLS_KEY /path/to/client.key If you run apache as say nobody, they must be in the home directory of nobody I guess... Stig -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php newsletter source
Hi, there is a newsletter or massmailer(open source), created with php, with option for sending mail with attashments to groups of clients? I tried phpmailer,DeepThroat,MyMail but atashments are not permitted, or only html and text. Any other sources? tx in advance for any help adi
[PHP] Re: php newsletter source
Hello, On 08/26/2002 03:49 AM, Adi wrote: > Hi, > there is a newsletter or massmailer(open source), created with php, with option for >sending mail with attashments to groups of clients? > I tried phpmailer,DeepThroat,MyMail but atashments are not permitted, or only html >and text. > Any other sources? This class lets you compose messages with attachments, in text, HTML with embededed images or not, HTML with alternative text, etc... http://www.phpclasses.org/mimemessage -- Regards, Manuel Lemos -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php