php-general Digest 14 Jul 2005 06:29:31 -0000 Issue 3566
php-general Digest 14 Jul 2005 06:29:31 - Issue 3566 Topics (messages 218638 through 218658): Re: 404 error - why???!! 218638 by: Joseph 218639 by: Grosz, Steve (IPG IT) Re: Time Zone names 218640 by: Philip Hallstrom Re: DAO/VO Pattern Help 218641 by: Manuel Lemos 404 error - DLL files needed ?? 218642 by: Grosz, Steve (IPG IT) 218643 by: Mikey 218645 by: Grosz, Steve (IPG IT) 218646 by: glumtail 218647 by: Grosz, Steve (IPG IT) 218650 by: Tjoekbezoer van Damme 218651 by: Grosz, Steve (IPG IT) 404 Header Problems 218644 by: Scott Taylor 218649 by: Jasper Bryant-Greene Install directions for Win2003 SP1?? 218648 by: Grosz, Steve (IPG IT) New Install Question 218652 by: php.swimwebs.com 218653 by: php.swimwebs.com Dynamic Images and File Permissions 218654 by: Adam Hubscher Echo array string index? 218655 by: Matt Darby 218656 by: Adam Hubscher Removing special characters 218657 by: Computer Programmer 218658 by: Marek Kilimajer Administrivia: To subscribe to the digest, e-mail: [EMAIL PROTECTED] To unsubscribe from the digest, e-mail: [EMAIL PROTECTED] To post to the list, e-mail: php-general@lists.php.net -- ---BeginMessage--- Steve, I may have missed this response, if this is a repeat please excuse me... Make sure you have the correct mysql and php versions to run phpBB. I had 404 errors with a blogging/forum application where the index file moved to another page. But because there were some errors in setup the page came up as 404. You might try to put this in a page: info.php html body ?php phpinfo(); ? /body /html Then go to the page, this will let you know if php is running. I have a feeling it is the BB which is having the problem. jzf Grosz, Steve (IPG IT) wrote: OK, you lost me, execute/write on which file? I don't use asp, I use Coldfusion, and .htm, I'm only installing PHP so I can use the phpBB system. -Original Message- From: glumtail [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 13, 2005 12:05 PM To: php-general@lists.php.net Subject: Re: [PHP] 404 error - why???!! Hello, it seems that your ISAPI is ok. 1. with full permission? e.g: execute,write and so on... 2. how about asp file? 2005/7/14, Grosz, Steve (IPG IT) [EMAIL PROTECTED]: Ok, now it appears the ISAPI is loaded, I get the green up arrow, but the priority always shows as 'unknown'. Still get the 404 errors when trying to view .php pages Steve -Original Message- From: glumtail [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 13, 2005 11:10 AM To: php-general@lists.php.net Subject: Re: [PHP] 404 error - why???!! Hello Steve, Administrator tools - Internet Services Manager - Default Web Site - ISAPI 2005/7/14, Grosz, Steve (IPG IT) [EMAIL PROTECTED]: I guess I'm not sure how to tell if its loading correctly. Can you tell me how to confirm that it is? I'm using PHP 4.x as well. Steve -Original Message- From: glumtail [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 13, 2005 11:00 AM To: php-general@lists.php.net Subject: Re: [PHP] 404 error - why???!! Hello Steve, is the ISAPI loaded success? what's your PHP version? Version 4.x works fine. 2005/7/14, Grosz, Steve (IPG IT) [EMAIL PROTECTED]: Regular .htm files work just fine. Its kinda strange.. -Original Message- From: Richard Davey [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 13, 2005 10:18 AM To: php-general@lists.php.net Subject: Re: [PHP] 404 error - why???!! Hello Steve, Wednesday, July 13, 2005, 5:11:58 PM, you wrote: GSII Ok, I thought I had installed PHP correctly on my Win2003 GSII server, using ISAPI. I added the extension, and mapped it to GSII the GSII php4isapi.dll file, added a path to my /php folder in GSII Win2003, GSII edited my php.ini file which I copied to my GSII /windows/system32 folder. This won't fix the 404 (sorry), but the php.ini doesn't go in system32, it just goes in the Windows directory. Do you only get 404s on PHP files? What happens if you copy an .html file into the same location and request that? Best regards, Richard Davey -- http://www.launchcode.co.uk - PHP Development Services I do not fear computers. I fear the lack of them. - Isaac Asimov -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Removing special characters
Computer Programmer wrote: Is there a PHP built-in function to retrieve only the alphanumeric characters from a given string? I know that I can check for alphanumeric characters using the function ctype_alphanum () but it won't retrieve the alphanum characters. I also know that I can use str_replace to replace an array of special characters such as the example below: $str = I*m using html tags with special/chars like | how to get rid of it???; $removeChars = array ('*','?','|','','','/','\\'); $str = str_replace ($removeChars, , $str); However, could there be a specific function for just retrieving alphanumeric characters? or a specific function for just stripping special characters? Or maybe a better way to do those things from the example given above? $str = preg_replace('/[^a-z0-9]/i', '', $str); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] searching multiple fields
Is there a way to use like to search various fields at one time. For example I want the search field to search by name or area or organisation. If the (minimum)three letter string matches any of these I want the record to show. $search_field is my textbox $query = SELECT * FROM sheet1 WHERE 'name' LIKE '$search_field%'; but really I want it to do the folowing. $query = SELECT * FROM sheet1 WHERE 'name' or 'area or 'organisation LIKE '$search_field%'; Cheers, R. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Echo array string index?
Hey Matt, you can print out the contents of your array by using print_r($arr) but more useful is using this foreach ($arr as $key = $value) { echo Key : .$key. Value : .$value; } Adios Joe On 7/13/05, Adam Hubscher [EMAIL PROTECTED] wrote: Matt Darby wrote: I have an array setup as such: *$arr['generated text']='generated number';* What would be the best way to echo the key in a loop? Seems pretty easy but I've never attempted... Thanks all! Matt Darby I'm not sure I understand the question. You could do foreach($arr as $key = $value) { print($key); }. There are also a number of functions that get the current key on the array's pointer: http://us2.php.net/manual/en/function.key.php http://us2.php.net/manual/en/function.array-keys.php But once again, it really comes down to what exactly it is you want to do... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Joe Harman - Do not go where the path may lead, go instead where there is no path and leave a trail. - Ralph Waldo Emerson
Re: [PHP] searching multiple fields
Hello Ross, Thursday, July 14, 2005, 9:37:10 AM, you wrote: R $query = SELECT * FROM sheet1 WHERE 'name' or 'area or 'organisation LIKE R '$search_field%'; SELECT * FROM blah WHERE name LIKE '$search%' OR area LIKE '$search%' OR blahblah LIKE '$search%' etc If you want to add extra conditions you can do so like this: SELECT * FROM blah WHERE (name LIKE '$search%' AND id 10) OR area LIKE '$search%' Best regards, Richard Davey -- http://www.launchcode.co.uk - PHP Development Services I do not fear computers. I fear the lack of them. - Isaac Asimov -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Big file encryption
Hello every body I'm in the ... well I have a big file (around 12M), and I have to encrypt this file, and to decrypt some time after. How could I do? Is it possible to encrypt and decrypt a file line by line ? Please help david -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Refresh
Hello people, I need to have a web page (PHP) that displays a status about electric facilities, this status is read from a database (MySQL), the thing is that these status may change from time to time in the DB so I need to re read the DB and display the according status on the web page. So, Is there a way to refresh or reload the page every 10 minutes automatically? Regards, --- Miguel Guirao Aguilera Logistica R8 TELCEL Tel. (999) 960.7994 Cel. 9931 600. Este mensaje es exclusivamente para el uso de la persona o entidad a quien esta dirigido; contiene informacion estrictamente confidencial y legalmente protegida, cuya divulgacion es sancionada por la ley. Si el lector de este mensaje no es a quien esta dirigido, ni se trata del empleado o agente responsable de esta informacion, se le notifica por medio del presente, que su reproduccion y distribucion, esta estrictamente prohibida. Si Usted recibio este comunicado por error, favor de notificarlo inmediatamente al remitente y destruir el mensaje. Todas las opiniones contenidas en este mail son propias del autor del mensaje y no necesariamente coinciden con las de Radiomovil Dipsa, S.A. de C.V. o alguna de sus empresas controladas, controladoras, afiliadas y subsidiarias. Este mensaje intencionalmente no contiene acentos. This message is for the sole use of the person or entity to whom it is being sent. Therefore, it contains strictly confidential and legally protected material whose disclosure is subject to penalty by law. If the person reading this message is not the one to whom it is being sent and/or is not an employee or the responsible agent for this information, this person is herein notified that any unauthorized dissemination, distribution or copying of the materials included in this facsimile is strictly prohibited. If you received this document by mistake please notify immediately to the subscriber and destroy the message. Any opinions contained in this e-mail are those of the author of the message and do not necessarily coincide with those of Radiomovil Dipsa, S.A. de C.V. or any of its control, controlled, affiliates and subsidiaries companies. No part of this message or attachments may be used or reproduced in any manner whatsoever. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Refresh
well I see two way. First is to make a php script without end, which will run continuously. second way is to add refresh html tag, in your page, or a js script to reload automaticaly. I'm not seeing other solution in php. regards Le Thu, 14 Jul 2005 02:27:47 +0200, Miguel Guirao [EMAIL PROTECTED] a écrit: Hello people, I need to have a web page (PHP) that displays a status about electric facilities, this status is read from a database (MySQL), the thing is that these status may change from time to time in the DB so I need to re read the DB and display the according status on the web page. So, Is there a way to refresh or reload the page every 10 minutes automatically? Regards, --- Miguel Guirao Aguilera Logistica R8 TELCEL Tel. (999) 960.7994 Cel. 9931 600. Este mensaje es exclusivamente para el uso de la persona o entidad a quien esta dirigido; contiene informacion estrictamente confidencial y legalmente protegida, cuya divulgacion es sancionada por la ley. Si el lector de este mensaje no es a quien esta dirigido, ni se trata del empleado o agente responsable de esta informacion, se le notifica por medio del presente, que su reproduccion y distribucion, esta estrictamente prohibida. Si Usted recibio este comunicado por error, favor de notificarlo inmediatamente al remitente y destruir el mensaje. Todas las opiniones contenidas en este mail son propias del autor del mensaje y no necesariamente coinciden con las de Radiomovil Dipsa, S.A. de C.V. o alguna de sus empresas controladas, controladoras, afiliadas y subsidiarias. Este mensaje intencionalmente no contiene acentos. This message is for the sole use of the person or entity to whom it is being sent. Therefore, it contains strictly confidential and legally protected material whose disclosure is subject to penalty by law. If the person reading this message is not the one to whom it is being sent and/or is not an employee or the responsible agent for this information, this person is herein notified that any unauthorized dissemination, distribution or copying of the materials included in this facsimile is strictly prohibited. If you received this document by mistake please notify immediately to the subscriber and destroy the message. Any opinions contained in this e-mail are those of the author of the message and do not necessarily coincide with those of Radiomovil Dipsa, S.A. de C.V. or any of its control, controlled, affiliates and subsidiaries companies. No part of this message or attachments may be used or reproduced in any manner whatsoever. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Refresh
david forums [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] well I see two way. First is to make a php script without end, which will run continuously. I don't recommend this way at all. Why take up all that energy second way is to add refresh html tag, in your page, or a js script to reload automaticaly. Much better and simpler idea, you can use an http header to do this. http://4umi.com/web/html/httpheaders.htm has a list of them Third idea, which may be overkill, depending on how important this information is, how many people will be accessing it, and whether people _need_ to see it real time. set up a cron job/scheduled task to read the db value every 30 seconds, say, and write out a flat html page with the latest data in. This is only of value if your db is getting hammered by requests. I only really mention this as it's the Open Golf Championship this week, and I used to work on their live scoring app, which pretty much worked as above. I'm not seeing other solution in php. regards Le Thu, 14 Jul 2005 02:27:47 +0200, Miguel Guirao [EMAIL PROTECTED] a écrit: Hello people, I need to have a web page (PHP) that displays a status about electric facilities, this status is read from a database (MySQL), the thing is that these status may change from time to time in the DB so I need to re read the DB and display the according status on the web page. So, Is there a way to refresh or reload the page every 10 minutes automatically? Regards, --- Miguel Guirao Aguilera Logistica R8 TELCEL Tel. (999) 960.7994 Cel. 9931 600. Este mensaje es exclusivamente para el uso de la persona o entidad a quien esta dirigido; contiene informacion estrictamente confidencial y legalmente protegida, cuya divulgacion es sancionada por la ley. Si el lector de este mensaje no es a quien esta dirigido, ni se trata del empleado o agente responsable de esta informacion, se le notifica por medio del presente, que su reproduccion y distribucion, esta estrictamente prohibida. Si Usted recibio este comunicado por error, favor de notificarlo inmediatamente al remitente y destruir el mensaje. Todas las opiniones contenidas en este mail son propias del autor del mensaje y no necesariamente coinciden con las de Radiomovil Dipsa, S.A. de C.V. o alguna de sus empresas controladas, controladoras, afiliadas y subsidiarias. Este mensaje intencionalmente no contiene acentos. This message is for the sole use of the person or entity to whom it is being sent. Therefore, it contains strictly confidential and legally protected material whose disclosure is subject to penalty by law. If the person reading this message is not the one to whom it is being sent and/or is not an employee or the responsible agent for this information, this person is herein notified that any unauthorized dissemination, distribution or copying of the materials included in this facsimile is strictly prohibited. If you received this document by mistake please notify immediately to the subscriber and destroy the message. Any opinions contained in this e-mail are those of the author of the message and do not necessarily coincide with those of Radiomovil Dipsa, S.A. de C.V. or any of its control, controlled, affiliates and subsidiaries companies. No part of this message or attachments may be used or reproduced in any manner whatsoever. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] $PHP_SELF or echo $PHP_SELF
Hi PHPers, Just a quick thing that is bugging me. In some of my older textbooks a form is returned to the same page by using echo $PHP_SELF no just $PHP_SELF is this just used in older versions of php?? Does the it make a difference what one is used? Ta, Ross
Re: [PHP] $PHP_SELF or echo $PHP_SELF
Hello Ross, Thursday, July 14, 2005, 11:11:25 AM, you wrote: R Just a quick thing that is bugging me. In some of my older R textbooks a form is returned to the same page by using R echo $PHP_SELF no just $PHP_SELF R is this just used in older versions of php?? Does the it make a R difference what one is used? PHP_SELF is part of the $_SERVER super global, you should really access it like this: $_SERVER['PHP_SELF'] To answer your question though, it's just a variable - if you want to output it into your form action then you can do either: ? echo $_SERVER['PHP_SELF'] ? or ?=$_SERVER['PHP_SELF']? Either would work. Best regards, Richard Davey -- http://www.launchcode.co.uk - PHP Development Services I do not fear computers. I fear the lack of them. - Isaac Asimov -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Refresh
Put this between the page's head tags: meta http-equiv=REFRESH content=1;url=http://somesite_to_refresh_to; The 1 in the above line controls the time to refresh; the higher the number, the longer to refresh. Matt Darby Miguel Guirao wrote: Hello people, I need to have a web page (PHP) that displays a status about electric facilities, this status is read from a database (MySQL), the thing is that these status may change from time to time in the DB so I need to re read the DB and display the according status on the web page. So, Is there a way to refresh or reload the page every 10 minutes automatically? Regards, --- Miguel Guirao Aguilera Logistica R8 TELCEL Tel. (999) 960.7994 Cel. 9931 600. Este mensaje es exclusivamente para el uso de la persona o entidad a quien esta dirigido; contiene informacion estrictamente confidencial y legalmente protegida, cuya divulgacion es sancionada por la ley. Si el lector de este mensaje no es a quien esta dirigido, ni se trata del empleado o agente responsable de esta informacion, se le notifica por medio del presente, que su reproduccion y distribucion, esta estrictamente prohibida. Si Usted recibio este comunicado por error, favor de notificarlo inmediatamente al remitente y destruir el mensaje. Todas las opiniones contenidas en este mail son propias del autor del mensaje y no necesariamente coinciden con las de Radiomovil Dipsa, S.A. de C.V. o alguna de sus empresas controladas, controladoras, afiliadas y subsidiarias. Este mensaje intencionalmente no contiene acentos. This message is for the sole use of the person or entity to whom it is being sent. Therefore, it contains strictly confidential and legally protected material whose disclosure is subject to penalty by law. If the person reading this message is not the one to whom it is being sent and/or is not an employee or the responsible agent for this information, this person is herein notified that any unauthorized dissemination, distribution or copying of the materials included in this facsimile is strictly prohibited. If you received this document by mistake please notify immediately to the subscriber and destroy the message. Any opinions contained in this e-mail are those of the author of the message and do not necessarily coincide with those of Radiomovil Dipsa, S.A. de C.V. or any of its control, controlled, affiliates and subsidiaries companies. No part of this message or attachments may be used or reproduced in any manner whatsoever. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] searching multiple fields
...I want it to do the folowing. $query = SELECT * FROM sheet1 WHERE 'name' or 'area or 'organisation LIKE '$search_field%'; SELECT * FROM sheet1 WHERE 'name' LIKE '$search_field%' OR 'organization' LIKE '$search_field%' lk
RE: [PHP] Big file encryption
[snip] well I have a big file (around 12M), and I have to encrypt this file, and to decrypt some time after. How could I do? Is it possible to encrypt and decrypt a file line by line ? [/snip] Start with the manual at http://us2.php.net/manual/en/ref.mcrypt.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Big file encryption
Hihihihi Of course I already has the whole object to encrypt and decrypt, my problem is link to the size of the file. There is no mcrypt function to load directly a file, so it's need to preload it in a variable and then encrypt or decrypt it. But when the file is 12M size it failed. So I need to know a way to be able to encrypt large file. regards david Le Thu, 14 Jul 2005 13:33:25 +0200, Jay Blanchard [EMAIL PROTECTED] a écrit: [snip] well I have a big file (around 12M), and I have to encrypt this file, and to decrypt some time after. How could I do? Is it possible to encrypt and decrypt a file line by line ? [/snip] Start with the manual at http://us2.php.net/manual/en/ref.mcrypt.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Big file encryption
david forums wrote: Hihihihi Of course I already has the whole object to encrypt and decrypt, my problem is link to the size of the file. There is no mcrypt function to load directly a file, so it's need to preload it in a variable and then encrypt or decrypt it. But when the file is 12M size it failed. So I need to know a way to be able to encrypt large file. regards david Le Thu, 14 Jul 2005 13:33:25 +0200, Jay Blanchard [EMAIL PROTECTED] a écrit: [snip] well I have a big file (around 12M), and I have to encrypt this file, and to decrypt some time after. How could I do? Is it possible to encrypt and decrypt a file line by line ? [/snip] Start with the manual at http://us2.php.net/manual/en/ref.mcrypt.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php You could try upping the max memory limit in your php.ini file, or with ini_set() if you only want to allow this for your one script... hth, Mikey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Big file encryption
[snip] There is no mcrypt function to load directly a file, so it's need to preload it in a variable and then encrypt or decrypt it. But when the file is 12M size it failed. [/snip] What do you mean it failed? What kind of error did you get? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Big file encryption
hi david, On 7/14/05, david forums [EMAIL PROTECTED] wrote: So I need to know a way to be able to encrypt large file. function readfile_chunked ($filename) { $chunksize = 1*(1024*1024); // it reads 1 mb per chunck. adjust this if u need. $buffer = ''; $handle = fopen($filename, 'rb'); if ($handle === false) { return false; } while (!feof($handle)) { $buffer = fread( $handle, $chunksize ); // do whatever with the chuck you read. // you can encrypt it and write all the chunks to the same file // (open a file for writing before the loop) } return fclose( $handle ); } -ahmed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to run .sql files using php
phpmyadmin On 7/13/05, glumtail [EMAIL PROTECTED] wrote: I think it's better to split the SQL into pieces line 1: create table line 2: insert into . $sql = 'create table' $sql = 'insert into ...' 2005/7/13, Shaw, Chris - Accenture [EMAIL PROTECTED]: Can you use mysqli_multi_query for mysql in php5? hth -Original Message- From: babu [mailto:[EMAIL PROTECTED] Sent: 13 July 2005 16:39 To: php-general@lists.php.net Subject: [PHP] How to run .sql files using php Hi , i have a set of queries which i have placed them in one .sql file.i want to run this file using php's mssql and oracle(oci) functions. any idea pls. thanks. babu - How much free photo storage do you get? Store your holiday snaps for FREE with Yahoo! Photos. Get Yahoo! Photos This message has been delivered to the Internet by the Revenue Internet e-mail service * -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to read PHP variables.
Thsi is way, way WAY too vague. What exactly do you need a patern for? If you simply want to change it, then just do a $var['whatever'] = value; again in the module you want to change it in. If you want to redo the config file, then you can just loop through the array, printing out, each value of the array as you go. Otherwise you could just use var_export(). On 7/12/05, Bruno B B Magalhães [EMAIL PROTECTED] wrote: Hi you all! That's my problem: I have a configuration files with the following structure... $vars['varname'] = 'varvalue'; And I would like to have a module to change those parameters, but I don't know how to write a pattern to match it... Thanks in advance... Best Regards, Bruno B B Magalhaes -- 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] searching multiple fields
Sounds like you want to use full text indexing. Create one full text index spanning name, area, organisation. Then search on all three fields at once. SELECT * FROM sheet1 MATCH(name,area,organisation) AGAINST ('textstring* otherstring* etc*). The * means use LIKE searching. There are a bunch of other options you can use and also limitations. Read the manual for all the details. On Jul 14, 2005, at 4:37 AM, Ross wrote: Is there a way to use like to search various fields at one time. For example I want the search field to search by name or area or organisation. If the (minimum)three letter string matches any of these I want the record to show. $search_field is my textbox $query = SELECT * FROM sheet1 WHERE 'name' LIKE '$search_field%'; but really I want it to do the folowing. $query = SELECT * FROM sheet1 WHERE 'name' or 'area or 'organisation LIKE '$search_field%'; Cheers, R. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to run .sql files using php
hi babu On 7/13/05, babu [EMAIL PROTECTED] wrote: i have a set of queries which i have placed them in one .sql file.i want to run this file using php's mssql and oracle(oci) functions. you need a database abstraction layer to help you with that (adodb for example) function fireSQL( $driver ) { // establish the connection to the database using the specified driver // read SQL from the file (probably tokenizing it into sql statements) // feed the sql into the connection } -ahmed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to run .sql files using php
or execute a shell command $ret = `mysql -u[user] -p[password] -h[host] [db_name] file.sql`; glumtail wrote: I think it's better to split the SQL into pieces line 1: create table line 2: insert into . $sql = 'create table' $sql = 'insert into ...' 2005/7/13, Shaw, Chris - Accenture [EMAIL PROTECTED]: Can you use mysqli_multi_query for mysql in php5? hth -Original Message- From: babu [mailto:[EMAIL PROTECTED] Sent: 13 July 2005 16:39 To: php-general@lists.php.net Subject: [PHP] How to run .sql files using php Hi , i have a set of queries which i have placed them in one .sql file.i want to run this file using php's mssql and oracle(oci) functions. any idea pls. thanks. babu - How much free photo storage do you get? Store your holiday snaps for FREE with Yahoo! Photos. Get Yahoo! Photos This message has been delivered to the Internet by the Revenue Internet e-mail service * -- 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] 404 error - DLL files needed ??
In the extension manager for the site/directory where this is not working, make sure the check box Verify file exists is not checked. I think I ran into a similar problem with a different extension and had the same issue. kgt Grosz, Steve (IPG IT) wrote: Tjoekbezoer, I can tell you that it is there, because I manually added it, and it is set to 'allowed'. Steve -Original Message- From: Tjoekbezoer van Damme [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 13, 2005 3:52 PM To: php-general@lists.php.net Subject: Re: [PHP] 404 error - DLL files needed ?? On 7/13/05, Grosz, Steve (IPG IT) [EMAIL PROTECTED] wrote: I tried that, renamed a txt file to .php, but when I try to get the .php file, I just get a 404 error. Grosz, this might very well be your webserver invoking. By default, IIS 6.0 all webserver extensions (like PHP). To check if your server still does, open up your IIS manager (Start-Run-'c:\windows\system32\inetsrv\iis.msc') Then browse to Web Service Extensions on the left. If you did install PHP correctly you should see PHP appearing in the list on the right. Set it to 'Allowed'. Now try requesting the page via your browser again. Good luck! Tjoekbezoer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $PHP_SELF or echo $PHP_SELF
* Richard Davey [EMAIL PROTECTED]: Hello Ross, Thursday, July 14, 2005, 11:11:25 AM, you wrote: R Just a quick thing that is bugging me. In some of my older R textbooks a form is returned to the same page by using R echo $PHP_SELF no just $PHP_SELF R is this just used in older versions of php?? Does the it make a R difference what one is used? PHP_SELF is part of the $_SERVER super global, you should really access it like this: $_SERVER['PHP_SELF'] To answer your question though, it's just a variable - if you want to output it into your form action then you can do either: ? echo $_SERVER['PHP_SELF'] ? or ?=$_SERVER['PHP_SELF']? Either would work. Actually, to be truly portable, it should be: ?php echo $_SERVER['PHP_SELF']; ? Not all hosts have short tags enabled in their PHP installations. Additionally, you have to be careful with PHP_SELF. On web servers that allow PATH_INFO -- i.e., arguments to the script in the form of path information, like '/path/to/script.php/more/path/info -- PHP_SELF will contain the path to the script PLUS the contents of $_SERVER['PATH_INFO'] -- which leaves PHP_SELF vulnerable to cross-site scripting attacks. For some discussion on this, see: http://blog.phpdoc.info/archives/13-XSS-Woes.html If you're using Apache, the safer bet is to use $_SERVER['SCRIPT_NAME']; otherwise, use PHP_SELF, but filter it to exclude the path information. -- Matthew Weier O'Phinney Zend Certified Engineer http://weierophinney.net/matthew/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] gettext best practice
How do you people best deal with text meant for i18n via gettext, which is either large or contains HTML tags, or both? The GNU gettext manual, in section 3.2, recommends to split long texts at paragraph level, or in the case of long --help screens, in batches of 5-10 lines at most. I can dig this, but I'd still appreciate some feedback. Formatting, however, is a slightly different issue. The manual seems to have been written mainly for C users, and as such only deals with spaces, tabs and newlines. Of course, structural HTML is a big no-no IMO (ie. the likes of p, li or tables). But styling HTML is often needed (strong, em ...). Am I right in assuming that a small set of pure style-related HTML should be allowed? I'm thinking strong, em, del and ins. The alternative of replacing them with %s instead and inserting them in the code on the fly looks like an attrocity to me. And allowing any tags still doesn't make me 100% happy; consider borderline complications due to HTML vs XHTML, or the very principle of separating content from presentation, which seems to be breached. And how should br be dealt with? Allow it, or go with newlines instead, and decide in the code if I want to apply a nl2br() or not? -- Romanian Web Developers - http://ROWD.ORG -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: gettext best practice
Skippy [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] How do you people best deal with text meant for i18n via gettext, which is either large or contains HTML tags, or both? The GNU gettext manual, in section 3.2, recommends to split long texts at paragraph level, or in the case of long --help screens, in batches of 5-10 lines at most. I can dig this, but I'd still appreciate some feedback. Formatting, however, is a slightly different issue. The manual seems to have been written mainly for C users, and as such only deals with spaces, tabs and newlines. Of course, structural HTML is a big no-no IMO (ie. the likes of p, li or tables). But styling HTML is often needed (strong, em ...). Am I right in assuming that a small set of pure style-related HTML should be allowed? I'm thinking strong, em, del and ins. The alternative of replacing them with %s instead and inserting them in the code on the fly looks like an attrocity to me. Consider whether you will always display the information in a web browser. If there is any possibility that another program may be used for display, you don't want the HTML tags in the database. And allowing any tags still doesn't make me 100% happy; consider borderline complications due to HTML vs XHTML, or the very principle of separating content from presentation, which seems to be breached. And how should br be dealt with? Allow it, or go with newlines instead, and decide in the code if I want to apply a nl2br() or not? -- Romanian Web Developers - http://ROWD.ORG -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: gettext best practice
Quoting Mark Rees [EMAIL PROTECTED]: Consider whether you will always display the information in a web browser. If there is any possibility that another program may be used for display, you don't want the HTML tags in the database. In this particular situation I'm dealing with I only have web browsers to worry about. However, for the sake of argument: couldn't I still allow those styling tags and do some post-processing in the code? Such as stripping the tags, or converting them to something else. Things like bold and italic are almost universally meaningful. -- Romanian Web Developers - http://ROWD.ORG -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Big file encryption
Quoting Ahmed Saad [EMAIL PROTECTED]: // do whatever with the chuck you read. // you can encrypt it and write all the chunks to the same file But if you encrypt one chunk at a time and concatenate them later, or if you encrypt the whole thing, will you still get the same result? -- Romanian Web Developers - http://ROWD.ORG -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Big file encryption
hi Skippy On 7/14/05, Skippy [EMAIL PROTECTED] wrote: Quoting Ahmed Saad [EMAIL PROTECTED]: // do whatever with the chuck you read. // you can encrypt it and write all the chunks to the same file But if you encrypt one chunk at a time and concatenate them later, or if you encrypt the whole thing, will you still get the same result? i think the point is encrypting/decrypting the file contents not *how* to encrypt/decrypt it but I'll do some experiments :) -ahmed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Big file encryption
Ok tx And you mean that I can concatenate every chunck in the same file ? And what about decryption, could I take the same way ? david Le Thu, 14 Jul 2005 14:25:48 +0200, Ahmed Saad [EMAIL PROTECTED] a écrit: hi david, On 7/14/05, david forums [EMAIL PROTECTED] wrote: So I need to know a way to be able to encrypt large file. function readfile_chunked ($filename) { $chunksize = 1*(1024*1024); // it reads 1 mb per chunck. adjust this if u need. $buffer = ''; $handle = fopen($filename, 'rb'); if ($handle === false) { return false; } while (!feof($handle)) { $buffer = fread( $handle, $chunksize ); // do whatever with the chuck you read. // you can encrypt it and write all the chunks to the same file // (open a file for writing before the loop) } return fclose( $handle ); } -ahmed -- 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] Big file encryption
Not at all cause the chunk are beeing free every time it is write in the file. so it does not excide the amount you set. regards Le Thu, 14 Jul 2005 16:10:17 +0200, Skippy [EMAIL PROTECTED] a écrit: Quoting Ahmed Saad [EMAIL PROTECTED]: // do whatever with the chuck you read. // you can encrypt it and write all the chunks to the same file But if you encrypt one chunk at a time and concatenate them later, or if you encrypt the whole thing, will you still get the same result? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Overriding __soapCall
I'm working on a soap client in PHP5, which I'm building by subclassing the built-in SoapClient class. However, it seems my overridden __soapCall method is never being called. My class looks something like this: class myClient extends SoapClient { public function __construct($wsdl = 'http://www.example.com/ my.wsdl', $options = NULL) { if (!is_array($options)) $options = array('soap_version' = SOAP_1_1, 'trace' = true, 'exceptions' = true); parent::__construct($wsdl, $options); } public function __soapCall($function_name, $arguments = array(), $options = array(), $input_headers = NULL, $output_headers = array()) { echo doing __soapCall\n; return parent::__soapCall($function_name, $arguments, $options, $input_headers, $output_headers); } } The constructor works fine. As you can see __soapCall does nothing but pass through the call to the parent, but it's just not being called. I've found various references to overriding the __call function (which is now completely obsolete as it clashes with a magic method) for the same kind of reason that I need to. So, it seems as if __soapCall is NOT called internally when calling a WSDL function, so if my client has a login function: $sc = new myClient(); $sc-login(array('username' = 'abc', 'password' = 'xyz')); but this does not seem to go via the internal __soapCall function, thus denying me the ability to tweak the request on its way through. If I call it manually (i.e. non-WSDL way), something like: $sc-__soapCall('login', array('username' = 'abc', 'password' = 'xyz')); then it works, but in that simple gesture I've lost most of the WSDL advantage. What am I supposed to do? Marcus -- Marcus Bointon Synchromedia Limited: Putting you in the picture [EMAIL PROTECTED] | http://www.synchromedia.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] cannot connect to MySQL server and not sure why
I am having trouble connecting to MySQL server through a PHP script and I am not sure why. the error I receive is: Warning: mysql_pconnect(): Access denied for user: '[EMAIL PROTECTED]' (Using password: YES) in /hsphere/local/home/bruceg/inspired-evolution.com/search/include/connect.php on line 6 Cannot connect to database, check if username, password and host are correct. trying to connect with the following script: ?php $database=bruceg_search; $mysql_user = bruceg_webmaster; $mysql_password = password; $mysql_host = server-10.existhost.com; mysql_pconnect ($mysql_host, $mysql_user, $mysql_password); if (!$success) die (bCannot connect to database, check if username, password and host are correct./b); $success = mysql_select_db ($database); if (!$success) { print bCannot choose database, check if database name is correct.; die(); } ? I double checked the database and I have created a database called bruceg_search and added a user called bruceg_webmaster with all of the editing privileges. Of course 'password' is changes with the password used to connect in the actual script. and I double checked that to be correct as well. Any suggestions? -- ::Bruce:: -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] cannot connect to MySQL server and not sure why
Bruce Gilbert wrote: I am having trouble connecting to MySQL server through a PHP script and I am not sure why. the error I receive is: Warning: mysql_pconnect(): Access denied for user: '[EMAIL PROTECTED]' (Using password: YES) in /hsphere/local/home/bruceg/inspired-evolution.com/search/include/connect.php on line 6 Cannot connect to database, check if username, password and host are correct. trying to connect with the following script: ?php $database=bruceg_search; $mysql_user = bruceg_webmaster; $mysql_password = password; $mysql_host = server-10.existhost.com; mysql_pconnect ($mysql_host, $mysql_user, $mysql_password); if (!$success) die (bCannot connect to database, check if username, password and host are correct./b); $success = mysql_select_db ($database); if (!$success) { print bCannot choose database, check if database name is correct.; die(); } ? I double checked the database and I have created a database called bruceg_search and added a user called bruceg_webmaster with all of the editing privileges. Of course 'password' is changes with the password used to connect in the actual script. and I double checked that to be correct as well. Any suggestions? Did you restart MySQL after you added the permissions? -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] cannot connect to MySQL server and not sure why
Where do you populate $success ? It looks too me that $success would always be empty no matter whether you connected or not. On 7/14/05 8:27 AM, Bruce Gilbert [EMAIL PROTECTED] wrote: mysql_pconnect ($mysql_host, $mysql_user, $mysql_password); if (!$success) -- Stephen Johnson The Lone Coder [EMAIL PROTECTED] http://www.thelonecoder.com *Continuing the struggle against bad code* -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] cannot connect to MySQL server and not sure why
Bruce, looks like mysql_pconnect ($mysql_host, $mysql_user, $mysql_password); wants to read $success = mysql_pconnect ($mysql_host, $mysql_user, $mysql_password); Raz -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] cannot connect to MySQL server and not sure why
Hello Bruce, Thursday, July 14, 2005, 4:27:12 PM, you wrote: BG ?php BG $database=bruceg_search; BG $mysql_user = bruceg_webmaster; BG $mysql_password = password; BG $mysql_host = server-10.existhost.com; BG mysql_pconnect ($mysql_host, $mysql_user, $mysql_password); BG if (!$success) BG die (bCannot connect to database, check if username, password and BG host are correct./b); BG $success = mysql_select_db ($database); BG if (!$success) { BG print bCannot choose database, check if database name is correct.; BG die(); BG } ? BG I double checked the database and I have created a database called BG bruceg_search and added a user called bruceg_webmaster with all of BG the editing privileges. Of course 'password' is changes with the BG password used to connect in the actual script. and I double BG checked that to be correct as well. Any suggestions? Sure.. where is $success set? I don't see it being set anywhere :) Best regards, Richard Davey -- http://www.launchcode.co.uk - PHP Development Services I do not fear computers. I fear the lack of them. - Isaac Asimov -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] 404 error - DLL files needed ??
I pretty sure that it isn't checked, but I'll double check againanything else? I can't imagine that it should be this difficult to get PHP running. Steve -Original Message- From: Kristen G. Thorson [mailto:[EMAIL PROTECTED] Sent: Thursday, July 14, 2005 7:09 AM Cc: php-general@lists.php.net Subject: Re: [PHP] 404 error - DLL files needed ?? In the extension manager for the site/directory where this is not working, make sure the check box Verify file exists is not checked. I think I ran into a similar problem with a different extension and had the same issue. kgt Grosz, Steve (IPG IT) wrote: Tjoekbezoer, I can tell you that it is there, because I manually added it, and it is set to 'allowed'. Steve -Original Message- From: Tjoekbezoer van Damme [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 13, 2005 3:52 PM To: php-general@lists.php.net Subject: Re: [PHP] 404 error - DLL files needed ?? On 7/13/05, Grosz, Steve (IPG IT) [EMAIL PROTECTED] wrote: I tried that, renamed a txt file to .php, but when I try to get the .php file, I just get a 404 error. Grosz, this might very well be your webserver invoking. By default, IIS 6.0 all webserver extensions (like PHP). To check if your server still does, open up your IIS manager (Start-Run-'c:\windows\system32\inetsrv\iis.msc') Then browse to Web Service Extensions on the left. If you did install PHP correctly you should see PHP appearing in the list on the right. Set it to 'Allowed'. Now try requesting the page via your browser again. Good luck! Tjoekbezoer -- 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 connect to MySQL server and not sure why
MySQL authentication is user+host+password. Make sure user brucer_webmaster has host 69.90.88.155. kgt Bruce Gilbert wrote: I am having trouble connecting to MySQL server through a PHP script and I am not sure why. the error I receive is: Warning: mysql_pconnect(): Access denied for user: '[EMAIL PROTECTED]' (Using password: YES) in /hsphere/local/home/bruceg/inspired-evolution.com/search/include/connect.php on line 6 Cannot connect to database, check if username, password and host are correct. trying to connect with the following script: ?php $database=bruceg_search; $mysql_user = bruceg_webmaster; $mysql_password = password; $mysql_host = server-10.existhost.com; mysql_pconnect ($mysql_host, $mysql_user, $mysql_password); if (!$success) die (bCannot connect to database, check if username, password and host are correct./b); $success = mysql_select_db ($database); if (!$success) { print bCannot choose database, check if database name is correct.; die(); } ? I double checked the database and I have created a database called bruceg_search and added a user called bruceg_webmaster with all of the editing privileges. Of course 'password' is changes with the password used to connect in the actual script. and I double checked that to be correct as well. Any suggestions? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Overriding __soapCall
On 14 Jul 2005, at 16:07, Marcus Bointon wrote: I've found various references to overriding the __call function (which is now completely obsolete as it clashes with a magic method) for the same kind of reason that I need to. So, it seems as if __soapCall is NOT called internally when calling a WSDL function Answering my own question - __soapCall is not called internally, but you can force it by using __call (that is the magic method, not the obsolete __call function in SoapClient) by adding this function to the class: function __call($function, $args) { return $this-__soapCall($function, $args, null); } This means that I can finally get to pass stuff though my own __soapCall method, though I have the feeling that it may prevent me doing other stuff later on (I'm not normally relying on __call functionality). Phew. Marcus -- Marcus Bointon Synchromedia Limited: Putting you in the picture [EMAIL PROTECTED] | http://www.synchromedia.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Dynamic Images and File Permissions
I have a script that generates, creates, and updates dynamic banner images for users of a service. Recently I have run into a problem with file permissions... that has thoroughly annoyed me. I found a solution to fix the problem, however, it was then hit with another problem, and I'm not sure how secure I find my solution to be. During the image creation process, the files are given the normal image permission of 644 (rw-r--r--). Of course, this makes updating impossible. I attempted to use a simple chmod();, however, the script didnt have the permissions to do this. I couldnt figure out a way to fix this, so I moved on to looking for other solutions. I ended up with somethign that worked, slightly, but did not provide me with an actual fix due to another problem. I would connect to the folder via local FTP, then using ftp_site run a direct CHMOD on the files. However, in doing this, I feel that the script itself is insecure. Also, it didnt work in the end. After running the update script, to test out my new solution, I was confronted with a new problem that I didnt understand. The FTP command returned Bad File Descriptor after executing the CHMOD. After attempting in a few other of my own FTP clients, I ran into -exactly- the same problem. My questions are this: A) Is there any way to set the permissions on the file on creation of the image? B) If no, is there a way I can do the CHMOD, even though chmod(); returned insufficient permissions to do so? C) If no, is there a way I can fix the bad file descriptor, to fix the ftp solution I have? Any other solutions would be able as well, given that they're somewhat secure. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Win2000 easier than Win2003 ??
Is setting up PHP easier on Windows 2000 server rather than Win2003? I'm having nothing but problems getting PHP files to show up in IE on the Win2003 server, I get nothing but 404 - file not found errors.
[PHP] Re: Win2000 easier than Win2003 ??
Grosz, Steve (IPG IT) [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] .. Is setting up PHP easier on Windows 2000 server rather than Win2003? I'm having nothing but problems getting PHP files to show up in IE on the Win2003 server, I get nothing but 404 - file not found errors. Can you install Apache? It's straightforward to set up. I've done it on three different win2k boxes without any problems. Top tip is to stop IIS before attempting to install Apache -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Win2000 easier than Win2003 ??
[snip] Is setting up PHP easier on Windows 2000 server rather than Win2003? I'm having nothing but problems getting PHP files to show up in IE on the Win2003 server, I get nothing but 404 - file not found errors. [/snip] http://www.webhostgear.com/203.html step by step for 2003 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Win2000 easier than Win2003 ??
Hello Steve, Thursday, July 14, 2005, 5:15:01 PM, you wrote: GSII Is setting up PHP easier on Windows 2000 server rather than GSII Win2003? I'm having nothing but problems getting PHP files to GSII show up in IE on the Win2003 server, I get nothing but 404 - GSII file not found errors. Just don't use IIS - use Apache instead. It's an extremely easy install process, one I documented fully on this mailing list no more than a few weeks ago. Best regards, Richard Davey -- http://www.launchcode.co.uk - PHP Development Services I do not fear computers. I fear the lack of them. - Isaac Asimov -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Dynamic Images and File Permissions
Adam Hubscher wrote: I have a script that generates, creates, and updates dynamic banner images for users of a service. Recently I have run into a problem with file permissions... that has thoroughly annoyed me. I found a solution to fix the problem, however, it was then hit with another problem, and I'm not sure how secure I find my solution to be. During the image creation process, the files are given the normal image permission of 644 (rw-r--r--). Of course, this makes updating impossible. How are those permissions getting set? What program is creating the image files? I would think that if PHP is generating the images, then PHP would be the owner? So PHP should be able to overwrite/delete those files. I attempted to use a simple chmod();, however, the script didnt have the permissions to do this. I couldnt figure out a way to fix this, so I moved on to looking for other solutions. I ended up with somethign that worked, slightly, but did not provide me with an actual fix due to another problem. I would connect to the folder via local FTP, then using ftp_site run a direct CHMOD on the files. However, in doing this, I feel that the script itself is insecure. Also, it didnt work in the end. After running the update script, to test out my new solution, I was confronted with a new problem that I didnt understand. The FTP command returned Bad File Descriptor after executing the CHMOD. After attempting in a few other of my own FTP clients, I ran into -exactly- the same problem. Is this a windows server? All of the ftp clients I've used that have a CHMOD feature only work on *nix servers. As far as I know windows doesn't have a CHMOD. My questions are this: A) Is there any way to set the permissions on the file on creation of the image? If PHP is doing the image creation you can use the chmod() function to change the permissions. I think it will even try to do a resonable attempt on windows machines too. I'm doing this on the images that I create on a *nix server. B) If no, is there a way I can do the CHMOD, even though chmod(); returned insufficient permissions to do so? C) If no, is there a way I can fix the bad file descriptor, to fix the ftp solution I have? Any other solutions would be able as well, given that they're somewhat secure. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: cannot connect to MySQL server and not sure why
Bruce, Do you mean to have a space before the word password? Aaron Aaron Greenspan President CEO Think Computer Corporation http://www.thinkcomputer.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php5 built-in soap - apache performance wsdl generation
Hello, I'm successfully playing with php 5 and Its built-in soap but I still have a couple of questions. The most important one is regarding the performance. It is something I also found using php 4 and nusoap. Most of the time for a call is being spend on loading the code. Aprox 0.25 sec per code line. This could be a problem if you have a lot of code for your server. Why Apache is loading all the code for each call? Is It possible to configure Apache to load the Soap Server just once? Second one is regarding wsdl generation. I unsuccessfully tried to find a tool to do it. I gave a try to Webservice Helper (jool.nl) and I didn't find the result convenient for my purpose. Is there any simple and useful tool to automatic generate the wsdl? I finally did it manually from scratch. Thank you very much in advance. Kind regards, Victor.
Re: [PHP] searching multiple fields
Brent Baisley wrote: Sounds like you want to use full text indexing. Create one full text index spanning name, area, organisation. Then search on all three fields at once. SELECT * FROM sheet1 MATCH(name,area,organisation) AGAINST ('textstring* otherstring* etc*). The * means use LIKE searching. There are a bunch of other options you can use and also limitations. Read the manual for all the details. On Jul 14, 2005, at 4:37 AM, Ross wrote: Just to remember! this method works just with MyISAM table types. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Tired and feeling dumb...maths question....
Hey, At this stage am pretty much brain dead and getting a simple percentage is too much for me now. Basically, I have these two fields: $pic_no_of_votes $vote_total_pts and this totals them up and keeps the average: $average_pts people vote on a scale of 1-5, so the average should be between 1-5 (right?? am not even sure of this!) I was thinking of rounding it with a 2 decimal point...eg: round(5.045, 2) Just need to solve this and them am hitting the sack, any help appreciated. Thanks, Ryan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Tired and feeling dumb...maths question....
The result should be between 1 - 5. Can you clarify the following: Basically, I have these two fields: $pic_no_of_votes $vote_total_pts What do they hold? Sums or individual votes? and this totals them up and keeps the average: $average_pts people vote on a scale of 1-5, so the average should be between 1-5 (right?? am not even sure of this!) Be clear, help us help you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Tired and feeling dumb...maths question....
Ryan A mailto:[EMAIL PROTECTED] on Thursday, July 14, 2005 12:17 PM said: Hey, Hey. people vote on a scale of 1-5, so the average should be between 1-5 (right?? am not even sure of this!) Yes. I was thinking of rounding it with a 2 decimal point...eg: round(5.045, 2) Just need to solve this and them am hitting the sack, any help appreciated. Solve what? I must have missed the problem. Chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] captcha on bugs.php.net/report.php doesn't work
hy! i have a simple problem when i try to report a bug. the captcha doesn't work. the script doesn't send any output at all. so i think my bug-report must wait ... is anybody else expieriencing this problem? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Tired and feeling dumb...maths question....
people vote on a scale of 1-5, so the average should be between 1-5 (right?? am not even sure of this!) Yes. I was thinking of rounding it with a 2 decimal point...eg: round(5.045, 2) Just need to solve this and them am hitting the sack, any help appreciated. Solve what? I must have missed the problem. Oops, sorry guys...girlfriends on holiday so have not had my medicine :-) and am also braindead right now... basically...how do I get the average? $pic_no_of_votes --- holds the total number of votes (eg: 212) $vote_total_pts holds the total points from all those votes (eg: 1027) how do i get the average down to something like: 3.23 or 1.02 or 4.11 etc Thanks, Ryan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Tired and feeling dumb...maths question....
basically...how do I get the average? $pic_no_of_votes --- holds the total number of votes (eg: 212) $vote_total_pts holds the total points from all those votes (eg: 1027) how do i get the average down to something like: 3.23 or 1.02 or 4.11 etc average = 1027 (total pts) / 212 (number of votes) = 4.84 (rounded) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Tired and feeling dumb...maths question....
$average = round(($votes/$pts),2); ;) Ryan A wrote: people vote on a scale of 1-5, so the average should be between 1-5 (right?? am not even sure of this!) Yes. I was thinking of rounding it with a 2 decimal point...eg: round(5.045, 2) Just need to solve this and them am hitting the sack, any help appreciated. Solve what? I must have missed the problem. Oops, sorry guys...girlfriends on holiday so have not had my medicine :-) and am also braindead right now... basically...how do I get the average? $pic_no_of_votes --- holds the total number of votes (eg: 212) $vote_total_pts holds the total points from all those votes (eg: 1027) how do i get the average down to something like: 3.23 or 1.02 or 4.11 etc Thanks, Ryan
[PHP] 404 Not Found - refresh to directory
I have a website that has several hundred agents in a mysql database. The client wants to be able to enter the domain.com/agentname and be redirected to a standard page where we show the agent information. An example would be an agent named John Smith whose agentname would be jsmith. So the user would enter domain.com/jsmith and get the agent's profile. I tried initially to dummy up a 404 page, where if the link was like: domain.com/jsmith that it would parse the agent name and pass it through to domain.com/agent_profile.php?agent=jsmith. It failed to work, ending up with a recursive call to the 404 page and getting hung. Right now, I have directories set up for each agent, with an index.php that does the redirect. It's really getting to be a mess with so many directories. I need to be able to check the mysql database for the agent name, and if found, do a redirect (header(Location: agent_profile.php?agent=agentID) and if not, continue to a standard 404 error page, or a sorry not found page. I think my question is: is there an easy way to use a 404 page written in php to capture the parameters from the missing page request and test against a db, resulting in either a valid page redirect or a not found redirect? Terry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Big file encryption
On Thu, 14 Jul 2005 16:24:25 +0200 david forums [EMAIL PROTECTED] wrote: Not at all cause the chunk are beeing free every time it is write in the file. so it does not excide the amount you set. What I meant was that if the encryption algorithm inserts some magic info at the beginning of every chunk, then simply concatenating several encrypted pieces won't produce a valid piece, the same way concatenating several zip files won't produce a big valid zip file. -- Skippy - Romanian Web Developers - http://ROWD.ORG -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] 404 Not Found - refresh to directory
Terry Romine mailto:[EMAIL PROTECTED] on Thursday, July 14, 2005 1:52 PM said: I have a website that has several hundred agents in a mysql database. The client wants to be able to enter the domain.com/agentname and be redirected to a standard page where we show the agent information. [snip/] I think my question is: is there an easy way to use a 404 page written in php to capture the parameters from the missing page request and test against a db, resulting in either a valid page redirect or a not found redirect? Never tried it, but this is super easy to do with mod_rewrite and .htaccess. ## DEFINE REWRITE RULES RewriteEngine on RewriteRule ^([\w-]+)$ yourpage.php?agent=$1 Should work (maybe). Chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] cannot connect to MySQL server and not sure why
Make sure that your ip is granted too. Best regards, Shiqi Yang -Original Message- From: Bruce Gilbert [mailto:[EMAIL PROTECTED] Sent: Thursday, July 14, 2005 11:27 PM To: php-general@lists.php.net Subject: [PHP] cannot connect to MySQL server and not sure why I am having trouble connecting to MySQL server through a PHP script and I am not sure why. the error I receive is: Warning: mysql_pconnect(): Access denied for user: '[EMAIL PROTECTED]' (Using password: YES) in /hsphere/local/home/bruceg/inspired-evolution.com/search/include/connect.php on line 6 Cannot connect to database, check if username, password and host are correct. trying to connect with the following script: ?php $database=bruceg_search; $mysql_user = bruceg_webmaster; $mysql_password = password; $mysql_host = server-10.existhost.com; mysql_pconnect ($mysql_host, $mysql_user, $mysql_password); if (!$success) die (bCannot connect to database, check if username, password and host are correct./b); $success = mysql_select_db ($database); if (!$success) { print bCannot choose database, check if database name is correct.; die(); } ? I double checked the database and I have created a database called bruceg_search and added a user called bruceg_webmaster with all of the editing privileges. Of course 'password' is changes with the password used to connect in the actual script. and I double checked that to be correct as well. Any suggestions? -- ::Bruce:: -- 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: Echo array string index?
Yeah, you can use foreach. But *may be* you just find sth called array_keys(). Best regards, Shiqi Yang -Original Message- From: Joe Harman [mailto:[EMAIL PROTECTED] Sent: Thursday, July 14, 2005 4:45 PM To: php-general@lists.php.net Subject: Re: [PHP] Re: Echo array string index? Hey Matt, you can print out the contents of your array by using print_r($arr) but more useful is using this foreach ($arr as $key = $value) { echo Key : .$key. Value : .$value; } Adios Joe On 7/13/05, Adam Hubscher [EMAIL PROTECTED] wrote: Matt Darby wrote: I have an array setup as such: *$arr['generated text']='generated number';* What would be the best way to echo the key in a loop? Seems pretty easy but I've never attempted... Thanks all! Matt Darby I'm not sure I understand the question. You could do foreach($arr as $key = $value) { print($key); }. There are also a number of functions that get the current key on the array's pointer: http://us2.php.net/manual/en/function.key.php http://us2.php.net/manual/en/function.array-keys.php But once again, it really comes down to what exactly it is you want to do... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Joe Harman - Do not go where the path may lead, go instead where there is no path and leave a trail. - Ralph Waldo Emerson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Dynamic Images and File Permissions
On Thu, 2005-07-14 at 12:09, Adam Hubscher wrote: My questions are this: A) Is there any way to set the permissions on the file on creation of the image? Set umask 002 on the user php is running as. -- s/:-[(/]/:-)/g BrianGnuPG - KeyID: 0x04A4F0DC | Key Server: pgp.mit.edu == gpg --keyserver pgp.mit.edu --recv-keys 04A4F0DC Key Info: http://gfx-design.com/keys Linux Registered User #339825 at http://counter.li.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] array help
How does one represent a MySQL table as a two dimensional array using the column names as one of the indices? My naive attempt went something like this: while ($row = mysqli_fetch_assoc($result)) $table[] = $row; but that generated this error; Fatal error: [] operator not supported for strings Ok. So then I try to explicitly assign each row, like this: while ($row = mysqli_fetch_assoc($result)) $table[$i++] = $row; While that generates no error, $table contains nothing useful when I'm done. So then I try to assign each row and column, like this: while ($row = mysqli_fetch_assoc($result)) { foreach ( $row as $col = $val) $table[$i][$col] = $val; $i++; } And that got me this error: Fatal error: Cannot use string offset as an array So clearly my understanding of PHP arrays is lacking. Please help. Thanks Fletcher -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] SimpleXML doesn't work with one single XML tag line...
Maybe I'm missing something about XML specifications, but this doesn't seem right to me. http://www.php.net/manual/en/ref.simplexml.php Here is a code fragment I use: $xml = simplexml_load_string($returnData); var_dump($xml); if (is_object($xml)) { //first lets make sure we didn't get an ERROR if ($xml-error) { echo An ERROR was encountered\n; echo CODE: .((string)$xml-error-code).\n; echo STRING: .((string)$xml-error-string).\n; exit; } ... } I have my XML setup such that if there is an error, I return: ?xml version=1.0 encoding=iso-8859-1 ? error code=tbd string=user not found. / But simple XML will not detect this as illustrated by var_dump($xml) object(SimpleXMLElement)#1 (0) { } However, if I change my output to be: ?xml version=1.0 encoding=iso-8859-1 ? error codetbd/code stringuser not found with those credentials./string /error Then I get... object(SimpleXMLElement)#1 (2) { [code]= string(3) tbd [string]= string(38) user not found. } Notice also that my object is not nested inside an [error] as I would expect it to be. So I would expect to get this (in BOTH cases actually): object(SimpleXMLElement)#1 (1) { [error]= object(SimpleXMLElement)#1 (2) { [code]= string(3) tbd [string]= string(38) user not found. } } More useful information: [EMAIL PROTECTED]:/lockdown/includes/api# php -v PHP 5.0.3 (cli) (built: Jul 11 2005 12:33:48) Copyright (c) 1997-2004 The PHP Group Zend Engine v2.0.3, Copyright (c) 1998-2004 Zend Technologies with Zend Extension Manager v1.0.6, Copyright (c) 2003-2004, by Zend Technologies with Zend Optimizer v2.5.7, Copyright (c) 1998-2004, by Zend Technologies -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] array help
Did you bother to initialize $table as an array() or are you another lazy slob of a programmer that expects the engine to read your mind (cluttered as that may be)? Cheers, Rob. On Thu, 2005-07-14 at 18:33, Fletcher Mattox wrote: How does one represent a MySQL table as a two dimensional array using the column names as one of the indices? My naive attempt went something like this: while ($row = mysqli_fetch_assoc($result)) $table[] = $row; but that generated this error; Fatal error: [] operator not supported for strings Ok. So then I try to explicitly assign each row, like this: while ($row = mysqli_fetch_assoc($result)) $table[$i++] = $row; While that generates no error, $table contains nothing useful when I'm done. So then I try to assign each row and column, like this: while ($row = mysqli_fetch_assoc($result)) { foreach ( $row as $col = $val) $table[$i][$col] = $val; $i++; } And that got me this error: Fatal error: Cannot use string offset as an array So clearly my understanding of PHP arrays is lacking. Please help. Thanks Fletcher -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] array help
Hello Fletcher, Thursday, July 14, 2005, 11:33:36 PM, you wrote: FM while ($row = mysqli_fetch_assoc($result)) FM $table[] = $row; FM but that generated this error; FM Fatal error: [] operator not supported for strings The above WILL work providing that (1) $table hasn't been set elsewhere in your script as a string, or (2) $table has been set as an array ($table = array()) prior to being used. Best regards, Richard Davey -- http://www.launchcode.co.uk - PHP Development Services I do not fear computers. I fear the lack of them. - Isaac Asimov -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] SimpleXML returns false positives
Am I just completely missing something with this SimpleXML functions? Something else I noticed that seems broken to me... I can change the if ($xml-error) line to if ($xml-foo) and I still get the text echo'd to the screen. ?!!?! If I change it to if ($xml-error-code) then I don't get the text. Which sort of makes sense, since there is no $xml-error object in the var_dump. if (is_object($xml-error)) also return true and outputs the text. object(SimpleXMLElement)#1 (2) { [code]= string(3) tbd [string]= string(38) user not found. } The way that I've hacked around this for now is if ( (string)$xml-code != '') Ideas on what I'm doing wrong, or is this function just completely bunk. -Original Message- Here is a code fragment I use: $xml = simplexml_load_string($returnData); var_dump($xml); if (is_object($xml)) { //first lets make sure we didn't get an ERROR if ($xml-error) { echo An ERROR was encountered\n; echo CODE: .((string)$xml-error-code).\n; echo STRING: .((string)$xml-error-string).\n; exit; } ... } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] array help
Rob writes: Did you bother to initialize $table as an array() or are you another lazy slob of a programmer that expects the engine to read your mind (cluttered as that may be)? Bingo. You seem to have no trouble reading my mind, why can't php? :) Years of perl programming has promoted a certain sloth in my character. It manifests in many different insidious forms. Ask my wife. Thanks! Fletcher lazy slob Mattox -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PDO Error
Hi. When using this example from http://netevil.org/talks/index.php?t=pdos=20, the site of pdo's author I have this error: Fatal error: Call to a member function fetchAll() on a non-object in /www/home/testes/pdo_my1.php on line 17 $dbh = new PDO('mysql:host=localhost;dbname=dbtest', 'user', 'pass'); $stmt = $dbh-query(SELECT * FROM foo); $rows = $stmt-fetchAll(); $count = count($rows); foreach ($rows as $row) { print_r($row); } $stmt = null; Wht's wrong with the example? Greetings holografix -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] 404 Not Found - refresh to directory
-Original Message- From: Terry Romine [mailto:[EMAIL PROTECTED] Sent: Thursday, July 14, 2005 3:52 PM To: php Subject: [PHP] 404 Not Found - refresh to directory I have a website that has several hundred agents in a mysql database. The client wants to be able to enter the domain.com/agentname and be redirected to a standard page where we show the agent information. An example would be an agent named John Smith whose agentname would be jsmith. So the user would enter domain.com/jsmith and get the agent's profile. I tried initially to dummy up a 404 page, where if the link was like: domain.com/jsmith that it would parse the agent name and pass it through to domain.com/agent_profile.php?agent=jsmith. It failed to work, ending up with a recursive call to the 404 page and getting hung. Right now, I have directories set up for each agent, with an index.php that does the redirect. It's really getting to be a mess with so many directories. I need to be able to check the mysql database for the agent name, and if found, do a redirect (header(Location: agent_profile.php?agent=agentID) and if not, continue to a standard 404 error page, or a sorry not found page. I think my question is: is there an easy way to use a 404 page written in php to capture the parameters from the missing page request and test against a db, resulting in either a valid page redirect or a not found redirect? Terry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php .htaccess: RewriteEngine on RewriteRule ^([\w-]+)$ index.php/$1 index.php: ?php $uriparams = explode(/,$REQUEST_URI); $uriparams = explode(?,$REQUEST_URI); $agent = $uriparams[0]; $agent = eregi_replace(/,,$agent); // Select from mysql where agent = agent etc.. etc.. echo (Location: agent_profile.php?agent=.$agent); ? Best regards, Andras Kende http://www.kende.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php