[PHP] RE: mysql_num_rows
I found the problem! It was a space before $ in ' $name' in line two of the query. Sorry for the trouble. Roger -Original Message- From: Roger Lewis [mailto:[EMAIL PROTECTED]] Sent: Tuesday, December 17, 2002 4:00 PM To: Php-General Subject: mysql_num_rows Would someone be kind enough to explain why I'm not getting the correct result from the following query. If I select a valid member no. and name, the following query should return 1 row. This is not the case, however. It returns zero rows. $sql = SELECT * FROM users WHERE member_no = '$member_no' and name = ' $name' ; $result = mysql_query($sql) or die (Cannot verify the member); $rows = mysql_num_rows($result); echo rows = $rowsbr; Furthermore when trying the following query where the table users contains 13 rows, the query returns only 12 rows. $sql = SELECT * FROM users; $result = mysql_query($sql) or die (Cannot verify the member); $rows = mysql_num_rows($result); echo rows = $rowsbr; Conclusion: mysql_num_rows seems to be returning one less row than exists. Is this correct? Thanks in advance Roger Lewis -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] mysql_num_rows
Would someone be kind enough to explain why I'm not getting the correct result from the following query. If I select a valid member no. and name, the following query should return 1 row. This is not the case, however. It returns zero rows. $sql = SELECT * FROM users WHERE member_no = '$member_no' and name = ' $name' ; $result = mysql_query($sql) or die (Cannot verify the member); $rows = mysql_num_rows($result); echo rows = $rowsbr; Furthermore when trying the following query where the table users contains 13 rows, the query returns only 12 rows. $sql = SELECT * FROM users; $result = mysql_query($sql) or die (Cannot verify the member); $rows = mysql_num_rows($result); echo rows = $rowsbr; Conclusion: mysql_num_rows seems to be returning one less row than exists. Is this correct? Thanks in advance Roger Lewis -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] test
This is a test. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] test
But it did! Otherwise I wouldn't have received your comment. Why did I get this message from Mailer-Daemon: Sorry. Your message could not be delivered to: php-list,emc (The name was not found at the remote site. Check that the name has been entered correctly.) -Original Message- From: Martin Towell [mailto:[EMAIL PROTECTED]] Sent: Tuesday, December 17, 2002 10:02 PM To: Php-General Subject: RE: [PHP] test na! didn't work :) g -Original Message- From: Roger Lewis [mailto:[EMAIL PROTECTED]] Sent: Wednesday, December 18, 2002 4:59 PM To: Php-General Subject: [PHP] test This is a test. -- 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 General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] test
John, I'm emailing. And it looks like each time I send something, I get the same message in return. Roger John Taylor wrote: Roger, Are you emailing or posting to the news group? John -- 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] test
So what the h... is going on? Roger Lookee there, I'm getting it now and I'm sending to the newsgroup. Subject: NDN: [PHP] Re: mysql_num_rows Date: Wed, 18 Dec 2002 14:18:28 +0800 From: Mailer-Daemon [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sorry. Your message could not be delivered to: php-list,emc (The name was not found at the remote site. Check that the name has been entered correctly.) -- 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] test
Martin, I'm sending too [EMAIL PROTECTED] also. Never seen anything like this before Roger Martin Towell wrote: actually, I get the same error. I've been putting it down to someone subscribing and now their email is invalid. BTW: I'm emailing to [EMAIL PROTECTED] - if that helps -- 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 General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Max File Size
Hi, Thursday, December 5, 2002, 5:11:16 PM, you wrote: RL Jason Wong responded Wednesday, December 04, 2002 10:24 PM RL On Thursday 05 December 2002 10:14, Roger Lewis wrote: RL Thanks for the suggestion. I'll try ini_set although I'm not yet RL certain RL of how to use it. RL As has already been pointed out, the uploads take place *before* your RL script RL is run. The manual has table which shows what you can and cannot change RL using RL ini_set(). RL THE place to change it is in php.ini. RL I checked again and post_max_size is not in my php.ini, but perhaps I RL should just add it. RL Perhaps you should indeed. I think it defaults to 2M, so if you haven't RL set it RL 2MB is your limit. RL Also, I was wrong before - I do have a directive for memory_limit. It RL is RL 8M RL I think this only has effect if php was compiled with RL --enable-memory-limit. RL Regardless, this doesn't explain why I can't upload a file that exceeds RL 2M, RL except that I don't seem to be able to reset upload_max_filesize to RL greater RL than 2M. RL You mean you set it in php.ini and phpinfo() reports something different? RL -- RL Jason Wong - Gremlins RL That's what I've been trying to say, Jason. I set upload_max_filesize in RL php.ini to 8M, 800, or any other number, restart Apache, and the reset RL seems to be ignored. When looking at phpinfo, upload_max_filesize is RL *always* 2M. RL Adding the directive post_max_size = 16M to my php.ini did nothing except RL change my include_path settings ?%!?!*. (I can see in phpinfo that the RL default is 8M, but there is no setting in my php.ini) RL In reply to Tom's comment, there is no difference between master and local RL settings; however, there are no separate settings in my php.ini either. RL Do you have any other thoughts on this? RL Regards, RL Roger TR A shot in the dark check for: TR file_uploads = On TR -- TR regards, TR Tom file_uploads = 1. I presume this is means on, right? Roger I think I figured it out. The clue was that phpinfo() would show changes that I wasn't making. I concluded that it might be a syntax error in my php.ini due to some weird line wrapping that was going on. (I can't see the entire text on my telnet screen). I deleted my entire section on Paths and Directories and replaced with a clean section. Then reset upload_max_filesize and restarted Apache. Wadda you know! It worked. Thanks for all the comments and suggestions. Roger 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 General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP Configuration - Can't Change Post_Max_Size
This is further to my post yesterday on Max File Size. I was able to set upload_max_filesize to 790 and I can therefore upload files up to that size. I would now like to increase that limit, but I am limited by post_max_size which defaults to 8M. I can't seem to change the value of post_max_size. The post_max_size directive is not in my php.ini; however, I tried inserting it into php.ini and setting it to 1600 and to 16M. I inserted it just before the directive, gpc_order = GPC. The change is ignored by phpinfo(), that is, phpinfo() still shows post_max_size = 8M. Furthermore, I tried resetting it using ini_set(post_max_size, 16M), and ini_set(post_max_size, 1600), but neither of these had any effect. Any suggestion for how I might reset post_max_size. I'm using PHP 4.0.6. Thanks in advance. Roger -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Need Redirection Trick...
Nilaab, This sounds similar to what I was trying to do recently, i.e creating dependent dropdown boxes. Here's a link to a demo of the code that might be of interest to you. http://www.onlinetools.org/tools/easyselectdata/index.html Cheers. Roger -Original Message- From: @ Nilaab [mailto:[EMAIL PROTECTED]] Sent: Thursday, December 05, 2002 7:36 PM To: Php-General Subject: [PHP] Need Redirection Trick... Hello Everyone, I have a simple problem that, I think, might require a little trick to be used. I have a list of products in a database that is organized by categories and subcategories. Categories can have as many subcategories as it wants, but some categories don't need to have a subcategory at all. In the following code cat refers to category and subcat refers to subcategory. cat_data and subcat_data refers to a multi-dimentional array, pulled from the DB, with values of an id and a name. example: cat_data[row_number][name_of_category] and cat_data[row_number][id]. Ok, before I ask the question, here's the code: [-- snip --] ?php include (nay_general.php); include ($include_path/base_db.class); // db $db = new base_db(); $cat_data = $db-get_cat_data(); for ($i=0; $i count($cat_data); $i++) { echo 'a href=' . $PHP_SELF . ?cat_id= . $cat_data[$i][id] . '' . $cat_data[$i][name] . /abr /\n; if ($cat_id) { $subcat_data = $db-get_subcat_data($cat_id); if ($subcat_data != 0 ($cat_id == $cat_data[$i][id])) { for ($j=0; $j count($subcat_data); $j++) { echo 'nbsp;nbsp;nbsp;nbsp;- a href=' . $PHP_SELF . ?cat_id=$cat_idsubcat_id= . $subcat_data[$j][id] . '' . $subcat_data[$j][name] . /abr /\n; } } elseif ($subcat_data == 0 ($cat_id == $cat_data[$i][id])) { $subcat_id = 0; header(Location: $PHP_SELF?cat_id=$cat_idsubcat_id=$subcat_id); } } } ? [-- snip --] What this does is it lists all the categories in the database, initially. When the user clicks on a category, the script will check if the category has any subcategories associated with it. One of two things should happen after this. First, it should list all the subcategories directly below the category it is associated with, with a little indention to specify that they are subcategories. The subcategories listed will be a link that passes over the cat_id and subcat_id GET variables to the same page. example:category 1 category 2 - subcategory 1 - subcategory 2 - subcategory 3 category 3 . . . This part of the script works fine. The second thing that should happen is that if there are actually no subcategories for the selected category then subcat_id should equal 0 and the script should redirect back to the same page with the GET variables of cat_id and subcat_id (which is equal to zero at this point). The problem is that I cannot redirect with a header() function because content is already sent to the browser at the beginning of the script (the list of categories). Is there any other way that I can redirect and send the variables of cat_id and subcat_id to the page in the second situation mentioned earlier? Register Globals is on. - Nilaab -- 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] Max File Size
Hi, I'm having a problem uploading files greater than 2mb, but I believe the problem is related to php.ini. UPLOAD_MAX_FILESIZE in my submit form is set to 1000. Also, I set upload_max_filesize = 1000 in php.ini. After changing php.ini, I stopped and then started httpd. I thought this was enough to be able to upload files greater than the default 2mb. Even though php.ini has been changed, when I check phpinfo.php, I see that upload_max_filesize is still 2mb and my file is not being uploaded. Can anyone tell me what I am missing here. Thanks, Roger Lewis -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Max File Size
Yep, Mine is in /etc/httpd/php.ini and that's what phpinfo gives me Roger -Original Message- From: Marco Tabini [mailto:[EMAIL PROTECTED]] Sent: Wednesday, December 04, 2002 3:19 PM To: Roger Lewis Cc: PHP-General Subject: Re: [PHP] Max File Size Are you sure you're looking at the right php.ini? Try calling phpinfo() and check where PHP is looking for the ini file. Marco -- php|architect - The magazine for PHP Professionals The monthly worldwide magazine dedicated to PHP programmers Come visit us at http://www.phparch.com! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Max File Size
On Wednesday, December 04, 2002 3:03 PM, I wrote Hi, I'm having a problem uploading files greater than 2mb, but I believe the problem is related to php.ini. UPLOAD_MAX_FILESIZE in my submit form is set to 1000. Also, I set upload_max_filesize = 1000 in php.ini. After changing php.ini, I stopped and then started httpd. I thought this was enough to be able to upload files greater than the default 2mb. Even though php.ini has been changed, when I check phpinfo.php, I see that upload_max_filesize is still 2mb and my file is not being uploaded. Can anyone tell me what I am missing here. Thanks, Roger Lewis Further to my original post, to check if my php.ini was being recognized I temporarily changed some other configuration options, i.e. register_globals and include_path, and reloaded phpinfo.php. All options, except for upload_max_filesize, were changed per my input. Does anyone know why upload_max_filesize is not being reset? The following is from my php.ini showing upload_max_filesize = 750: ; ; Paths and Directories ; ; include_path= .:/home/sites/home/users/demo/phpinclude ; UNIX: /path1:/path2 Windows: \path1;\path2 doc_root= ; the root of the php pages, used only if nonempty user_dir= ; the directory under which php opens the script using /~username, used only if nonempty ;upload_tmp_dir = ; temporary directory for HTTP uploaded files (will use system default if not specified) upload_max_filesize = 750 ; 2 Meg default limit on file uploads extension_dir = /usr/lib/apache/php ; directory in which the loadable extensions (modules) reside Thanks for any help on this, Roger -- 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] Max File Size
From phpinfo.php I see that post_max_size is 8M; however, I don't find a setting for this in php.ini. Although I can live with 8M, can you tell me how to change this setting. I am using php 4.0.6 Also I understand that memory_limit may be affecting things, but I don't seem to have access to this setting. Roger -Original Message- From: David Banks [mailto:[EMAIL PROTECTED]] Sent: Wednesday, December 04, 2002 5:22 PM To: 'Roger Lewis' Subject: RE: [PHP] Max File Size Don't forget to increase post_max_size as well See also http://www.php.net/manual/en/features.file-upload.php -Original Message- From: Roger Lewis [mailto:[EMAIL PROTECTED]] Sent: Wednesday, December 04, 2002 5:00 PM To: Php-General Cc: [EMAIL PROTECTED] Subject: RE: [PHP] Max File Size On Wednesday, December 04, 2002 3:03 PM, I wrote Hi, I'm having a problem uploading files greater than 2mb, but I believe the problem is related to php.ini. UPLOAD_MAX_FILESIZE in my submit form is set to 1000. Also, I set upload_max_filesize = 1000 in php.ini. After changing php.ini, I stopped and then started httpd. I thought this was enough to be able to upload files greater than the default 2mb. Even though php.ini has been changed, when I check phpinfo.php, I see that upload_max_filesize is still 2mb and my file is not being uploaded. Can anyone tell me what I am missing here. Thanks, Roger Lewis Further to my original post, to check if my php.ini was being recognized I temporarily changed some other configuration options, i.e. register_globals and include_path, and reloaded phpinfo.php. All options, except for upload_max_filesize, were changed per my input. Does anyone know why upload_max_filesize is not being reset? The following is from my php.ini showing upload_max_filesize = 750: ; ; Paths and Directories ; ; include_path = .:/home/sites/home/users/demo/phpinclude ; UNIX: /path1:/path2 Windows: \path1;\path2 doc_root = ; the root of the php pages, used only if nonempty user_dir = ; the directory under which php opens the script using /~username, used only if nonempty ;upload_tmp_dir= ; temporary directory for HTTP uploaded files (will use system default if not specified) upload_max_filesize = 750 ; 2 Meg default limit on file uploads extension_dir = /usr/lib/apache/php ; directory in which the loadable extensions (modules) reside Thanks for any help on this, Roger -- 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 General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: Re[2]: [PHP] Max File Size
Hi, Thursday, December 5, 2002, 11:00:14 AM, you wrote: RL On Wednesday, December 04, 2002 3:03 PM, I wrote RL Hi, RL Further to my original post, to check if my php.ini was being recognized I RL temporarily changed some other configuration options, i.e. register_globals RL and include_path, and reloaded phpinfo.php. All options, except for RL upload_max_filesize, were changed per my input. Does anyone know why RL upload_max_filesize is not being reset? RL The following is from my php.ini showing upload_max_filesize = 750: RL ; RL ; Paths and Directories ; RL ; RL include_path= .:/home/sites/home/users/demo/phpinclude ; UNIX: RL /path1:/path2 Windows: \path1;\path2 RL doc_root= ; the root of the php pages, used only if nonempty RL user_dir= ; the directory under which php opens the script using RL /~username, used only if nonempty RL ;upload_tmp_dir = ; temporary directory for HTTP uploaded RL files (will use system default if not specified) RL upload_max_filesize = 750 ; 2 Meg default limit on file uploads RL extension_dir = /usr/lib/apache/php ; directory in which the loadable RL extensions (modules) reside RL Thanks for any help on this, RL Roger TR Tom Rogers wrote, Wednesday, December 04, 2002 5:24 PM TRSounds like php.ini is being overridden by a .htaccess file or httpd.conf TR-- TRregards, TRTom Tom, Thanks for your response. If this is so, can you tell me how I check it out and fix things. Roger -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Max File Size
Thanks for the suggestion. I'll try ini_set although I'm not yet certain of how to use it. It still seems odd that I can't simply set upload_max_filesize to whatever value I want. I checked again and post_max_size is not in my php.ini, but perhaps I should just add it. Also, I was wrong before - I do have a directive for memory_limit. It is 8M Regardless, this doesn't explain why I can't upload a file that exceeds 2M, except that I don't seem to be able to reset upload_max_filesize to greater than 2M. If you have any other thoughts, they are much appreciated. Roger -Original Message- From: David Banks [mailto:[EMAIL PROTECTED]] Sent: Wednesday, December 04, 2002 5:57 PM To: 'Roger Lewis' Subject: RE: [PHP] Max File Size post_max_size *should* be in php.ini, I think I ususally leave these things up to our sysop ;) Checking back to when I was coding for file uploading, I see that there were 4 settings to ensure were 'high enough' max_execution_time memory_limit post_max_size upload_max_filesize I *think* that ini_set may be used to change these settings, but I could be wrong. Cheers Dave -Original Message- From: Roger Lewis [mailto:[EMAIL PROTECTED]] Sent: Wednesday, December 04, 2002 5:48 PM To: David Banks Cc: Php-General Subject: RE: [PHP] Max File Size From phpinfo.php I see that post_max_size is 8M; however, I don't find a setting for this in php.ini. Although I can live with 8M, can you tell me how to change this setting. I am using php 4.0.6 Also I understand that memory_limit may be affecting things, but I don't seem to have access to this setting. Roger -Original Message- From: David Banks [mailto:[EMAIL PROTECTED]] Sent: Wednesday, December 04, 2002 5:22 PM To: 'Roger Lewis' Subject: RE: [PHP] Max File Size Don't forget to increase post_max_size as well See also http://www.php.net/manual/en/features.file-upload.php -Original Message- From: Roger Lewis [mailto:[EMAIL PROTECTED]] Sent: Wednesday, December 04, 2002 5:00 PM To: Php-General Cc: [EMAIL PROTECTED] Subject: RE: [PHP] Max File Size On Wednesday, December 04, 2002 3:03 PM, I wrote Hi, I'm having a problem uploading files greater than 2mb, but I believe the problem is related to php.ini. UPLOAD_MAX_FILESIZE in my submit form is set to 1000. Also, I set upload_max_filesize = 1000 in php.ini. After changing php.ini, I stopped and then started httpd. I thought this was enough to be able to upload files greater than the default 2mb. Even though php.ini has been changed, when I check phpinfo.php, I see that upload_max_filesize is still 2mb and my file is not being uploaded. Can anyone tell me what I am missing here. Thanks, Roger Lewis Further to my original post, to check if my php.ini was being recognized I temporarily changed some other configuration options, i.e. register_globals and include_path, and reloaded phpinfo.php. All options, except for upload_max_filesize, were changed per my input. Does anyone know why upload_max_filesize is not being reset? The following is from my php.ini showing upload_max_filesize = 750: ; ; Paths and Directories ; ; include_path = .:/home/sites/home/users/demo/phpinclude ; UNIX: /path1:/path2 Windows: \path1;\path2 doc_root = ; the root of the php pages, used only if nonempty user_dir = ; the directory under which php opens the script using /~username, used only if nonempty ;upload_tmp_dir= ; temporary directory for HTTP uploaded files (will use system default if not specified) upload_max_filesize = 750 ; 2 Meg default limit on file uploads extension_dir = /usr/lib/apache/php ; directory in which the loadable extensions (modules) reside Thanks for any help on this, Roger -- 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 General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Max File Size
Tom Rogers responded on Wednesday, December 04, 2002 6:11 PM Hi, Thursday, December 5, 2002, 11:54:08 AM, you wrote: RL Tom, RL Thanks for your response. If this is so, can you tell me how I check it out RL and fix things. RL Roger TR Unless you have set it yourself that is probably not the reason. TR Try setting it like this TR upload_max_filesize = 8M TR maybe there are too many digits for php to cope :) TR -- TR regards, TR Tom I tried using 8M, but no difference. The original setting was 200, and that didn't seem to be too many digits. I'm going to check out ini_set as suggested by David Banks and will post the outcome in due course. Thanks, Roger -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Max File Size
Jason Wong responded Wednesday, December 04, 2002 10:24 PM On Thursday 05 December 2002 10:14, Roger Lewis wrote: Thanks for the suggestion. I'll try ini_set although I'm not yet certain of how to use it. As has already been pointed out, the uploads take place *before* your script is run. The manual has table which shows what you can and cannot change using ini_set(). THE place to change it is in php.ini. I checked again and post_max_size is not in my php.ini, but perhaps I should just add it. Perhaps you should indeed. I think it defaults to 2M, so if you haven't set it 2MB is your limit. Also, I was wrong before - I do have a directive for memory_limit. It is 8M I think this only has effect if php was compiled with --enable-memory-limit. Regardless, this doesn't explain why I can't upload a file that exceeds 2M, except that I don't seem to be able to reset upload_max_filesize to greater than 2M. You mean you set it in php.ini and phpinfo() reports something different? -- Jason Wong - Gremlins That's what I've been trying to say, Jason. I set upload_max_filesize in php.ini to 8M, 800, or any other number, restart Apache, and the reset seems to be ignored. When looking at phpinfo, upload_max_filesize is *always* 2M. Adding the directive post_max_size = 16M to my php.ini did nothing except change my include_path settings ?%!?!*. (I can see in phpinfo that the default is 8M, but there is no setting in my php.ini) In reply to Tom's comment, there is no difference between master and local settings; however, there are no separate settings in my php.ini either. Do you have any other thoughts on this? Regards, Roger -- 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: Re[2]: [PHP] Max File Size
Hi, Thursday, December 5, 2002, 5:11:16 PM, you wrote: RL Jason Wong responded Wednesday, December 04, 2002 10:24 PM RL On Thursday 05 December 2002 10:14, Roger Lewis wrote: RL Thanks for the suggestion. I'll try ini_set although I'm not yet RL certain RL of how to use it. RL As has already been pointed out, the uploads take place *before* your RL script RL is run. The manual has table which shows what you can and cannot change RL using RL ini_set(). RL THE place to change it is in php.ini. RL I checked again and post_max_size is not in my php.ini, but perhaps I RL should just add it. RL Perhaps you should indeed. I think it defaults to 2M, so if you haven't RL set it RL 2MB is your limit. RL Also, I was wrong before - I do have a directive for memory_limit. It RL is RL 8M RL I think this only has effect if php was compiled with RL --enable-memory-limit. RL Regardless, this doesn't explain why I can't upload a file that exceeds RL 2M, RL except that I don't seem to be able to reset upload_max_filesize to RL greater RL than 2M. RL You mean you set it in php.ini and phpinfo() reports something different? RL -- RL Jason Wong - Gremlins RL That's what I've been trying to say, Jason. I set upload_max_filesize in RL php.ini to 8M, 800, or any other number, restart Apache, and the reset RL seems to be ignored. When looking at phpinfo, upload_max_filesize is RL *always* 2M. RL Adding the directive post_max_size = 16M to my php.ini did nothing except RL change my include_path settings ?%!?!*. (I can see in phpinfo that the RL default is 8M, but there is no setting in my php.ini) RL In reply to Tom's comment, there is no difference between master and local RL settings; however, there are no separate settings in my php.ini either. RL Do you have any other thoughts on this? RL Regards, RL Roger TR A shot in the dark check for: TR file_uploads = On TR -- TR regards, TR Tom file_uploads = 1. I presume this is means on, right? Roger 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] publishing php mysql website on cd-rom
Personally, I like the idea of a static site. I have a dynamic, database-driven site that handles documentation for an engineering project. When the project is over, I would like to archive the entire site, including the database and all document directories, onto a static, html-only, CD. Has anyone done this? Can it be done other than by separately displaying and saving each page as an html page, and then manually creating the links? Roger Lewis On Wednesday, November 06, 2002 1:51 AM, BigDog replied To: ROBERT MCPEAK BD That is going to be very hard to do...you might want to look at doing it BD all static...however, what are u going to do about the database BD connections... BD IMHO, i would take the php site and make it static and then put it on a BD CD-ROM...it might be out of date, however, it might be the fastest way BD for ya. BD Do you want them to access your site from the CD-ROM pages? BD You could create special pages on your site that the CD-ROM pages call. BD But that would require the user of the disc to have internet access. BD But running PHP from a cd-rom will probably not work unless you are BD doing some commandline cgi stuff...and i dont even want to think how BD that would work for ya... BD i would probably do something where static html pages pull data from BD your site... BD HTH... On Wed, 2002-11-06 at 16:44, ROBERT MCPEAK wrote: My organization has a need to publish some of our web content on a CD-ROM. I'm in search of suggestions on how to publish our dynamic content (php/mysql templates) in some sort of runtime configuration that would let users browse the site from cd. What's involved with this? Is there such a thing as runtime mySQL? What would it take to serve PHP from a CD? Help! I don't know where to begin and am looking for advice. Thanks, Bob -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- .: B i g D o g :. -- 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] publishing php mysql website on cd-rom
This sounds pretty good, but I know absolutely nothing about xml or xsl. Any literature, articles, links, or other resources you know of that could point me in the right direction. This would be worth researching. Roger -Original Message- From: .: B i g D o g :. [mailto:bigdog;venticon.com] Sent: Thursday, November 07, 2002 5:15 AM To: Roger Lewis Cc: [EMAIL PROTECTED] Subject: RE: [PHP] publishing php mysql website on cd-rom This is where xml and xsl come in handy...you could have all the pages outputed to xml format and then use xslt to transform to html. Then you could do it all on the fly, and each month create a new cd with all the html files... On Thu, 2002-11-07 at 18:29, Roger Lewis wrote: Personally, I like the idea of a static site. I have a dynamic, database-driven site that handles documentation for an engineering project. When the project is over, I would like to archive the entire site, including the database and all document directories, onto a static, html-only, CD. Has anyone done this? Can it be done other than by separately displaying and saving each page as an html page, and then manually creating the links? Roger Lewis On Wednesday, November 06, 2002 1:51 AM, BigDog replied To: ROBERT MCPEAK BD That is going to be very hard to do...you might want to look at doing it BD all static...however, what are u going to do about the database BD connections... BD IMHO, i would take the php site and make it static and then put it on a BD CD-ROM...it might be out of date, however, it might be the fastest way BD for ya. BD Do you want them to access your site from the CD-ROM pages? BD You could create special pages on your site that the CD-ROM pages call. BD But that would require the user of the disc to have internet access. BD But running PHP from a cd-rom will probably not work unless you are BD doing some commandline cgi stuff...and i dont even want to think how BD that would work for ya... BD i would probably do something where static html pages pull data from BD your site... BD HTH... On Wed, 2002-11-06 at 16:44, ROBERT MCPEAK wrote: My organization has a need to publish some of our web content on a CD-ROM. I'm in search of suggestions on how to publish our dynamic content (php/mysql templates) in some sort of runtime configuration that would let users browse the site from cd. What's involved with this? Is there such a thing as runtime mySQL? What would it take to serve PHP from a CD? Help! I don't know where to begin and am looking for advice. Thanks, Bob -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- .: B i g D o g :. -- 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 i g D o g :. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Problem with is_dir function
On Saturday, November 02, 2002 11:07 AM, I wrote * I'm having a problem with the is_dir function, or maybe I don't understand how it supposed to work. I'm using the following code to check whether or not a directory called $user_dir exists. If it exists, I am returned the proper message. But if it doesn't exist, I get the following error message that says that it doesn't exist. (I already knew that!) ERROR Number=8 Description=Error: quot;stat failed for /home/sites/home/users/demodocs/web/userforum/user (errno=2 - No such file or directory)quot; on line 175 of /home/sites/home/users/demo/web/user_forum/messages.php./ Can someone please explain what I am doing wrong here, and how to return a usable value if the directory doesn't exist. $test = is_dir($user_dir); if($test){echo You have a user directory. It is $user_dir;} else{echo Your user directory doesn't exist; return;} Thanks a lot. Roger Lewis This is a follow-up to my original posting. * I did not get an answer as to why is_dir does not return a false value; however, file_exists does the job nicely. Thanks for all the suggestions. * Roger -- 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] Problem with is_dir function
I'm having a problem with the is_dir function, or maybe I don't understand how it supposed to work. I'm using the following code to check whether or not a directory called $user_dir exists. If it exists, I am returned the proper message. But if it doesn't exist, I get the following error message that says that it doesn't exist. (I already knew that!) ERROR Number=8 Description=Error: quot;stat failed for /home/sites/home/users/demodocs/web/userforum/user (errno=2 - No such file or directory)quot; on line 175 of /home/sites/home/users/demo/web/user_forum/messages.php./ Can someone please explain what I am doing wrong here, and how to return a usable value if the directory doesn't exist. $test = is_dir($user_dir); if($test){echo You have a user directory. It is $user_dir;} else{echo Your user directory doesn't exist; return;} Thanks a lot. Roger Lewis -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Problem with is_dir function
I believe the path is of the correct format. So for example, if $user_dir = /home/sites/home/users/demodocs/web/userforum/user and $user_dir exists, then is_dir($user_dir) should = 1 however, if $user_dir doesn't exist, then is_dir($user_dir) should = 0 Isn't this the correct logic? Roger -Original Message- From: Andrew Brampton [mailto:andrew;bramp.freeserve.co.uk] Sent: Saturday, November 02, 2002 11:24 AM To: Roger Lewis; [EMAIL PROTECTED] Subject: Re: [PHP] Problem with is_dir function what values of $user_dir are you passing to is_dir? echo them out before the test, you might be sending paths which are most certainly not directories... for example: c:\windows /home/blah would be valid, but c:\windows\win.com /home/blah/myfile http://somesite/somepath ftp://someftpserver/incoming are invalid Hope this helps Andrew - Original Message - From: Roger Lewis [EMAIL PROTECTED] To: Php-General [EMAIL PROTECTED] Sent: Saturday, November 02, 2002 7:06 PM Subject: [PHP] Problem with is_dir function I'm having a problem with the is_dir function, or maybe I don't understand how it supposed to work. I'm using the following code to check whether or not a directory called $user_dir exists. If it exists, I am returned the proper message. But if it doesn't exist, I get the following error message that says that it doesn't exist. (I already knew that!) ERROR Number=8 Description=Error: quot;stat failed for /home/sites/home/users/demodocs/web/userforum/user (errno=2 - No such file or directory)quot; on line 175 of /home/sites/home/users/demo/web/user_forum/messages.php./ Can someone please explain what I am doing wrong here, and how to return a usable value if the directory doesn't exist. $test = is_dir($user_dir); if($test){echo You have a user directory. It is $user_dir;} else{echo Your user directory doesn't exist; return;} Thanks a lot. Roger Lewis -- 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 General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Confirm a Deletion
I know this should be very simple, but I just don't get it. I want to delete a record from a mysql table, but prior to deleting the record I want to receive an option to confirm the deletion. On page one (kb_areas_add.php) I have a form for inputting the field (area_todelete) for the record I want to delete. The form action goes to page two (kb_areas_delete) on which I am asked to confirm the deletion. I want to be able to press the delete button to delete the record, or the cancel button to cancel the operation. The way the code is written, the record gets deleted immediately upon clicking the submit button on page one. Is there some way I can keep the script on page two from executing until after I press the confirmation button? Thanks for any suggestions. /* FORM FOR SELECTING AREA TO DELETE */ form action='kb_areas_delete.php' method=post name=DeleteAnArea input type=submit name=DeleteArea value=Delete Area border=0 Area: input type=text name=area_todelete size=24 border=0 /form /* FORM TO CONFIRM DELETION */ ?php //Delete Areas and All Subjects for the Area $host = localhost; $user = root; $pass = pwd; $database = new_kb; // Connecting to the Database $connect = mysql_connect($host, $user, $pass) or die(could not connect to server); $db_select = mysql_select_db($database) or die(could not select the database); // Get Area ID $sql = SELECT id FROM kb_areas WHERE area = '$area_todelete' ; $result = mysql_query($sql) or die(could not complete your query for Area ID); $area_id = mysql_result($result, 0, id); ? pConfirm Deletion/p pAre you sure you wish to delete the general area, b?php echo $area_todelete?/b/p form action='kb_areas_add.php' method=post name=DeleteTopic input type=submit name=DeleteArea value=Delete ba href=kb_areas_add_test.phpCancel/a/b /form ?php //Delete area from kb_areas $sql2 = DELETE FROM kb_areas WHERE id = $area_id; $result2 = mysql_query($sql2) or die(couldn't complete your query to delete the areas); ? ?php //Delete subjects from kb $sql3 = DELETE FROM kb WHERE area_id = $area_id; $result3 = mysql_query($sql3) or die(couldn't complete your query to delete the subjects); ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Confirm a Deletion
Jay Blanchard wrote: One of two ways, an intermediary PHP page that asks Are you sure? while carrying the information forward, or a JavaScript pop-up confirmation dialog box. HTH! Jay And John Holmes wrote: Just create a middle page that stores the value of $area_todelete in a hidden field. input type=hidden name=area_todelete value=?=htmlentities($_POST['area_todelete'])? You YES button would submit it to the delete code you already have, the NO confirmation button would send the user somewhere else, maybe back to the choose area page. I hope that's not too confusing. ---John Holmes... Thanks guys. The intermediate page scheme worked. I added the hidden field like so because I couldn't get htmlentities to work: input type=hidden name=area_todelete value=?=$area_todelete? I appreciate the help. Roger -Original Message- From: Roger Lewis [mailto:[EMAIL PROTECTED]] Sent: Tuesday, October 01, 2002 2:51 PM To: Php-General Subject: [PHP] Confirm a Deletion I know this should be very simple, but I just don't get it. I want to delete a record from a mysql table, but prior to deleting the record I want to receive an option to confirm the deletion. On page one (kb_areas_add.php) I have a form for inputting the field (area_todelete) for the record I want to delete. The form action goes to page two (kb_areas_delete) on which I am asked to confirm the deletion. I want to be able to press the delete button to delete the record, or the cancel button to cancel the operation. The way the code is written, the record gets deleted immediately upon clicking the submit button on page one. Is there some way I can keep the script on page two from executing until after I press the confirmation button? Thanks for any suggestions. /* FORM FOR SELECTING AREA TO DELETE */ form action='kb_areas_delete.php' method=post name=DeleteAnArea input type=submit name=DeleteArea value=Delete Area border=0 Area: input type=text name=area_todelete size=24 border=0 /form /* FORM TO CONFIRM DELETION */ ?php //Delete Areas and All Subjects for the Area $host = localhost; $user = root; $pass = pwd; $database = new_kb; // Connecting to the Database $connect = mysql_connect($host, $user, $pass) or die(could not connect to server); $db_select = mysql_select_db($database) or die(could not select the database); // Get Area ID $sql = SELECT id FROM kb_areas WHERE area = '$area_todelete' ; $result = mysql_query($sql) or die(could not complete your query for Area ID); $area_id = mysql_result($result, 0, id); ? pConfirm Deletion/p pAre you sure you wish to delete the general area, b?php echo $area_todelete?/b/p form action='kb_areas_add.php' method=post name=DeleteTopic input type=submit name=DeleteArea value=Delete ba href=kb_areas_add_test.phpCancel/a/b /form ?php //Delete area from kb_areas $sql2 = DELETE FROM kb_areas WHERE id = $area_id; $result2 = mysql_query($sql2) or die(couldn't complete your query to delete the areas); ? ?php //Delete subjects from kb $sql3 = DELETE FROM kb WHERE area_id = $area_id; $result3 = mysql_query($sql3) or die(couldn't complete your query to delete the subjects); ? -- 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: Dependent Dropdown Boxes
Thanks Elias, I took a look at the code and there are indeed many things to learn; however, it's all in js. I'm trying to have php write the js, but I don't know enough about arrays and manipulating their elements. Roger -Original Message- From: lallous [mailto:[EMAIL PROTECTED]] Sent: Wednesday, September 11, 2002 2:02 AM To: [EMAIL PROTECTED] Subject: [PHP] Re: Dependent Dropdown Boxes Hi, Try to learn many things from the test code i created below: http://lgwm.org/ozone/dynatable.htm Good luck, Elias Roger Lewis [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... The Situation: I'm trying to create a pair of dynamic dropdown boxes where the options in the second box are dependent on the selection in the first box. I call the first box categories and the second, subcategories. I want to store the categories and subcategories in a mysql table(s) so that a user can dynamically update them. Currently, I have a single table called categories, with columns: id, category, and subcategory. The primary code for selecting the options for the second box is in javascript. This code makes use of the following datasets for storing the various categories and subcategories. If I can get php to generate this text, then the dependent boxes will work. datasets=new Array(); datasets[0]=Category1,subCategory1_1,subCategory1_2,subCategory1_3,subCateg ory1_4.split(,); datasets[1]=Category2,subCategory2_1,subCategory2_2,subCategory2_3.split( ,); datasets[2]=Category3,subCategory3_1, subCategory3_2, subCategory3_3,subCategory3_4,subCategory3_5.split(,); datasets[3]=Category4,subCategory4_1,subCategory4_2,subCategory4_3,subCateg ory4_4.split(,); datasets[4]=Category5,subCategory5_1,subCategory5_2,subCategory5_3,subCateg ory5_4,subCategory5_5,subCategory5_6.split(,); etc. The Problem: Using the following code I can get php to print the results, but only in a line-by-line, category/subcategory format. Of course, this is NOT what is needed. Each subcategory name should be on the same line as its associated category. ?php $dbConnect = mysql_connect(localhost, root, pwd); mysql_select_db(new_kb,$dbConnect); $sql = SELECT * from categories; $result = mysql_query($sql); for ($count = 1; $row = mysql_fetch_row ($result); ++$count) { print brdatasets[$count]=\; print $row[1],; print $row[2]\; } ? datasets[0]=Category1,subCategory1_1 datasets[1]=Category1,subCategory1_2 datasets[2]=Category1,subCategory1_3 datasets[3]=Category1,subCategory1_4 datasets[4]=Category2,subCategory2_1 datasets[5]=Category2,subCategory2_2 etc. Can someone explain how to write the php code to output the category and subcategory names from the mysql table to match the javascript format above. Thanks in advance for any help or suggestions. Roger Lewis -- 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] Dependent Dropdown Boxes
The Situation: I'm trying to create a pair of dynamic dropdown boxes where the options in the second box are dependent on the selection in the first box. I call the first box categories and the second, subcategories. I want to store the categories and subcategories in a mysql table(s) so that a user can dynamically update them. Currently, I have a single table called categories, with columns: id, category, and subcategory. The primary code for selecting the options for the second box is in javascript. This code makes use of the following datasets for storing the various categories and subcategories. If I can get php to generate this text, then the dependent boxes will work. datasets=new Array(); datasets[0]=Category1,subCategory1_1,subCategory1_2,subCategory1_3,subCateg ory1_4.split(,); datasets[1]=Category2,subCategory2_1,subCategory2_2,subCategory2_3.split( ,); datasets[2]=Category3,subCategory3_1, subCategory3_2, subCategory3_3,subCategory3_4,subCategory3_5.split(,); datasets[3]=Category4,subCategory4_1,subCategory4_2,subCategory4_3,subCateg ory4_4.split(,); datasets[4]=Category5,subCategory5_1,subCategory5_2,subCategory5_3,subCateg ory5_4,subCategory5_5,subCategory5_6.split(,); etcÂ… The Problem: Using the following code I can get php to print the results, but only in a line-by-line, category/subcategory format. Of course, this is NOT what is needed. Each subcategory name should be on the same line as its associated category. ?php $dbConnect = mysql_connect(localhost, root, pwd); mysql_select_db(new_kb,$dbConnect); $sql = SELECT * from categories; $result = mysql_query($sql); for ($count = 1; $row = mysql_fetch_row ($result); ++$count) { print brdatasets[$count]=\; print $row[1],; print $row[2]\; } ? datasets[0]=Category1,subCategory1_1 datasets[1]=Category1,subCategory1_2 datasets[2]=Category1,subCategory1_3 datasets[3]=Category1,subCategory1_4 datasets[4]=Category2,subCategory2_1 datasets[5]=Category2,subCategory2_2 etcÂ… Can someone explain how to write the php code to output the category and subcategory names from the mysql table to match the javascript format above. Thanks in advance for any help or suggestions. Roger Lewis -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Any netscape users out there?
Ctrl r worked for me -Original Message- From: Peter Janett [mailto:[EMAIL PROTECTED]] Sent: Tuesday, September 03, 2002 10:00 AM To: Robert Cummings; [EMAIL PROTECTED] Cc: Dan Ostrowski; [PHP GENERAL] Subject: Re: [PHP] Any netscape users out there? Simply hold down the control key and then push the r key while looking at the source code window. That will cause the page source to repost, and you will see the resulting source code. HTH, Peter Janett New Media One Web Services New Upgrades Are Now Live!!! Windows 2000 accounts - Cold Fusion 5.0 and Imail 7.1 Sun Solaris (UNIX) accounts - PHP 4.1.2, mod_perl/1.25, Stronghold/3.0 (Apache/1.3.22), MySQL 3.23.43 PostgreSQL coming soon! http://www.newmediaone.net [EMAIL PROTECTED] (303)828-9882 - Original Message - From: Robert Cummings [EMAIL PROTECTED] To: [EMAIL PROTECTED] Cc: Dan Ostrowski [EMAIL PROTECTED]; [PHP GENERAL] [EMAIL PROTECTED] Sent: Tuesday, September 03, 2002 10:40 AM Subject: Re: [PHP] Any netscape users out there? Netscape 4.xx series is notorious for caching issues. When you post data and then try to view the source code netscape thinks it has expired and thus gone. Another issue is when you resize the view source window, netscape reloads the page *ack*. On my site at http://www.wocmud.org I think my no cache headers even cause netscape to choke since I can't get page source on any of my pages in the 4.xx series. My solution is to use Mozilla/Netscape 7 to view the source when I need to and just use the 4.xx brokwser when I want to make sure it looks ok visually. HTH, Rob. -- - Ashley M. Kirchner wrote: Dan Ostrowski wrote: Post data makes Netscape REFUSE to show the underlying source code! It's virtually impossible to design form handling stuff when I can't see the code that's generated when i send post data. Is this a bug and how do you fix it?? i've never seen this problem in ns, at least not with the stuff i've designed in the past. do you have a page/form somewhere we could look at? -- .-. | Robert Cummings | :-`. | Webdeployer - Chief PHP and Java Programmer | :--: | Mail : mailto:[EMAIL PROTECTED] | | Phone : (613) 731-4046 x.109 | :--: | Website : http://www.webmotion.com | | Fax : (613) 260-9545 | `--' -- 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 General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: set filename of file open/download
Richard Lynch wrote On Saturday, August 24, 2002 4:52 PM To: David Buerer I'm using a php script to stream a microsoft word file to a browser. I'm sending header(Content-type: {$mimetype[DOC]} \n); to set the mime type to application/msword so that the browser knows how to open the file. However, some users systems are configured to allow the choice of open or saveas. The problem is that when the user selects saveas the filename it uses is the name of the php script which streams the file, not the actual filename of the file. How do I set this filename? Alas, different browsers do this differently... The *BEST* way to do it is to make your link be named the filename you want them to download: Example: http://uncommonground.com/events.pdf This is *really* a PHP script that happens to have a filename of 'events.pdf' I've put this into my .htaccess file to force Apache to parse events.pdf as PHP: Files events.pdf ForceType application/x-httpd-php /Files So Apache knows it's a PHP file and PHP spews out valid PDF content and the browser never even sees .php anywhere, so the browser thinks it's just getting a static PDF file. If you have a zillion files to link to, you might want to consider: Creating broken links to http://example.com/index/nonexistent.doc *BUT* you have a file named 'index' and a ForceType like above to make Apache parse it as PHP, and inside 'index' you do: ?php # Use $path_info to determine what file they wish to download. # NOTE: It's going to be $_ENV['path_info'] or $_SERVER['path_info'] or something like that now... # Use phpinfo() to figure out what it is... ? Or, if that sounds too tricky just put the filename into the link, even though it looks bogus: http://example.com/download.php/whatever.doc?filename=whatever.doc Even though your PHP file is really 'download.php', Apache and PHP don't care about that extra crap in there '/whatever.doc' and the browsers are so stupid they think you've got an actual file with that name in it. You can also dink with headers involving Content-disposition and something else I forgot, since IE and Netscape and different versions of each look at different headers to decide what to use for Save As... *BUT* there will always be some minor version of IE or Netscape that doesn't follow their own rules, and the headers won't work for it. Thus I usually go with the first option, and don't even give the browser any way to know that it's not a plain old static URL. I have been struggling with this problem for the last several days. (See my recent post, Trouble Downloading Files, 8.24.02. The problem I had was mostly with IE. Here is how I solved it. I used the code from the following as the basis of my code: http://www.zend.com/zend/trick/tricks-august-2001.php To make it work in IE, I had to add two lines to the section on send headers (See commented lines below). //send headers if(($pc 1) AND isset($mimetype[$p[$pc - 1]])) { //display file inside browser header(Content-type: . $mimetype[$p[$pc - 1]] . \n); header(Content-disposition: attachment; filename=\$file\\n); // THIS LINE IS ADDED TO GIVE A CHOICE TO OPEN, OR SAVE AS FILENAME. } else { //force download dialog header(Content-type: application/octet-stream\n); header(Content-disposition: attachment; filename=\$file\\n); } header('Cache-Control: public');// THIS LINE IS ADDED TO MAKE MSIE WORK AT ALL header(Content-transfer-encoding: binary\n); header(Content-length: . filesize($path) . \n); //send file contents $fp=fopen($path, r); fpassthru($fp); The Cache-Control header came from comments by [EMAIL PROTECTED], 04-Apr-2002 12:25, in http://www.php.net/manual/en/function.fpassthru.php I'm not sure why these additions fixed the problem, but they did. Maybe someone out there with a better understanding than I can explain. Hope this helps. Roger -- 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: Trouble Downloading Files
Richard Lynch responded Monday, August 26, 2002 3:28 PM to Roger Lewis I'm not certain this is the right place to ask, but here goes. For security reasons I have placed certain document files in a directory outside my web root. There are many types of files included (e.g. jpg, gif, txt, pdf, xls, doc, mdb, ppt, and dwg). Clicking links on my web page will download the files through a php script (getdocfile.php) into a new pop-up window. The following is how I have coded the link: a href='#' target=_blank onclick=window.open('../getdocfile.php?file=?php echo $DrawingGroups-Value(filename)?', '_blank','resizable=yes,scrollbars=yes,width=700,height=500');return false?php echo $DrawingGroups-Value(is_viewable)?/a Problem: The download fails with IE5.5 when trying to retrieve files other than jpg, gif, txt, and pdf. One of the following happens depending on whether or not I force the download dialog box for the file to appear: (Note: I force the download dialog by commenting out the appropriate mime types in the code below) IE is stupid. Really, really stupid. Not that Netscape is any smarter, or anything, but IE is really really really stupid. In particular, their hack to have embedded documents in a browser and stuff rely on the URL of the thing being downloaded and when you start crossing that with your .php URL and JavaScript's popup windows, all hell breaks loose, as you've noted. Things you *might* try: 1. Rename the getdocfile.php to getdocfile.htm and force Apache to make it a PHP file. 2. Get rid of the ?file= part, and just use /?=$DrawingGroups-Value('filename')? and then use $path_info in your getdocfile.htm script instead of $_GET['file'] 3. Whoops. 2. conflicts with 3. You maybe be stuck with something really stupid like using: /?=str_replace('.', '_', $DrawingGroups-Value('filename')?.htm and then inside of getdocfile.htm you'll need to de-construct the foo_pdf.htm back into foo.pdf to get the file you actually want. Yes, your URLs will now look very strange, but remember how stupid IE is? It's really stupid. 4. You may even need to go so far as to have the popup window have a META tag to re-locate to the actual document you want, so that only an HTML document is the first thing to appear in the popup window. Again, IE is really stupid, and as soon as you cross a popup with a non-HTML document (of certain types you have begun to discover empirically) it screws up. I never have figured out which/why/when IE screws up popups with non-HTML content and don't really care cuz I hate popups... But it's a known issue, and there's not much you can do about it other than make IE happy by following the adage: Don't do that. Richard, Did you see my reply to your recent response to David Buerer in Re: set filename of file open/download? After searching everything I could find on the subject, and hours of trying as many combinations of headers as I could think of, I got everything to work the way I wanted in both IE and NN. The pop-up pops up. The jpg and pdf, etc. files open in the windows. If it's an xls or some such file, the dialog asks if I want to save or open. Whatever my response, it knows the filename and behaves as requested. Hard to believe. :) I believe the key was to add: header('Cache-Control: public'); Any thoughts as to why this is needed for MSIE. Roger -- 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] How Do You Protect Individual Files
On Wednesday 21 August 2002 10:54, Roger Lewis wrote: I did, but like I said, I couldn't find much. Maybe I wasn't using the correct key words. There is a lot about protecting php and html files but not much on other, non-php files in external directories. There is some discussion about .htaccess, but I know nothing about this. Is that the way to do it, or can it be done with php. Justin French, Tuesday, August 20, 2002 10:40 PM In real short, you want to store the files outside your htdocs root (so they can't be served by http), OR restrict them from being served by using a htaccess file (try an apache list, the apache site, or your ISP sys admin). Then, you want to serve those files THROUGH a PHP script. Usually these scripts will: - authenticate a user - set the right mime-type header for the file type using header() - parse the requested file though the PHP script to the browser There were a few recent threads on this... search for the following subject lines in the archives: - Authenticate files downloads - secure files acess Finally, there is a decent script/article/tutorial on the Zend site (another place you should have looked), which is the basis for my code at the moment. http://www.zend.com/zend/trick/tricks-august-2001.php Well, I originally searched for protect file downloads. I also searched protect individual files, protect files, authenticate files, and on and on. There are thousands of messages, but very few with relevant titles or content. One point to consider: I have no control over the files themselves. They are being uploaded to the document directories by end users, so I do not know the file names. What I am trying to do is prevent someone who knows the path to the file from being able to gain access to it without authorization. One of the best ideas I saw was to put the files outside the web root directory. That sounded pretty good until I discovered that then I couldn't access the files. Now you've again pointed out that solution, so I'm sure it will work. I've just got to study up on the subject. I ran across the Zend article a couple of weeks ago, but it's going to take me awhile to understand it. I'm pretty new at this game, and my programming skills are very limited. I'm going to research .htaccess also. Thanks -- 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] Multiple File Uploads With a Single Input
Is anyone aware of any recent developments that would allow you to upload multiple files from a single input type=file. Many of the messages in the archives say that this is impossible; however, these messages are more that a year old. I would like to be able to click a browse button, select multiple files, and upload them to a directory all at one time. Can it be done? Roger Lewis -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Web Site
On Wednesday, August 21, 2002 6:41 PM Peter Goggin wrote 2. I need to set up credit card payments. Has anyone any experience with PayPal? Are there any other providers I should consider. Nothing but good to say about PayPal Roger -- 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] How Do You Protect Individual Files
Justin, Thanks again. I've been doing some more research on .htaccess. The problem I see is that it is high maintenance, i.e. I've already got a MySQL table of users with username and password. To use .htaccess, you have to have a htpasswd file containing duplicate usernames and passwords, and this would have to be in sync with the MySQL table. I have found that there is an Apache module, mod_auth_mysql, that allows .htaccess to access a MySQL database for the information it needs. This module is available at http://www.diegonet.com/support/mod_auth_mysql.shtml. Problem is you have to install the mod and recompile Apache, I think. And I don't know how to do that yet. However, if everything works in accordance with my interpretation, you should be able to put an .htascess file into the directory you wish to protect and Mod_auth_mysql will communicate with the database to authenticate the users. Roger -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How Do You Protect Individual Files
I haven't been able to find much on this subject in the archives. Using sessions I have been able to have the server validate the user's access level before serving him a page. I put include files on each page that I want authenticated. This is all well and good, except on my pages there are links to non-html, and non-php files that are stored in document directories on the server. How, on a file-by-file basis, do I ensure that the user is authorized to download these files? If he gets to them through the link I provide, this is acceptable because he is already authorized to view the page that the link is on. However, if he somehow knows the full path to the file, he can get to it directly, bypassing the link and overriding the authentication system. Thanks for any help on this question. Roger Lewis -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] How Do You Protect Individual Files
On Wednesday 21 August 2002 08:59, Roger Lewis wrote: I haven't been able to find much on this subject in the archives. Using sessions I have been able to have the server validate the user's access level before serving him a page. I put include files on each page that I want authenticated. This is all well and good, except on my pages there are links to non-html, and non-php files that are stored in document directories on the server. How, on a file-by-file basis, do I ensure that the user is authorized to download these files? If he gets to them through the link I provide, this is acceptable because he is already authorized to view the page that the link is on. However, if he somehow knows the full path to the file, he can get to it directly, bypassing the link and overriding the authentication system. On Tuesday, August 20, 2002 7:24 PM, Jason Wong wrote: Try searching the archives. It has been discussed many times before. Jason, I did, but like I said, I couldn't find much. Maybe I wasn't using the correct key words. There is a lot about protecting php and html files but not much on other, non-php files in external directories. There is some discussion about .htaccess, but I know nothing about this. Is that the way to do it, or can it be done with php. Roger -- 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] How Can I Generate an Email List from a MySQL Table
On Sat, 17 Aug 2002 20:10:02 -0700 Roger Lewis [EMAIL PROTECTED] wrote: My problem is how do you create the variable, $to, from the MySQL table so that it contains all of the addresses separated by commas. Daren Cotter [mailto:[EMAIL PROTECTED]] responded Saturday, August 17, 2002 8:42 PM // Query database $result = mysql_query(SELECT email_address FROM users WHERE is_subscribed = 'Y', $link); while ($row = mysql_fetch_array($result)) { mail($row[email_address], $SUBJECT, $BODY, $HEADER); } mysql_free_result($result); Darren, Thanks a lot. This works fine. Please have a virtual beer on me! :) To Chris Knipe [mailto:[EMAIL PROTECTED]] who responded $to = ''; while ($blah = mysql_fetch_row($ref)) { $to =+ $blah['address']; }; I tried this, but I got an index error. It doesn't understand 'address' and I couldn't figure out what was going on. To Kevin Waterson who responded simply create your array and use implode. There is an example of comma seperated lists in the manual http://www.php.net/manual/en/function.implode.php I like this method because it seems more elegant than above, but I don't seem to be able to create the array properly. I tried the following as well as many other combinations, but couldn't get anything to work: $sql = SELECT email_address FROM users WHERE is_subscribed = 1; $result = mysql_query($sql); $to = implode(,, mysql_fetch_array($result)); Thanks again everyone for your help Roger Lewis PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php __ Do You Yahoo!? HotJobs - Search Thousands of New Jobs http://www.hotjobs.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How Can I Generate an Email List from a MySQL Table
I have a MySQL table named users in which there is a column named email_address and another named is_subscribed. I would like to send an email to all of the addresses for which is_subscribed is true. I think I know how to send the email, i.e., mail($to, $subject, $message, $headers); I tested this out and it works fine when, for instance, $to = [EMAIL PROTECTED], [EMAIL PROTECTED] or some such collection of addresses. My problem is how do you create the variable, $to, from the MySQL table so that it contains all of the addresses separated by commas. Thanks for your help, Roger Lewis -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] How Can I Generate an Email List from a MySQL Table
Thanks for the quick responses from Chris, Daren, and Kevin. I didn't know so many would be up Sat night. This looks like it might do the trick since I only have 20 to 30 recipients and I have a dedicated server. I'll check it out and let you know. Thanks again, Roger -Original Message- From: Chris Knipe [mailto:[EMAIL PROTECTED]] Sent: Saturday, August 17, 2002 8:37 PM To: Roger Lewis; Php-General Subject: Re: [PHP] How Can I Generate an Email List from a MySQL Table $to = ''; while ($blah = mysql_fetch_row($ref)) { $to =+ $blah['address']; }; Be careful however. Most SMTP servers has a limit on the number of recipients you can send one email to. It's a very easy way to trigger spam alerts and stuff. -- me - Original Message - From: Roger Lewis [EMAIL PROTECTED] To: Php-General [EMAIL PROTECTED] Sent: Sunday, August 18, 2002 5:10 AM Subject: [PHP] How Can I Generate an Email List from a MySQL Table I have a MySQL table named users in which there is a column named email_address and another named is_subscribed. I would like to send an email to all of the addresses for which is_subscribed is true. I think I know how to send the email, i.e., mail($to, $subject, $message, $headers); I tested this out and it works fine when, for instance, $to = [EMAIL PROTECTED], [EMAIL PROTECTED] or some such collection of addresses. My problem is how do you create the variable, $to, from the MySQL table so that it contains all of the addresses separated by commas. Thanks for your help, Roger Lewis -- 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] How do you make a directory
I'm trying to learn to create a directory in php, and from everything I've read I created this simple test that I put into the file add_user_dir.php. Unfortunately I can't get it to work. I am getting the error message: Warning: MkDir failed (Permission denied) in /home/sites/home/users/demo/web/Admin/add_user_dir.php on line 20. Obviously, it has something to do with permissions. I have chmod for the directory 'userforum' set to 0777. I tried playing around with umask, and changing the chmod, but I can't get anything to work. I am using PHP 4.0.6 with Apache 1.3.20 Here is the script: form action=? echo $PHP_SELF; ? method=post name=FormName pUser Nameinput type=text name=username size=24 border=0 input type=submit name=submitButtonName value=Make Directory border=0/p /form ?php $dirpath = /home/sites/home/users/demodocs/web/userforum . $username; mkdir($dirpath, 0777); ? Can anyone see what I am doing wrong? Thanks. Roger Lewis -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] How do you make a directory
On Wednesday 24 July 2002 11:12, Roger Lewis wrote: I'm trying to learn to create a directory in php, and from everything I've read I created this simple test that I put into the file add_user_dir.php. Unfortunately I can't get it to work. I am getting the error message: Warning: MkDir failed (Permission denied) in /home/sites/home/users/demo/web/Admin/add_user_dir.php on line 20. Obviously, it has something to do with permissions. I have chmod for the directory 'userforum' set to 0777. I tried playing around with umask, and changing the chmod, but I can't get anything to work. [snip] ?php $dirpath = /home/sites/home/users/demodocs/web/userforum . $username; mkdir($dirpath, 0777); ? Assuming $username is 'tom', are you trying to create: a) /home/sites/home/users/demodocs/web/userforumtom or: b) /home/sites/home/users/demodocs/web/userforum/tom Your code is trying to do (a). In any case whatever you're trying to do, you need both the following: i) Have execute permissions ('x') on all the directories in the path leading down to where you wish to create your directory ii) Have write permission ('w') on the directory in which you are creating your directory Jason and TechSupport, Jeeze, do I feel stupid. One slash and that's all it took. Thanks much. Re the permissions, I have userforum set to 0777. php creates the new directory as 0775. Presumably this is because of the effect of umask, right? When I upload files to the new directory using php uploading script, they go in as 0600, with owner - httpd, and group - root. (The owner/group on my machine is httpd/httpd). I can link to and read the files on the browser OK so I'm happy. Are there any security issues I should be concerned with here. Thanks again, Roger Lewis -- 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