[PHP] Problem solved!
I didn't want to give up entirely on the flexibility of writing my scripts in C, so I thought some more about how to get a CGI script to use PHP without having to spend a lot of time on PHP logic. My first attempt was to see whether I could substitute the extension .php for the usual .cgi extension. I could, but it made no difference, i.e., PHP didn't intercept the output. I did some searching in /usr/local/lib/php to no avail, but then I brought up the phpinfo page and studied it. Under the Environment heading, I found the variable SCRIPT_FILENAME and passed it a test PHP filename as a command-line argument. Voila! I got a HTTP header and the expected PHP-processed output! Now all I have to do is use popen from the C program that will become my CGI script, and I'll be able to let C handle the GET and/or POST query strings, create the MySQL queries, and pass a more manageable amount of PHP code to access the tables. Using HTTPS should also be more straightforward that way. I knew there had to be a better way! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] problem solved (?)
Thanks very much, Curt. I assumed (stupid me) that I needed to configure PHP 5 for mysqli but this was nonsense since I am using version 4.0 of MySQL. Now I use php_mysql.dll in C:\PHP and only remove the ; from ;extension=php_mysql.dll in php.ini. Sorry to have bothered you all with this. ! Still the problem remains that there is no mysqli equivalent for mysql_field_name Regards, Mark Curt Zirzow [EMAIL PROTECTED] schreef in bericht news:[EMAIL PROTECTED] * Thus wrote Mark: I use MySQL: C:\mysql\binmysqladmin version status proc C:\MYSQL\BIN\MYSQLA~1.EXE Ver 8.40 Distrib 4.0.20a, for Win95/Win98 on i32 Copyright (C) 2000 MySQL AB MySQL Finland AB TCX DataKonsult AB This software comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to modify and redistribute it under the GPL license - php script implies you want to use mysqli_* stuff - using msql_* module in your code - using 4.0.x mysql datase which which expects mysql_* module You should really straigten out those issues before you continue. Curt -- First, let me assure you that this is not one of those shady pyramid schemes you've been hearing about. No, sir. Our model is the trapezoid! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] problem solved (?)
[snip] ! Still the problem remains that there is no mysqli equivalent for mysql_field_name [/snip] As I had suggested earlier you could do a DESCRIBE `table` query and loop through the column names returned. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] [problem solved] - Is it possible to see if a jpeg is RGB or CMYK via PHP GD2?
I was to fast on this list... I found the solution reading the manual better ;) ... With JPG images, two extra indexes are returned: channels and bits. channels will be 3 for RGB pictures and 4 for CMYK pictures. bits is the number of bits for each color. Beginning with PHP 4.3, bits and channels are present for other image types, too. However, the presence of these values can be a bit confusing. As an example, GIF always uses 3 channels per pixel, but the number of bits per pixel cannot be calculated for an animated GIF with a global color table. ... -Original Message- From: SED [mailto:[EMAIL PROTECTED] Sent: 9. janúar 2004 09:51 To: [EMAIL PROTECTED] Subject: [PHP] Is it possible to see if a jpeg is RGB or CMYK via PHP GD2? I'm allowing user to upload images to a gallery. However, some user seem to have both RGB and CMYK jpeg images. I get an error from ImageCreateFromJPEG when the script is creating thumbnails from a CMYK jpeg. Can I somehow see if the image is RGB or CMYK, so I know when to skip the automatic thumbnail creation? Regards, SED -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problem solved
Just in case someone wants to know : I had to uncheck the passing parameters in the go to detailpage parameter box! Martin Wmb [EMAIL PROTECTED] schreef in bericht [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... | Hope Í'm at the right place to ask this question. | | Am using DMX and encounter following problem: | | Have a connection to a database with plenty of data. | On a page which shows part of these records (10 max) I have a go to detail | page action which works fine when called from the 1st 10 records, but when | called from any other page (not the 1st 10 records any more) it suddenly | sends the following header: | quote-- | http://blabla.com/detailshowpage.php?pageNum_Recordset1=2totalRows_Recordse | t1=1130lidnummer=515 | unquote-- | and now the detailshowpage doesn't work correctly, | | while when done from the 1st page with the 1st ten records it only sends: | quote-- | http://blabla.com/detailshowpage.php?lidnummer=515 | unquote-- | | on the page I am using the recordset paging functions, and this is pbly | causing it but just don't know how to solve my little problem here. | | Your help is appreciated, thanks, | Martin | | | -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problem Solved
I figured i would post my solution to the problem that i found somewhere. It had nothing to do with anything i was doing. Its a bug in some versions of PHP. here is the function i had to use to fix this function fix_php_upload_bug($tmp){ $infile=fopen($tmp,r); // Open the file for the copy $outfile=fopen($tmp.new,w); // create a new temp file $header=fgets($infile,255); //get the 1st line (netscape sometimes doesn't add a Content-type line) //if its more than just a \r\n sequence then if (strlen($header)2) $header=fgets($infile,255); //get next line also while(!feof($infile)) { // Loop through the remaining file $temp=fread($infile,128); fwrite($outfile,$temp,strlen($temp)); //copying contents to new temp file } fclose($outfile); fclose($infile); copy($tmp.new,$tmp); //replace the original with our new bug fixed file unlink($tmp.new); //and delete the new file return $tmp; } Ryan Andrey Hristov [EMAIL PROTECTED] wrote in message 0b4501c177eb$8b02c900$0b01a8c0@ANDreY">news:0b4501c177eb$8b02c900$0b01a8c0@ANDreY... As I showed by this : FORM ACTION=http://your.domain.com/your.script.php; Method=Post ENCTYPE=multipart/form-data Input Type=text Name=ImageFile_name value=../../../../etc/passwd Input Type=Submit Name=Submit /FORM I can write this in a simple html, press the submit button and instead of file you will receive $ImageFile_name as a text variable. I can write in it everything but you rely on that PHP made it. No PHP didn't. Also in such form $ImageFile_tmpname can be supplied and if someone does this : ?php echo (implode('',file($ImageFile_tmpname))); ? The /etc/passwd file can be shown easily. My suggestion : rely on $HTTP_POST_FILES . Yes it is long to type but it's secured. Also as I said. Since the new PHP 4.1.0 there will be $_FILES array, equivalent of $HTTP_POST_FILES(which will exists also). The GD extension is used for dynamic construction of jpg,png,gif(up to some 1.x version). The constructed image can be saved to file or sent to the browser. GetImageSize() is one of the many functions provided by GD. http://www.php.net/manual/en/ref.image.php Best regards, Andrey Hristov - Original Message - From: Ryan Stephens (Hotmail) [EMAIL PROTECTED] To: Andrey Hristov [EMAIL PROTECTED] Sent: Wednesday, November 28, 2001 10:51 AM Subject: Re: [PHP] Image Uploads beeing corupted this means nothing to me... sorry, i've only been working with PHP for a couple weeks. and a few month of web learning. the site im working on is hosted by some other guy, so i dont have access to it if i had to change anything there. Why is $ImageFile a possible security hole? What is GD extension? I dont need to find the type... i just used that as a test to see if that might have anything to do with my corrupted file problem. And i found that all the information beeing entered into the database re: its name and size is fine... but it wont return a type... Im thinking if it cant return a type (but still uploads the file) there must be a connection to it beeing corrupt. Ryan - Original Message - From: Andrey Hristov [EMAIL PROTECTED] To: Ryan Stephens [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Wednesday, November 28, 2001 12:46 AM Subject: Re: [PHP] Image Uploads beeing corupted If you have GD extension build in your PHP use it to find the type(if you are limited ot jpeg/gif/png files). I want to say again that the using of $ImageFile* is a possible security hole. Regards, Andrey Hristov - Original Message - From: Ryan Stephens [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, November 28, 2001 10:39 AM Subject: Re: [PHP] Image Uploads beeing corupted the funny thing is this the information is beeing inserted into the database... the file is beeing uploaded (as i can see it in the directory). I can get results from $ImageFile $ImageFile_name $ImageFile_size but i cant get a result for $ImageFile_type this comes up blank there is obviously some connection, but just not sure what. Ryan Andrey Hristov [EMAIL PROTECTED] wrote in message 0b0c01c177e5$f0e15580$0b01a8c0@ANDreY">news:0b0c01c177e5$f0e15580$0b01a8c0@ANDreY... The problem is in that you do global only for $ImageFile, but not for $ImageFile_name. Big flaw is that if someone make a form FORM ACTION=?php $SCRIPT_NAME ? Method=Post ENCTYPE=multipart/form-data INPUT TYPE=hidden name=MAX_FILE_SIZE value=100 Input Type=text Name=ImageFile__name value=../../../../etc/passwd Input Type=Submit Name=Submit /FORM may be can make a big shot. Depends on under which user Apache is running. The best technique is to use $HTTP_POST_FILES. Since PHP4.1.0 there will be new name for it = $_FILES .This array will be global, so there is no need to
[PHP] PROBLEM SOLVED - was [PHP] Rasmus HELP ! Fwd: [PHP] mail() ERROR - WHY, WHY, WHY]
This is a forwarded message From: Badger [EMAIL PROTECTED] To: [EMAIL PROTECTED] Date: Monday, September 10, 2001, 11:04:54 PM Subject: [PHP] Rasmus HELP ! Fwd: [PHP] mail() ERROR - WHY, WHY, WHY ===8==Original message text=== This is a forwarded message From: Badger [EMAIL PROTECTED] To: [EMAIL PROTECTED] Date: Monday, September 10, 2001, 11:34:45 AM Subject: [PHP] Ramesus HELP ! Fwd: [PHP] mail() ERROR - WHY, WHY, WHY ===8==Original message text=== This is a forwarded message From: Badger [EMAIL PROTECTED] To: [EMAIL PROTECTED] Date: Monday, September 10, 2001, 12:23:54 AM Subject: [PHP] mail() ERROR - WHY, WHY, WHY ===8==Original message text=== Hello , I drowing here and need a life-ring! I have a site relying heavily on e-mail registration, forums, etc. and mail() is broken in my php install. I've been using an smtp server other than sendmail, but based on recommendations I have removed that smtp server, removed php, installed sendmail, reinstalled php, and php still complains that Warning: mail() is not supported in this PHP build and sendmail is clearly in my /var/lib/php.ini sendmail_path and the location is correct. I can send mail from the command line, but not via php's mail() Need Heelp! real bad. (beg, beg) -- Best regards, Badger mailto:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] ===8===End of original message text=== I am desperate to get this working. If anyone can tell me a way to troubleshoot this problem, I'll be happy to pursue it myself. I am running the RedHat 7.1 distribution of Linux, Apache 1.3.20, php 4.0.6, and sendmail-8.10.11. The Apache and php are src builds using tarballs and the sendmail is an rpm - I am only using sendmail to troubleshoot the problem, but I will eventually use dmail as my smtp server. All the above servers are on the sam machine. I have turned logging on in my php.ini, but the mail() error does not get written to the log file I specified, only to the Apache error log - but the error is the same as that displayed in my browser when php tries to call mail() Warning: mail() is not supported in this PHP build I've tried everything I can think of and recommendations from this list... I have removed php, removed sendmail, reinstalled sendmail, reinstalled php: here is my php build: - CPPFLAGS=-I/usr/local/include LDFLAGS=-L/usr/local/lib ./configure --prefix=/usr/local \ --with-apache=/usr/local/src/Apachetoolbox-1.5.38/apache_1.3.20 \ --enable-exif \ --enable-track-vars \ --with-calendar=shared \ --enable-safe-mode \ --enable-magic-quotes \ --enable-trans-sid \ --enable-wddx \ --enable-ftp \ --with-gd=/usr/local \ --with-zlib \ --enable-gd-native-tt \ --with-t1lib=/usr/local/lib/php/t1libs \ --with-jpeg-dir=/usr/local \ --with-png-dir=/usr/local \ --with-zlib-dir=/usr/local \ --with-ttf \ --with-freetype-dir=/usr/local \ --with-imap=/usr/local \ --with-mhash=/usr/local \ --with-mcrypt=/usr/local \ --with-unixODBC=/usr/local/unixODBC \ --with-mysql \ -- My php.ini is i the proper location and chnges get reloaded after reloading Apache - verified by phpinfo(). Here is the pertinent area of my php.ini file: --- sendmail_path = /usr/sbin/sendmail -t -i - Here are others that I've tried in my php.ini file: sendmail_path = /usr/sbin/sendmail --- sendmail_path = /usr/sbin -- sendmail_path = .:/usr/sbin/sendmail -t -i -- sendmail_path = .:/usr/sbin/sendmail sendmail_path = .:/usr/sbin -- ;sendmail_path = (default) -- I still get the mail() error Please help me figure this one out. -- Best regards, Badgermailto:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] ===8===End of original message text=== Sorry about the name misspell -- Best regards, Badgermailto:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] ===8===End of original message text=== Hello all, I finally solved this bugger of a
[PHP] Problem solved, thanks!
"distinct" and "order by" are all I need. Thanks to John Keith and John Perkins for their quick answers! -- Plutarck Should be working on something... ...but forgot what it was. ""Plutarck"" [EMAIL PROTECTED] wrote in message 9b6229$48j$[EMAIL PROTECTED]">news:9b6229$48j$[EMAIL PROTECTED]... I need to query a MySQL database with something like: "select guild from table_name" I'm going to take "guild" and eventually make a drop-down box with the information, but that I can handle. The thing is, I want to have only one entry for each guild, and I want them to be in alphabetical order. My current idea is to read all the results into an array with a while loop, then use array_unique on it, then run sort on that. Is this really the best way to do it, or am I missing a simpler solution? -- Plutarck Should be working on something... ...but forgot what it was. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]