[PHP] Read directory; store filenames found in mySQL table?
Ave, This is what I'm trying to do; I want to read a directory (eg: W:\Test \) and take all the filenames found in the directory (eg: 1.vox, 2.wav, 3.txt) and store them in a simple mySQL table. Can I do this? --- Rahul Sitaram Johari Founder, Internet Architects Group, Inc. [Email] sleepwal...@rahulsjohari.com [Web] http://www.rahulsjohari.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Read directory; store filenames found in mySQL table?
On Jan 13, 2010, at 9:56 AM, Warren Windvogel wrote: On 2010/01/13 04:25 PM, Rahul S. Johari wrote: Ave, This is what I'm trying to do; I want to read a directory (eg: W: \Test\) and take all the filenames found in the directory (eg: 1.vox, 2.wav, 3.txt) and store them in a simple mySQL table. Sorry. Forgot to include this. function dirList ($directory) { // create an array to hold directory list $results = array(); // create a handler for the directory $handler = opendir($directory); // keep going until all files in directory have been read while ($file = readdir($handler)) { // if $file isn't this directory or its parent, // add it to the results array if ($file != '.' $file != '..') $results[] = $file; } // tidy up: close the handler closedir($handler); // done! return $results; } If you're dealing with 1 directory you can use it to read all files in it to an array. Kind regards Warren This is an interesting approach. Following is what I came up with to scan a directory and store the filenames into an array ... very similar to your example: $listDir = array(); $dir = ../mounts/wd/IDT/IDT/; if($handler = opendir($dir)) { while (($sub = readdir($handler)) !== FALSE) { if ($sub != . $sub != .. $sub != Thumb.db) { if(is_file($dir./.$sub)) { $listDir[] = $sub; }elseif(is_dir($dir./.$sub)){ $listDir[$sub] = $this- ReadFolderDirectory($dir./.$sub); } } } closedir($handler); } and this is what I'm trying to implement in order to store the array into a mysql table .. $db = mysql_connect(localhost,usr,pwd); mysql_select_db(db,$db); $colors=serialize($listDir); //takes the data from a post operation... $sql=INSERT INTO recordings (ID, RECORDING, ADDED) VALUES('','$colors',''); $result = mysql_query($sql) or die (mysql_error()); I'm not sure if this the best or fastest approach ... but it's running in the background as I write this (I should have tested on a smaller folder). The folder I'm scanning has literally over 80,000 files ... so it's taking LOOONG!! --- Rahul Sitaram Johari Founder, Internet Architects Group, Inc. [Email] sleepwal...@rahulsjohari.com [Web] http://www.rahulsjohari.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Read directory; store filenames found in mySQL table?
On Jan 13, 2010, at 10:07 AM, Kenneth Sande wrote: Ashley Sheridan wrote: On Wed, 2010-01-13 at 09:25 -0500, Rahul S. Johari wrote: Ave, This is what I'm trying to do; I want to read a directory (eg: W: \Test \) and take all the filenames found in the directory (eg: 1.vox, 2.wav, 3.txt) and store them in a simple mySQL table. Can I do this? --- Rahul Sitaram Johari Founder, Internet Architects Group, Inc. [Email] sleepwal...@rahulsjohari.com [Web] http://www.rahulsjohari.com You'll probably want to look at the readdir() function. The manual page also has dozens of different example scripts that would be easy to tweak for your purpose. http://php.net/manual/en/function.readdir.php Thanks, Ash http://www.ashleysheridan.co.uk I use the glob function in my little homemade web cam page, which can really swell up in memory when used against a large amount of files (in my case around 30k files). = $imgdir = 'img/south*'; $files = glob( $imgdir ); // Sort files by modified time, latest to earliest // Use SORT_ASC in place of SORT_DESC for earliest to latest array_multisort( array_map( 'filemtime', $files ), SORT_NUMERIC, SORT_DESC, $files ); = http://www.php.net/manual/en/function.glob.php DISCLAIMER: I found this code on a how-to somewhere out there and modified it to fit my need. Quite possibly there are much better means to this end. Ken Sande/KC8QNI Considering that I have over 80K files in the folder, would this be a faster/efficient then the readdir() method? Or should I stick to what I'm doing (other email)? --- Rahul Sitaram Johari Founder, Internet Architects Group, Inc. [Email] sleepwal...@rahulsjohari.com [Web] http://www.rahulsjohari.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: dbase_get_record_with_names; Very slow search!!!
On Nov 30, 2009, at 11:07 AM, Bob McConnell wrote: From: news even though the dbf has 10K records Fox can't spend minutes to found a match by the way, its very strange to have 35 columns in a table/dbf or whatever pay attention to the comment of Ashley in Fox, you should: SELECT directory INDEX on phone_number to idx_directory_phone - or - INDEX on phone_number tag phone of cdx_directory i worked with Fox with dbfs of 2 millions of records and the speed is amazing -- using indexes of course! It has been a long time since I worked with either FoxPro or dBase, but IIRC, both required you to explicitly create any indexes they might need. They don't have query analyzers like Postgres, MySQL and other modern DBMS engines. Bob McConnell That is correct! But in my case - I DO indeed have Indexes created manually. FoxPro created .CDX files for Indexes. The problem is - does PHP use those indexes? --- Rahul Sitaram Johari Founder, Internet Architects Group, Inc. [Email] sleepwal...@rahulsjohari.com [Web] http://www.rahulsjohari.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: dbase_get_record_with_names; Very slow search!!!
On Nov 30, 2009, at 11:41 AM, Bob McConnell wrote: From: Rahul S. Johari On Nov 30, 2009, at 11:07 AM, Bob McConnell wrote: From: news even though the dbf has 10K records Fox can't spend minutes to found a match by the way, its very strange to have 35 columns in a table/dbf or whatever pay attention to the comment of Ashley in Fox, you should: SELECT directory INDEX on phone_number to idx_directory_phone - or - INDEX on phone_number tag phone of cdx_directory i worked with Fox with dbfs of 2 millions of records and the speed is amazing -- using indexes of course! It has been a long time since I worked with either FoxPro or dBase, but IIRC, both required you to explicitly create any indexes they might need. They don't have query analyzers like Postgres, MySQL and other modern DBMS engines. Bob McConnell That is correct! But in my case - I DO indeed have Indexes created manually. FoxPro created .CDX files for Indexes. The problem is - does PHP use those indexes? And the secondary question is whether you have enough memory to 'permanently' cache those indexes? They don't improve performance very much unless they are kept in local memory all the time. The only way to fix this is to move to a real DBMS engine. Bob McConnell Well that might be a problem. The indexes, along with the files, are stored on the network and they are accessed over the network, not locally. Although to be fair; I have tried using a copy of the DBF it's Index File (CDX) locally and it didn't make any difference to the search. Either way, it all points in the same direction ... using a modern DBMS. It's just a problem on our end because all our customer data is in FoxPro databases and all the other applications are written for those FoxPro databases. --- Rahul Sitaram Johari Founder, Internet Architects Group, Inc. [Email] sleepwal...@rahulsjohari.com [Web] http://www.rahulsjohari.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] dbase_get_record_with_names; Very slow search!!!
Ave, I'm connecting to a foxpro database (dbase) and simply running a search to retrieve a record. It's a very simple code. The problem is, as the database is growing, the search is becoming ridiculously slow ... and I mean it's taking minutes. When the dbase had 10,000 records ... search was fast efficient ... as if you were connecting to a mySQL Database. Now that the database has over 75,000 records and still growing ... it's taking minutes to search. The database has about 35 fields; Search is based on a phone number. This is the code ... ?php #Open DBF $db = dbase_open(dbase.dbf, 0); #PULL UP RECORD if ($db) { $record_numbers = dbase_numrecords($db); for ($i = 1; $i = $record_numbers; $i++) { $row = dbase_get_record_with_names($db, $i); if ($row['PHONE'] == $_POST['PHONE']) { #Retrieve row display fields echo $row['STUFF']; } } } ? It works ... but it's getting way too slow. One thing with FoxPro DBF's is that they use an Index file for searches within FoxPro. These are .CDX files which contain the Index. You can create an Index on, for example, PHONE field. However I don't think there's any way in PHP to reference this Index file for faster searches. Is there any possibility to improve search response time? Thanks! --- Rahul Sitaram Johari Founder, Internet Architects Group, Inc. [Email] sleepwal...@rahulsjohari.com [Web] http://www.rahulsjohari.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] dbase_get_record_with_names; Very slow search!!!
On Nov 24, 2009, at 8:59 AM, Ashley Sheridan wrote: On Tue, 2009-11-24 at 08:40 -0500, Rahul S. Johari wrote: Ave, I'm connecting to a foxpro database (dbase) and simply running a search to retrieve a record. It's a very simple code. The problem is, as the database is growing, the search is becoming ridiculously slow ... and I mean it's taking minutes. When the dbase had 10,000 records ... search was fast efficient ... as if you were connecting to a mySQL Database. Now that the database has over 75,000 records and still growing ... it's taking minutes to search. The database has about 35 fields; Search is based on a phone number. This is the code ... ?php #Open DBF $db = dbase_open(dbase.dbf, 0); #PULL UP RECORD if ($db) { $record_numbers = dbase_numrecords($db); for ($i = 1; $i = $record_numbers; $i++) { $row = dbase_get_record_with_names($db, $i); if ($row['PHONE'] == $_POST['PHONE']) { #Retrieve row display fields echo $row['STUFF']; } } } ? It works ... but it's getting way too slow. One thing with FoxPro DBF's is that they use an Index file for searches within FoxPro. These are .CDX files which contain the Index. You can create an Index on, for example, PHONE field. However I don't think there's any way in PHP to reference this Index file for faster searches. Is there any possibility to improve search response time? Thanks! I would assume that any indexes created on any tables would be referenced automatically by the dbms and wouldn't need to be explicitly referenced from within PHP. Thanks, Ash http://www.ashleysheridan.co.uk Makes sense; but I'm not sure if the Index is being referenced here ... based on the extremely slow searches. --- Rahul Sitaram Johari Founder, Internet Architects Group, Inc. [Email] sleepwal...@rahulsjohari.com [Web] http://www.rahulsjohari.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: dbase_get_record_with_names; Very slow search!!!
Your post definitely gives me hope. It's possible I'm doing something wrong! I definitely have the foxpro database indexed. I use this FoxPro command ... INDEX ON PHONE TAG PHONE I do have a .CDX file present for the Database and if I MODIFY STRUCTURE and I can see the INDEX present on PHONE. Did you check my Code? Is there any other way to pull records off a FoxPro Database? Can you use SQL Commands via PHP on FoxPro databases (SELECT * FROM ) ? Thanks On Nov 24, 2009, at 9:16 AM, keyser soze wrote: even though the dbf has 10K records Fox can't spend minutes to found a match by the way, its very strange to have 35 columns in a table/dbf or whatever pay attention to the comment of Ashley in Fox, you should: SELECT directory INDEX on phone_number to idx_directory_phone - or - INDEX on phone_number tag phone of cdx_directory i worked with Fox with dbfs of 2 millions of records and the speed is amazing -- using indexes of course! regards, ks Rahul S. Johari escribió: Ave, I'm connecting to a foxpro database (dbase) and simply running a search to retrieve a record. It's a very simple code. The problem is, as the database is growing, the search is becoming ridiculously slow ... and I mean it's taking minutes. When the dbase had 10,000 records ... search was fast efficient ... as if you were connecting to a mySQL Database. Now that the database has over 75,000 records and still growing ... it's taking minutes to search. The database has about 35 fields; Search is based on a phone number. This is the code ... ?php #Open DBF $db = dbase_open(dbase.dbf, 0); #PULL UP RECORD if ($db) { $record_numbers = dbase_numrecords($db); for ($i = 1; $i = $record_numbers; $i++) { $row = dbase_get_record_with_names($db, $i); if ($row['PHONE'] == $_POST['PHONE']) { #Retrieve row display fields echo $row['STUFF']; } } } ? It works ... but it's getting way too slow. One thing with FoxPro DBF's is that they use an Index file for searches within FoxPro. These are .CDX files which contain the Index. You can create an Index on, for example, PHONE field. However I don't think there's any way in PHP to reference this Index file for faster searches. Is there any possibility to improve search response time? Thanks! --- Rahul Sitaram Johari Founder, Internet Architects Group, Inc. [Email]sleepwal...@rahulsjohari.com [Web]http://www.rahulsjohari.com --- avast! Antivirus: Outbound message clean. Virus Database (VPS): 091124-0, 24/11/2009 Tested on: 24/11/2009 11:16:25 a.m. avast! - copyright (c) 1988-2009 ALWIL Software. http://www.avast.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- Rahul Sitaram Johari Founder, Internet Architects Group, Inc. [Email] sleepwal...@rahulsjohari.com [Web] http://www.rahulsjohari.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: dbase_get_record_with_names; Very slow search!!!
I do believe that what I'm doing is scanning the foxpro dbase row by row to get the match ... which is why it's returning the results very slow. But I don't know if there's any other way to do this. Basically the FoxPro DBF has 75,000 records and I have to search for the one row which has the Phone number I'm looking for, and display results. If there's any other way to do this ... I'll be more then happy to try. On Nov 24, 2009, at 9:55 AM, keyser soze wrote: i will try to help you but think i'm old in Fox but new in php and sadly never used php+fox so, reading your code i see you are scanning the whole dbf file from php Fox cant help you in this way if there is not another option for scan a dbf the row by row method is very slow Rahul S. Johari escribió: Your post definitely gives me hope. It's possible I'm doing something wrong! I definitely have the foxpro database indexed. I use this FoxPro command ... INDEX ON PHONE TAG PHONE I do have a .CDX file present for the Database and if I MODIFY STRUCTURE and I can see the INDEX present on PHONE. Did you check my Code? Is there any other way to pull records off a FoxPro Database? Can you use SQL Commands via PHP on FoxPro databases (SELECT * FROM ) ? Thanks On Nov 24, 2009, at 9:16 AM, keyser soze wrote: even though the dbf has 10K records Fox can't spend minutes to found a match by the way, its very strange to have 35 columns in a table/dbf or whatever pay attention to the comment of Ashley in Fox, you should: SELECT directory INDEX on phone_number to idx_directory_phone - or - INDEX on phone_number tag phone of cdx_directory i worked with Fox with dbfs of 2 millions of records and the speed is amazing -- using indexes of course! regards, ks Rahul S. Johari escribió: Ave, I'm connecting to a foxpro database (dbase) and simply running a search to retrieve a record. It's a very simple code. The problem is, as the database is growing, the search is becoming ridiculously slow ... and I mean it's taking minutes. When the dbase had 10,000 records ... search was fast efficient ... as if you were connecting to a mySQL Database. Now that the database has over 75,000 records and still growing ... it's taking minutes to search. The database has about 35 fields; Search is based on a phone number. This is the code ... ?php #Open DBF $db = dbase_open(dbase.dbf, 0); #PULL UP RECORD if ($db) { $record_numbers = dbase_numrecords($db); for ($i = 1; $i = $record_numbers; $i++) { $row = dbase_get_record_with_names($db, $i); if ($row['PHONE'] == $_POST['PHONE']) { #Retrieve row display fields echo $row['STUFF']; } } } ? It works ... but it's getting way too slow. One thing with FoxPro DBF's is that they use an Index file for searches within FoxPro. These are .CDX files which contain the Index. You can create an Index on, for example, PHONE field. However I don't think there's any way in PHP to reference this Index file for faster searches. Is there any possibility to improve search response time? Thanks! --- Rahul Sitaram Johari Founder, Internet Architects Group, Inc. [Email]sleepwal...@rahulsjohari.com [Web]http://www.rahulsjohari.com --- avast! Antivirus: Outbound message clean. Virus Database (VPS): 091124-0, 24/11/2009 Tested on: 24/11/2009 11:16:25 a.m. avast! - copyright (c) 1988-2009 ALWIL Software. http://www.avast.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- Rahul Sitaram Johari Founder, Internet Architects Group, Inc. [Email]sleepwal...@rahulsjohari.com [Web]http://www.rahulsjohari.com --- avast! Antivirus: Outbound message clean. Virus Database (VPS): 091124-0, 24/11/2009 Tested on: 24/11/2009 11:55:50 a.m. avast! - copyright (c) 1988-2009 ALWIL Software. http://www.avast.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- Rahul Sitaram Johari Founder, Internet Architects Group, Inc. [Email] sleepwal...@rahulsjohari.com [Web] http://www.rahulsjohari.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: dbase_get_record_with_names; Very slow search!!!
Keyser, It gets better -- I'm on a Mac OS X (Leopard)!! As far as I know, there isn't a VisualFoxPro ODBC Driver for Mac OS X. On Nov 24, 2009, at 10:11 AM, keyser soze wrote: Rahul, my friend i found this in a first search perhaps it be helpful http://www.yinfor.com/blog/archives/2008/01/php_connect_dbf_file.html Rahul S. Johari escribió: I do believe that what I'm doing is scanning the foxpro dbase row by row to get the match ... which is why it's returning the results very slow. But I don't know if there's any other way to do this. Basically the FoxPro DBF has 75,000 records and I have to search for the one row which has the Phone number I'm looking for, and display results. If there's any other way to do this ... I'll be more then happy to try. On Nov 24, 2009, at 9:55 AM, keyser soze wrote: i will try to help you but think i'm old in Fox but new in php and sadly never used php+fox so, reading your code i see you are scanning the whole dbf file from php Fox cant help you in this way if there is not another option for scan a dbf the row by row method is very slow Rahul S. Johari escribió: Your post definitely gives me hope. It's possible I'm doing something wrong! I definitely have the foxpro database indexed. I use this FoxPro command ... INDEX ON PHONE TAG PHONE I do have a .CDX file present for the Database and if I MODIFY STRUCTURE and I can see the INDEX present on PHONE. Did you check my Code? Is there any other way to pull records off a FoxPro Database? Can you use SQL Commands via PHP on FoxPro databases (SELECT * FROM ) ? Thanks On Nov 24, 2009, at 9:16 AM, keyser soze wrote: even though the dbf has 10K records Fox can't spend minutes to found a match by the way, its very strange to have 35 columns in a table/dbf or whatever pay attention to the comment of Ashley in Fox, you should: SELECT directory INDEX on phone_number to idx_directory_phone - or - INDEX on phone_number tag phone of cdx_directory i worked with Fox with dbfs of 2 millions of records and the speed is amazing -- using indexes of course! regards, ks Rahul S. Johari escribió: Ave, I'm connecting to a foxpro database (dbase) and simply running a search to retrieve a record. It's a very simple code. The problem is, as the database is growing, the search is becoming ridiculously slow ... and I mean it's taking minutes. When the dbase had 10,000 records ... search was fast efficient ... as if you were connecting to a mySQL Database. Now that the database has over 75,000 records and still growing ... it's taking minutes to search. The database has about 35 fields; Search is based on a phone number. This is the code ... ?php #Open DBF $db = dbase_open(dbase.dbf, 0); #PULL UP RECORD if ($db) { $record_numbers = dbase_numrecords($db); for ($i = 1; $i = $record_numbers; $i++) { $row = dbase_get_record_with_names($db, $i); if ($row['PHONE'] == $_POST['PHONE']) { #Retrieve row display fields echo $row['STUFF']; } } } ? It works ... but it's getting way too slow. One thing with FoxPro DBF's is that they use an Index file for searches within FoxPro. These are .CDX files which contain the Index. You can create an Index on, for example, PHONE field. However I don't think there's any way in PHP to reference this Index file for faster searches. Is there any possibility to improve search response time? Thanks! --- Rahul Sitaram Johari Founder, Internet Architects Group, Inc. [Email]sleepwal...@rahulsjohari.com [Web]http://www.rahulsjohari.com --- avast! Antivirus: Outbound message clean. Virus Database (VPS): 091124-0, 24/11/2009 Tested on: 24/11/2009 11:16:25 a.m. avast! - copyright (c) 1988-2009 ALWIL Software. http://www.avast.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- Rahul Sitaram Johari Founder, Internet Architects Group, Inc. [Email]sleepwal...@rahulsjohari.com [Web]http://www.rahulsjohari.com --- avast! Antivirus: Outbound message clean. Virus Database (VPS): 091124-0, 24/11/2009 Tested on: 24/11/2009 11:55:50 a.m. avast! - copyright (c) 1988-2009 ALWIL Software. http://www.avast.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- Rahul Sitaram Johari Founder, Internet Architects Group, Inc. [Email]sleepwal...@rahulsjohari.com [Web]http://www.rahulsjohari.com --- avast! Antivirus: Outbound message clean. Virus Database (VPS): 091124-0, 24/11/2009 Tested on: 24/11/2009 12:11:02 p.m. avast! - copyright (c) 1988-2009 ALWIL Software. http://www.avast.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- Rahul Sitaram Johari Founder, Internet Architects Group, Inc. [Email] sleepwal...@rahulsjohari.com [Web] http://www.rahulsjohari.com
Re: [PHP] Re: dbase_get_record_with_names; Very slow search!!!
Back in 1996 FoxPro was multi-platform. The last FoxPro version released for Mac was Visual FoxPro 3.0b (1996). After that Microsoft bought FoxPro and Mac Support/Development was cut off. As of now, there are NO known ODBC Drivers for FoxPro for the Mac Platform. So that aside ... back to Original Topic: Still no solution for a faster search through the dbf via PHP. On Nov 24, 2009, at 11:11 AM, keyser soze wrote: uhh, i don't know (time ago Fox was multi-platform unix/mac/dos) did you found that on the web? Rahul S. Johari escribió: Keyser, It gets better -- I'm on a Mac OS X (Leopard)!! As far as I know, there isn't a VisualFoxPro ODBC Driver for Mac OS X. On Nov 24, 2009, at 10:11 AM, keyser soze wrote: Rahul, my friend i found this in a first search perhaps it be helpful http://www.yinfor.com/blog/archives/2008/01/ php_connect_dbf_file.html Rahul S. Johari escribió: I do believe that what I'm doing is scanning the foxpro dbase row by row to get the match ... which is why it's returning the results very slow. But I don't know if there's any other way to do this. Basically the FoxPro DBF has 75,000 records and I have to search for the one row which has the Phone number I'm looking for, and display results. If there's any other way to do this ... I'll be more then happy to try. On Nov 24, 2009, at 9:55 AM, keyser soze wrote: i will try to help you but think i'm old in Fox but new in php and sadly never used php+fox so, reading your code i see you are scanning the whole dbf file from php Fox cant help you in this way if there is not another option for scan a dbf the row by row method is very slow Rahul S. Johari escribió: Your post definitely gives me hope. It's possible I'm doing something wrong! I definitely have the foxpro database indexed. I use this FoxPro command ... INDEX ON PHONE TAG PHONE I do have a .CDX file present for the Database and if I MODIFY STRUCTURE and I can see the INDEX present on PHONE. Did you check my Code? Is there any other way to pull records off a FoxPro Database? Can you use SQL Commands via PHP on FoxPro databases (SELECT * FROM ) ? Thanks On Nov 24, 2009, at 9:16 AM, keyser soze wrote: even though the dbf has 10K records Fox can't spend minutes to found a match by the way, its very strange to have 35 columns in a table/dbf or whatever pay attention to the comment of Ashley in Fox, you should: SELECT directory INDEX on phone_number to idx_directory_phone - or - INDEX on phone_number tag phone of cdx_directory i worked with Fox with dbfs of 2 millions of records and the speed is amazing -- using indexes of course! regards, ks Rahul S. Johari escribió: Ave, I'm connecting to a foxpro database (dbase) and simply running a search to retrieve a record. It's a very simple code. The problem is, as the database is growing, the search is becoming ridiculously slow ... and I mean it's taking minutes. When the dbase had 10,000 records ... search was fast efficient ... as if you were connecting to a mySQL Database. Now that the database has over 75,000 records and still growing ... it's taking minutes to search. The database has about 35 fields; Search is based on a phone number. This is the code ... ?php #Open DBF $db = dbase_open(dbase.dbf, 0); #PULL UP RECORD if ($db) { $record_numbers = dbase_numrecords($db); for ($i = 1; $i = $record_numbers; $i++) { $row = dbase_get_record_with_names($db, $i); if ($row['PHONE'] == $_POST['PHONE']) { #Retrieve row display fields echo $row['STUFF']; } } } ? It works ... but it's getting way too slow. One thing with FoxPro DBF's is that they use an Index file for searches within FoxPro. These are .CDX files which contain the Index. You can create an Index on, for example, PHONE field. However I don't think there's any way in PHP to reference this Index file for faster searches. Is there any possibility to improve search response time? Thanks! --- Rahul Sitaram Johari Founder, Internet Architects Group, Inc. [Email]sleepwal...@rahulsjohari.com [Web]http://www.rahulsjohari.com --- avast! Antivirus: Outbound message clean. Virus Database (VPS): 091124-0, 24/11/2009 Tested on: 24/11/2009 11:16:25 a.m. avast! - copyright (c) 1988-2009 ALWIL Software. http://www.avast.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- Rahul Sitaram Johari Founder, Internet Architects Group, Inc. [Email]sleepwal...@rahulsjohari.com [Web]http://www.rahulsjohari.com --- avast! Antivirus: Outbound message clean. Virus Database (VPS): 091124-0, 24/11/2009 Tested on: 24/11/2009 11:55:50 a.m. avast! - copyright (c) 1988-2009 ALWIL Software. http://www.avast.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- Rahul Sitaram Johari Founder, Internet
Re: [PHP] dbase_get_record_with_names; Very slow search!!!
Quite right. Unfortunately there doesn't seem to be any available ODBC Drivers for FoxPro available for Mac OS X either!! I'm hitting a brick wall no matter what direction I take. On Nov 24, 2009, at 12:22 PM, Olav wrote: Ashley Sheridan wrote: I would assume that any indexes created on any tables would be referenced automatically by the dbms and wouldn't need to be explicitly referenced from within PHP. This is dBase (.dbf) he is asking about. There is no such thing as a DBMS in dBase. The program / driver that accesses the data must handle everything. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- Rahul Sitaram Johari Founder, Internet Architects Group, Inc. [Email] sleepwal...@rahulsjohari.com [Web] http://www.rahulsjohari.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] dbase_get_record_with_names; Very slow search!!!
Well I use mySQL on my Mac for all my other database work. This particular database is natively produced in FoxPro as that is what our Company uses. My website offers some of our clients this data (stored in FoxPro DBF's) using PHP which is running on an Apache Web Server on Mac OS X. I am looking into the option of importing the DBF records in my mySQL Server on my Mac. The one issue that's coming to my mind is ... the DBF is updated daily. An End-Of-Day program run at night updates the FoxPro DBF. I can write a program in PHP to import the DBF Records -- mySQL ... however, I'm going to need to somehow Automate this procedure so that it runs automatically every nigh (or early morning) ... and also such that only NEWER records are imported from the DBF -- mySQL. Sounds a bit rough ... but seems to be a plausible solution. On Nov 24, 2009, at 12:46 PM, Olav wrote: Rahul S. Johari wrote: Quite right. Unfortunately there doesn't seem to be any available ODBC Drivers for FoxPro available for Mac OS X either!! I'm hitting a brick wall no matter what direction I take. Convert to SQLite and don't look back ;) Unless your DBF files are still in use in another application of course. If that use is not simultaneous you could at least trivially write an import/export routine. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- Rahul Sitaram Johari Founder, Internet Architects Group, Inc. [Email] sleepwal...@rahulsjohari.com [Web] http://www.rahulsjohari.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] moving to quad core
On 9/15/09 10:54 AM, Andres Gonzalez and...@packetstorm.com wrote: I have an application developed that uses alot of PHP. Currently, it is running on a Ubuntu 8.04 , single core CPU host. We are moving to a quad core host for this application. Is there anything special that I need to do to configure PHP to run on a quad core host? I noticed that my current single core system has PHP configured with Thread Safety disabled (as reported from phpinfo()). Does that need to be enabled to run in a multi-core environment? Any other suggestions for configuring PHP for multi-core use? Very interesting question indeed; I moved from a single-core to dual-core some time back, and recently moved from dual-core to quad-core. Never paid attention to the hyper- threading difference in the httpd process. Would definitely be interesting in seeing more information on this topic. --- Rahul Sitaram Johari Founder, Internet Architects Group, Inc. [Email] sleepwal...@rahulsjohari.com [Web] http://www.rahulsjohari.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How do I Upload XML file using cUrl?
Ave, I have a client who used Lead360.Com to manage their Leads. We have a Leads Management application in place that creates an XML file of the lead which give the client manually to download. What are client is requesting is to POST the XML File directly to their Leads360.Com account. We have a POST Url from Leads360 where we can send the lead, but I'm not sure what kind of a cUrl script I need to use to POST an XML file. I've handled POST Data before using cUrl but I haven't written a cUrl script that uploads a file to a URL. From what I have gathered so far ... this is what I have ... [CODE] $filename = file.xml; $handle = fopen($filename, r); $XPost = fread($handle, filesize($filename)); fclose($handle); $url = https://secure.leads360.com/Import.aspx;; $ch = curl_init(); // initialize curl handle curl_setopt($ch, CURLOPT_VERBOSE, 1); // set url to post to curl_setopt($ch, CURLOPT_URL, $url); // set url to post to curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // return into a variable curl_setopt($ch, CURLOPT_HTTPHEADER, Array(Content-Type: text/xml)); curl_setopt($ch, CURLOPT_HEADER, 1); curl_setopt($ch, CURLOPT_TIMEOUT, 40); // times out after 4s curl_setopt($ch, CURLOPT_POSTFIELDS, $XPost); // add POST fields curl_setopt($ch, CURLOPT_POST, 1); $result = curl_exec($ch); // run the whole process [END CODE] Am I on the right track here or am I missing something? Thanks Guys! --- Rahul Sitaram Johari Founder, Internet Architects Group, Inc. [Email] sleepwal...@rahulsjohari.com [Web] http://www.rahulsjohari.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Extract variable out of a Class - Function
I have a function within a class. There is a variable inside that function which I need to access use outside of the class/function. For example ... Class Test { function showOutput { if ($this-url) { $justTT = substr($this-url,-10,7); echo $justTT; } } } I need to use $justTT. How do I get the value of $justTT into a different variable outside of this class/function so I can use it in a different class? --- Rahul S. Johari Supervisor, Internet Administration Informed Sources, Inc. [Email] ra...@troyjobs.com [Web] https://www.informed-sources.com [Phone] 518-687-6700 Ext: 154 [Fax] 518-687-6799 --- Rahul Sitaram Johari Founder, Internet Architects Group, Inc. [Email] sleepwal...@rahulsjohari.com [Web] http://www.rahulsjohari.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: RES: [PHP] Extract variable out of a Class - Function
Yes!!! It works!! Thats' exactly what I was looking for ... getting the value of $justTT in $othervar. I'm new to classes ... thus the noobity! On Apr 23, 2009, at 2:04 PM, Jônatas Zechim wrote: Class Test { function showOutput { if ($this-url) { $this-justTT = substr($this-url,-10,7); } } } $myvar=new Test(); $myvar-showOutput(); $othervar=$myvar-justTT; echo $othervar; $otherClass=new anotherclass($othervar); Is that u want? Zechim SP/Brazil -Mensagem original- De: Rahul S. Johari [mailto:sleepwal...@rahulsjohari.com] Enviada em: quinta-feira, 23 de abril de 2009 14:56 Para: php-general@lists.php.net Assunto: [PHP] Extract variable out of a Class - Function I have a function within a class. There is a variable inside that function which I need to access use outside of the class/function. For example ... Class Test { function showOutput { if ($this-url) { $justTT = substr($this-url,-10,7); echo $justTT; } } } I need to use $justTT. How do I get the value of $justTT into a different variable outside of this class/function so I can use it in a different class? --- Rahul Sitaram Johari Founder, Internet Architects Group, Inc. [Email] sleepwal...@rahulsjohari.com [Web] http://www.rahulsjohari.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Connecting to dBase using ODBC on Mac OS X
Ave, Does anyone have any knowledge on connecting a FoxPro table (.dbf, dbase) using ODBC on a Mac OS X? I've been googling but not much is turning up. Some information is available on ODBC Connections using PHP ... very little on Mac OS X ... and absolutely none to do with a FoxPro dBase table. Thanks. --- Rahul Sitaram Johari Founder, Internet Architects Group, Inc. [Email] sleepwal...@rahulsjohari.com [Web] http://www.rahulsjohari.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Writing to dbase (dbf) deletes index (cdx)
Ave, I noticed something peculiar and I can't find a solution for this. I'm wondering if anyone can help me out. I'm using the dbase functions to read write from dbf (foxpro) tables. The DBF tables usually have an Index which is contained in filename.cdx. It appears that anytime I Write to the dbf table, it deletes the Index. Is there any way around this? Here's a simple code that I use for appending to a DBF table: // open in read-write mode $db = dbase_open(dbf/myfile.dbf, 2); // gets the old row if ($db) { $record_numbers = dbase_numrecords($db); for ($i = 1; $i = $record_numbers; $i++) { $row = dbase_get_record_with_names($db, $i); if ($row['SECCODE'] == $_COOKIE['seccodeCookie']) { unset($row[deleted]); // Update fields $row['f1'] = $_POST['name']; $row['f2'] = $_POST['email']; //echo Replacing Record number $i; // Replace the record $row = array_values($row); dbase_replace_record($db, $row, $i) or die(Fatal Error); } } } dbase_close($db); ? Thanks. --- Rahul Sitaram Johari Founder, Internet Architects Group, Inc. [Email] sleepwal...@rahulsjohari.com [Web] http://www.rahulsjohari.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Export/Write rows from DBF to CSV
Ave, I'm trying to retrieve data from a DBF database and write it to a CSV file in a comma delimited format. I'm able to get the data and write it to CSV, but it only writes the last row/record ... not all the records. I know I don't have the correct code and I'm hoping someone can help me... _ #CREATE CSV $date = date('mdy'); $_file = 'CSV/TransferData_'.$date.'.csv'; $_fp = @fopen( $_file, 'w' ); #SELECT DBF TO OPEN - READ ONLY $db = dbase_open(mydata.dbf, 0); #PULL UP RECORD if ($db) { $record_numbers = dbase_numrecords($db); for ($i = 1; $i = $record_numbers; $i++) { $row = dbase_get_record_with_names($db, $i); #WRITE ROWS TO VARIABLE $_csv_data = trim($row['PHONE']).,.trim($row['DATE']).,.\n; -- THIS is where my problem is! This only writes the last row!! } } #WRITE TO CSV @fwrite( $_fp, $_csv_data ); @fclose( $_fp ); _ Thanks! --- Rahul Sitaram Johari Founder, Internet Architects Group, Inc. [Email] sleepwal...@rahulsjohari.com [Web] http://www.rahulsjohari.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Export/Write rows from DBF to CSV
On Mar 13, 2009, at 10:01 AM, Bastien Koert wrote: On Fri, Mar 13, 2009 at 9:56 AM, Rahul S. Johari sleepwal...@rahulsjohari.com wrote: Ave, I'm trying to retrieve data from a DBF database and write it to a CSV file in a comma delimited format. I'm able to get the data and write it to CSV, but it only writes the last row/record ... not all the records. I know I don't have the correct code and I'm hoping someone can help me... _ #CREATE CSV $date = date('mdy'); $_file = 'CSV/TransferData_'.$date.'.csv'; $_fp = @fopen( $_file, 'w' ); #SELECT DBF TO OPEN - READ ONLY $db = dbase_open(mydata.dbf, 0); #PULL UP RECORD if ($db) { $record_numbers = dbase_numrecords($db); for ($i = 1; $i = $record_numbers; $i++) { $row = dbase_get_record_with_names($db, $i); #WRITE ROWS TO VARIABLE $_csv_data = trim($row['PHONE']).,.trim($row['DATE']).,.\n; -- THIS is where my problem is! This only writes the last row!! } } #WRITE TO CSV @fwrite( $_fp, $_csv_data ); @fclose( $_fp ); _ Thanks! --- Rahul Sitaram Johari Founder, Internet Architects Group, Inc. [Email] sleepwal...@rahulsjohari.com [Web] http://www.rahulsjohari.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php You are overwriting the variable ($csv_data) that holds the row, add a period (concatenator) operator to build the up the data #WRITE ROWS TO VARIABLE $_csv_data .= trim($row['PHONE']).,.trim($row['DATE']).,.\n; -- THIS is where my problem is! This only writes the last row!! -- Bastien Cat, the other other white meat AH!!! The Simplest Solution!! It works Absolutely 100% Perfect!! Much Thanks :) --- Rahul Sitaram Johari Founder, Internet Architects Group, Inc. [Email] sleepwal...@rahulsjohari.com [Web] http://www.rahulsjohari.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Export/Write rows from DBF to CSV
On Mar 13, 2009, at 11:44 AM, Shawn McKenzie wrote: Rahul S. Johari wrote: On Mar 13, 2009, at 10:01 AM, Bastien Koert wrote: On Fri, Mar 13, 2009 at 9:56 AM, Rahul S. Johari sleepwal...@rahulsjohari.com wrote: Ave, I'm trying to retrieve data from a DBF database and write it to a CSV file in a comma delimited format. I'm able to get the data and write it to CSV, but it only writes the last row/record ... not all the records. I know I don't have the correct code and I'm hoping someone can help me... _ #CREATE CSV $date = date('mdy'); $_file = 'CSV/TransferData_'.$date.'.csv'; $_fp = @fopen( $_file, 'w' ); #SELECT DBF TO OPEN - READ ONLY $db = dbase_open(mydata.dbf, 0); #PULL UP RECORD if ($db) { $record_numbers = dbase_numrecords($db); for ($i = 1; $i = $record_numbers; $i++) { $row = dbase_get_record_with_names($db, $i); #WRITE ROWS TO VARIABLE $_csv_data = trim($row['PHONE']).,.trim($row['DATE']).,.\n; -- THIS is where my problem is! This only writes the last row!! } } #WRITE TO CSV @fwrite( $_fp, $_csv_data ); @fclose( $_fp ); _ Thanks! --- Rahul Sitaram Johari Founder, Internet Architects Group, Inc. [Email] sleepwal...@rahulsjohari.com [Web] http://www.rahulsjohari.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php @fwrite( $_fp, $_csv_data ); You are overwriting the variable ($csv_data) that holds the row, add a period (concatenator) operator to build the up the data #WRITE ROWS TO VARIABLE $_csv_data .= trim($row['PHONE']).,.trim($row['DATE']).,.\n; -- THIS is where my problem is! This only writes the last row!! -- Bastien Cat, the other other white meat AH!!! The Simplest Solution!! It works Absolutely 100% Perfect!! Much Thanks :) Or even simpler and won't build a huge string if you have millions of rows, just move your fwrite() up into the loop to write each record to the csv: #WRITE ROWS TO VARIABLE AND WRITE LINE TO CSV $_csv_data = trim($row['PHONE']).,.trim($row['DATE']).,.\n; @fwrite( $_fp, $_csv_data ); -- Thanks! -Shawn http://www.spidean.com Very, Very Interesting Snippet - works perfectly fine and I agree, more efficient! Thanks!! --- Rahul Sitaram Johari Founder, Internet Architects Group, Inc. [Email] sleepwal...@rahulsjohari.com [Web] http://www.rahulsjohari.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Why MS Won't Retire Browsers -- was: Interntet Explorer 8 beater 2
On Sep 12, 2008, at 10:18 AM, Boyd, Todd M. wrote: -Original Message- From: Sancar Saran [mailto:[EMAIL PROTECTED] Sent: Thursday, September 11, 2008 6:15 PM To: php-general@lists.php.net Subject: Re: [PHP] Re: Why MS Won't Retire Browsers -- was: Interntet Explorer 8 beater 2 Because, M$ earning money from Win GUI. No WinGUI no money. From the begining, M$ try to broke web compatibilty in every way... Sure M$ has bad records about software quality. But even ask yourself. WHY IE (especially 5 and 6) SO buggy even M$ standards. M$ isn't mr nice guy and they wont get a dime from web. They hate web and internet from begining. M$ is anti web IT company. They are too big they are to bold (or bald) to accept changing market and they got too much money on bank to do someting very very stupid. Like Windows VISTA. Don't expect anything good from M$... tirade Okay... here it goes. I'm sick and tired of people talking trash on Windows Vista. It came pre-installed on my laptop (Home Premium... not Business Pro, sadly) and I haven't had any issues with it whatsoever. Some of my WinXP programs don't show up in the start menu when they're installed... but it's not Microsoft's fault that software companies haven't taken the initiative to adapt to the new Vista framework (which, let's be honest, can't require all that much effort in most cases where base-level operating system stuff isn't involved in the actual program). Annoyed with the UAC that asks you to confirm every administrative decision you make on your computer? Quit being a weenie and just automate it with RegEdit (or, if you're using Business, there is an explicit option for it in the Control Panel). Annoyed with all the bells and whistles in the Aero theme that is installed by default? Don't use it! I remember the first time I installed a Linux distro that came pre-bundled with KDE... I took the time to remove all the fading, transparency, window animations, bouncing cursors, etc. (actually, I just switched to XFCE instead). I don't see the difference. If you want to get high and mighty with a retort about rolling your own Linux distribution--well, you've just sailed far beyond ANY pre-packaged OS (Mac, Windows, Linux, or otherwise) and the point is moot. Find a new scapegoat to complain about, PLEASE. Bitch about WebKit's lack of XMLDOM instantiation. Bitch about Google launching pay-for- play high resolution satellite imagery. Bitch about the Xandros EEE being squashed by Intel. Bitch about Facebook's API and their draconic limitations on markup language and Javascript... but this Vista sucks and I won't comment as to why broken record has run its course. /tirade Have a lovely day! Todd Boyd Web Programmer Three Votes Todd!! In total agreement. I've been meaning to make a similar post statement not just here (in PHP mailing list), but in an abundant number of places all across the Internet horizon. And My PC didn't come bundled with Vista, in fact, I actually Upgraded from XP personally manually. I have no stock options in Microsoft, and I have nothing personal with them - Just another commodity user/customer. And I couldn't have said it any better. Cheers! --- Rahul Sitaram Johari Founder, Internet Architects Group, Inc. [Email] [EMAIL PROTECTED] [Web] http://www.rahulsjohari.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Dynamic Select Lists - 1st Selection Effects 2nd!
Ave, What I have is two Select (Drop-Down) lists (State County) and I'm populating them from a mySQL table. What I want is when the user selects the State from the State List, the County List should only pull out counties associated with that State. Now I know that you can create such an effect using Javascript or AJAX and have nothing to do with PHP/mySQL - and I was able to accomplish that - but only for lists where you could define data manually. I'm not able to accomplish this at all with Lists that are pulling out option data from a mySQL table. I'm also giving the User the opportunity to add as many State/County combinations as possible in a box. 'tis my code: !-- *** STATE/COUNTY BOX -- TR TD CLASS=blackTextState: /TD TD CLASS=blackTextSELECT NAME=d_state ?php do { ? OPTION VALUE=?php echo $row_D_STATE['STATE']??php echo $row_D_STATE['STATE']?/OPTION ?php } while ($row_D_STATE = mysql_fetch_assoc($D_STATE)); $rows = mysql_num_rows($D_STATE); if($rows 0) { mysql_data_seek($D_STATE, 0); $row_D_STATE = mysql_fetch_assoc($D_STATE); } ? /SELECT /TD /TR TR TD CLASS=blackTextCounty: /TD TD CLASS=blackText SELECT NAME=d_county OPTION VALUE=ALL SELECTEDAll/OPTION ?php do { ? OPTION VALUE=?php echo $row_D_COUNTY['COUNTY']??php echo $row_D_COUNTY['COUNTY']?/OPTION ?php } while ($row_D_COUNTY = mysql_fetch_assoc($D_COUNTY)); $rows = mysql_num_rows($D_COUNTY); if($rows 0) { mysql_data_seek($D_COUNTY, 0); $row_D_COUNTY = mysql_fetch_assoc($D_COUNTY); } ? /SELECT INPUT NAME=add_btn_1 TYPE=button VALUE=[+] Add onClick=document.AD_INVENTORY_FORM.d_state_county.value +=document.AD_INVENTORY_FORM.d_state.value +'/'+document.AD_INVENTORY_FORM.d_county.value+'\n'; /TD /TR TR TD CLASS=blackText COLSPAN=2TEXTAREA NAME=d_state_county COLS=26 ROWS=3/TEXTAREA/TD /TR !-- *** STATE/COUNTY BOX -- I'm not able to understand exactly how to manipulate the SQL Query or otherwise force the 2nd Select List to only show records that match the selected State. Any pointers? --- Rahul Sitaram Johari Founder, Internet Architects Group, Inc. [Email] [EMAIL PROTECTED] [Web] http://www.rahulsjohari.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Dynamic Select Lists - 1st Selection Effects 2nd!
On Jul 31, 2008, at 12:55 PM, Boyd, Todd M. wrote: -Original Message- From: Rahul S. Johari [mailto:[EMAIL PROTECTED] Sent: Thursday, July 31, 2008 11:40 AM To: php-general@lists.php.net Subject: [PHP] Dynamic Select Lists - 1st Selection Effects 2nd! Ave, What I have is two Select (Drop-Down) lists (State County) and I'm populating them from a mySQL table. What I want is when the user selects the State from the State List, the County List should only pull out counties associated with that State. Now I know that you can create such an effect using Javascript or AJAX and have nothing to do with PHP/mySQL - and I was able to accomplish that - but only for lists where you could define data manually. I'm not able to accomplish this at all with Lists that are pulling out option data from a mySQL table. I'm also giving the User the opportunity to add as many State/County combinations as possible in a box. 'tis my code: !-- *** STATE/COUNTY BOX -- TR TD CLASS=blackTextState: /TD TD CLASS=blackTextSELECT NAME=d_state ?php do { ? OPTION VALUE=?php echo $row_D_STATE['STATE']??php echo $row_D_STATE['STATE']?/OPTION ?php } while ($row_D_STATE = mysql_fetch_assoc($D_STATE)); $rows = mysql_num_rows($D_STATE); if($rows 0) { mysql_data_seek($D_STATE, 0); $row_D_STATE = mysql_fetch_assoc($D_STATE); } ? /SELECT /TD /TR TR TD CLASS=blackTextCounty: /TD TD CLASS=blackText SELECT NAME=d_county OPTION VALUE=ALL SELECTEDAll/OPTION ?php do { ? OPTION VALUE=?php echo $row_D_COUNTY['COUNTY']??php echo $row_D_COUNTY['COUNTY']?/OPTION ?php } while ($row_D_COUNTY = mysql_fetch_assoc($D_COUNTY)); $rows = mysql_num_rows($D_COUNTY); if($rows 0) { mysql_data_seek($D_COUNTY, 0); $row_D_COUNTY = mysql_fetch_assoc($D_COUNTY); } ? /SELECT INPUT NAME=add_btn_1 TYPE=button VALUE=[+] Add onClick=document.AD_INVENTORY_FORM.d_state_county.value +=document.AD_INVENTORY_FORM.d_state.value +'/'+document.AD_INVENTORY_FORM.d_county.value+'\n'; /TD /TR TR TD CLASS=blackText COLSPAN=2TEXTAREA NAME=d_state_county COLS=26 ROWS=3/TEXTAREA/TD /TR !-- *** STATE/COUNTY BOX -- I'm not able to understand exactly how to manipulate the SQL Query or otherwise force the 2nd Select List to only show records that match the selected State. Any pointers? The page referenced by an AJAX XmlHttpRequest() doesn't have to be static. You can even use the query string to supply the AJAX call with parameters (or perhaps post a form instead). This way, you can pass the chosen state to the AJAX-requested page and use PHP on the other end to construct the appropriate counties selection list. AJAX could then push this result into a DIV that had, up until now, contained an empty selection list with no available options. Summary: Page has two DIVs: one for state list, one for county list (which is empty). User clicks first DIV's selection box, onChange JS method fires AJAX call to getCounties.php?state=XX (where XX is the chosen state). PHP on the other end builds a selection list for the given state and returns it to the AJAX call. The AJAX result is then assigned to the second div, which now contains the list of counties for the given state. HTH, Todd Boyd Web Programmer In theory your solution sounds extremely feasible perhaps the appropriate procedure. My problem is that I'm not an expert at all in AJAX (Or javascript for that matter). The manually-fed examples I worked with were freely available sources for such a functional Select List, and I tried manipulating them to fit in my php/mySQL code but to no avail. I'll try work this out, but I doubt I'll be able to. Thanks. --- Rahul Sitaram Johari Founder
Re: [PHP] Dynamic Select Lists - 1st Selection Effects 2nd! -- SOLVED!!
Did IT Haha ... just as you were probably writing in sending this mail. I pretty much used your theory and actually did look around under http://www.w3schools.com/ajax/ to get the relevant AJAX information. Works like a charm. Pretty much using an onChange=grabCountiesfromAnotherPHPpage(); function. Code is similar to your example below - slightly different. An included 'ajax.js' takes care of the AJAX code, and an additional 'counties.php' writes counties based on a SELECT COUNTY from myTable WHERE STATE = $_GET['STATE'] SQL Query in an independent SELECT LIST. AJAX takes care of the rest by pulling in this SELECT LIST on to the original page. Thanks a ton - this actually turned out to be easier then I thought!! :) On Jul 31, 2008, at 2:31 PM, Boyd, Todd M. wrote: Rahul, Aww, come now... don't be so negative! :) Most widely-adopted programming practices are widely-adopted for a reason: they are not inherently difficult to use. This does, of course, get obfuscated by various extensions and poor programming techniques end-users employ, but I digress. http://www.w3schools.com/ajax/ should get you started, but here's a simple implementation: selection.html: --- div id=stateDiv select id=stateList name=state onchange=ajaxCounties(); option value=AlabamaAlabama/option option value=AlaskaAlaska/option !-- You get the idea... -- /select /div !-- /stateDiv -- div id=countyDiv select name=county option value=/option /select /div !-- /countyDiv -- script type=text/javascript function ajaxCounties() { var xmlHttp; var stateList = document.getElementById(stateList); try { // Firefox, Opera 8.0+, Safari xmlHttp = new XMLHttpRequest(); } catch (e) { // Internet Explorer try { xmlHttp = new ActiveXObject(Msxml2.XMLHTTP); } catch (e) { // Older IE try { xmlHttp = new ActiveXObject(Microsoft.XMLHTTP); } catch (e) { // AJAX unsupported alert(Your browser does not support AJAX!); return false; } } } // ajax actions xmlHttp.onReadyStateChange = function() { // data returned from server if(xmlHttp.readyState == 4) { // fill div with server-generated select element document.getElementById(countyDiv).innerHTML = xmlHttp.responseText; } } // request counties from web server xmlHttp.open(GET, county.php?state= + stateList.options[stateList.selectedIndex].value, true); xmlHttp.send(null); } /script --- I'll leave the PHP implementation up to you... but it'll look something like this: county.php --- select id=countyList name=county ?php // perform query here. for(a = 0; a mysql_num_rows($result); a++) { $row = mysql_fetch_array($result); echo option value=\{$row['countyId']}\{$row['countyName']} . /option; } ? /select --- HTH, Todd Boyd Web Programmer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- Rahul Sitaram Johari Founder, Internet Architects Group, Inc. [Email] [EMAIL PROTECTED] [Web] http://www.rahulsjohari.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Dynamic Select Lists - 1st Selection Effects 2nd! -- SOLVED!!
On Jul 31, 2008, at 3:10 PM, Boyd, Todd M. wrote: -Original Message- From: Rahul S. Johari [mailto:[EMAIL PROTECTED] Sent: Thursday, July 31, 2008 2:06 PM To: Boyd, Todd M. Cc: php-general@lists.php.net Subject: Re: [PHP] Dynamic Select Lists - 1st Selection Effects 2nd! -- SOLVED!! Did IT Haha ... just as you were probably writing in sending this mail. I pretty much used your theory and actually did look around under http://www.w3schools.com/ajax/ to get the relevant AJAX information. Works like a charm. Pretty much using an onChange=grabCountiesfromAnotherPHPpage(); function. Code is similar to your example below - slightly different. An included 'ajax.js' takes care of the AJAX code, and an additional 'counties.php' writes counties based on a SELECT COUNTY from myTable WHERE STATE = $_GET['STATE'] SQL Query in an independent SELECT LIST. AJAX takes care of the rest by pulling in this SELECT LIST on to the original page. Thanks a ton - this actually turned out to be easier then I thought!! :) Rahul, Glad to hear it! Hopefully, this will keep you from abandoning new and exciting programming horizons that you don't immediately feel capable of grasping. After all, if you're going to be an Internet Architect, AJAX is something you'll need to be (at least comfortably) familiar with. :) Todd Boyd Web Programmer Indeed! This problem actually opened up my horizon to the whole AJAX foundation. I think what I was most impressed was the ease with which I was able to accomplish this Dynamic state for my select lists, and how effective the script actually is. I actually had two separate SELECT LIST combinations on the page which both needed the same Dynamic functionality. Achieved it by fine-tuning my script a bit. Really liking AJAX right now and ready to dip in my feet deeper. Thanks Todd, appreciate your support! --- Rahul Sitaram Johari Founder, Internet Architects Group, Inc. [Email] [EMAIL PROTECTED] [Web] http://www.rahulsjohari.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] After INSERT form submit - Data doesn't refresh!
Ave, I'm wondering if there's a PHP solution to this, I could be in the wrong place. I have an INSERT form which submits to the same php page, which also displays the records from the mySQL database the INSERT form submits to. When the form submits and the page returns, the added record does not show up unless you Refresh the page. I'm imagining even after form submit, the Browser is caching the data and displaying data from the Cache. Is there a solution to this? Is there anything PHP can do to instruct the browser not the cache the data? Thanks! --- Rahul Sitaram Johari Founder, Internet Architects Group, Inc. [Email] [EMAIL PROTECTED] [Web] http://www.rahulsjohari.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] After INSERT form submit - Data doesn't refresh!
I tried with just the first three header() statements you gave, but it didn't work. Let me try the modification date ... which file is being referred to in $ffile? Also, I'm using Firefox, if it's of any consequence. Thanks! On Jul 22, 2008, at 7:30 AM, Bernhard Kohl wrote: I'm pretty sure this is a cache issue .. To disable caching: header('Cache-Control: no-cache, no-store, max-age=0, must- revalidate'); header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past header('Pragma: no-cache'); But if you have the modification date then use $time = filemtime($ffile); header('Last-Modified: '.gmdate('D, d M Y H:i:s', $time).' GMT'); On Tue, Jul 22, 2008 at 1:14 PM, Rahul S. Johari [EMAIL PROTECTED] wrote: Ave, I'm wondering if there's a PHP solution to this, I could be in the wrong place. I have an INSERT form which submits to the same php page, which also displays the records from the mySQL database the INSERT form submits to. When the form submits and the page returns, the added record does not show up unless you Refresh the page. I'm imagining even after form submit, the Browser is caching the data and displaying data from the Cache. Is there a solution to this? Is there anything PHP can do to instruct the browser not the cache the data? Thanks! --- Rahul Sitaram Johari Founder, Internet Architects Group, Inc. [Email] [EMAIL PROTECTED] [Web] http://www.rahulsjohari.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- Rahul Sitaram Johari Founder, Internet Architects Group, Inc. [Email] [EMAIL PROTECTED] [Web] http://www.rahulsjohari.com
Re: [PHP] After INSERT form submit - Data doesn't refresh!
Hmm, interesting. In my case, $file does indeed output dynamic data. I did try with the modified time but it still doesn't work. I still have to hit refresh on the browser, after submitting the form, in order for the inserted record to appear. Not sure what to do - it's rather annoying. Novice users of the page would assume the entry didn't get inserted or something happened. One alternate is to submit Data to a different page and let that page redirect to the Original page - but I do find it hard to believe that there is no solution to this caching. Thanks guys! On Jul 22, 2008, at 8:26 AM, Yeti wrote: The Last-Modified header tells the browser when the requested page was last modified. Now I don't know how you get the date in your case but here is an example: browser requests /test/test.php which is a simple php file without any includes etc. in this case $file = '/test/test.php'; This wont work if $file outputs dynamic data, so only use it if the content only changes when you change the file. Now if you are using templates etc. obtaining the Last-Modified time is a bit more complicated. If you use server side caching then you can chose the cached file else you have to figure it out yourself. And the RFC 2616 header specification says: An origin server MUST NOT send a Last-Modified date which is later than the server's time of message origination. In such cases, where the resource's last modification would indicate some time in the future, the server MUST replace that date with the message origination date. So do not send a future date! On Tue, Jul 22, 2008 at 2:11 PM, Rahul S. Johari [EMAIL PROTECTED] wrote: I tried with just the first three header() statements you gave, but it didn't work. Let me try the modification date ... which file is being referred to in $ffile? Also, I'm using Firefox, if it's of any consequence. Thanks! On Jul 22, 2008, at 7:30 AM, Bernhard Kohl wrote: I'm pretty sure this is a cache issue .. To disable caching: header('Cache-Control: no-cache, no-store, max-age=0, must- revalidate'); header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past header('Pragma: no-cache'); But if you have the modification date then use $time = filemtime($ffile); header('Last-Modified: '.gmdate('D, d M Y H:i:s', $time).' GMT'); On Tue, Jul 22, 2008 at 1:14 PM, Rahul S. Johari [EMAIL PROTECTED] wrote: Ave, I'm wondering if there's a PHP solution to this, I could be in the wrong place. I have an INSERT form which submits to the same php page, which also displays the records from the mySQL database the INSERT form submits to. When the form submits and the page returns, the added record does not show up unless you Refresh the page. I'm imagining even after form submit, the Browser is caching the data and displaying data from the Cache. Is there a solution to this? Is there anything PHP can do to instruct the browser not the cache the data? Thanks! --- Rahul Sitaram Johari Founder, Internet Architects Group, Inc. [Email] [EMAIL PROTECTED] [Web] http://www.rahulsjohari.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- Rahul Sitaram Johari Founder, Internet Architects Group, Inc. [Email] [EMAIL PROTECTED] [Web] http://www.rahulsjohari.com --- Rahul Sitaram Johari Founder, Internet Architects Group, Inc. [Email] [EMAIL PROTECTED] [Web] http://www.rahulsjohari.com
Re: [PHP] After INSERT form submit - Data doesn't refresh!
Here's what it is: I have a php page, a.php, which contains these three things: - SELECT statement to display records from a mySQL Table - HTML Form for inserting data into the mySQL Table - INSERT statement to insert that row into the mySQL Table The HTML Form submits to the same, a.php Once the user submits the Form, a.php is called which INSERT's the row into the mySQL Table. However, the row does not appear in the SELECT statement table data unless I hit refresh on the page. (The INSERT function is executed before the SELECT in the page). I used the header() code that was suggested: header('Cache-Control: no-cache, no-store, max-age=0, must-revalidate'); header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past header('Pragma: no-cache'); $ffile = 'a.php'; $time = filemtime($ffile); header('Last-Modified: '.gmdate('D, d M Y H:i:s', $time).' GMT'); .. but it didn't help. Everything is working fine except that the Browser is more then likely caching the data and thus not allowing the newly inserted row to appear on top when the SELECT is executed. On Jul 22, 2008, at 8:34 AM, Thiago H. Pojda wrote: Code, please? :) On Tue, Jul 22, 2008 at 9:33 AM, Rahul S. Johari [EMAIL PROTECTED] wrote: Hmm, interesting. In my case, $file does indeed output dynamic data. I did try with the modified time but it still doesn't work. I still have to hit refresh on the browser, after submitting the form, in order for the inserted record to appear. Not sure what to do - it's rather annoying. Novice users of the page would assume the entry didn't get inserted or something happened. One alternate is to submit Data to a different page and let that page redirect to the Original page - but I do find it hard to believe that there is no solution to this caching. Thanks guys! On Jul 22, 2008, at 8:26 AM, Yeti wrote: The Last-Modified header tells the browser when the requested page was last modified. Now I don't know how you get the date in your case but here is an example: browser requests /test/test.php which is a simple php file without any includes etc. in this case $file = '/test/test.php'; This wont work if $file outputs dynamic data, so only use it if the content only changes when you change the file. Now if you are using templates etc. obtaining the Last-Modified time is a bit more complicated. If you use server side caching then you can chose the cached file else you have to figure it out yourself. And the RFC 2616 header specification says: An origin server MUST NOT send a Last-Modified date which is later than the server's time of message origination. In such cases, where the resource's last modification would indicate some time in the future, the server MUST replace that date with the message origination date. So do not send a future date! On Tue, Jul 22, 2008 at 2:11 PM, Rahul S. Johari [EMAIL PROTECTED] wrote: I tried with just the first three header() statements you gave, but it didn't work. Let me try the modification date ... which file is being referred to in $ffile? Also, I'm using Firefox, if it's of any consequence. Thanks! On Jul 22, 2008, at 7:30 AM, Bernhard Kohl wrote: I'm pretty sure this is a cache issue .. To disable caching: header('Cache-Control: no-cache, no-store, max-age=0, must- revalidate'); header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past header('Pragma: no-cache'); But if you have the modification date then use $time = filemtime($ffile); header('Last-Modified: '.gmdate('D, d M Y H:i:s', $time).' GMT'); On Tue, Jul 22, 2008 at 1:14 PM, Rahul S. Johari [EMAIL PROTECTED] wrote: Ave, I'm wondering if there's a PHP solution to this, I could be in the wrong place. I have an INSERT form which submits to the same php page, which also displays the records from the mySQL database the INSERT form submits to. When the form submits and the page returns, the added record does not show up unless you Refresh the page. I'm imagining even after form submit, the Browser is caching the data and displaying data from the Cache. Is there a solution to this? Is there anything PHP can do to instruct the browser not the cache the data? Thanks! --- Rahul Sitaram Johari Founder, Internet Architects Group, Inc. [Email] [EMAIL PROTECTED] [Web] http://www.rahulsjohari.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- Rahul Sitaram Johari Founder, Internet Architects Group, Inc. [Email] [EMAIL PROTECTED] [Web] http://www.rahulsjohari.com --- Rahul Sitaram Johari Founder, Internet Architects Group, Inc. [Email] [EMAIL PROTECTED] [Web] http://www.rahulsjohari.com -- Thiago Henrique Pojda --- Rahul Sitaram Johari Founder, Internet Architects Group, Inc. [Email] [EMAIL PROTECTED] [Web] http://www.rahulsjohari.com
Re: [PHP] After INSERT form submit - Data doesn't refresh!
It works, but it's not the most efficient solution. The page has heavy graphics text. Using the header(Location: a.php) loads the page in question twice. Slower connections will respond slowly to the page. In theory, the header() statements for not using cache should have worked - I'm not sure why they are working. Even Googling the loading from cache problem gives those statements in various places. On Jul 22, 2008, at 10:16 AM, Jason Pruim wrote: Without seeing the code it's hard to tell.. But couldn't you just use a header(Location: a.php); after the insert statement? Or is that too ugly of a hack? :) It works for me on a project I'm working on. On Jul 22, 2008, at 9:42 AM, Daniel Brown wrote: On Tue, Jul 22, 2008 at 8:56 AM, Yeti [EMAIL PROTECTED] wrote: ok, in that case forget the Last-Modified or set it to the current date. header('Last-Modified: '.gmdate('D, d M Y H:i:s', time()).' GMT'); Expanding on this, keep in mind that some people may be as far ahead as GMT +1300. So if you want to use the Last-Modified HTTP/1.0 standard, you may want to try this: ?php header(Last-Modified: .gmdate(D, d M Y H:i:s,strtotime(+3 days)). GMT); ? As for turning off caching in his own browser, while it may fix the OP's problem on his machine, it by no means fixes the bug in general. Other users will still be faced with the same issue. -- /Daniel P. Brown Better prices on dedicated servers: Intel 2.4GHz/60GB/512MB/2TB $49.99/mo. Intel 3.06GHz/80GB/1GB/2TB $59.99/mo. Dedicated servers, VPS, and hosting from $2.50/mo. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 11287 James St Holland, MI 49424 www.raoset.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- Rahul Sitaram Johari Founder, Internet Architects Group, Inc. [Email] [EMAIL PROTECTED] [Web] http://www.rahulsjohari.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] After INSERT form submit - Data doesn't refresh!
No, actually the flow of the program does not work in that order. The flow of the program is in this order: - INSERT row function - INSERT HTML FORM - SELECT function to display records Technically the point at which the SELECT statement is executed and pulls records from the mySQL database - the newly inserted row is ALREADY there, so it really shouldn't have any problems displaying the new row. I know a couple of you are asking for the code, but quite honestly the codes are very, very simple INSERT, SELECT sql quries along with a simple HTML form. I don't think the actual SQL quries embedded in the page will really resolve the problem or help anyone in diagnosing this. I can post them - but I think like Thijs requested - the order would probably have been more important. The page begins with: ?php if($insertSubmit) { $query = INSERT INTO . .. execute query ... } ? somewhere after that is the HTML Form that the user can fill in somewhere after that ?php $query = SELECT * FROM tbl . .. execute query ... echo all records } ? So honestly I don't think it's this code that makes the difference. I still believe this is a browser cache issue. I could be wrong though. On Jul 22, 2008, at 9:08 AM, Thijs Lensselink wrote: Quoting Rahul S. Johari [EMAIL PROTECTED]: Here's what it is: I have a php page, a.php, which contains these three things: - SELECT statement to display records from a mySQL Table - HTML Form for inserting data into the mySQL Table - INSERT statement to insert that row into the mySQL Table If the flow of you program really works in this order. Then i can understand you are looking at the same records after a INSERT. The SELECT query is run before the INSERT. So if you submit your INSERT form. The page first selects a record set from the database. And after that preforms the INSERT. The HTML Form submits to the same, a.php Once the user submits the Form, a.php is called which INSERT's the row into the mySQL Table. However, the row does not appear in the SELECT statement table data unless I hit refresh on the page. (The INSERT function is executed before the SELECT in the page). I used the header() code that was suggested: header('Cache-Control: no-cache, no-store, max-age=0, must- revalidate'); header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past header('Pragma: no-cache'); $ffile = 'a.php'; $time = filemtime($ffile); header('Last-Modified: '.gmdate('D, d M Y H:i:s', $time).' GMT'); .. but it didn't help. Everything is working fine except that the Browser is more then likely caching the data and thus not allowing the newly inserted row to appear on top when the SELECT is executed. On Jul 22, 2008, at 8:34 AM, Thiago H. Pojda wrote: Code, please? :) On Tue, Jul 22, 2008 at 9:33 AM, Rahul S. Johari [EMAIL PROTECTED] wrote: Hmm, interesting. In my case, $file does indeed output dynamic data. I did try with the modified time but it still doesn't work. I still have to hit refresh on the browser, after submitting the form, in order for the inserted record to appear. Not sure what to do - it's rather annoying. Novice users of the page would assume the entry didn't get inserted or something happened. One alternate is to submit Data to a different page and let that page redirect to the Original page - but I do find it hard to believe that there is no solution to this caching. Thanks guys! On Jul 22, 2008, at 8:26 AM, Yeti wrote: The Last-Modified header tells the browser when the requested page was last modified. Now I don't know how you get the date in your case but here is an example: browser requests /test/test.php which is a simple php file without any includes etc. in this case $file = '/test/test.php'; This wont work if $file outputs dynamic data, so only use it if the content only changes when you change the file. Now if you are using templates etc. obtaining the Last-Modified time is a bit more complicated. If you use server side caching then you can chose the cached file else you have to figure it out yourself. And the RFC 2616 header specification says: An origin server MUST NOT send a Last-Modified date which is later than the server's time of message origination. In such cases, where the resource's last modification would indicate some time in the future, the server MUST replace that date with the message origination date. So do not send a future date! On Tue, Jul 22, 2008 at 2:11 PM, Rahul S. Johari [EMAIL PROTECTED] wrote: I tried with just the first three header() statements you gave, but it didn't work. Let me try the modification date ... which file is being referred to in $ffile? Also, I'm using Firefox, if it's of any consequence. Thanks! On Jul 22, 2008, at 7:30 AM, Bernhard Kohl wrote: I'm pretty sure this is a cache issue .. To disable caching: header('Cache-Control
Re: [PHP] After INSERT form submit - Data doesn't refresh!
Actually you do have a point. I didn't think about exit() I can surely use this, and the connection overhead is not of a major concern to me - definitely no more then displaying the newly inserted row - at the same time I would like *not* to abandon a search for an even better code if possible. Unless there doesn't exist any alternates, which still stumps me. Thanks! On Jul 22, 2008, at 10:37 AM, Andrew Ballard wrote: On Tue, Jul 22, 2008 at 10:24 AM, Rahul S. Johari [EMAIL PROTECTED] wrote: It works, but it's not the most efficient solution. The page has heavy graphics text. Using the header(Location: a.php) loads the page in question twice. Slower connections will respond slowly to the page. No, it really doesn't. A redirect should be followed with an exit() to stop execution after the Location header is passed, so you don't need to send all the heavy text or the IMG tags to embed the images, and most client browsers will stop rendering the page as soon as they see this header and therefore won't request the heavy images in any event. Granted, there is still the connection overhead caused by an additional request. In theory, the header() statements for not using cache should have worked - I'm not sure why they are working. Even Googling the loading from cache problem gives those statements in various places. On Jul 22, 2008, at 10:16 AM, Jason Pruim wrote: Without seeing the code it's hard to tell.. But couldn't you just use a header(Location: a.php); after the insert statement? Or is that too ugly of a hack? :) It works for me on a project I'm working on. (I hope this doesn't get lost in all the top posting on this thread.) Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- Rahul Sitaram Johari Founder, Internet Architects Group, Inc. [Email] [EMAIL PROTECTED] [Web] http://www.rahulsjohari.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] After INSERT form submit - Data doesn't refresh!
I just checked a couple of other browsers (IE, Safari, Opera) and it seems to be working fine in all the browsers except Firefox 3. I think this issue is now out of bounds for PHP - I don't think there is anything wrong in the script or the way I'm doing this - I think the problem is lying somewhere in either Firefox 3 or my settings of Firefox 3. Let me look into this. Thanks guys! On Jul 22, 2008, at 10:45 AM, Thijs Lensselink wrote: Quoting Rahul S. Johari [EMAIL PROTECTED]: No, actually the flow of the program does not work in that order. The flow of the program is in this order: My response was just to fast. Should have read all. At least the order is clear now :) - INSERT row function - INSERT HTML FORM - SELECT function to display records Technically the point at which the SELECT statement is executed and pulls records from the mySQL database - the newly inserted row is ALREADY there, so it really shouldn't have any problems displaying the new row. So if you do a print_r() on the result. It shows the updated record set? I know a couple of you are asking for the code, but quite honestly the codes are very, very simple INSERT, SELECT sql quries along with a simple HTML form. I don't think the actual SQL quries embedded in the page will really resolve the problem or help anyone in diagnosing this. I can post them - but I think like Thijs requested - the order would probably have been more important. Indeed the order is important. But a bit of code never hurts. Or a URL to check the output. The page begins with: ?php if($insertSubmit) { $query = INSERT INTO . .. execute query ... } ? somewhere after that is the HTML Form that the user can fill in somewhere after that ?php $query = SELECT * FROM tbl . .. execute query ... echo all records } ? So honestly I don't think it's this code that makes the difference. I still believe this is a browser cache issue. I could be wrong though. On Jul 22, 2008, at 9:08 AM, Thijs Lensselink wrote: Quoting Rahul S. Johari [EMAIL PROTECTED]: Here's what it is: I have a php page, a.php, which contains these three things: - SELECT statement to display records from a mySQL Table - HTML Form for inserting data into the mySQL Table - INSERT statement to insert that row into the mySQL Table If the flow of you program really works in this order. Then i can understand you are looking at the same records after a INSERT. The SELECT query is run before the INSERT. So if you submit your INSERT form. The page first selects a record set from the database. And after that preforms the INSERT. The HTML Form submits to the same, a.php Once the user submits the Form, a.php is called which INSERT's the row into the mySQL Table. However, the row does not appear in the SELECT statement table data unless I hit refresh on the page. (The INSERT function is executed before the SELECT in the page). I used the header() code that was suggested: header('Cache-Control: no-cache, no-store, max-age=0, must- revalidate'); header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past header('Pragma: no-cache'); $ffile = 'a.php'; $time = filemtime($ffile); header('Last-Modified: '.gmdate('D, d M Y H:i:s', $time).' GMT'); .. but it didn't help. Everything is working fine except that the Browser is more then likely caching the data and thus not allowing the newly inserted row to appear on top when the SELECT is executed. On Jul 22, 2008, at 8:34 AM, Thiago H. Pojda wrote: Code, please? :) On Tue, Jul 22, 2008 at 9:33 AM, Rahul S. Johari [EMAIL PROTECTED] wrote: Hmm, interesting. In my case, $file does indeed output dynamic data. I did try with the modified time but it still doesn't work. I still have to hit refresh on the browser, after submitting the form, in order for the inserted record to appear. Not sure what to do - it's rather annoying. Novice users of the page would assume the entry didn't get inserted or something happened. One alternate is to submit Data to a different page and let that page redirect to the Original page - but I do find it hard to believe that there is no solution to this caching. Thanks guys! On Jul 22, 2008, at 8:26 AM, Yeti wrote: The Last-Modified header tells the browser when the requested page was last modified. Now I don't know how you get the date in your case but here is an example: browser requests /test/test.php which is a simple php file without any includes etc. in this case $file = '/test/test.php'; This wont work if $file outputs dynamic data, so only use it if the content only changes when you change the file. Now if you are using templates etc. obtaining the Last- Modified time is a bit more complicated. If you use server side caching then you can chose the cached file else you have to figure it out yourself. And the RFC 2616 header specification says
Re: [PHP] PHP-MYSQL Error: Can't connect to MySQL socket. Can someonehelp me out please?
Ok. I apologize for the mix. When I'm mailing someone, I simply don't get Google into mind. :) Thanks, Rahul On Sun, May 11, 2008 at 12:53 AM, Nathan Nobbe [EMAIL PROTECTED] wrote: On Sun, May 11, 2008 at 1:46 AM, Rahul P [EMAIL PROTECTED] wrote: Ok I removed mysql using yum remove mysql. But is there a special way to tell yum to install that version of mysql? ahh, this is where google comes in for sure. it looks like you could download an older rpm, like from mysql and use 'yum localinstall' or there is a way to search for older versions that are still in the yum repos. heres a quick link i found http://www.fedoraforum.org/forum/showthread.php?t=96684 -nathan -- Rahul Computer Engineering and Systems Division. Department of Electrical Engineering and Computer Science Robert R. McCormick School of Engineering Northwestern University 2145 Sheridan Road, Evanston,IL60208. Administrator: The En?gma Project Website: http://www.enigmaportal.com
Re: [PHP] Can I make EasyPHP on Windows allow remote connections?
Looks like it is closed... Thanks. I will pay a visit to the Root... You've been of great help... Thanks Rahul On Sun, May 11, 2008 at 1:00 AM, Nathan Nobbe [EMAIL PROTECTED] wrote: On Sun, May 11, 2008 at 1:48 AM, Rahul P [EMAIL PROTECTED] wrote: Well I thought it has something to do with EasyPHP because I'm able to use Remote Desktop Connection of Windows. Actually I've been using EasyPHP through RDC but I thought I could use it directly... rdp has a special port that it runs over. mysql runs over 3306. just because they have the rdp port open doesnt mean they have the mysql one open. but again, good question for the lan admin. i doubt it has anything to do w/ easyPHP. when you say you have a 'web address' for your computer at work, does that mean you can connect to websites hosted on your computer from the internet (like from home for example [not using rdp])? if thats the case then your company also has port 80 open to your system as well, which still doesnt mean that 3306 is open. if you want, you can find out real quick yourself, by using nmap. just use the hostname for your box at work and nmap it. say for example your box has the name mybox.myoffice.com, then you do nmap mybox.myoffice.com if you dont see port 3306 in the list, likely you wont have direct access. but if you do have access over port 80 (web) you can install mysqlAdmin and get to it that way. -nathan -- Rahul Computer Engineering and Systems Division. Department of Electrical Engineering and Computer Science Robert R. McCormick School of Engineering Northwestern University 2145 Sheridan Road, Evanston,IL60208. Administrator: The En?gma Project Website: http://www.enigmaportal.com
[PHP] PHP-MYSQL Error: Can't connect to MySQL socket. Can someone help me out please?
I am using Fedora Core 4. As I was unable to use PHP or MySQL together, I uninstalled both of them and installed again using the following commands: yum install mysql And then apt-get install php php-devel php-gd php-imap php-ldap php-mysql php-odbc php-pear php-xml php-xmlrpc curl curl-devel perl-libwww-perl ImageMagick And then started the mysql server. I am able to connect to the server from the console my typing mysql -h hostname -u root -p mypass However, when I try to connect to mysql through PHP I get the following errors: PHP Warning: mysql_query(): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /export/home/rahul/may/sample.php on line 5 PHP Warning: mysql_query(): A link to the server could not be established in /export/home/rahul/may/sample.php on line 5 Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) Can someone please help me out? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP-MYSQL Error: Can't connect to MySQL socket. Can someone helpme out please?
By the way it installed MySQL 6 and PHP 5.0.4 and from the console this command does not work: mysql -u root -p but only this works: mysql -h hostname -u root -p I tried doing the same while connecting to the database via php but it does not work. Rahul wrote: I am using Fedora Core 4. As I was unable to use PHP or MySQL together, I uninstalled both of them and installed again using the following commands: yum install mysql And then apt-get install php php-devel php-gd php-imap php-ldap php-mysql php-odbc php-pear php-xml php-xmlrpc curl curl-devel perl-libwww-perl ImageMagick And then started the mysql server. I am able to connect to the server from the console my typing mysql -h hostname -u root -p mypass However, when I try to connect to mysql through PHP I get the following errors: PHP Warning: mysql_query(): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /export/home/rahul/may/sample.php on line 5 PHP Warning: mysql_query(): A link to the server could not be established in /export/home/rahul/may/sample.php on line 5 Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) Can someone please help me out? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP-MYSQL Error: Can't connect to MySQL socket. Can someone help me out please?
Thanks a lot for your reply. I have tried using $host = localhost; $db = dbname; $table_main = tablename; $dbusername = root; $dbpass = passhere; mysql_connect($host, $dbusername, $dbpass) or die(mysql_error()); and $host = mycomputer.webaddress.com; $db = dbname; $table_main = tablename; $dbusername = root; $dbpass = passhere; mysql_connect($host, $dbusername, $dbpass) or die(mysql_error()); And this mycomputer.webaddress.com works when I use with mysql like this: mysql -h mycomputer.webaddress.com -u root -p Thank You Nathan Nobbe wrote: On Sun, May 11, 2008 at 12:30 AM, Rahul [EMAIL PROTECTED] wrote: I am using Fedora Core 4. As I was unable to use PHP or MySQL together, I uninstalled both of them and installed again using the following commands: yum install mysql And then apt-get install php php-devel php-gd php-imap php-ldap php-mysql php-odbc php-pear php-xml php-xmlrpc curl curl-devel perl-libwww-perl ImageMagick And then started the mysql server. I am able to connect to the server from the console my typing mysql -h hostname -u root -p mypass However, when I try to connect to mysql through PHP I get the following errors: PHP Warning: mysql_query(): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /export/home/rahul/may/sample.php on line 5 PHP Warning: mysql_query(): A link to the server could not be established in /export/home/rahul/may/sample.php on line 5 Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) Can someone please help me out? what is the hostname you are typing at the command line and what is the one you are using when trying to connect from php? when using mysql, you will have to have a separate entry for localhost connections. -nathan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP-MYSQL Error: Can't connect to MySQL socket. Can someonehelp me out please?
I have recorded both the errors by changing the variable: $host = mycomputer.webaddress.com PHP Warning: mysql_connect(): Lost connection to MySQL server during query in /export/home/rpo219/may/conf_global.php on line 18 Lost connection to MySQL server during query $host = localhost PHP Warning: mysql_connect(): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111) in /export/home/rpo219/may/conf_global.php on line 18 Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' I found something weird for the first time: I tried looking at the mysql6 data directory and it says the following: total 28 drwxr-xr-x 3 nfsnobody nfsnobody 4096 May 10 23:57 . drwxrwxrwx 21 root root 4096 May 7 14:35 .. -rw-rw 1 nfsnobody nfsnobody 1009 May 10 23:57 mycomputer.webaddress.com.err drwxr-xr-x 2 nfsnobody nfsnobody 4096 Jan 24 20:07 mysql And when I try to change the ownership of the directory to mysql by [EMAIL PROTECTED] chown mysql ./mysql6 chown: changing ownership of `./mysql6': Operation not permitted Just thought it might be related to the problem Thanks, Rahul Rahul wrote: Thanks a lot for your reply. I have tried using $host = localhost; $db = dbname; $table_main = tablename; $dbusername = root; $dbpass = passhere; mysql_connect($host, $dbusername, $dbpass) or die(mysql_error()); and $host = mycomputer.webaddress.com; $db = dbname; $table_main = tablename; $dbusername = root; $dbpass = passhere; mysql_connect($host, $dbusername, $dbpass) or die(mysql_error()); And this mycomputer.webaddress.com works when I use with mysql like this: mysql -h mycomputer.webaddress.com -u root -p Thank You Nathan Nobbe wrote: On Sun, May 11, 2008 at 12:30 AM, Rahul [EMAIL PROTECTED] wrote: I am using Fedora Core 4. As I was unable to use PHP or MySQL together, I uninstalled both of them and installed again using the following commands: yum install mysql And then apt-get install php php-devel php-gd php-imap php-ldap php-mysql php-odbc php-pear php-xml php-xmlrpc curl curl-devel perl-libwww-perl ImageMagick And then started the mysql server. I am able to connect to the server from the console my typing mysql -h hostname -u root -p mypass However, when I try to connect to mysql through PHP I get the following errors: PHP Warning: mysql_query(): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /export/home/rahul/may/sample.php on line 5 PHP Warning: mysql_query(): A link to the server could not be established in /export/home/rahul/may/sample.php on line 5 Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) Can someone please help me out? what is the hostname you are typing at the command line and what is the one you are using when trying to connect from php? when using mysql, you will have to have a separate entry for localhost connections. -nathan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP-MYSQL Error: Can't connect to MySQL socket. Can someonehelp me out please?
Thanks. I just stopped mysql and when I try to start it again it throws another set of errors: chown: changing ownership of `/home-public/mysql6': Operation not permitted So I guess something is messed up completely. I wish I installed it better. Now the installing is messed up I guess with all sorts of bad files. I will try Google now... Thanks for the help... :) On Sun, May 11, 2008 at 12:17 AM, Nathan Nobbe [EMAIL PROTECTED] wrote: On Sun, May 11, 2008 at 1:05 AM, Rahul [EMAIL PROTECTED] wrote: I have recorded both the errors by changing the variable: $host = mycomputer.webaddress.com PHP Warning: mysql_connect(): Lost connection to MySQL server during query in /export/home/rpo219/may/conf_global.php on line 18 Lost connection to MySQL server during query i have seen this before, but i cant recall, specifically what the problem could be. i recommend google ;) $host = localhost PHP Warning: mysql_connect(): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111) in /export/home/rpo219/may/conf_global.php on line 18 Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' i believe this is because the user root, does not have permission to connect to the datbase from host 'localhost', especially since you said this didnt work from the command line either. you will have to add a grant clause to allow the root user to connect from the localhost. I found something weird for the first time: I tried looking at the mysql6 data directory and it says the following: total 28 drwxr-xr-x 3 nfsnobody nfsnobody 4096 May 10 23:57 . drwxrwxrwx 21 root root 4096 May 7 14:35 .. -rw-rw 1 nfsnobody nfsnobody 1009 May 10 23:57 mycomputer.webaddress.com.err drwxr-xr-x 2 nfsnobody nfsnobody 4096 Jan 24 20:07 mysql that is likely the way your distribution has designed the permission scheme for the mysql server. And when I try to change the ownership of the directory to mysql by [EMAIL PROTECTED] chown mysql ./mysql6 chown: changing ownership of `./mysql6': Operation not permitted this is probly because you dont have permission to make the change... you could do it via sudo, but i wouldnt recommend it. your distro has set it up this way on purpose. Just thought it might be related to the problem have you created any databases after installing mysql? you should create at least one, like test db or something, and its good practice to create a specific user to access the database through as well. instead of having php connect as root. thats like a hackers dream right there. -nathan -- Rahul Computer Engineering and Systems Division. Department of Electrical Engineering and Computer Science Robert R. McCormick School of Engineering Northwestern University 2145 Sheridan Road, Evanston,IL60208. Administrator: The En?gma Project Website: http://www.enigmaportal.com
[PHP] Can I make EasyPHP on Windows allow remote connections?
I have EasyPHP installed on my Windows system and can connect to the php+mysql using localhost in the browser but I was wondering if I can connect to this computer (which is at my office) from my home. I have a web address alloted to my computer at office. Thanks, Rahul -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP-MYSQL Error: Can't connect to MySQL socket. Can someonehelp me out please?
Oh... This is the fourth time I'm doing that except that this time yum installed mysql6 instead of older versions... I don't see any way out other than reinstalling the OS itself... There are so many dependency failures I'm spending more time troubleshooting than actually coding something :) On Sun, May 11, 2008 at 12:27 AM, Nathan Nobbe [EMAIL PROTECTED] wrote: On Sun, May 11, 2008 at 1:22 AM, Rahul P [EMAIL PROTECTED] wrote: Thanks. I just stopped mysql and when I try to start it again it throws another set of errors: chown: changing ownership of `/home-public/mysql6': Operation not permitted So I guess something is messed up completely. I wish I installed it better. Now the installing is messed up I guess with all sorts of bad files. I will try Google now... Thanks for the help... :) one benefit of package managers is that they let you uninstall and reinstall easily. are you using yum or apt-get ? in your first post you included both the commands.. anyway, id just uninstall and reinstall it; should take 10 minutes or so. -nathan -- Rahul Computer Engineering and Systems Division. Department of Electrical Engineering and Computer Science Robert R. McCormick School of Engineering Northwestern University 2145 Sheridan Road, Evanston,IL60208. Administrator: The En?gma Project Website: http://www.enigmaportal.com
Re: [PHP] PHP-MYSQL Error: Can't connect to MySQL socket. Can someonehelp me out please?
On Sun, May 11, 2008 at 12:42 AM, Nathan Nobbe [EMAIL PROTECTED] wrote: On Sun, May 11, 2008 at 1:29 AM, Rahul P [EMAIL PROTECTED] wrote: Oh... This is the fourth time I'm doing that except that this time yum installed mysql6 instead of older versions... I don't see any way out other than reinstalling the OS itself... There are so many dependency failures I'm spending more time troubleshooting than actually coding something :) i dont even think mysql6 is any where near ready for real usage (tho could be wrong). can you see if you could put 5 or 5.1 on there instead? os reinstall sounds painful =/ -nathan -- Rahul Computer Engineering and Systems Division. Department of Electrical Engineering and Computer Science Robert R. McCormick School of Engineering Northwestern University 2145 Sheridan Road, Evanston,IL60208. Administrator: The En?gma Project Website: http://www.enigmaportal.com
Re: [PHP] PHP-MYSQL Error: Can't connect to MySQL socket. Can someonehelp me out please?
Ok I removed mysql using yum remove mysql. But is there a special way to tell yum to install that version of mysql? On Sun, May 11, 2008 at 12:44 AM, Rahul P [EMAIL PROTECTED] wrote: On Sun, May 11, 2008 at 12:42 AM, Nathan Nobbe [EMAIL PROTECTED] wrote: On Sun, May 11, 2008 at 1:29 AM, Rahul P [EMAIL PROTECTED] wrote: Oh... This is the fourth time I'm doing that except that this time yum installed mysql6 instead of older versions... I don't see any way out other than reinstalling the OS itself... There are so many dependency failures I'm spending more time troubleshooting than actually coding something :) i dont even think mysql6 is any where near ready for real usage (tho could be wrong). can you see if you could put 5 or 5.1 on there instead? os reinstall sounds painful =/ -nathan -- Rahul Computer Engineering and Systems Division. Department of Electrical Engineering and Computer Science Robert R. McCormick School of Engineering Northwestern University 2145 Sheridan Road, Evanston,IL60208. Administrator: The En?gma Project Website: http://www.enigmaportal.com -- Rahul Computer Engineering and Systems Division. Department of Electrical Engineering and Computer Science Robert R. McCormick School of Engineering Northwestern University 2145 Sheridan Road, Evanston,IL60208. Administrator: The En?gma Project Website: http://www.enigmaportal.com
Re: [PHP] Can I make EasyPHP on Windows allow remote connections?
Well I thought it has something to do with EasyPHP because I'm able to use Remote Desktop Connection of Windows. Actually I've been using EasyPHP through RDC but I thought I could use it directly... On Sun, May 11, 2008 at 12:44 AM, Nathan Nobbe [EMAIL PROTECTED] wrote: On Sun, May 11, 2008 at 1:25 AM, Rahul [EMAIL PROTECTED] wrote: I have EasyPHP installed on my Windows system and can connect to the php+mysql using localhost in the browser but I was wondering if I can connect to this computer (which is at my office) from my home. I have a web address alloted to my computer at office. this is primarily dependent upon firewall restrictions and subnet configurations at your office. most places ive worked at have their internal networks pretty well isolated from the internet, and for good reason. probly this question is better for the LAN admin at ur office ;) -nathan -- Rahul Computer Engineering and Systems Division. Department of Electrical Engineering and Computer Science Robert R. McCormick School of Engineering Northwestern University 2145 Sheridan Road, Evanston,IL60208. Administrator: The En?gma Project Website: http://www.enigmaportal.com
[PHP] Transferring files between computers using php
I have a small file to be transferred between two computers every few seconds. I'm using unix with a bare bones version of php, i.e. just the original thing that gets installed when I run yum install php. As there is no webserver on any of these machines, I was wondering if there is a way to transfer a small file between them and if there is, could someone be kind enough to provide me with an example please? Thank You -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Transferring files between computers using php
Thank you all so much for replying... I guess I was very vague in describing the situation. I will write in detail: I have three computers A, B and C. To login to B and C I should use A because it has a SSH key. I don't have any other way of accessing these two computers. Now, if I need to transfer a file between B and C, I am unable to find a way that would work... because I don't know how to authenticate without SSH keys... I was gathering some data in B and C using PHP. Now, I need these two computers to coordinate a little and didn't want to use a server in between and so I was thinking of establishing a direct connection between them.. Zareef Ahmed wrote: On 3/7/08, Shawn McKenzie [EMAIL PROTECTED] wrote: Rahul wrote: I have a small file to be transferred between two computers every few seconds. I'm using unix with a bare bones version of php, i.e. just the original thing that gets installed when I run yum install php. As there is no webserver on any of these machines, I was wondering if there is a way to transfer a small file between them and if there is, could someone be kind enough to provide me with an example please? Thank You FYI... If you're using yum I assume it's a Linux machine (maybe Fedora) and not Unix. If you want to use rsync and scp in a cronjob (for continuous transfer at a predefined interval), you may need to set your server (read ssh) to accept connection without password. Ref : http://linuxproblem.org/art_9.html BUT If you really want to do that from PHP, you can install a web server and enable http as your stream for opening files. (In php.ini) You can read the file using fopen or any other file functions, then can write that file to the server on which script will be running, then you can set this script as your cron job. For example : $filecontents=file_get_contents(http://firstserver/file.txt;); $fp=fopen(path to local file, mode); Now use $fiiecontents to write the file using $fp resource. BUT remember, using rsync is always a better solution, and file_get_contents and file functions are resource hungry, specially they will consume more memory of your system. -- 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: Transferring files between computers using php
Zareef Ahmed wrote: On 3/7/08, Rahul [EMAIL PROTECTED] wrote: Thank you all so much for replying... I guess I was very vague in describing the situation. I will write in detail: I have three computers A, B and C. To login to B and C I should use A because it has a SSH key. I don't have any other way of accessing these two computers. Now, if I need to transfer a file between B and C, I am unable to find a way that would work... because I don't know how to authenticate without SSH keys... I was gathering some data in B and C using PHP. Now, I need these two computers to coordinate a little and didn't want to use a server in between and so I was thinking of establishing a direct connection between them.. If you have ruled out web server and ssh, then you can use ftp using PHP or use NFS mounting. Zareef Ahmed wrote: On 3/7/08, Shawn McKenzie [EMAIL PROTECTED] wrote: Rahul wrote: I have a small file to be transferred between two computers every few seconds. I'm using unix with a bare bones version of php, i.e. just the original thing that gets installed when I run yum install php. As there is no webserver on any of these machines, I was wondering if there is a way to transfer a small file between them and if there is, could someone be kind enough to provide me with an example please? Thank You FYI... If you're using yum I assume it's a Linux machine (maybe Fedora) and not Unix. If you want to use rsync and scp in a cronjob (for continuous transfer at a predefined interval), you may need to set your server (read ssh) to accept connection without password. Ref : http://linuxproblem.org/art_9.html BUT If you really want to do that from PHP, you can install a web server and enable http as your stream for opening files. (In php.ini) You can read the file using fopen or any other file functions, then can write that file to the server on which script will be running, then you can set this script as your cron job. For example : $filecontents=file_get_contents(http://firstserver/file.txt;); $fp=fopen(path to local file, mode); Now use $fiiecontents to write the file using $fp resource. BUT remember, using rsync is always a better solution, and file_get_contents and file functions are resource hungry, specially they will consume more memory of your system. -- 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 Well I haven't ruled our webserver and ssh but I don't have much options. Number 1 is that I have many such computers and I don't think I can afford to install a webserver on all of them atleast. And coming to SSH, I can't use it because of the scenario that I explained. Please let me know if you have any other advice. Thank You -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] XSS
On Wednesday 26 December 2007 21:03:40 Mad Unix wrote: Am facig problem with XSS cross Site scripting general on our web site, and i think its a coding issue since our dedicated server run Linux with apache mysql and php... any recommendation to resolve this issue Sure! --- Rahul Sitaram Johari CEO, Twenty Four Seventy Nine Inc. [Email] [EMAIL PROTECTED] [Web] http://www.rahulsjohari.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Won't Access Files Outside Web Root (Leopard/MacOS X 10.5)
On 11/2/07 11:12 AM, Daniel Brown [EMAIL PROTECTED] wrote: Rahul, I believe all of the modern MacOS variants still use the *nix-style (due to being based on BSD) rc.d startups, right? If so: sudo echo sudo -u www mount_smbfs -f 0777 -d 0777 //usr:[EMAIL PROTECTED]/share node /etc/rc.d/init.d/winsharemount sudo chmod 755 /etc/rc.d/init.d/windsharemount sudo ln -s /etc/rc.d/init.d/winsharemount /etc/rc.d/rc3.d/S74winsharemount sudo ln -s /etc/rc.d/init.d/winsharemount /etc/rc.d/rc5.d/S74winsharemount That should help automate it on startup in single-user and multi-user mode (rc3 and rc5, respectively). Daniel, I couldn't find an /etc/rd.d or rc3.d on my system at all. I've been manually mounting after each boot, so still looking for an automated mounting solution. Thought I'd let you know. Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Won't Access Files Outside Web Root (Leopard/MacOS X 10.5)
On 11/6/07 12:03 PM, Nathan Nobbe [EMAIL PROTECTED] wrote: On 11/6/07, Rahul S. Johari [EMAIL PROTECTED] wrote: I couldn't find an /etc/rd.d or rc3.d on my system at all. I've been manually mounting after each boot, so still looking for an automated mounting solution. look for /etc/fstab -nathan Nathan, Found /etc/fstab.hd ... But it's contents are conspicuous: IGNORE THIS FILE. This file does nothing, contains no useful data, and might go away in future releases. Do not depend on this file or its contents. !!! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Won't Access Files Outside Web Root (Leopard/MacOS X 10.5)
On 11/6/07 12:57 PM, Nathan Nobbe [EMAIL PROTECTED] wrote: On 11/6/07, Rahul S. Johari [EMAIL PROTECTED] wrote: On 11/6/07 12:03 PM, Nathan Nobbe [EMAIL PROTECTED] wrote: On 11/6/07, Rahul S. Johari [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: I couldn't find an /etc/rd.d or rc3.d on my system at all. I've been manually mounting after each boot, so still looking for an automated mounting solution. look for /etc/fstab -nathan Nathan, Found /etc/fstab.hd ... But it's contents are conspicuous: IGNORE THIS FILE. This file does nothing, contains no useful data, and might go away in future releases. Do not depend on this file or its contents. !!! perhaps if you google around on something like mac os x /etc/fstab something useful will turn up. im sure there is an alternative mechanism to mount things at boot time on that system. -nathan Oh I've been living off of Google since I upgraded to Leopard ;) The problem is, Leopard is so new, there's not so much information out there yet about various services issues coming up with Leopard. Back when I had Panther (10.3.9), it was a quick jump on Google that would rid me of all Worldly Problems. Information is very slowly trickling out about things in Leopard - they just changed SO MANY things in Leopard, it's not even funny. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Won't Access Files Outside Web Root (Leopard/MacOS X 10.5) *SOLVED*
On 11/6/07 12:57 PM, Nathan Nobbe [EMAIL PROTECTED] wrote: perhaps if you google around on something like mac os x /etc/fstab something useful will turn up. im sure there is an alternative mechanism to mount things at boot time on that system. -nathan For whatever reason, when I first attempted this following AppleScript, it didn't work - for whatever reason - coming back to it and trying it again, it simply just Worked! I've set it to run on Login and it's actually working fine. Rebooted my system a couple of times and it automatically mounted the shares with designated permissions each time upon boot up. ~~~ do shell script sudo -u www mount_smbfs -f 0777 -d 0777 //usr:[EMAIL PROTECTED]/Transfer /Library/WebServer/Documents/mysite/mounts/osm password pwd with administrator privileges do shell script sudo -u www mount_smbfs -f 0777 -d 0777 //usr2:[EMAIL PROTECTED]/VOX /Library/WebServer/Documents/mysite/mounts/vox password pwd with administrator privileges activate display dialog Connections to Server Established. -SHARE1 Mounted! -SHARE2 Mounted! ~~~ I guess I can officially consider this case closed with all problems solved! Thanks All! ~ Rahul Sitaram Johari CEO, Twenty Four Seventy Nine Inc. W: http://www.rahulsjohari.com E: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Won't Access Files Outside Web Root (Leopard/MacOS X 10.5) *SOLVED*
On 11/6/07 4:07 PM, Daniel Brown [EMAIL PROTECTED] wrote: We are the geniuses that are the core PHP community. Hear us roar! :D You know the funniest thing? As my discussion progressed, and the contributions back forth, the problem became evidently little to do with PHP and a whole lot to do with Mac OS X! And yet, on a PHP mailing list - we Solved it! Diversity in Unity! Of course, I've heard longer, endless, pointless rants in this same very mailing list over the course of last 6 years or so that I've been here. ~ Rahul Sitaram Johari CEO, Twenty Four Seventy Nine Inc. W: http://www.rahulsjohari.com E: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Won't Access Files Outside Web Root (Leopard/MacOS X 10.5)
On 11/2/07 11:12 AM, Daniel Brown [EMAIL PROTECTED] wrote: On 11/2/07, Rahul Sitaram Johari [EMAIL PROTECTED] wrote: That sounds like a good place to look. I actually did figure out a way to make this work. It appears that Apache Web Server did not have enough permissions to read files on a mounted share, simply because Leopard eliminated the -u -g arguments for mount_smbfs - so basically my guess was right on target. I was able to figure out the workaround to mounting a share giving it specific user/group: Sudo -u www mount_smbfs -f 0777 -d 0777 //usr:[EMAIL PROTECTED]/share node That works! It mounts the share as www - which is Apache Web Server - and my PHP scripts had no problem reading files of the share on my Website. Now I need to figure out how to write an AppleScript (or use the Automator) to automate the process on every boot up. I had an AppleScript before to do this - but it's changed now. Thanks guys. PS: You guys are funny! And brilliant!! Rahul, I believe all of the modern MacOS variants still use the *nix-style (due to being based on BSD) rc.d startups, right? If so: sudo echo sudo -u www mount_smbfs -f 0777 -d 0777 //usr:[EMAIL PROTECTED]/share node /etc/rc.d/init.d/winsharemount sudo chmod 755 /etc/rc.d/init.d/windsharemount sudo ln -s /etc/rc.d/init.d/winsharemount /etc/rc.d/rc3.d/S74winsharemount sudo ln -s /etc/rc.d/init.d/winsharemount /etc/rc.d/rc5.d/S74winsharemount That should help automate it on startup in single-user and multi-user mode (rc3 and rc5, respectively). WOW! You are a Rock Star! I haven't tried it out on my machine but looks promising - and yes - I do agree that Mac's being based on the BSD are after all *nix at the core, I'm pretty positive that should work. Thanks! I'll post back. ~~~ Rahul Sitaram Johari CEO, Twenty Four Seventy Nine Inc. W: http://www.rahulsjohari.com E: [EMAIL PROTECTED] ³I morti non sono piu soli ... The dead are no longer lonely² -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Won't Access Files Outside Web Root (Leopard/MacOS X 10.5)
On 11/2/07 8:26 AM, Jason Pruim [EMAIL PROTECTED] wrote: On Nov 1, 2007, at 5:54 PM, Jim Lucas wrote: Sounds like a clear case of Apache being chroot'ed. This is based off the BSD style setup I believe. Which I believe Mac uses, So, I would check your startup line for Apache. I did some googling, but I could not find anything to confirm my thinking that the Mac Apache configuration is anything like the default OpenBSD setup. I know you can manually start httpd with the -u flag to disable chrooting Again, I can't find any examples of the Mac setup, but my money would be on chrooting as the problem. I have been a Mac user for my entire computing life, and although I can't tell you the difference between Apple's setup and OpenBSD's set up.. I can point you to a list that would definitely be able to help. which is: http://lists.apple.com/mailman/listinfo/macos-x-server That list as some of the most knowledgeable mac Heads I have ever dealt with, and they have helped me through all kinds of stuff. If anyone can tell you, they can. That sounds like a good place to look. I actually did figure out a way to make this work. It appears that Apache Web Server did not have enough permissions to read files on a mounted share, simply because Leopard eliminated the -u -g arguments for mount_smbfs - so basically my guess was right on target. I was able to figure out the workaround to mounting a share giving it specific user/group: Sudo -u www mount_smbfs -f 0777 -d 0777 //usr:[EMAIL PROTECTED]/share node That works! It mounts the share as www - which is Apache Web Server - and my PHP scripts had no problem reading files of the share on my Website. Now I need to figure out how to write an AppleScript (or use the Automator) to automate the process on every boot up. I had an AppleScript before to do this - but it's changed now. Thanks guys. PS: You guys are funny! And brilliant!! ~~~ Rahul Sitaram Johari CEO, Twenty Four Seventy Nine Inc. W: http://www.rahulsjohari.com E: [EMAIL PROTECTED] ³I morti non sono piu soli ... The dead are no longer lonely² -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP Won't Access Files Outside Web Root (Leopard/MacOS X 10.5)
Ave, Somehow my PHP won't access, won't even acknowledge the existence of a file that is outside the /Library/WebServer/Documents folder. This was never a a problem before in any Mac version - it just started with Leopard. I don't know what has changed where, in httpd.conf or php.ini or somewhere else, but something changed that's crippling access to files outside of the webserver. This Works in Mac OS X 10.3.9 (i.e., prints File Exists) but the same exact script does not work in Mac OS X 10.5, and yes, the file is available in Leopard in the mentioned location - path is exact same - permissions are all set: $filename = /Users/username/Documents/Transfers/test.txt; if (file_exists($filename)) { echo The file $filename existsbrbr; } else { echo The file $filename does not existbrbr; } I¹ve already checked safe_mode which is Off and open_basedir which is not set same settings as php.ini from before. Any ideas what might be causing this? Thanks! ~~~ Rahul Sitaram Johari CEO, Twenty Four Seventy Nine Inc. W: http://www.rahulsjohari.com E: [EMAIL PROTECTED] ³I morti non sono piu soli ... The dead are no longer lonely²
Re: [PHP] PHP Won't Access Files Outside Web Root (Leopard/MacOS X 10.5)
On 11/1/07 9:46 AM, Robert Cummings [EMAIL PROTECTED] wrote: On Thu, 2007-11-01 at 09:06 -0400, Rahul Sitaram Johari wrote: Ave, Somehow my PHP won't access, won't even acknowledge the existence of a file that is outside the /Library/WebServer/Documents folder. This was never a a problem before in any Mac version - it just started with Leopard. I don't know what has changed where, in httpd.conf or php.ini or somewhere else, but something changed that's crippling access to files outside of the webserver. This Works in Mac OS X 10.3.9 (i.e., prints File Exists) but the same exact script does not work in Mac OS X 10.5, and yes, the file is available in Leopard in the mentioned location - path is exact same - permissions are all set: $filename = /Users/username/Documents/Transfers/test.txt; if (file_exists($filename)) { echo The file $filename existsbrbr; } else { echo The file $filename does not existbrbr; } I¹ve already checked safe_mode which is Off and open_basedir which is not set same settings as php.ini from before. Any ideas what might be causing this? Have you checked phpinfo() to check that the php.ini being loaded is the one you think is being loaded? Also, are you get any warnings or notices? Yes. Checked phpinfo() ... Correct php.ini loaded. On fopen(), I get the following warning: Warning: fopen(/Library/WebServer/Documents/Misc/osm/ox.txt) [function.fopen]: failed to open stream: Permission denied in /Library/WebServer/Documents/Misc/test.php on line 5 I was using if/else before with file_exists() or is_readable() and it didn't give me any warnings or notices. Now I tried with fopen() and it does indeed give me a warning. One thing I must point out is that osm is a Share Point which has a windows network share mounted on it (via SMB). I'm not sure where the problems are in permissions, because while mounting, I'm allowing full read/write permissions to share: Mount_smbfs -f 777 -d 777 //user:[EMAIL PROTECTED]/share sharePoint ~~~ Rahul Sitaram Johari CEO, Twenty Four Seventy Nine Inc. W: http://www.rahulsjohari.com E: [EMAIL PROTECTED] ³I morti non sono piu soli ... The dead are no longer lonely² -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Won't Access Files Outside Web Root (Leopard/MacOS X 10.5)
On 11/1/07 10:22 AM, Daniel Brown [EMAIL PROTECTED] wrote: On 11/1/07, Robert Cummings [EMAIL PROTECTED] wrote: On Thu, 2007-11-01 at 09:06 -0400, Rahul Sitaram Johari wrote: Ave, Somehow my PHP won't access, won't even acknowledge the existence of a file that is outside the /Library/WebServer/Documents folder. This was never a a problem before in any Mac version - it just started with Leopard. I don't know what has changed where, in httpd.conf or php.ini or somewhere else, but something changed that's crippling access to files outside of the webserver. This Works in Mac OS X 10.3.9 (i.e., prints File Exists) but the same exact script does not work in Mac OS X 10.5, and yes, the file is available in Leopard in the mentioned location - path is exact same - permissions are all set: $filename = /Users/username/Documents/Transfers/test.txt; if (file_exists($filename)) { echo The file $filename existsbrbr; } else { echo The file $filename does not existbrbr; } I¹ve already checked safe_mode which is Off and open_basedir which is not set same settings as php.ini from before. Any ideas what might be causing this? Also make sure that it's not something simple that you may have accidentally overlooked as well: 1.) Did you restart Apache after making any changes to php.ini or httpd.conf? 2.) The path is cAsE-sEnSiTiVe. Did you make sure that it's EXACTLY the same? 3.) Is any part of that symlinked, and if so, does Apache allow FollowSymLinks? 4.) Is the account jailed or chroot'ed? 1) Checked! 2) Checked! 3) It is symlinked indeed!! Where in httpd.conf do I need to specify FollowSymLinks? I'm running Apache 2.2.6 with PHP 5.2.4 on Mac OS X 10.5 4) chroot'ed? Basically I'm mounting a windows network share on a share point and during mount I'm giving it full read/write permissions. (mount_smbfs -f 777 -d 777 //user:[EMAIL PROTECTED]/share sharePoint) ~~~ Rahul Sitaram Johari CEO, Twenty Four Seventy Nine Inc. W: http://www.rahulsjohari.com E: [EMAIL PROTECTED] ³I morti non sono piu soli ... The dead are no longer lonely² -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Won't Access Files Outside Web Root (Leopard/MacOS X 10.5)
On 11/1/07 10:41 AM, Daniel Brown [EMAIL PROTECTED] wrote: On 11/1/07, Rahul Sitaram Johari [EMAIL PROTECTED] wrote: 1.) Did you restart Apache after making any changes to php.ini or httpd.conf? 2.) The path is cAsE-sEnSiTiVe. Did you make sure that it's EXACTLY the same? 3.) Is any part of that symlinked, and if so, does Apache allow FollowSymLinks? 4.) Is the account jailed or chroot'ed? 1) Checked! 2) Checked! 3) It is symlinked indeed!! Where in httpd.conf do I need to specify FollowSymLinks? I'm running Apache 2.2.6 with PHP 5.2.4 on Mac OS X 10.5 Bah! Sorry to give you false hope on that, Rahul. I re-read the post and my responses, and Apache would actually have nothing to do with this particular problem. In any case, in your httpd.conf file, you can enable FollowSymLinks near your AllowOverride directives. It won't help in this case, but that's where it resides, nonetheless. If you `su -` to the user as which the PHP script is running, does that user have permission to access the Windows share? Are you running this from the CLI or the web (I just noticed in the email you just sent to Rob that it's a web error message). Try this: Take *just* that part of the script and run it from the CLI as yourself to see if you can see the file. If not, try it as root. If you can, then `su -` to the account under which Apache is daemonized. You may need to update /etc/passwd to allow a shell to be opened for that account. When running the simple script from the CLI as the web server account, can you see the file? Can you change to that directory? It may very well be that the account under which Apache runs is jailed/chroot'ed. Well FollowSymLinks was present in my httpd.conf, and it's definitely not the problem. I think the problem is the fact that on in Panther, I was able to specify Apache Web Server to be the User/Group for the share being mounted with -u 70 -g 70 during mount_smbfs. In Leopard I'm not able to do that because they eliminated the -u -g arguments for mount_smbfs - in fact they even eliminated NetInfo Manager so I don't even know Apache's UID GID. So after mounting the share on the share point, this is what happens: http://www.troyjobs.com/media/smb.gif (It's a screenshot of difference between Panther Leopard on the same folder showing different User/Group). As you can see files within the mounted share had www (Apache) as the user group and PHP didn't have any problems accessing the files. But in Leopard, www (Apache) is not the user/group. I don't know what you have to do in Leopard to mount a share giving it a User/Group of your choice. ~~~ Rahul Sitaram Johari CEO, Twenty Four Seventy Nine Inc. W: http://www.rahulsjohari.com E: [EMAIL PROTECTED] ³I morti non sono piu soli ... The dead are no longer lonely² -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Won't Access Files Outside Web Root (Leopard/MacOS X 10.5)
On 11/1/07 12:17 PM, Daniel Brown [EMAIL PROTECTED] wrote: On 11/1/07, Rahul Sitaram Johari [EMAIL PROTECTED] wrote: Well FollowSymLinks was present in my httpd.conf, and it's definitely not the problem. I think the problem is the fact that on in Panther, I was able to specify Apache Web Server to be the User/Group for the share being mounted with -u 70 -g 70 during mount_smbfs. In Leopard I'm not able to do that because they eliminated the -u -g arguments for mount_smbfs - in fact they even eliminated NetInfo Manager so I don't even know Apache's UID GID. So after mounting the share on the share point, this is what happens: http://www.troyjobs.com/media/smb.gif (It's a screenshot of difference between Panther Leopard on the same folder showing different User/Group). As you can see files within the mounted share had www (Apache) as the user group and PHP didn't have any problems accessing the files. But in Leopard, www (Apache) is not the user/group. I don't know what you have to do in Leopard to mount a share giving it a User/Group of your choice. Rahul, The image you showed indicates that there is no user account associated with UID 501 on Leopard. That particular UID is, on most *nix-based systems, the second-lowest-available default UID for a user-created account (starting at 500, unless you specify otherwise). Try creating an account on Leopard (you may have to do two, unless you want to edit /etc/passwd) and then `ls -l` the Leopard view of the share again. You'll see 501 disappear and be replaced by the name associated with UID 501. Then just see what the GID associated with the group 'admin' is and update that, if need be. The fix for this could be as simple as `su -`'ing to root and chown'ing the directory to the UID/GID of the web server, but I don't know how much conflict that will cause for the rest of your system, so that's entirely up to you. Daniel, You're on the right track. I do realize the UID 501 and how to change that, I think my biggest two problems right now are: A) I don't know what's the UID/GID of Apache in Leopard. It used to be 70 in Panther and I don't know if it's changed or not. They eliminated NetInfo Manager so I don't even know how to find out. B) Even if I did find out, I don't know how to apply Apache's UID/GID to mounted share while mounting. I could possibly go in and manually give the folder the UID/GID using terminal. Is there a Terminal way of figuring out the UID/GID of something like admin, apache etcetera? PS: I know it's going OT! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Won't Access Files Outside Web Root (Leopard/MacOS X 10.5)
On 11/1/07 12:43 PM, Daniel Brown [EMAIL PROTECTED] wrote: On 11/1/07, Rahul Sitaram Johari [EMAIL PROTECTED] wrote: Is there a Terminal way of figuring out the UID/GID of something like admin, apache etcetera? PS: I know it's going OT! Yes, you'll find those UIDs in /etc/passwd. For example: apache:x:48:48:Apache:/var/www:/sbin/nologin That means my Apache server runs with UID 48 and GID 48, with /var/www as the home directory and /sbin/nologin as the shell. Well, chown is not able to change the User/Group for the mounted files at all. It simply doesn't change anything at all. I guess the only way to define a User/Group for a share being mounted is while mounting the share, which was a piece of cake in earlier mac's with mount_smbfs -u UID -g GID ... Of course this was eliminated in Leopard - now I don't know what to do ! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Curl Timeout causing Firefox to Download PHP File ?!?
Ave, I¹m not sure what¹s causing the problem, but I have a feeling that its¹ a timeout issue. I have a curl function that retrieves specific data from a remote webpage. The script works fine on my localhost, but when I upload it to my remote server, the script tries to execute, but 10 15 seconds into it, Firefox gives me an option to download the PHP script. Googling it I found that the Curl function taking too long might cause a timeout, which Firefox interprets by giving a Download option for the script. Safari on the other hand says ³Could not load data from script². Again, same script works on localhost on both browsers. I don¹t know if that¹s the real cause or if something is wrong with my script. Note that latest PHP Curl are enabled and working on the remote server, and other PHP pages curl functions run on that remote server, so that¹s not an issue. Here¹s my curl function: ?php # Gather cookies in a Jar $ch = curl_init(); curl_setopt($ch, CURLOPT_COOKIEJAR, ³path-to-cookieFileName); curl_setopt($ch, CURLOPT_URL,http://www.mywebsite.com;); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); ob_start(); // prevent any output curl_exec ($ch); // execute the curl command ob_end_clean(); // stop preventing output curl_close ($ch); unset($ch); # Login with your Cookie Jar $ch = curl_init(); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, usr=usrnamepwd=password); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); curl_setopt($ch, CURLOPT_COOKIEFILE, path-to-cookieFileName); curl_setopt($ch, CURLOPT_URL,http://www.mywebsite.com;); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); $result = curl_exec ($ch); curl_close ($ch); # Get the text in the middle of ... function get_middle($source, $beginning, $ending, $init_pos) { $beginning_pos = strpos($source, $beginning, $init_pos); $middle_pos = $beginning_pos + strlen($beginning); $ending_pos = strpos($source, $ending, $beginning_pos + 1); $middle = substr($source, $middle_pos, $ending_pos - $middle_pos); return $middle; } # trim result and get what you need ... $share_ratio = get_middle($result, 'Share ratio', '/tr', 0); $share_ratio2 = trim(ereg_replace([\n\r\t], , $share_ratio)); $share_ratio3 = substr($share_ratio2, 25, 5); echo Ratio: STRONG$share_ratio3/STRONG; ? ~~~ Rahul Sitaram Johari CEO, Twenty Four Seventy Nine Inc. W: http://www.rahulsjohari.com E: [EMAIL PROTECTED] ³I morti non sono piu soli ... The dead are no longer lonely²
[PHP] PHP Installer on Vista
Ave, Is it true that the PHP Installer does not work on Windows Vista? And if it does, it only installs the CGI version? ~~~ Rahul Sitaram Johari CEO, Twenty Four Seventy Nine Inc. W: http://www.rahulsjohari.com E: [EMAIL PROTECTED] ³I morti non sono piu soli ... The dead are no longer lonely²
Re: [PHP] PHP Installer on Vista
On 9/12/07 10:56 AM, M. Sokolewicz [EMAIL PROTECTED] wrote: Did you try it? Easiest way to find out... I installed - it didn't give me any errors - but PHP is not working. Apache starts without any errors either. The thing is, I can easily remove the installation and install PHP manually (Something I have done before) and then PHP will work - but I did want to establish whether the Installer Works on Vista or Not! On the other hand - if it is a fact that the Installer only installs PHP as CGI - then I won't even bother because I don't want PHP as CGI. Make sense? ~~~ Rahul Sitaram Johari CEO, Twenty Four Seventy Nine Inc. W: http://www.rahulsjohari.com E: [EMAIL PROTECTED] ³I morti non sono piu soli ... The dead are no longer lonely² -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Curl redirection problem.
Chris wrote: Curl won't redirect you, you have to do it. header('Location: http://www.website.org'); But bear in mind that any cookies you've set up with curl will not be there when you redirect the client since they're in your cookie jar not on the clients machine, so if you're trying to do what I think you're trying to do it won't work. -Stut Exactly!! And it doesn¹t work! Stut you¹re absolutely right. I did indeed try the header('Location: http://www.website.org'); directive in many different ways. When it failed to work, I realized that the cookies that curl setup are stores in the cookie jar, not the client browser/machine therefore the redirection took me to the ³unlogged-in² page, and not the ³logged-in² page of the website. So what¹s the work around? ~~~ Rahul Sitaram Johari CEO, Twenty Four Seventy Nine Inc. W: http://www.rahulsjohari.com E: [EMAIL PROTECTED] ³I morti non sono piu soli ... The dead are no longer lonely²
[PHP] Curl redirection problem.
Ave, I¹m using Curl to login to a website. I gather cookies from one page, carry the cookiejar to another page, post data to login, and get the result. The problem is, the final landing page displays on my php page as part of the page and remains on my server, therefore the Links on that Landing page are malformed as they are carrying my Server. I want to redirect to the Landing page altogether. How do I do that? Here¹s my code: $curl = curl_init(); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($curl, CURLOPT_HEADER, 0); curl_setopt($curl, CURLOPT_POST, true); curl_setopt($curl, CURLOPT_RETURNTRANSFER, false); curl_setopt($curl, CURLOPT_USERAGENT, Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); curl_setopt($curl, CURLOPT_COOKIEFILE, /Library/WebServer/Documents/Misc/curl/garbage/wbCookieFile); curl_setopt($curl, CURLOPT_COOKIEJAR, /Library/WebServer/Documents/Misc/curl/garbage/wbCookieFile); curl_setopt($curl, CURLOPT_POSTFIELDS, username=usrpassword=pwd); curl_setopt($curl, CURLOPT_URL, http://www.website.org/login.php;); $xxx = curl_exec($curl); curl_setopt($curl, CURLOPT_URL, http://www.website.org/index.php;); curl_setopt($curl, CURLOPT_POSTFIELDS, username=usrpassword=pwd); $xxx = curl_exec($curl); curl_close ($curl); Basically I want to redirect to: http://www.website.org/index.php after logging in using curl. Thanks. ~~~ Rahul Sitaram Johari CEO, Twenty Four Seventy Nine Inc. W: http://www.rahulsjohari.com E: [EMAIL PROTECTED] ³I morti non sono piu soli ... The dead are no longer lonely²
[PHP] CURL problems posting data
Ave, We need to login to a client¹s website in order to feed some data to their database, using their forms. To automate it, I¹m trying to use Curl to login. This is their form: form name=Form1 method=post action=http://www.website.com/Login.aspx; id=Form1 input type=hidden name=__VIEWSTATE value=dDwtNDI5NDcwNDM2Ozs+oeS6YcaxMhbb66r8w2jsMzFiezM= / input name=login:username VALUE=usr type=HIDDEN id=login_username / input name=login:password VALUE=pwd type=HIDDEN id=login_password / input name=login:txtAffiliateCode VALUE=db type=HIDDEN id=login_txtAffiliateCode / input type=submit name=login:loginbutton value=Login id=login_loginbutton /form I¹m not quite sure why their field names have a ³:² and what purpose it serves, but I just can¹t seem to login using Curl no matter what I try. I¹ve gone through testing different codes, and this is where I¹m at to make this work: ?php $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,http://www.website.com/Login.aspx;); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, urlencode('login:username').=usr.urlencode('login:password').=pwd.urle ncode('login:txtAffiliateCode').=db.urlencode('__VIEWSTATE').=.urlencod e('dDwtNDI5NDcwNDM2Ozs+oeS6YcaxMhbb66r8w2jsMzFiezM=')); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $result=curl_exec ($ch); if (curl_errno($ch)) { print curl_error($ch); } curl_close ($ch); print_r($result); ? Needless to say that if I put their form ³as-is² on a page on my server and specify full URL in ³ACTION², it works. Why is Curl failing to log me in? ~~~ Rahul Sitaram Johari CEO, Twenty Four Seventy Nine Inc. W: http://www.rahulsjohari.com E: [EMAIL PROTECTED] ³I morti non sono piu soli ... The dead are no longer lonely²
Re: [PHP] OT- why is network solutions more than godaddy?
On Fri, 2007-08-03 at 14:22 -0400, blackwater dev wrote: I have to register a bunch of names and am trying to figure out why I would pay $35 when I can just pay $9 at godaddy. Does godaddy own it and I lease it from them??? Ave, I think I have at least 13 domains (personal + business) with GoDaddy, for over 4 years now. No problems whatsoever. And their domains do come with a boatload of stuff. This is something like getting an Intel Core 2 Duo E6420 Processor (Retail/Packaged) brand new from CompUSA for $339 and getting the same exact thing from Newegg.Com for $179. It¹s the exact same thing you can burn it when you get home, if you like! No You own it! ~~~ Rahul Sitaram Johari CEO, Twenty Four Seventy Nine Inc. W: http://www.rahulsjohari.com E: [EMAIL PROTECTED] ³I morti non sono piu soli ... The dead are no longer lonely²
Re: [PHP] OT- why is network solutions more than godaddy?
Interesting read - although the whole thing is trumpeted upon their policy We have the right to terminate a service at any time without any reason - Well apparently, Network Solutions and most Major Domain Name Service vendors have a similar policy - so I wouldn't be surprised to see a www.networkproblems.com website one day. :P On 8/3/07 3:12 PM, Austin Denyer [EMAIL PROTECTED] wrote: Robert Cummings wrote: On Fri, 2007-08-03 at 14:22 -0400, blackwater dev wrote: I have to register a bunch of names and am trying to figure out why I would pay $35 when I can just pay $9 at godaddy. Does godaddy own it and I lease it from them??? No, you own it. But, don't make your final decision until you've read this: http://nodaddy.com Regards, Austin. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Compiling php 5.2.3 / Mac OS X 10.3.9 / mysql configure failed
Ave, Trying to configure, build compile PHP 5.2.3 on a Mac OS X 10.3.9 from scratch (Since there is no installer available for Panther). Installed all dependencies. Latest mySQL 5 client/server is installed (Using the mySQL Installer available at the mySQL website). I did not build compile mySQL and I don¹t wish to either so looking for some other solution to this problem. Getting the following error during ./configure: configure: error: mysql configure failed. Please check config.log for more information. This is the mysql related portion from ³config.log²: int main() { dnet_addr() ; return 0; } configure:58392: checking for MySQL support configure:58438: checking for specified location of the MySQL UNIX socket configure:58495: checking for MySQL UNIX socket location configure:58685: checking for mysql_close in -lmysqlclient configure:58704: gcc -o conftest -I/usr/include -g -O2 -no-cpp-precomp -L/usr/local/mysql/lib -L/usr/local/mysql/lib -liconv -L/usr/lib -L/opt/local/lib -L/opt/local/lib -L/usr/local/php5/lib -L/usr/local/php5/lib conftest.c -lmysqlclient -lsybdb -lldap -llber -liconv -lintl -lfreetype -lpng -lz -ljpeg -lbz2 -lz -lssl -lcrypto -lm -lxml2 -lz -liconv -lm -lxml2 -lz -liconv -lm 15 ld: table of contents for archive: /usr/local/php5/lib/libsybdb.a is out of date; rerun ranlib(1) (can't load from it) configure: failed program was: #line 58693 configure #include confdefs.h /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char mysql_close(); int main() { mysql_close() ; return 0; } configure:58925: checking for mysql_error in -lmysqlclient configure:58944: gcc -o conftest -I/usr/include -g -O2 -no-cpp-precomp -L/usr/local/mysql/lib -L/usr/local/mysql/lib -liconv -L/usr/lib -L/opt/local/lib -L/opt/local/lib -L/usr/local/php5/lib -L/usr/local/php5/lib -L/usr -L/usr conftest.c -lmysqlclient -lz -lsybdb -lldap -llber -liconv -lintl -lfreetype -lpng -lz -ljpeg -lbz2 -lz -lssl -lcrypto -lm -lxml2 -lz -liconv -lm -lxml2 -lz -liconv -lm 15 ld: table of contents for archive: /usr/local/php5/lib/libsybdb.a is out of date; rerun ranlib(1) (can't load from it) configure: failed program was: #line 58933 configure #include confdefs.h /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char mysql_error(); int main() { mysql_error() ; return 0; } Help would be appreciated. ~~~ Rahul Sitaram Johari CEO, Twenty Four Seventy Nine Inc. W: http://www.rahulsjohari.com E: [EMAIL PROTECTED] ³I morti non sono piu soli ... The dead are no longer lonely²
[PHP] Looking for PHP 5.0.1 for Mac OS X 10.3.9
Ave, Does anyone have the old PHP installers for Mac OS X 10.3.9 ?? Entropy.ch only has the latest installer for 10.4 I¹m looking for any PHP 5 Installer that will install work on a Mac OS X 10.3.9 ... Can¹t seem to find it anywhere!!! Help! ~~~ Rahul Sitaram Johari CEO, Twenty Four Seventy Nine Inc. W: http://www.rahulsjohari.com E: [EMAIL PROTECTED] ³I morti non sono piu soli ... The dead are no longer lonely²
[PHP] Compiling/Building PHP 5.2.3 on Mac OS X 10.3.9
Ave, I¹m running php 5.0.2 on Mac OS X 10.3.9 (Panther) which I had installed using entropy.ch¹s installer. Time to upgrade but not sure which way to go. Apparently Entropy does not support anything 10.4 (Tiger). I¹ve looked around macports fink but can¹t get any clear direction. Tried macports but it gave nothing but errors. So at this point I¹m considering building/compiling php 5.2.3 on my mac. I¹m no *nix expert and I¹ve never compiled anything (relatively critical) before. Looking for the right direction to instructions or knowledge on how to go about doing this. Unless anyone has a better solution of getting php 5.2.3 on mac os x 10.3.9 Thanks. ~~~ Rahul Sitaram Johari CEO, Twenty Four Seventy Nine Inc. W: http://www.rahulsjohari.com E: [EMAIL PROTECTED] ³I morti non sono piu soli ... The dead are no longer lonely²
Re: [PHP] Creating 'Next' 'Previous' for PHP Photo Gallery
Jim, Code looks extremely promising well explained - let me give it a try and work it out. I'm sure to hit snags - but can't thank you enough. The one thing that comes straight off in my mind looking at the code is - and I may be addressing this prematurely since I haven't tried the code yet - but my thumbnails are in a Separate .php page, and each thumbnail links to the full image which are in a Separate .php page. The Next Previous link I'm trying to create are to be displayed on the full image page. But let me integrate the code and see how I can pass the values along to pages and make it work. Thanks again! On 7/10/07 11:04 AM, Jim Lucas [EMAIL PROTECTED] wrote: Rahul Sitaram Johari wrote: I¹m trying to write a Photo Gallery in PHP. Everything else is pretty much worked out like thumbnails, indexes, titles all the one thing I¹m stuck at is the Next Previous links for the Photos on the main Photo Page. It¹s a simple program where you drop images in a folder and glob() picks up the thumbnails displays them on a page which are automatically linked to the Full Size Images. This is the code: ? $ID = $_GET['ID']; The following code is completely untested. I typed it straight into the email client. You might have to track down a few bugs. It should give you a good start though # Set your page display limit $display_limit = 20; # Collect a list of files $filelist = glob($ID/thumbnails/*.jpg); # get the current page number, set the default to 1 $pageNum = 1; if ( !empty($_GET['pageNum']) ) { $pageNum = (int)$_GET['pageNum']; } # count the total number of files to list $total_files = count($filelist); # calculate the total number of pages to be displayed $total_pages = ceil($total_files/$display_limit); # Initialize the link holder array $links = array(); # Since I don't know the name of your script, I assume that it should link to itself # So I will use $_SERVER['SCRIPT_NAME'] to get the scripts true name # Create Previous tag is needed if ( $pageNum 1 ) { $links[] = a href='{$_SERVER['SCRIPT_NAME']}?ID={$_GET['ID']}pageNum=.($pageNum-1).'Pre vious/a; } # Create Next tag is needed if ( $pageNum $total_pages ) { $links[] = a href='{$_SERVER['SCRIPT_NAME']}?ID={$_GET['ID']}pageNum=.($pageNum+1).'Nex t/a; } # Display the link if they exist echo '[ '.join(' | ', $links).' ]'; foreach ($filelist as $key=$value) { $title = rtrim(basename($value),'.jpg'); $newtitle = preg_replace('/_/', ' ', $title); ? A HREF=photo.php?photo=?php echo basename($value); ?title=?php echo $newtitle; ?ID=?php echo $_GET['ID']; ?KEY=?php echo $key; ? TARGET=photoFrame IMG SRC=?php echo $ID; ?/thumbnails/?php echo basename($value); ?/A ?php echo $newtitle; ? ? } ? I know that $key holds the sequence of images that are being picked up by glob() - I¹m just trying to figure out a way to use this $key to generate the Next Previous link. The problem is everything is passed on to a separate page (photo.php) ... What I¹m thinking is determining which Photo File would be Next or Previous to the one being selected, and passing that along to the (photo.php) page. I¹m just not able to figure out how to pick out the next previous filename and place it in the Query String. Any suggestions? ~~~ Rahul Sitaram Johari CEO, Twenty Four Seventy Nine Inc. W: http://www.rahulsjohari.com E: [EMAIL PROTECTED] ³I morti non sono piu soli ... The dead are no longer lonely² -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Mac popup happy?
Richard, I'm using Firefox on Mac OS X 10.3.9 ... Clicking your link takes me to a page with http authentication asking me for usr/pass. Where are you seeing the pop-up phenomena? I have Safari as well to check with. I can't get past the Authorization to see where you get the pop-up. On 7/11/07 4:23 PM, Richard Lynch [EMAIL PROTECTED] wrote: Could anybody point me in the right general direction for why Mac OS X Safari and Firefox would open up a new window/tab for this link? a href=http://complaintsdevbrowse.hostedlabs.com/redirect_by_entry_id.php?entry _id=146802FW: VitalChek Order Confirmation/a It's password-protected to keep Google out until we launch, but I could send you a login offline, if you really want... Here is the actual HTTP exchange captured by LiveHTTPHeaders in Firefox on Windows: http://complaintsdevbrowse.hostedlabs.com/redirect_by_entry_id.php?entry_id=14 6802 GET /redirect_by_entry_id.php?entry_id=146802 HTTP/1.1 Host: complaintsdevbrowse.hostedlabs.com User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.4) Gecko/20070515 Firefox/2.0.0.4 Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0. 8,image/png,*/*;q=0.5 Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Connection: keep-alive Referer: http://complaintsdevwww.hostedlabs.com/tagged/confirmation.htm Authorization: Basic bHluY2g6ZnJlZDAwNw== HTTP/1.x 302 Found Date: Wed, 11 Jul 2007 19:14:04 GMT Server: HTTPD Set-Cookie: complaints=72de46df781bc8b305a69dc11b580ff0; path=/; domain=hostedlabs.com; secure Expires: Thu, 19 Nov 1981 08:52:00 GMT Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Pragma: no-cache Location: http://complaintsdevwww.hostedlabs.com/2007/july/3/FW__VitalChek_Order_Confirm ation_146802.htm Content-Encoding: gzip Vary: Accept-Encoding Keep-Alive: timeout=3, max=100 Connection: Keep-Alive Transfer-Encoding: chunked Content-Type: text/html; charset=UTF-8 The redirect script is about as simple as it gets: ?php set_include_path('/webapps/data/sagacity.com/complaints.com/includes'); require 'globals.inc'; $public = /webapps/data/sagacity.com/complaints.com/static; $entry_id = (int) $_GET['entry_id']; $pattern =$public/*/*/*/*_$entry_id.htm; $files = glob($pattern); if (is_array($files) count($files) === 1){ $basename = substr($files[0], strlen($public)); error_log(about to redirect to $STATICURL$basename); header(Location: $STATICURL$basename); exit; } header(Location: http://complaints.com;); ? In this instance, globals.inc is a rather large file that gets included solely to set $STATICURL to 'http://complaintsdevwww.hostedlabs.com' I'm just not seeing any rational explanation for why my boss' computer is doing popups in all this. Surely a re-direct to a different sub-domain doesn't make Mac OS X decide it's a Good Idea to do popups... Does it?... The sub-domains are needed as the 'www' sub-domain will be a world-wide distributed server-farm DCN static data setup, while the 'browse' one will be a different world-wide distributed server-farm of PHP application boxes... I realize this isn't a PHP question, really, but I don't know what kind of a question it *IS* to know where to start looking, and my keyword combinations to Google have only returned a LOT of results with no relevance to my actual issue, as you might imagine... :-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Creating 'Next' 'Previous' for PHP Photo Gallery
I¹m trying to write a Photo Gallery in PHP. Everything else is pretty much worked out like thumbnails, indexes, titles all the one thing I¹m stuck at is the Next Previous links for the Photos on the main Photo Page. It¹s a simple program where you drop images in a folder and glob() picks up the thumbnails displays them on a page which are automatically linked to the Full Size Images. This is the code: ? $ID = $_GET['ID']; foreach (glob($ID/thumbnails/*.jpg) as $key=$value) { $title = rtrim(basename($value),'.jpg'); $newtitle = preg_replace('/_/', ' ', $title); ? A HREF=photo.php?photo=?php echo basename($value); ?title=?php echo $newtitle; ?ID=?php echo $_GET['ID']; ?KEY=?php echo $key; ? TARGET=photoFrame IMG SRC=?php echo $ID; ?/thumbnails/?php echo basename($value); ?/A ?php echo $newtitle; ? ? } ? I know that $key holds the sequence of images that are being picked up by glob() - I¹m just trying to figure out a way to use this $key to generate the Next Previous link. The problem is everything is passed on to a separate page (photo.php) ... What I¹m thinking is determining which Photo File would be Next or Previous to the one being selected, and passing that along to the (photo.php) page. I¹m just not able to figure out how to pick out the next previous filename and place it in the Query String. Any suggestions? ~~~ Rahul Sitaram Johari CEO, Twenty Four Seventy Nine Inc. W: http://www.rahulsjohari.com E: [EMAIL PROTECTED] ³I morti non sono piu soli ... The dead are no longer lonely²
[PHP] Replace/Update record in dbase using dbase_replace_record()
Ave, Can¹t figure this one out. I¹m using the dbase_replace_record() function to replace a record in a dbase (.dbf) database. I just want to replace the value of one of the fields with another value. This is my code: $db = dbase_open(CRUMBS.DBF, 2) or die(Fatal Error: Could not open database!); if ($db) { $record_numbers = dbase_numrecords($db); for ($i = 1; $i = $record_numbers; $i++) { $row = dbase_get_record_with_names($db, $i); if ($row['PHONE'] == $thekey) { print_r($row); $row['A'] == F; dbase_replace_record($db, $row, 1); } } } dbase_close($db); Basically I have a database called ³CRUMBS.DBF², and the record where PHONE = $thekey, I want to replace the value of the field ³A² with ³F². I keep getting the error: ³Wrong number of fields specified². I have over 60 fields in each row and I just want to replace the value of the field ³A². Any suggestions? ~~~ Rahul Sitaram Johari CEO, Twenty Four Seventy Nine Inc. W: http://www.rahulsjohari.com E: [EMAIL PROTECTED] ³I morti non sono piu soli ... The dead are no longer lonely²
[PHP] Latest PHP for Mac OS X 10.3.9 (Panther)
Ave, I¹m looking for the latest PHP releases (5.2.2 or higher) for Mac OS X 10.3.9 (Panther). Entropy.ch is only providing releases for Mac OS X 10.4 (Tiger), in fact there stable PHP 5.2.2 release won¹t even install on 10.4 Mac¹s. Is there any other way to get latest PHP releases for Mac OS X 10.3.9? I¹m currently running PHP 5.0.1 / Apache 1.3 Thanks. ~~~ Rahul Sitaram Johari CEO, Twenty Four Seventy Nine Inc. W: http://www.rahulsjohari.com E: [EMAIL PROTECTED] ³I morti non sono piu soli ... The dead are no longer lonely²
[PHP] Catch result from an external web page
Ave, Basically I¹m throwing an account number to a webpage on an external website And I want to catch the result in some sort to find out if the account number exists. Let¹s say I have this form: FORM ACTION=http://www.somewhere.com/acc.asp; METHOD=post NAME=frm input TYPE=TEXT NAME=ACCTNUM SIZE=20 MAXLENGTH=15 input TYPE=HIDDEN NAME=GOOD VALUE=0 INPUT NAME=frmSubmit TYPE=submit VALUE=Let's Go! /FORM Now when I click submit the browser goes to www.somewhere.com if the account number is good, it¹ll bring up further option if not it redirects to an error page. www.somewhere.com is an external site I don¹t have access to it¹s codes or variables. I want to be able to determine if that form succeeded in getting to the Account Page, i.e., the Account Number was good or if it failed and redirected to the error page. Is there any way to do this? Is there perhaps a way to read the output of that page and store it in a text file? Thanks. PS: Anyone with an inquisitive mind NO! I¹m not trying to hack someone¹s website. ³Somewhere.Com² is our client and we need to hit their website to determine if the account is good or not for a service we¹re providing them. Right now we¹re trying to avoid requesting them for their source/code or help for that matter. ~~~ Rahul Sitaram Johari CEO, Twenty Four Seventy Nine Inc. W: http://www.rahulsjohari.com E: [EMAIL PROTECTED] ³I morti non sono piu soli ... The dead are no longer lonely²
Re: [PHP] Catch result from an external web page
AWESOME!!! Never worked with Curl before - but looks like a solution to my problem from what I'm reading. Thanks! I'll write back if I run into snags. On 6/20/07 11:25 AM, Robert Cummings [EMAIL PROTECTED] wrote: On Wed, 2007-06-20 at 11:16 -0400, Rahul Sitaram Johari wrote: Ave, Basically I¹m throwing an account number to a webpage on an external website And I want to catch the result in some sort to find out if the account number exists. Let¹s say I have this form: FORM ACTION=http://www.somewhere.com/acc.asp; METHOD=post NAME=frm input TYPE=TEXT NAME=ACCTNUM SIZE=20 MAXLENGTH=15 input TYPE=HIDDEN NAME=GOOD VALUE=0 INPUT NAME=frmSubmit TYPE=submit VALUE=Let's Go! /FORM Now when I click submit the browser goes to www.somewhere.com if the account number is good, it¹ll bring up further option if not it redirects to an error page. www.somewhere.com is an external site I don¹t have access to it¹s codes or variables. I want to be able to determine if that form succeeded in getting to the Account Page, i.e., the Account Number was good or if it failed and redirected to the error page. Is there any way to do this? Is there perhaps a way to read the output of that page and store it in a text file? Thanks. PS: Anyone with an inquisitive mind NO! I¹m not trying to hack someone¹s website. ³Somewhere.Com² is our client and we need to hit their website to determine if the account is good or not for a service we¹re providing them. Right now we¹re trying to avoid requesting them for their source/code or help for that matter. Use cURL to post the form to the remote site from within PHP. Then you can process the resulting HTML yourself to determine if it succeeded. Cheers, Rob. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Cannot access file on Network Drive (Windows 2003)
At this point having gone through all sorts of permissions and running Apache as User and what not - I'm pretty close to giving up myself. Fortunately I do have other alternates to running this particular application - but it would have helped if things worked. On 5/24/07 6:23 PM, David Giragosian [EMAIL PROTECTED] wrote: I had a similar problem with a mysqldump file that I was trying to copy over, via a script, to a networked drive. The networked drive was on a Novell share, and I could see it and copy just fine using windows explorer but nothing I did ever allowed me to copy via the script. I even had Apache installed as a service on the windows box and had all permissions as open as possible on all directories just to test. I finally gave up and did it from a Linux server using ncpfs to mount the Novell drive. FWIT, David -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Check if Record was Entered Today.
WORKS!! Thanks. On 5/24/07 5:34 PM, Richard Lynch [EMAIL PROTECTED] wrote: $db = dbase_open(try.dbf, 0); if ($db) { $exists = false; $today = false; $record_numbers = dbase_numrecords($db); for ($i = 1; $i = $record_numbers; $i++) { $row = dbase_get_record_with_names($db, $i); $thedate = date(mdY); if(($row['ACC'] == $thekey) ($row['DATE'] == $thedate)) { // echo The Account Number has already been entered once // today; // echo $row['DATE']. : .$thedate; // exit; $today = true; } else { // echo The Account Number exists but not entered // todaybr; // echo $row['DATE']. : .$thedate; // exit; $exists = true; } } } if ($today) echo Yes, today.; elseif ($exists) echo Yes, but not today.; else echo No.; exit; completely halts a script and does NOTHING else. You maybe thought you wanted 'continue' or 'break' but those wouldn't work for this either. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Check if Record was Entered Today.
I guess one of the problems is that PHP has a limited number of dbase functions and I'm not able to run SQL Queries on a dbf database. Basically I have to make-do with the few dbase() functions I have available in PHP. But I do get your logic and it's pretty helpful. I did re-write the code using Boolean (flags) as Richard had also suggested and it works fine now! Still wish I could run SQL Queries or do more to a dbase database using PHP. Thanks! On 5/24/07 4:07 PM, Jared Farrish [EMAIL PROTECTED] wrote: I believe you need a while instead of an if. The if will only run until the first occurance is true. Whereas a while will run to find all results that are true until it goes thru all of the result rows.. No, I think he's checking to make sure that $db contains a resource id and not a boolean false (meaning the file did not load or contains no data). Maybe a more descriptive way may be to say: code if ($db !== false is_resource($db)) { doStuff(); } /code To the next problem: 'exit' terminates the script. You should not be using exit there. When you want a loop structure to stop and goto what flows next in the code, use break: code for ($i = 0; $i count($items); $i++) { if ($items[$i] == $arbitraryCondition) { echo 'I do not need to doStuff() anymore.'; break; } doStuff(); } /code When you want a loop structure to skip over something but still continue to loop, use continue: code for ($i = 0; $i count($items); $i++) { if ($items[$i] == $arbitraryCondition) { echo 'I do not need to doStuff() on this item.'; continue; } doStuff(); } /code When reading through values in an array or other structure, you can while or do/while loop: code $db = getDb('location/db.dbf'); while($row = db_fetch_array($result)) { if ($row['AcctActivation'] != $date) { continue; } elseif ($row['AcctActivation'] == $date) { break; } doStuff(); } /code Isn't there a way to search for and select only the rows with the account number though? If you're looking for needles in a (potentially large) haystack, this sounds like an expensive process for something SQL or other could do better/faster. Incidentally, does this mean you solved the file access problems from this thread: http://news.php.net/php.general/255542 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] using mysql_escape_string with implode() !!
Ave, I¹m inserting values out of an array into mySQL. There¹s other values besides the array values that are being inserted as well. This is my simple INSERT code: $sql = INSERT INTO db (Date,Time,Phone,Account,AccountType,RateClass,VoltLevel,IsoZone,TaxDist,Loa dProfile,ServiceName,ServiceAddress,ServiceCity,ServiceState,ServiceZip,Dema nd,Kwh,Cost) VALUES ('$dt','$tm','$thephone','.implode(',', array_values($var)).'); $var can contain values that have special characters that I need to escape. I¹d like to use mysql_escape_string() but I¹m not sure how to integrate mysql_escape_string here with the INSERT statement. I tried it, but it¹s not working. Any clues? Thanks. ~~~ Rahul Sitaram Johari CEO, Twenty Four Seventy Nine Inc. W: http://www.rahulsjohari.com E: [EMAIL PROTECTED] ³I morti non sono piu soli ... The dead are no longer lonely²
Re: [PHP] using mysql_escape_string with implode() !!
Ok, I'm not able to use array_map() at all to my benefit, or at least I can't figure out how to. I'm trying to generate the string with escape slashes before I put it in the INSERT statement, but it's not working primarily because values have to be enclosed in Single Quotes while inserting into mySQL and Single Quote itself is escape when using mysql_escape_string!!! On 5/25/07 11:41 AM, Zoltán Németh [EMAIL PROTECTED] wrote: Ave, I¹m inserting values out of an array into mySQL. There¹s other values besides the array values that are being inserted as well. This is my simple INSERT code: $sql = INSERT INTO db (Date,Time,Phone,Account,AccountType,RateClass,VoltLevel,IsoZone,TaxDist,Loa dProfile,ServiceName,ServiceAddress,ServiceCity,ServiceState,ServiceZip,Dema nd,Kwh,Cost) VALUES ('$dt','$tm','$thephone','.implode(',', array_values($var)).'); $var can contain values that have special characters that I need to escape. I¹d like to use mysql_escape_string() but I¹m not sure how to integrate mysql_escape_string here with the INSERT statement. I tried it, but it¹s not working. Any clues? you should do the escaping before assembling the INSERT statement a useful tool for this is array_map(): http://hu.php.net/array_map then you can use the above method for creating the query string -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] using mysql_escape_string with implode() - SOLVED!
Ave, Alright, here's I solved it. Used the array_walk function. This is my code: function test_alter($item1) { $item1 = mysql_escape_string($item1); } array_walk($var, 'test_alter'); $var = implode(',', $var); $sql = INSERT INTO nimo_account(Date,Time,Phone,Account,AccountType,RateClass,VoltLevel,IsoZone ,TaxDist,LoadProfile,ServiceName,ServiceAddress,ServiceCity,ServiceState,Ser viceZip,Demand,Kwh,Cost) VALUES ('$dt','$tm','$thephone','.$var.'); $result = mysql_query($sql) or die(Critical Error: .mysql_error()); And it Works! All special characters are escaped within the Array's Values itself, and then I just implode them with ',' and add them to the mySQL Database!! On 5/25/07 11:32 AM, Rahul Sitaram Johari [EMAIL PROTECTED] wrote: Ave, I¹m inserting values out of an array into mySQL. There¹s other values besides the array values that are being inserted as well. This is my simple INSERT code: $sql = INSERT INTO db (Date,Time,Phone,Account,AccountType,RateClass,VoltLevel,IsoZone,TaxDist,LoadP rofile,ServiceName,ServiceAddress,ServiceCity,ServiceState,ServiceZip,Demand,K wh,Cost) VALUES ('$dt','$tm','$thephone','.implode(',', array_values($var)).'); $var can contain values that have special characters that I need to escape. I¹d like to use mysql_escape_string() but I¹m not sure how to integrate mysql_escape_string here with the INSERT statement. I tried it, but it¹s not working. Any clues? Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Cannot access file on Network Drive (Windows 2003)
Ave, UNC paths didn't work, i.e., (server\\share\\Transfer\\test.dbf). I have no clue how to Run Apache as a particular User on Windows! I installed Apache using the Installer available - but I really don't know anything else 'user' related about Apache. Both SYSTEM and the Computer I'm running all this on have Full Control Permissions to the Network Share. On 5/24/07 5:28 AM, Stut [EMAIL PROTECTED] wrote: I assume you've mapped drive X to the network share for the user that Apache runs as? If not are you really surprised that it can't find that file? Try using the UNC path (server\\share\\Transfer\\test.dbf) [note double backslashes]. If that still doesn't work then it's likely a permissions issue. -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] RE: Cannot access file on Network Drive (Windows 2003)
How exactly do you run Apache manually as your own user on Windows 2003? On 5/24/07 5:32 AM, Stut [EMAIL PROTECTED] wrote: Does the user Apache is running as have permission to access the network at all? It's fairly common for services to lack that access for (shockingly for Windows) security reasons. The easiest way to test it is to stop the Apache service and run it manually as your user. If it works like that then your problem is definitely permissions-related and you should consult your sysadmin (or Google if you don't have one). -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] RE: Cannot access file on Network Drive (Windows 2003)
Ave, Instead of going back forth on various function path tests, I wrote a small code containing different suggested combinations of PATH and also the gettype() as Jim had requested. Following is the Code and the Output. Code: $filename = 'X:\send\Transfer\LIVE\live.txt'; echo gettype($filename).br; if (file_exists($filename)) { echo The file $filename Existsbr; } else { echo The file $filename does NOT Existbrbr; } $filename1 = 'X:\\send\\Transfer\\LIVE\\live.txt'; echo gettype($filename1).br; if (file_exists($filename1)) { echo The file $filename1 Existsbr; } else { echo The file $filename1 does NOT Existbrbr; } $filename2 = 'X:/send/Transfer/LIVE/live.txt'; echo gettype($filename2).br; if (file_exists($filename2)) { echo The file $filename2 Existsbr; } else { echo The file $filename2 does NOT Existbrbr; } $filename3 = 'X://send//Transfer//LIVE//live.txt'; echo gettype($filename3).br; if (file_exists($filename3)) { echo The file $filename3 Existsbr; } else { echo The file $filename3 does NOT Existbrbr; } $filename4 = '\\Foresight\send\Transfer\LIVE\live.txt'; echo gettype($filename4).br; if (file_exists($filename4)) { echo The file $filename4 Existsbr; } else { echo The file $filename4 does NOT Existbrbr; } $filename5 = 'Foresight\\send\\Transfer\\LIVE\\live.txt'; echo gettype($filename5).br; if (file_exists($filename5)) { echo The file $filename5 Existsbr; } else { echo The file $filename5 does NOT Existbrbr; } $filename6 = '//Foresight/send/Transfer/LIVE/live.txt'; echo gettype($filename6).br; if (file_exists($filename6)) { echo The file $filename6 Existsbr; } else { echo The file $filename6 does NOT Existbrbr; } $filename7 = 'Foresight//send//Transfer//LIVE//live.txt'; echo gettype($filename7).br; if (file_exists($filename7)) { echo The file $filename7 Existsbr; } else { echo The file $filename7 does NOT Existbrbr; } Output: string The file X:\send\Transfer\LIVE\live.txt does NOT Exist string The file X:\send\Transfer\LIVE\live.txt does NOT Exist string The file X:/send/Transfer/LIVE/live.txt does NOT Exist string The file X://send//Transfer//LIVE//live.txt does NOT Exist string The file \Foresight\send\Transfer\LIVE\live.txt does NOT Exist string The file \\Foresight\send\Transfer\LIVE\live.txt does NOT Exist string The file //Foresight/send/Transfer/LIVE/live.txt does NOT Exist string The file Foresight//send//Transfer//LIVE//live.txt does NOT Exist ~~~ Rahul Sitaram Johari CEO, Twenty Four Seventy Nine Inc. W: http://www.rahulsjohari.com E: [EMAIL PROTECTED] ³I morti non sono piu soli ... The dead are no longer lonely² -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: RE: Cannot access file on Network Drive (Windows 2003)
On 5/24/07 11:04 AM, Jared Farrish [EMAIL PROTECTED] wrote: Well, I'll say you've dramatically upped the ante by having an Apache server on a windows box attempt to mount and read a file on a MacOS machine. Yipes! So let me get this straight: * Apache is on Windows Server 2003. * PHP is running on Apache. * A folder containing scripts/data/both is on a MacOSX machine. * A user from frontierland knocks on PHP's front host.com:80 door and says, Please... * PHP - Apache: Gimme gimme [resource P] * Apache says, Ok, let me get the data from location X. * Apache - location X: Pretty Please, gimme gimme. * location X - Apache: [barf] * Apache - PHP: No luck. Jared, I think you got a little confused with a previous post of mine. Mac OS X is Not in this scenario at all!!! So completely Eradicate it from this current Scenario. This is a complete PHP/Apache on Windows 2003 Scenario. That's it! So what it is supposed to be is: * PHP5 / Apache2.2 on Windows Server 2003 * Folder on another Windows Machine on the Network contains some files (mapped as network drive X:\) * PHP trying to read file on X:\ from Apache on Windows 2003. There's really nothing else to it. Can you, from the Windows 2003 machine, manually access the folder/file that you're asking PHP (through Apache) to access? Unless the service that Apache is running under has permissions to communicate with the share resource (location X), this will always fail. Yes! Without any problems! I can easily navigate to the X: drive on that Windows Machine, and do anything I want with files there. I have all permissions. ~~~ Rahul Sitaram Johari CEO, Twenty Four Seventy Nine Inc. W: http://www.rahulsjohari.com E: [EMAIL PROTECTED] ³I morti non sono piu soli ... The dead are no longer lonely² -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: RE: Cannot access file on Network Drive (Windows 2003)
You may have something here. Problem is, I don¹t know how to mess with how under what user Apache is running and no one else here does either so basically I have to figure this one out! I would like to, as you suggested, try and ³get Apache to run as a service under a user that can access the network resource². I definitely agree about using non-mapped addresses and using the actual Server Name addresses. On 5/24/07 11:24 AM, Jared Farrish [EMAIL PROTECTED] wrote: Are you running Apache under a different (non-privileged) account on the Win2003 machine? If Apache is running as a service with a different username (with no extended access to network resources), you will need to get Apache to run as a service under a user that can access the network resource. And I still think you should use non-mapped addresses instead of mapped addresses, since a mapping is just a localized version of a resource name alias. If, after determing that Apache is running with the right permissions for the owned processes to connect to and use a network shared resource, then it's probably an Apache UID conflict (is PHP in safe mode?).
[PHP] Check if Record was Entered Today.
Ave, I have a dbase (dbf) database and I¹m using PHP¹s dbase function to open search the database. Each row in the database contains an Account Number and the Date it was inserted. I want to search this database for to see if the Account number ($thekey) was inserted today (using date() to find out today¹s date). Essentially, here¹s the code: $db = dbase_open(try.dbf, 0); if ($db) { $record_numbers = dbase_numrecords($db); for ($i = 1; $i = $record_numbers; $i++) { $row = dbase_get_record_with_names($db, $i); $thedate = date(mdY); if(($row['ACC'] == $thekey) ($row['DATE'] == $thedate)) { echo The Account Number has already been entered once today; echo $row['DATE']. : .$thedate; exit; } else { echo The Account Number exists but not entered todaybr; echo $row['DATE']. : .$thedate; exit; } } } The problem is the scripts stops at the first entry of the Account Number, and is not looping through all the rows which contain the Account Number. So if the Account Number was entered yesterday, it stops and gives ³The Account Number exists but not entered today² even though the Account Number does exist in another row with Today¹s Date. How do I make it loop through all the rows and check if there is any entry with the Account Number Today¹s Date? Thanks, ~~~ Rahul Sitaram Johari CEO, Twenty Four Seventy Nine Inc. W: http://www.rahulsjohari.com E: [EMAIL PROTECTED] ³I morti non sono piu soli ... The dead are no longer lonely²
[PHP] Cannot access file on Network Drive (Windows 2003)
Ave, Apache 2.2, PHP5 mySQL 5 on Windows 2003. I have some files sitting on a Network Drive accessible on the Windows 2003 Server. But my php script is not able to open the files. Let¹s say there¹s a database on X:\Transfer\test.dbf If I use: $db = dbase_open(³X:\Transfer\test.dbf², 0); It is not able to open the database. The X: Drive is a network drive. Any clues on how to make this happen? Thanks. ~~~ Rahul Sitaram Johari CEO, Twenty Four Seventy Nine Inc. W: http://www.rahulsjohari.com E: [EMAIL PROTECTED] ³I morti non sono piu soli ... The dead are no longer lonely²
Re: [PHP] Cannot access file on Network Drive (Windows 2003)
Well, Full Permissions (Full Control, including read write) have been given to the Machine on which the Apache Web Server is setup. Not sure if anything else needs to be done! On 5/23/07 3:02 PM, Jay Blanchard [EMAIL PROTECTED] wrote: [snip] Let¹s say there¹s a database on X:\Transfer\test.dbf If I use: $db = dbase_open(³X:\Transfer\test.dbf², 0); It is not able to open the database. The X: Drive is a network drive. Any clues on how to make this happen? [/snip] Have you checked the permissions? -- 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] Cannot access file on Network Drive (Windows 2003)
Didn't help. Tried X:\\Transfer\\test.dbf Still can't access the file. On 5/23/07 3:11 PM, Tijnema [EMAIL PROTECTED] wrote: The \ is an escape token, and you should use \\ instead. Try X:\\Transfer\\test.dbf instead. Tijnema ps. Please don't top post. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] RE: Cannot access file on Network Drive (Windows 2003)
Tried that too. Used \\Servername\sharename\test.dbf Also used additional backslashes for the escape issue: Servername\\sharename\\test.dbf Still doesn't work! I'm not getting a permissions related issue and I'm doubting it is a permissions issue. I have Full Control given to the system all this is on. On 5/23/07 3:16 PM, Jared Farrish [EMAIL PROTECTED] wrote: Other than permissions, you might be referencing the folder by the local network mapping drive initial, instead of the actual path: X:\\offsite\db\test.dbf == \\compname-x\offsite\db\test.dbf Generally, I like using the computer name and not a mapping. I find this name-based address through the 'My Network Places' folder. I'm not much of a windows networking person, but this might be the problem. Results may vary, but in windows, I think the mappings are by machine only, as mappings (I assume) are local aliases, and must be set or shared among groups of machines to be known. It's probably a permissions thing, though. FWIW -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] RE: Cannot access file on Network Drive (Windows 2003)
I've been trying to run various entry level functions on the file, like file_exists(), isreadable() etcetera But no matter what I do, I pretty much get the cannot open warnings without much specification as to Why cannot open. So when I do the dbase_open() function, and I've tried all different combinations of paths, backslashes and all, I always get this: Warning: dbase_open() [function.dbase-open]: unable to open database test.dbf in ... *followed by whatever path I put in*. I'm still going to try some more testing using text files, but this is what I'm really get at. On 5/23/07 3:32 PM, Jared Farrish [EMAIL PROTECTED] wrote: Try to simply include() and var_dump() or something. Start from just checking you can access the file first (I'd even start with a test.txtfile), before you inflate the db... Let us know what the error is exactly, as well. What happens? Error? Warning? Blank page? What tells you the script doesn't work? On 5/23/07, Rahul Sitaram Johari [EMAIL PROTECTED] wrote: Tried that too. Used \\Servername\sharename\test.dbf Also used additional backslashes for the escape issue: Servername\\sharename\\test.dbf Still doesn't work! I'm not getting a permissions related issue and I'm doubting it is a permissions issue. I have Full Control given to the system all this is on. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] RE: Cannot access file on Network Drive (Windows 2003)
I use a Mac OS X Server generally, where I mount network drives to a share point. Everything works therein. Recently I had a need to setup Apache Web Server, PHP mySQL on a Windows 2003 Server we have in the office. There I used the same scripts I was running on Mac OS X to access files on a network drive. But in Windows 2003, I¹m not mounting anything on a share point, I¹m simply referring to the files using actual paths. Whether it¹s a direct X:\ kind of path, or a network path \\servername ... With or without backslashes. This is the first application I setup on the Windows Server to access files on a network drive. On 5/23/07 4:33 PM, Jared Farrish [EMAIL PROTECTED] wrote: So you haven't been able to actually access the drive yet? Are you using any other shared content on network drives that does currently work? On 5/23/07, Rahul Sitaram Johari [EMAIL PROTECTED] wrote: I've been trying to run various entry level functions on the file, like file_exists(), isreadable() etcetera But no matter what I do, I pretty much get the cannot open warnings without much specification as to Why cannot open. So when I do the dbase_open() function, and I've tried all different combinations of paths, backslashes and all, I always get this: Warning: dbase_open() [function.dbase-open]: unable to open database test.dbf in ... *followed by whatever path I put in*. I'm still going to try some more testing using text files, but this is what I'm really get at.