RE: [PHP] php.ini file
-Original Message- From: Burhan Khalid [mailto:[EMAIL PROTECTED] Sent: Monday, March 21, 2005 8:57 AM Check the output of phpinfo(); to see where it is expecting the file to be. Works only if the installation is completed and PHP is running ;-) Use your system wide /tmp folder. I believe this is the default setting in PHP, so it should Just Work (tm) Hopefully not! Files in /tmp are deleted in most *NIX variants, this is a _bad_ idea and the name of the folder pretty much tell You so... Default path is /usr/local/lib -- Med venlig hilsen / best regards ComX Networks A/S Kim Madsen Systemudvikler/systemdeveloper -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How to show user country (internet connection) on a page
Hi everyone, I would like to show the country of the user provider during the navigation. I haven't problem with provider located in europe, simply this code: $indirizzo_cliente = $_SERVER[REMOTE_ADDR]; $i=0; $fp = file (http://www.ripe.net/whois?form_type=simplefull_query_string=searchtext=$ indirizzo_cliente); while (list ($line_num, $line) = each ($fp)) { if(strstr($line,country)!=){ // or other fields like person, address etc etc $almenouno = true; $lineaok[$i]=$line; $i = $i +1; } } if($almenouno==true){ echo Dati rilevati:BR; } for($i=0;$icount($lineaok);$i++){ echo $lineaok[$i].br; } THE PROBLEM cames when a want to show the country of providers located in NORTH AMERICA, in this case I have to send the query by POST (ARIN DATABASE). So I can't match both the results of the two interrogation and then choose the right one in the same php page. Sebastiano -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] die function
Hi all, I have a machine that must insert in cron in a mysql db in another remote machine. The problem is that I cannot know if the connection in the first machine (adsl) go down because no entry in the machine log is generated. I would like to redirect the die function in a e-mail that say me what happens. I found a script ?php function die_script($errmsg) { print $errmsg . /body/html; die; } ? and I tried to insert a mail() before die function but I cannot call the function in this way: or die(Connection failed: . die_script()); But no email is generated. How can I do? Thanks Barbara -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Damn escaping... Grunf...
Hi, I want this code to display peoples' names within an hyperlink. I'm tired of trying different ways, read all about it in PHP's manual, but i can't get it there. You can visit http://www.dte.ua.pt/cv In the rightmost column it is suposed to apear two name below Links, but... it doen't, becuase i can't straight the escaping :( Any help would be apreciated. The code follows my signature. Warm Regards, Mário Gamito -- // select names to display in the right column $recordSet = $conn-Execute('SELECT name FROM users'); while (!$recordSet-EOF) { print ('a href=\'http://www.dte.ua.pt/cv/email=?' . $recordSet-fields[0] . '\'' . 'br /'); $recordSet-MoveNext(); } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Escaping
Hi, I want this code to display peoples' names within an hyperlink. I'm tired of trying different ways, read all about it in PHP's manual, but i can't get it there. You can visit http://www.dte.ua.pt/cv In the rightmost column it is suposed to apear two name below Links, but... it doen't, becuase i can't straight the escaping :( Any help would be apreciated. The code follows my signature. Warm Regards, Mário Gamito -- // select names to display in the right column $recordSet = $conn-Execute('SELECT name FROM users'); while (!$recordSet-EOF) { print ('a href=\'http://www.dte.ua.pt/cv/email=?' . $recordSet-fields[0] . '\'' . 'br /'); $recordSet-MoveNext(); } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] test
Is the list active? My last received message is: [PHP] die function -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] test
[snip] Is the list active? My last received message is: [PHP] die function [/snip] yes -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] XML HTTP
I need to use SOAP and I use PHP 5. Do I need to compile PHP with some option? Thanks On Fri, 18 Mar 2005 16:03:20 -0500, Jason Barnett [EMAIL PROTECTED] wrote: Chris Shiflett wrote: Jerry Swanson wrote: I generated XML file. I need to send the file to another server not through FTP but though HTTP. Yes, I gathered that, but you're not telling us how you're supposed to send it. For example, when Google first provided their web API, they didn't say, just send us an XML document. :-) There are many details you're not giving us (you can leave out the details involving the XML document itself, of course), so it's pretty much impossible to even guess an answer to your question. Chris Seriously... Chris is truly trying to help you. There are many, many ways to send an XML file. The following are HTTP methods off of the top of my head: SOAP (possibly with WSDL) Simple HTTP POST (usually through a form) Simple HTTP GET (possibly through a form, though passing XML documents through URL parameters is probably not A Good Thing.) It really depends on what the *receiving server* expects. Is there a documented API? Or perhaps can you just point us to the page (URL) that is supposed to receive the XML document? -- Teach a man to fish... NEW? | http://www.catb.org/~esr/faqs/smart-questions.html STFA | http://marc.theaimsgroup.com/?l=php-generalw=2 STFM | http://php.net/manual/en/index.php STFW | http://www.google.com/search?q=php LAZY | http://mycroft.mozdev.org/download.html?name=PHPsubmitform=Find+search+plugins -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] XML HTTP
[snip] I need to use SOAP and I use PHP 5. Do I need to compile PHP with some option? [/snip] Probably. Have you RTFM on the subject? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php.ini file
Kim Madsen wrote: -Original Message- From: Burhan Khalid [mailto:[EMAIL PROTECTED] Sent: Monday, March 21, 2005 8:57 AM Check the output of phpinfo(); to see where it is expecting the file to be. Works only if the installation is completed and PHP is running ;-) Use your system wide /tmp folder. I believe this is the default setting in PHP, so it should Just Work (tm) Hopefully not! Files in /tmp are deleted in most *NIX variants, this is a _bad_ idea and the name of the folder pretty much tell You so... Default path is /usr/local/lib No, I don't think this is correct. The default path for temporary files is /tmp -- I just tested it on a clean install of PHP. The whole point of temporary upload files is that they are deleted by the system, so you don't have stale files lying around. Which is why there is the move_uploaded_file function. This, of course, is assuming I didn't mis-interpret the question. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Renaming Directories
I've made a small PHP script that renames the files and folders in my music library, to make them more linux-friendly. I'm running PHP 5.0.3 on version 2.6.9 kernel. What's happening is that all files and folders are renamed, except for folders whose names consist of one word only (such as Toto), which is still with a capital T. Here is the script and the result I'm getting: ?php error_reporting(E_ALL | E_STRICT); header('Content-Type: text/plain'); function clean_filename ($str) { $str = strtolower($str); $str = str_replace(' - ', '-', $str); $str = str_replace(' ', '_', $str); $str = str_replace('\'', '', $str); return $str; } function parse_dir ($dir_name) { $dir = opendir($dir_name); while (false !== ($file = readdir($dir))) { if ($file != '.' $file != '..') { $path_old = $dir_name . $file; $path_new = $dir_name . clean_filename($file); echo renaming $path_old to $path_new... ; echo rename($path_old, $path_new) ? done\n : failed\n; if (is_dir($file)) parse_dir($path_old); } } closedir($dir); } parse_dir('/shared/music/'); ? renaming /shared/music/dire_straits to /shared/music/dire_straits... done renaming /shared/music/johnny_winter to /shared/music/johnny_winter... done renaming /shared/music/pink_floyd to /shared/music/pink_floyd... done renaming /shared/music/ten_years_after to /shared/music/ten_years_after... done renaming /shared/music/the_doors to /shared/music/the_doors... done renaming /shared/music/Santana to /shared/music/santana... done renaming /shared/music/the_jimi_hendrix_experience to /shared/music/the_jimi_hendrix_experience... done renaming /shared/music/the_velvet_underground to /shared/music/the_velvet_underground... done renaming /shared/music/tim_christensen to /shared/music/tim_christensen... done renaming /shared/music/dizzy_mizz_lizzy to /shared/music/dizzy_mizz_lizzy... done renaming /shared/music/Toto to /shared/music/toto... done renaming /shared/music/Cream to /shared/music/cream... done renaming /shared/music/Filopahpos to /shared/music/filopahpos... done renaming /shared/music/bob_dylan to /shared/music/bob_dylan... done renaming /shared/music/dinojax to /shared/music/dinojax... done renaming /shared/music/red_hot_chili_peppers to /shared/music/red_hot_chili_peppers... done renaming /shared/music/peter_frampton to /shared/music/peter_frampton... done renaming /shared/music/louis_armstrong-what_a_wonderful_world.mp3 to /shared/music/louis_armstrong-what_a_wonderful_world.mp3... done As you can see, the rename() returns TRUE, but it doesn't rename the folder. I hope you guys can help me out, because otherwise I'll have to do it manually (which I'm too lazy to even consider.) Daniel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Damn escaping... Grunf...
Hi Try using instead of ' Meaning you should write: Print (a href =\http://www.dte.ua.pt/cv/email=?.$recordSet-fields[0]. \ br /); -Original Message- From: Mrio Gamito [mailto:[EMAIL PROTECTED] Sent: Monday, March 21, 2005 12:50 PM To: php-general@lists.php.net Subject: [PHP] Damn escaping... Grunf... Hi, I want this code to display peoples' names within an hyperlink. I'm tired of trying different ways, read all about it in PHP's manual, but i can't get it there. You can visit http://www.dte.ua.pt/cv In the rightmost column it is suposed to apear two name below Links, but... it doen't, becuase i can't straight the escaping :( Any help would be apreciated. The code follows my signature. Warm Regards, Mrio Gamito -- // select names to display in the right column $recordSet = $conn-Execute('SELECT name FROM users'); while (!$recordSet-EOF) { print ('a href=\'http://www.dte.ua.pt/cv/email=?' . $recordSet-fields[0] . '\'' . 'br /'); $recordSet-MoveNext(); } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] multiple words search query advise
You want to use a full text index spanning the two fields. You wouldn't want to do a LIKE search because that wouldn't be able to use indexes, resulting in a full table scan every search. If you are using MySQL, you search read the part of the manual on creating and using full text indexes. It's really easy and exactly what you are looking for. On Mar 21, 2005, at 6:39 AM, Ryan A wrote: Hi, We have an a auction like site, now we have to add a search feature to the site, the searching will be done for 2 fields: subject and description (ad_sub, ad_text). Since i have never done this before, I would appreciate some advise on how to do it. I was thinking of getting the search string, running an explode() on it and then doing a LIKE sql query to get the results on each word...but then that would add up to quite a bit if even 5 words were written (5 queries each for the subject and 5 for the text) Any help in the form of advise, links, code, examples etc would be appreciated. After googleing a bit I have gotten a bit of help from some of the pages but not much, one very helpful bit of advise i got was to ignore works like: the, a, in as they are too common...if you have anymore to add, please feel free to write it. Thanks in advance, Ryan -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.308 / Virus Database: 266.7.4 - Release Date: 3/18/2005 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Brent Baisley Systems Architect Landover Associates, Inc. Search Advisory Services for Advanced Technology Environments p: 212.759.6400/800.759.0577 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Renaming Directories
Daniel Schierbeck wrote: I've made a small PHP script that renames the files and folders in my music library, to make them more linux-friendly. I'm running PHP 5.0.3 on version 2.6.9 kernel. What's happening is that all files and folders are renamed, except for folders whose names consist of one word only (such as Toto), which is still with a capital T. Here is the script and the result I'm getting: ?php error_reporting(E_ALL | E_STRICT); header('Content-Type: text/plain'); function clean_filename ($str) { $str = strtolower($str); $str = str_replace(' - ', '-', $str); $str = str_replace(' ', '_', $str); $str = str_replace('\'', '', $str); return $str; } function parse_dir ($dir_name) { $dir = opendir($dir_name); while (false !== ($file = readdir($dir))) { if ($file != '.' $file != '..') { $path_old = $dir_name . $file; $path_new = $dir_name . clean_filename($file); echo renaming $path_old to $path_new... ; echo rename($path_old, $path_new) ? done\n : failed\n; if (is_dir($file)) parse_dir($path_old); } } closedir($dir); } parse_dir('/shared/music/'); ? renaming /shared/music/dire_straits to /shared/music/dire_straits... done renaming /shared/music/johnny_winter to /shared/music/johnny_winter... done renaming /shared/music/pink_floyd to /shared/music/pink_floyd... done renaming /shared/music/ten_years_after to /shared/music/ten_years_after... done renaming /shared/music/the_doors to /shared/music/the_doors... done renaming /shared/music/Santana to /shared/music/santana... done renaming /shared/music/the_jimi_hendrix_experience to /shared/music/the_jimi_hendrix_experience... done renaming /shared/music/the_velvet_underground to /shared/music/the_velvet_underground... done renaming /shared/music/tim_christensen to /shared/music/tim_christensen... done renaming /shared/music/dizzy_mizz_lizzy to /shared/music/dizzy_mizz_lizzy... done renaming /shared/music/Toto to /shared/music/toto... done renaming /shared/music/Cream to /shared/music/cream... done renaming /shared/music/Filopahpos to /shared/music/filopahpos... done renaming /shared/music/bob_dylan to /shared/music/bob_dylan... done renaming /shared/music/dinojax to /shared/music/dinojax... done renaming /shared/music/red_hot_chili_peppers to /shared/music/red_hot_chili_peppers... done renaming /shared/music/peter_frampton to /shared/music/peter_frampton... done renaming /shared/music/louis_armstrong-what_a_wonderful_world.mp3 to /shared/music/louis_armstrong-what_a_wonderful_world.mp3... done As you can see, the rename() returns TRUE, but it doesn't rename the folder. I hope you guys can help me out, because otherwise I'll have to do it manually (which I'm too lazy to even consider.) Daniel Ooops, that should've been parse_dir($path_new) instead of parse_dir($path_old). -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: die function
Barbara Picci wrote: Hi all, I have a machine that must insert in cron in a mysql db in another remote machine. The problem is that I cannot know if the connection in the first machine (adsl) go down because no entry in the machine log is generated. I would like to redirect the die function in a e-mail that say me what happens. I think the way you want to solve this problem is to create a customized error handler. Check out this link: http://php.net/manual/en/function.set-error-handler.php ?php function email_error_handler($level, $msg, $file, $line) { switch ($level) { /** E_ERROR, E_USER_ERROR, etc. */ mail_to_admin($level: $msg in $file on line $line); } } function mail_to_admin($msg) { /** stuff */ } ? -- Teach a man to fish... NEW? | http://www.catb.org/~esr/faqs/smart-questions.html STFA | http://marc.theaimsgroup.com/?l=php-generalw=2 STFM | http://php.net/manual/en/index.php STFW | http://www.google.com/search?q=php LAZY | http://mycroft.mozdev.org/download.html?name=PHPsubmitform=Find+search+plugins signature.asc Description: OpenPGP digital signature
[PHP] How to show user country by IP (II post)
Hi all, I send this message for the second time becouse I had problems with the mailing list. I would like to show the country of the user provider (only by organizations databases). I haven't problem with provider located in europe, simply this code: $indirizzo_cliente = $_SERVER[REMOTE_ADDR]; $fp = file (http://www.ripe.net/whois?form_type=simplefull_query_string=searchtext=$ indirizzo_cliente); while (list ($line_num, $line) = each ($fp)) { if(strstr($line,country)!=){ // or other fields like person, address etc etc $lineaok[$i]=$line; } } THE PROBLEM cames when a want to show the country of providers located in NORTH AMERICA, in this case I have to send the query by POST METHOD (ARIN DATABASE). So I can't match both the results of the two interrogation in the same php page, get and post method in the same php script. Please don't suggest method based on commercial services, a would like to find a programming based solution. Sebastiano -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Renaming Directories
Hello Daniel! In the code it says: echo rename($path_old, $path_new) ? done\n : failed\n; I assume that this line is supposed to actually rename the directory. Why did you wrote echo before rename? Try to change the code to: if (!rename($path_old,$path_new)) { echo failed\n; } else { echo done\n; } May this helps! /frank 2005-03-21 kl. 15.07 skrev Daniel Schierbeck: Daniel Schierbeck wrote: I've made a small PHP script that renames the files and folders in my music library, to make them more linux-friendly. I'm running PHP 5.0.3 on version 2.6.9 kernel. What's happening is that all files and folders are renamed, except for folders whose names consist of one word only (such as Toto), which is still with a capital T. Here is the script and the result I'm getting: ?php error_reporting(E_ALL | E_STRICT); header('Content-Type: text/plain'); function clean_filename ($str) { $str = strtolower($str); $str = str_replace(' - ', '-', $str); $str = str_replace(' ', '_', $str); $str = str_replace('\'', '', $str); return $str; } function parse_dir ($dir_name) { $dir = opendir($dir_name); while (false !== ($file = readdir($dir))) { if ($file != '.' $file != '..') { $path_old = $dir_name . $file; $path_new = $dir_name . clean_filename($file); echo renaming $path_old to $path_new... ; echo rename($path_old, $path_new) ? done\n : failed\n; if (is_dir($file)) parse_dir($path_old); } } closedir($dir); } parse_dir('/shared/music/'); ? renaming /shared/music/dire_straits to /shared/music/dire_straits... done renaming /shared/music/johnny_winter to /shared/music/johnny_winter... done renaming /shared/music/pink_floyd to /shared/music/pink_floyd... done renaming /shared/music/ten_years_after to /shared/music/ten_years_after... done renaming /shared/music/the_doors to /shared/music/the_doors... done renaming /shared/music/Santana to /shared/music/santana... done renaming /shared/music/the_jimi_hendrix_experience to /shared/music/the_jimi_hendrix_experience... done renaming /shared/music/the_velvet_underground to /shared/music/the_velvet_underground... done renaming /shared/music/tim_christensen to /shared/music/tim_christensen... done renaming /shared/music/dizzy_mizz_lizzy to /shared/music/dizzy_mizz_lizzy... done renaming /shared/music/Toto to /shared/music/toto... done renaming /shared/music/Cream to /shared/music/cream... done renaming /shared/music/Filopahpos to /shared/music/filopahpos... done renaming /shared/music/bob_dylan to /shared/music/bob_dylan... done renaming /shared/music/dinojax to /shared/music/dinojax... done renaming /shared/music/red_hot_chili_peppers to /shared/music/red_hot_chili_peppers... done renaming /shared/music/peter_frampton to /shared/music/peter_frampton... done renaming /shared/music/louis_armstrong-what_a_wonderful_world.mp3 to /shared/music/louis_armstrong-what_a_wonderful_world.mp3... done As you can see, the rename() returns TRUE, but it doesn't rename the folder. I hope you guys can help me out, because otherwise I'll have to do it manually (which I'm too lazy to even consider.) Daniel Ooops, that should've been parse_dir($path_new) instead of parse_dir($path_old). -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: looking for address finder..uk
AndreaD wrote: I'm looking for an address finder where a user types in a postcode and house number and then the user is given an option of to houses to choose from. Anything like this available for a small charge? Ross Try talking to Richard Lynch... he *might* be able to help you out. Or at least he was talking about this same problem on the list a while back. -- Teach a man to fish... NEW? | http://www.catb.org/~esr/faqs/smart-questions.html STFA | http://marc.theaimsgroup.com/?l=php-generalw=2 STFM | http://php.net/manual/en/index.php STFW | http://www.google.com/search?q=php LAZY | http://mycroft.mozdev.org/download.html?name=PHPsubmitform=Find+search+plugins signature.asc Description: OpenPGP digital signature
[PHP] Re: PHP 5 DOM, XPath, UTF-8, and Form Input
C Drozdowski wrote: I have been doing some testing and need confirmation that the following is correct. You have a DOMDocument that potentially contains UTF-8 encoded data (it might not however). You want to search it via DOMXpath-query() using a value that comes from a $_POST value. If the page that posts the data via a form to the search script IS NOT encoded in UTF-8, then the value must be converted to UTF-8 before it is used in the query expression. Else, if the posting page IS UTF-8 encoded, then the $_POST data does not need to be converted before being used in the expression. Is this correct? AFAIK... yes, this is correct. Also, if the $_POST data comes from a UTF-8 encoded page, and it needs to be sanitized before use, will the basic PHP string functions work on the data (e.g. htmlentities, stripslashes, trim, preg_replace, etc)? If not what do I have to do? I believe that PHP uses ISO-8859-1 as the default encoding, but there are ways around it. htmlentities() will let you specify UTF-8 encoding. Remember that your DOMDocument may / may not be whitespace-sensitive, so be careful about how / if you trim(). I don't know how well stripslashes, preg_replace, etc. work with UTF-8. Hopefully someone else will be able to help out with those... -- Teach a man to fish... NEW? | http://www.catb.org/~esr/faqs/smart-questions.html STFA | http://marc.theaimsgroup.com/?l=php-generalw=2 STFM | http://php.net/manual/en/index.php STFW | http://www.google.com/search?q=php LAZY | http://mycroft.mozdev.org/download.html?name=PHPsubmitform=Find+search+plugins signature.asc Description: OpenPGP digital signature
Re: [PHP] Damn escaping... Grunf...
Hi Yharonkh, Thanks a lot. It really did the trick :) Regards, Mrio Gamito [EMAIL PROTECTED] wrote: Hi Try using instead of ' Meaning you should write: Print (a href =\http://www.dte.ua.pt/cv/email=?.$recordSet-fields[0]. \ br /); -Original Message- From: Mrio Gamito [mailto:[EMAIL PROTECTED] Sent: Monday, March 21, 2005 12:50 PM To: php-general@lists.php.net Subject: [PHP] Damn escaping... Grunf... Hi, I want this code to display peoples' names within an hyperlink. I'm tired of trying different ways, read all about it in PHP's manual, but i can't get it there. You can visit http://www.dte.ua.pt/cv In the rightmost column it is suposed to apear two name below Links, but... it doen't, becuase i can't straight the escaping :( Any help would be apreciated. The code follows my signature. Warm Regards, Mrio Gamito -- // select names to display in the right column $recordSet = $conn-Execute('SELECT name FROM users'); while (!$recordSet-EOF) { print ('a href=\'http://www.dte.ua.pt/cv/email=?' . $recordSet-fields[0] . '\'' . 'br /'); $recordSet-MoveNext(); } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: XSLT solution
Devraj Mukherjee wrote: Hi everyone, I have been very intrigued by the way Gentoo.org offers its documentation. The documents are stored using a series of XML files and are delivered via XSLT via some ruby scripts. Are there any similar frameworks, solutions availble for the PHP world? Devraj Why would we re-invent the wheel? ;) OK, OK... the answers are YES, PHP does have similar frameworks. Just check these out: PHP4 http://php.net/manual/en/ref.xslt.php PHP5 http://php.net/manual/en/ref.xsl.php -- Teach a man to fish... NEW? | http://www.catb.org/~esr/faqs/smart-questions.html STFA | http://marc.theaimsgroup.com/?l=php-generalw=2 STFM | http://php.net/manual/en/index.php STFW | http://www.google.com/search?q=php LAZY | http://mycroft.mozdev.org/download.html?name=PHPsubmitform=Find+search+plugins signature.asc Description: OpenPGP digital signature
Re: [PHP] multiple words search query advise
Hey! Thanks! I'll look it up. -Ryan On 3/21/2005 5:53:38 AM, Brent Baisley ([EMAIL PROTECTED]) wrote: You want to use a full text index spanning the two fields. You wouldn't want to do a LIKE search because that wouldn't be able to use indexes, resulting in a full table scan every search. If you are using MySQL, you search read the part of the manual on creating and using full text indexes. It's really easy and exactly what you are looking for. On Mar 21, 2005, at 6:39 AM, Ryan A wrote: Hi, We have an a auction like site, now we have to add a search feature to the site, the searching will be done for 2 fields: subject and description (ad_sub, ad_text). Since i have never done this before, I would appreciate some advise on how to do it. I was thinking of getting the search string, running an explode() on it and then doing a LIKE sql query to get the results on each word...but then that would add up to quite a bit if even 5 words were written (5 queries each for the subject and 5 for the text) Any help in the form of advise, links, code, examples etc would be appreciated -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.308 / Virus Database: 266.7.4 - Release Date: 3/18/2005 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Forms
Does anyone know how to get a particular option to display in a drop menu? select name=category id=category option selected=true value=Option ValueOption Value/option option value=line-/option option value=value1 value1/option option value=value2 value2 /option option value=value3 value3/option option value=value4 value4/option /select add selected=selected to the option option value=value4 selected=selectedvalue4/option -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Forms
On Mon, 21 Mar 2005 10:04:23 -0600, Marquez Design [EMAIL PROTECTED] wrote: Greetings, Does anyone know how to get a particular option to display in a drop menu? Perhaps, do db query first, then for each option (perhaps as a foreach or something): echo option name=\whatever\ value=\\; if (!(strcmp($required_value, $db_result))) { echo selected; } echo ; cheers -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Forms
At 12:04 PM 3/21/2005, Marquez Design wrote: Greetings, Does anyone know how to get a particular option to display in a drop menu? select name=category id=category option selected=true value=Option ValueOption Value/option option value=line-/option option value=value1 value1/option option value=value2 value2 /option option value=value3 value3/option option value=value4 value4/option /select The user has previously selected a category. That information is in the database. Here they are editing the record. What I would like is for the option that was selected and is in the database to be displayed as the selectd option. Does anyone know how I can do this, or can you point me in the right direction? Thank you, -- Steve Marquez Marquez Design Steve, These can be a PITA. Here's how I've done it. 1. Create a function to determine which is selected: function is_selected( $option_expression ) { if ($option_expression) { $retval = selected; } else { $retval = ; } return $retval; } // end of function is_selected 2. Build your list of selection, in this case a list of classifications fetched from a database; $option_class is the variable holding the list of options: $sql = select * from class; $result = mysql_query( $sql ); while( $row = mysql_fetch_array( $result ) ) { $nClassKey = $row[nClassKey]; $cClass = $row[cClass]; $selectval = is_selected( $nClassKey == $nClass ); $option_class .= option value = \$nClassKey\ $selectval $cClass/option; } // end while $row = mysql_fetch... 3. Then display it this way in the form: Select name=nClass ? echo $option_class ? /select Hope this is helpful - Miles -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Forms
The way I did: # taking values from DB $query = mysql_query(select * from VALUES) $result = mysql_fet_array($query); #create an array of all values of dropdow menu $values = arra('value1', 'value2', 'value3', 'value4'); # create SELECT form using for loop echo 'select name=category id=categoryoption selected=true value=Option ValueOption Value/optionoption value=line-/option'; for($i=0; $icount($values); $i++) { # if value from DB is equal to value in SELECT form set it as SELECTED $selected = ($result['value_from_db'] == $values[$i]) ? 'SELECTED' : ''; echo 'option value='.$values[$i].' '.$selected.' '.$values[$i].'/option'; } echo '/select'; and it work just fine for me :) -afan Marquez Design wrote: Greetings, Does anyone know how to get a particular option to display in a drop menu? select name=category id=category option selected=true value=Option ValueOption Value/option option value=line-/option option value=value1 value1/option option value=value2 value2 /option option value=value3 value3/option option value=value4 value4/option /select The user has previously selected a category. That information is in the database. Here they are editing the record. What I would like is for the option that was selected and is in the database to be displayed as the selectd option. Does anyone know how I can do this, or can you point me in the right direction? Thank you, -- Steve Marquez Marquez Design -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [PHP-WIN] setting php for accepting the urls... phpinfo.php/extra/information/
Leif Gregory wrote: Hello Rob, Saturday, March 19, 2005, 2:39:08 AM, you wrote: R could someone possibly point me in the right direction for allow R PHP on IIS 6 to accept urls with the query string seperated by R slashes.. This is called slash arguments and IIS can not natively handle it. I ran into this issue setting up a Moodle http://www.moodle.org installation for a client. There is a 3rd party app you can install on an IIS server which will allow you to do this. It is free for a single website, but if you are virtual hosting, it costs money. It's called ISAPI Rewrite http://www.isapirewrite.com/ I finally ended up building them an Win2K, Apache2, MySQL, PHP5 box so they could use Moodle to the fullest with slash arguments. Cheers, Leif Gregory Um, no, you're wrong... it's called PATH_INFO and it IS possible on IIS, at least I have it working fine with 5.1 on windows xp. The trick is to install php with the isapi/cgi as an application mapping, and when you do that make sure the check that file exists button is unchecked. some additional information for cgi users http://wordpress.org/support/topic.php?id=15197 according to the IIS 6 stuff, the scriptmap stuff works the same as the application mapping used to http://www.microsoft.com/resources/documentation/iis/6/all/proddocs/en-us/ref_mb_scriptmaps.mspx make sure the MD_SCRIPTMAPFLAG_CHECK_PATH_INFO is set to NOT be checked, you want it to hit the index.php and ignore the path info :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Forms
Greetings, Does anyone know how to get a particular option to display in a drop menu? select name=category id=category option selected=true value=Option ValueOption Value/option option value=line-/option option value=value1 value1/option option value=value2 value2 /option option value=value3 value3/option option value=value4 value4/option /select The user has previously selected a category. That information is in the database. Here they are editing the record. What I would like is for the option that was selected and is in the database to be displayed as the selectd option. Does anyone know how I can do this, or can you point me in the right direction? Thank you, -- Steve Marquez Marquez Design -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Mod Rewrite help
I know this isn't exactly a PHP question, but it's for a PHP site if that helps :) :) How would I mod_rewrite a request for /baseball.htm into /query.php?q=baseball? - Brian -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Mod Rewrite help
Hello Brian, Monday, March 21, 2005, 6:05:59 PM, you wrote: BD I know this isn't exactly a PHP question, but it's for a PHP site if BD that helps :) :) BD How would I mod_rewrite a request for /baseball.htm into BD /query.php?q=baseball? Definitely more than one way to skin this cat, but the following will work: RewriteEngine on RewriteRule ^baseball.htm/ /query.php?q=baseball [L] If you want to make it a bit more dynamic you could do this: RewriteRule ^sport/(.*)$ /query.php?q=$1 [L] Then you can do sport/baseball.htm or sport/football.htm and it'll be passed to query.php each time. 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[2]: [PHP] Mod Rewrite help
RD Definitely more than one way to skin this cat, but the following will RD work: RD RewriteEngine on RD RewriteRule ^baseball.htm/ /query.php?q=baseball [L] Erm, self-correcting myself here - don't have the / after .htm! 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] Mod Rewrite help
How would I mod_rewrite a request for /baseball.htm into /query.php?q=baseball? This should be doing it as far as I can tell, but for some reason it's not... RewriteEngine on RewriteRule /^(.+).htm$ /query.php?q=$1 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Mod Rewrite help
RewriteEngine on RewriteRule /^(.+).htm$ /query.php?q=$1 AFAIK you should have that space at the end of your regex after the $ HTH, Mikey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP-NUKE on IIS
It is posible to install php-nuke on IIS? Thanks in advance Armando
[PHP] PHP-NUKE
Hi, I've already downloaded ver 7.2 of php-nuke, but it does not tell how to install it on Windows environment. Can somebody tell me where did I go wrong? I've have always follos the instruction manual but it does no work with IIS Thanks in advance, once again Armando
RE: [PHP] PHP-NUKE
[snip] I've already downloaded ver 7.2 of php-nuke, but it does not tell how to install it on Windows environment. Can somebody tell me where did I go wrong? I've have always follos the instruction manual but it does no work with IIS [/snip] Right there on phpnuke.org http://phpnuke.org/modules.php?name=Newsfile=articlesid=3164 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] class and global
Ok, i've found a workaround. So contrary to what is stated apparently in the documentation I had to declara the variables explicitely global to make it working and to create the object and assign _without_ reference. to sum up : global $freedb; $freedb = new freedbaxs(); function return_freedb_search($array) { global $freedb; [snip] $freedb-freedb_search($txt); } this is the one working. On Sun, 20 Mar 2005 11:37:53 +, Mister Jack [EMAIL PROTECTED] wrote: Ok, I've tried with a dummy class : class dummy { var $yank; Function dummy() { $this-yank = test dummy; } } and the problem is exactly the same. i've done print_r($dummy); is works ok outside the function, but inside print_r($dummy) doesn't return anything, like $dummy wasn't existing, even tough I declared it to be global... So the class n itself doesn't have anything to do with it. I'm really stuck with this. Is there any incompatibiliy with class and global declaration ? btw, I'm using PHP 4.3.10-8 thanks for your help, On Sat, 19 Mar 2005 20:45:55 +, Mister Jack [EMAIL PROTECTED] wrote: there is no database connection involved here. if I displace the $freedb = new freedbaxs(); inside the function it's works. I should give a try with a dummy object. (but the constructor, only initialize empty array) On Sat, 19 Mar 2005 21:17:02 +0200, BAO RuiXian [EMAIL PROTECTED] wrote: Evert - Rooftop Solutions wrote: pooly wrote: I'm trying to use a global object (declared at a upper level), but all I got is : Call to a member function on a non-object in /home/pooly/public_html/templeet/modules/freedb.php on line 16 Hmm, perhaps your problem is the failed connection to your database. Can you verify this? Best Bao part of the code is : $freedb = new freedbaxs(); Function return_freedb_search($array) { global $freedb; [snip] $freedb-freedb_search($txt); I don't see an error in this code, perhaps you should give us a bit more information. grt, Evert -- 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] fwrite and sort
i have a form with checkboxes which after POST it writes to a file. i would like to allow the user to sort the selected checkbox filename in the order they want it written to file. so i was thinking creating an input text box where they can enter a number, then have it written to file in that order.. question is how? the script starts like such: foreach($_POST['map'] AS $file) { if(file_exists('/maps/'.trim($file))) { $found .= $file; } } if (file_exists($mapcycle) $found) { $fp = fopen($mapcycle, 'w'); fwrite($fp, $found); fclose($fp); } any help is appreciated. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP-NUKE
There is a lot of information like this at nukecops.com, too, btw. You'll want to start here: http://nukecops.com/forum2.html Nick -Original Message- From: Armando Afa [mailto:[EMAIL PROTECTED] Sent: Monday, March 21, 2005 12:19 PM To: php-general@lists.php.net Subject: [PHP] PHP-NUKE Hi, I've already downloaded ver 7.2 of php-nuke, but it does not tell how to install it on Windows environment. Can somebody tell me where did I go wrong? I've have always follos the instruction manual but it does no work with IIS Thanks in advance, once again Armando -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] ODBC Errors and Undefined functions
Okie dokie. I have an odbc data and I can use odbc_result_all() to return data in an HTML table format. If I switch to odbc_fetch_array() or odbc_fetch_object() I get a call to an undefined function even though TFM says that these are available in 4.3.7 running phpinfo() shows that ODBC is enabled properly. I have googled for it, with no meaningful return except that at one time there may have been a bug. Signed *Scratching My Head in Texas* -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] ODBC Errors and Undefined functions
[snip] Okie dokie. I have an odbc data and I can use odbc_result_all() to return data in an HTML table format. If I switch to odbc_fetch_array() or odbc_fetch_object() I get a call to an undefined function even though TFM says that these are available in 4.3.7 running phpinfo() shows that ODBC is enabled properly. I have googled for it, with no meaningful return except that at one time there may have been a bug. Signed *Scratching My Head in Texas* [/snip] I should have asked a question [*slaps own wrist*], huh? Has anyone encountered this before and is there a solution? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Mod Rewrite help
Mikey wrote: RewriteEngine on RewriteRule /^(.+).htm$ /query.php?q=$1 ^-- this slash looks to me like its in the wrong place. AFAIK you should have that space at the end of your regex after the $ HTH, Mikey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Different approach?
John Taylor-Johnston wrote: Sorry to bother. I was hoping for inspiration. The code works. I wonder if there is a cleaner way? what is the context of the code you posted? ... in a function? class? part of an app? whats its purpose? why do you need to check/create the table dynamically? why do you think the way its done now is 'bad'? rgds, Jochem John Taylor-Johnston wrote: Hi, I've read: http://dev.mysql.com/doc/mysql/en/create-table.html Would anyone code/approach this differently? # $server = localhost; $user = myname; $pass = mypass; $db = mydb; $table = demo_assignment1; # $myconnection = mysql_connect($server,$user,$pass); # $sql = CREATE TABLE IF NOT EXISTS `demo_assignment1` ( `StudentNumber` varchar(8) NOT NULL default '', `Exercise1` varchar(100) NOT NULL default '', `Exercise2` varchar(100) NOT NULL default '', `TimeStamp` timestamp(14) NOT NULL, PRIMARY KEY (`TimeStamp`) ) TYPE=MyISAM COMMENT='place something here';; mysql_select_db($db,$myconnection); mysql_query($sql) or die(print mysql_error()); # $sql = INSERT INTO $table (StudentNumber,Exercise1,Exercise2) values ('$StudentNumber','$Exercise1','$Exercise2'); mysql_select_db($db,$myconnection); mysql_query($sql) or die(print mysql_error()); mysql_close($myconnection); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] sessioncookies?
William Stokes wrote: Hello, I have a following line in my code to set a session cookie when user logs in. It works fine. setcookie(sess_id,$sess_id,0,/); Can I store more information to the session cookie? I mean other variables. what are you trying to do? (do you need the info in the cookie on the client? or does it need to be 'permanent'? explicitly-without-sarcasm do you know what a php session is? I get the impression you either don't or that there is some kind of misunderstanding. /explicitly-without-sarcasm if you want to use the native php session functionality then you don't have to use setcookie(), instead have good look at: http://php.net/session and in particular: http://php.net/session_start tiny hint: you 'start' the session on each page (maybe an include file would come in handy) and then make use of the $_SESSION superglobal (which can store allsorts [but not all**] of types of variables accross requests). **resources,filehandles,streams,etc Like I tried it like this with no success. setcookie(sess_id,$sess_id,$another_variable,0,/); Thanks -Will -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] refreshing an included php file
I have a file, index.php and this has an included file, lets call it calculate.php. When I insert values in text boxes and hit submit the values are written as cookies. The question is how can I refresh calculate.php so it shows the new value. AD -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] refreshing an included php file
AndreaD mailto:[EMAIL PROTECTED] on Monday, March 21, 2005 2:27 PM said: I have a file, index.php and this has an included file, lets call it calculate.php. When I insert values in text boxes and hit submit the values are written as cookies. The question is how can I refresh calculate.php so it shows the new value. By submitting the form probably...? You haven't provided any code, or actual problems. If you wrote the code correctly within calculate.php you wouldn't be asking this question. Upon refresh/reload of index.php, calculate.php should be updating your cookie. Chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] [semi OT]: Planning projects
Hello, This is the only programming list I participate in so that is why I'm asking my question here. I hope no one objects greatly! So my question has to do with planning a project (not necessarily a website in general, but a programming project specifically). I've got Visio 2003 and a pad of paper with a pencil. I'm pretty much willing to try out different methods although I prefer a visual approach. I've googled on this subject quite a bit in the past but haven't really found anything that satisfies me. That is, I've found some short documents on flow charting, but nothing directly related to programming (and what symbols to use, or how detailed to get). I've also tried just writing out some pseudo-code but that always tends to get a little messy when I try it. If I start writing code outright I find myself rethinking a lot stuff once I'm already pretty entrenched in what I've got. Of course this turns into being a major pain going back and revamping stuff. Anyway, I'd like to hear some feedback from the audience as far as what works/doesn't work for you as well as some keyword recommendations that I can feed Google with. Thanks, Chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] [semi OT]: Planning projects
On Mon, March 21, 2005 2:55 pm, Chris W. Parker said: a pad of paper with a pencil. +1 :-) Seriously, any time I try to plan something out for any kind of programming, I find that a nice big desk surface, and a pencil and paper are the best tools. After I've got things worked out on paper, with all the scratch-outs, circles and arrows, and am happy with the basic design, I then type up something in plain text as my final draft. Not claiming I don't end up revising the hell out of it in development, mind you, but it seems to work, and I catch all the stuff I have enough smarts to anticipate. The stuff I can't anticipate, well, there you are, eh? I've tried Visio and all that stuff, and find myself wasting *WAY* more time lining up the damn boxes than actually thinking about what I want to *do*. YMMV -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Download system
Hi, i want to add my site a more specific download system. The redirecting is now done by directly giving the path of the file to variable. I want to do it over an id number. (now: dl.php?rel=/files/somefile.zip, i want: dl.php?id=64b3j283) The file path and id is read from mysql table. System is now; it matches from table and lets visitor to download but putting this kind of path is something useless. Download script is just used for counting the hit but for example i want to rename the file while giving to visitor instead of letting user to learn where it is stored and its real name, The_Justice_by_Someone_MyDomain_com.zip looks like what i want to have. I tried this system with header(Location: ..); but it just opened a new page and nothing happened else. For example if visitor uses FlashGet i want him to see just an address which doesnt involve the real path and name. If any body can help me, please.. Thanx a lot.. __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] refreshing an included php file
On Mon, March 21, 2005 2:27 pm, AndreaD said: I have a file, index.php and this has an included file, lets call it calculate.php. When I insert values in text boxes and hit submit the values are written as cookies. The question is how can I refresh calculate.php so it shows the new value. When you set a cookie, it is sent *TO* the browser, to be sent *back* in the *NEXT* HTTP request. The browser itself does not have access to the cookies, so you can't, say, use javaScript to do calculations with them. The Cookies you just *sent* at the top of your script have not been sent *back* yet -- But since you have the values at the top of the script, you can use those same values in some variables to provide whatever calculations you want. Hope that helps you sort things out... -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: refreshing an included php file
AndreaD wrote: I have a file, index.php and this has an included file, lets call it calculate.php. When I insert values in text boxes and hit submit the values are written as cookies. The question is how can I refresh calculate.php so it shows the new value. AD You'll need calculate.php to setcookie(). Then on the *next* index.php invocation $_COOKIE['yourcookie'] should get updated with the value you wrote to the cookie. The only way to refresh calculate.php is to finish output to the browser and then refresh index.php. Although perhaps using a session is better than using a cookie in this case? I guess I don't grok your problem because the way you described it seems trivial. ?php function calculate($var) { return The value of var is $var; } /** From the browser / cookie / whatever */ $input = 11; $output = calculate($input); setcookie('yourcookie', $output); /** And now you do whatever you want with output */ var_dump($output); ? -- Teach a man to fish... NEW? | http://www.catb.org/~esr/faqs/smart-questions.html STFA | http://marc.theaimsgroup.com/?l=php-generalw=2 STFM | http://php.net/manual/en/index.php STFW | http://www.google.com/search?q=php LAZY | http://mycroft.mozdev.org/download.html?name=PHPsubmitform=Find+search+plugins signature.asc Description: OpenPGP digital signature
[PHP] Re: [semi OT]: Planning projects
disclaimerI am not very good at diagramming these things!/disclaimer After programming in PHP for a while I ran across this (helpful) website. Although I don't really do this like I should, perhaps this link will explain things well and /or inspire you to do things The Right Way? http://www.jjg.net/ia/visvocab/ -- Teach a man to fish... NEW? | http://www.catb.org/~esr/faqs/smart-questions.html STFA | http://marc.theaimsgroup.com/?l=php-generalw=2 STFM | http://php.net/manual/en/index.php STFW | http://www.google.com/search?q=php LAZY | http://mycroft.mozdev.org/download.html?name=PHPsubmitform=Find+search+plugins signature.asc Description: OpenPGP digital signature
[PHP] Building modular applications (long)
Hello, So I was thinking about building some modularity into future projects and wanted to bounce some ideas off my fellow list members. My definition of modular application is: A modular application is one that can have it's major functions added/removed with the click of a button, or the creating/deleting of a file without breaking the application on any level. The user should be able to add/remove a module* from the filesystem and have the application update itself automatically without any (or very little) interaction with the user of the application. For example, here is what I've come up with at this point for how a modular application could be built. First of all there would need to be some kind of script that controls/integrats/manages the individual modules. I imagine this task to be performed within an include file that is included at the top of every file in the application (let's call it adjuster.php). This include file would determine how to build the main menu based on certain factors within the applications directory tree. Said another way, this file would take an inventory of the available modules and build a menu based on what it found. In this way a module could be added/removed without any interaction** from the user and the menu would update automatically. This in and of itself is not difficult. What I think the difficult part of it will be is finding the appropriate way to construct modules. At this point I'm imaging a directory called modules/ where each directory within the modules/ directory is a module itself. It would contain all the classes and functions associated with that module as well as a definition file for that module (could be a simple .txt file). Adjuster.php would read the modules/ directory and recursively discover each module and then build the main menu accordingly. Having said all that I think what I'm looking for is some feedback from experienced person(s) on the list with building modular applications. I can see this being really helpful for something like a shopping cart, CRM, or CMS app. Thanks, Chris. * In the short time I've been thinking about what a module is I've determined it to be one of a few things (or a combination thereof). A module could be (a) a single file, (b) a set of files, or (c) a directory containing one or more files and/or directories. ** Not having any interaction with the user does not have to be a requirement, but it would sure be helpful when upgrading the application. For example: Customer comes to your website, buys a new module (or downloads for free, however you choose to license the software), and simply adds it to the module repository. Yadda yadda yadda, a new, full functional menu option is available. p.s. Are there any lists out there that deal with programming in general? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Download system
On Mon, March 21, 2005 3:45 pm, JoShQuNe \(TR\) said: Hi, i want to add my site a more specific download system. The redirecting is now done by directly giving the path of the file to variable. I want to do it over an id number. (now: dl.php?rel=/files/somefile.zip, i want: dl.php?id=64b3j283) The file path and id is read from mysql table. System is now; it matches from table and lets visitor to download but putting this kind of path is something useless. Download script is just used for counting the hit but for example i want to rename the file while giving to visitor instead of letting user to learn where it is stored and its real name, The_Justice_by_Someone_MyDomain_com.zip looks like what i want to have. I tried this system with header(Location: ..); but it just opened a new page and nothing happened else. For example if visitor uses FlashGet i want him to see just an address which doesnt involve the real path and name. If any body can help me, please.. Thanx a lot.. Some snippets of ideas that should be useful to you: Build a table that relates secret tokens to filenames: create table downloads ( token char(32) unique not null primary key, filename varchar(255), whattime time_stamp ); Generate a secret token: $token = md5(uniqid(rand(), true)); Put the file they asked for and the token in the table: $query = insert into downloads (token, filename) values ('$token', '$download'); You're on your own for the rest. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ODBC Errors and Undefined functions
Jay Blanchard wrote: [snip] Okie dokie. I have an odbc data and I can use odbc_result_all() to return data in an HTML table format. If I switch to odbc_fetch_array() or odbc_fetch_object() I get a call to an undefined function even though TFM says that these are available in 4.3.7 running phpinfo() shows that ODBC is enabled properly. I have googled for it, with no meaningful return except that at one time there may have been a bug. Signed *Scratching My Head in Texas* [/snip] I should have asked a question [*slaps own wrist*], huh? Has anyone encountered this before and is there a solution? I haven't encountered this problem before. However, most of the time when I run into a problem like this it's because there is a missing library that is required *in addition to* the library for the extension. -- Teach a man to fish... NEW? | http://www.catb.org/~esr/faqs/smart-questions.html STFA | http://marc.theaimsgroup.com/?l=php-generalw=2 STFM | http://php.net/manual/en/index.php STFW | http://www.google.com/search?q=php LAZY | http://mycroft.mozdev.org/download.html?name=PHPsubmitform=Find+search+plugins signature.asc Description: OpenPGP digital signature
Re: [PHP] fwrite and sort
http://php.net/asort On Mon, March 21, 2005 12:29 pm, Sebastian said: i have a form with checkboxes which after POST it writes to a file. i would like to allow the user to sort the selected checkbox filename in the order they want it written to file. so i was thinking creating an input text box where they can enter a number, then have it written to file in that order.. question is how? the script starts like such: foreach($_POST['map'] AS $file) { if(file_exists('/maps/'.trim($file))) { $found .= $file; } } if (file_exists($mapcycle) $found) { $fp = fopen($mapcycle, 'w'); fwrite($fp, $found); fclose($fp); } any help is appreciated. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] [semi OT]: Planning projects
Richard Lynch mailto:[EMAIL PROTECTED] on Monday, March 21, 2005 3:44 PM said: On Mon, March 21, 2005 2:55 pm, Chris W. Parker said: a pad of paper with a pencil. +1 Seriously, any time I try to plan something out for any kind of programming, I find that a nice big desk surface, and a pencil and paper are the best tools. [snip] All true. And having read Jason's email I think I'll try to put that graphical process into practice. Doesn't have to be in Visio considering... I've tried Visio and all that stuff, and find myself wasting *WAY* more time lining up the damn boxes than actually thinking about what I want to *do*. Agreed. Thanks, Chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: looking for address finder..uk
On Mon, March 21, 2005 6:50 am, Jason Barnett said: AndreaD wrote: I'm looking for an address finder where a user types in a postcode and house number and then the user is given an option of to houses to choose from. Anything like this available for a small charge? Ross Try talking to Richard Lynch... he *might* be able to help you out. Or at least he was talking about this same problem on the list a while back. It's a work in progress, but so far the progress is so minimal that the phrase I got nothin would be closest to what he needs. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Download system
--- Richard Lynch [EMAIL PROTECTED] wrote: On Mon, March 21, 2005 3:45 pm, JoShQuNe \(TR\) said: Hi, i want to add my site a more specific download system. The redirecting is now done by directly giving the path of the file to variable. I want to do it over an id number. (now: dl.php?rel=/files/somefile.zip, i want: dl.php?id=64b3j283) The file path and id is read from mysql table. System is now; it matches from table and lets visitor to download but putting this kind of path is something useless. Download script is just used for counting the hit but for example i want to rename the file while giving to visitor instead of letting user to learn where it is stored and its real name, The_Justice_by_Someone_MyDomain_com.zip looks like what i want to have. I tried this system with header(Location: ..); but it just opened a new page and nothing happened else. For example if visitor uses FlashGet i want him to see just an address which doesnt involve the real path and name. If any body can help me, please.. Thanx a lot.. Some snippets of ideas that should be useful to you: Build a table that relates secret tokens to filenames: create table downloads ( token char(32) unique not null primary key, filename varchar(255), whattime time_stamp ); Generate a secret token: $token = md5(uniqid(rand(), true)); Put the file they asked for and the token in the table: $query = insert into downloads (token, filename) values ('$token', '$download'); You're on your own for the rest. -- Like Music? http://l-i-e.com/artists.htm Thanx for answer but i ve already done this part of job. I have got generated tokens for files but at the time of download i can not use the token instead of file name and path. I want to redirect to file while showing a senseless token but i can not imagine how to do it.. __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] carriage returns using error_log?
Heh... no, I was already using double quotes. I also tried using actual carriage returns in the string, that didn't work either. Is error_log simply incapable of obeying carriage returns within the error string? It works for me, but if it's not working for you... function my_error_log($text){ $lines = explode(\n); while (list(, $line) = each($lines)) error_log($line); } [shrug] -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regex
On Sun, March 20, 2005 3:18 pm, Colin Ross said: I'm trying to compress down a php-powered javascript file. In the file i have php run a bunch of loops and foreaches to build huge nested arrays for use in the javascript. Have you considered using PHP to write JavaScript that will build the arrays?... If the arrays are at all predictable from a smaller set of data, this can cut your bandwidth. One starts to wonder if you're not maybe just going down the wrong path entirely... -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] [semi OT]: Planning projects
I'm with Richard - lots of scrap paper, couple of nice sharp HB pencils ... let it ferment a bit, then pseudocode in a plain text editor. As for the graphics - well, I have an old template used in Introductory Basic for the Control Data Corporation whatever. Haven't used it since about 1970, but then keypunch machines have been scarce. Cheers - Miles At 08:02 PM 3/21/2005, Chris W. Parker wrote: Richard Lynch mailto:[EMAIL PROTECTED] on Monday, March 21, 2005 3:44 PM said: On Mon, March 21, 2005 2:55 pm, Chris W. Parker said: a pad of paper with a pencil. +1 Seriously, any time I try to plan something out for any kind of programming, I find that a nice big desk surface, and a pencil and paper are the best tools. [snip] All true. And having read Jason's email I think I'll try to put that graphical process into practice. Doesn't have to be in Visio considering... I've tried Visio and all that stuff, and find myself wasting *WAY* more time lining up the damn boxes than actually thinking about what I want to *do*. Agreed. Thanks, Chris. -- 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: http authentication with safe mode enabled?!
I have no idea what to do to deal with this. There is only one .htaccess file, which is in the top-level directory of my account with my ISP. And I've even put You can always add more .htaccess files in more directories, or edit the one that's there. AuthType None in there, but it doesn't change anything. The fact that the uid of the script is appended to the realm specified shouldn't require any changes in the code, or should it? No. It would only invalidate any saved logins or passwords from the old realm being managed by the browser. Different realm == different login/credentials needed. I really don't have any more ideas of what to do. What is probably important is that apparently my ISP upgraded his version of PHP to 4.3.10 which is now CGI instead of a module. That's your ISP being silly, not PHP 4.3.10 changing That said, HTTP Authentication WILL NOT WORK with CGI. It is disabled in PHP source because, because your password would be transmitted insecurely from Apache to PHP, and the PHP Team is not willing to do that for obvious reasons. Get your host to go back to PHP as Module, or switch to a form login. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Authorization header is missing from apache_request_headers() array
On Fri, March 18, 2005 6:24 am, LacaK said: When I try to use HTTP Digest Authorization using code like : Header( HTTP/1.0 401 Unauthorized); Header( WWW-Authenticate: Digest realm=\www.myrealm.com\, opaque=\opaque\, nonce=\nonce\, stale=\false\, qop=\auth\); browser returns in HTTP request Authorization header like this one : Digest username=lacak, realm=www.myrealm.com, qop=auth, algorithm=MD5, uri=/devel/phpinfo.php, nonce=5e8ac9b033001458fc5380d8a88325a2, nc=0004, cnonce=c9495e4af19fa6b08eb045f32e6ced79, response=fbd8f86b45334202b2cac380f29d9706 When PHP runs as apache module with safe_mode=off I can read this header using apache_request_headers() function But when safe_mode=On, then apache_request_headers() returns no Authorization (this is documented behavior) Is this bug or exists other way how access Authorization header ? Can anyone help ? How to report this to php developers, to fix this problem ? I could be *WAY* wrong, but I thought nobody ever bothered with Digest Auth because, e. It's not better/safer than HTTP Auth? You might as well go with SSL if you go to that much trouble? Not enough browsers support it? Okay, so clearly I don't remember why I thought this. Google for PHP HTTP Digest Authentication and see what turns up... But don't be surprised if the answer is Not supported -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: fopen
On Sat, March 19, 2005 6:48 am, John Taylor-Johnston said: chmod($defaultfile, 666); http://php.net/chmod has examples that tell you exactly why this is wrong... 666 is decimal. The 666 you want is Octal. They ain't the same number. What does the at_sign mean at the start of this line? @ $results = fopen($datafilename, w+); @ means you are IGNORING any errors this generates. It's usually a really bad idea unless you have some more code for error checking. if (!$results) { die (Our results file could not be opened for writing. Your score was not recorded. Please contact the person responsible and try again later.); } flock($results, 2); #lock file for writing fwrite($results, $filestr); #write $filestr to $results flock($results, 3); #unlock file fclose($results); #close file This is an incorrect way to try to flock a file for writing. You should: 1) Open the file for READING. 2) flock that file handle, so only YOU have access to that file. 3) Re-open the file for WRITING, now that you have control. 4) Write your data 5) Release the lock. Your application, as it stands now, has a race condition between the open for writing and the flock, which sooner or later, WILL bite you in the ass. Probably. Maybe. If $filestr is small enough, the Linux OS has locking built-in. Windows may or may not (and I don't care enough about Windows to remember, much less look it up). FreeBSD and other OSes may or may not also have locking at OS layer. I wouldn't rely on it, though, since it's trivial to do the 5 steps above. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Download system
How about setting up symbolic links on the server in a tmp directory. You could use the values from your database table to create the sym links. Have the sym link be the token name and then have it linked to the real file name. You could then have a cron job running to clear the sym links at set intervals. I do this for a Royalty Free stock site and it works great. Chris On Mar 21, 2005, at 7:08 PM, JoShQuNe ((TR)) wrote: --- Richard Lynch [EMAIL PROTECTED] wrote: On Mon, March 21, 2005 3:45 pm, JoShQuNe \(TR\) said: Hi, i want to add my site a more specific download system. The redirecting is now done by directly giving the path of the file to variable. I want to do it over an id number. (now: dl.php?rel=/files/somefile.zip, i want: dl.php?id=64b3j283) The file path and id is read from mysql table. System is now; it matches from table and lets visitor to download but putting this kind of path is something useless. Download script is just used for counting the hit but for example i want to rename the file while giving to visitor instead of letting user to learn where it is stored and its real name, The_Justice_by_Someone_MyDomain_com.zip looks like what i want to have. I tried this system with header(Location: ..); but it just opened a new page and nothing happened else. For example if visitor uses FlashGet i want him to see just an address which doesnt involve the real path and name. If any body can help me, please.. Thanx a lot.. -- Chris Bruce [EMAIL PROTECTED] Idextrus E-Business Architects http://www.idextrus.com 3282 Wilmar Cres. Mississauga, ON L5L4B2 CA 905.828.9189 South Office 705.361.0331 North Office Skype: callto://chrisrjbruce This e-mail and its contents are privileged, confidential and subject to copyright. If you are not the intended recipient, please delete this e-mail immediately. Any unauthorized use or disclosure of the information herein is prohibited.
Re: [PHP] Chapter 38. Handling file uploads
On Fri, March 18, 2005 1:43 pm, Timothy A. Whitley, P.E. said: Warning: move_uploaded_file(/images/tim.jpg): failed to open stream: No such file or directory in /usr/hsphere/local/home/ice-admi/iceagents.com/CxDatabase/fileuploadh.ph p on line 20 Dollars to doughnuts there is *NO* /images directory on your machine. There might be a /www/iceagents.com/public_html/images directory, or there might be a /home/whitley/public_html/images directory or something like that, but almost for sure there ain't no /images directory on your machine. If there *IS* such a directory, PHP needs write access to it. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] [semi OT]: Planning projects
On Mon, 2005-03-21 at 18:43, Richard Lynch wrote: On Mon, March 21, 2005 2:55 pm, Chris W. Parker said: a pad of paper with a pencil. +1 +1 For the most part if you're working on this alone, then the pencil, paper approach is probably the best. It doesn't matter how carefully you plan your architecture you WILL want to change it and then not only will you have to change your code, but that big fancy time-sucking, visio diagram. On the other hand if you are working with a bunch of people (and this is especially true if they are remote from one another) then you really MUST have some kind of clear and concise plan in place or you'll be stepping all over each other. Cheers, Rob. -- .. | 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] Files upload - Encrypt into a variable - Do not injectinto db (PHP/Apache/MySQL)
On Fri, March 18, 2005 12:00 pm, Steven Altsman said: Got packet bigger than 'max_allowed_packet' ... Gotta love mysql_error(); If I find out what causes this, I'll bring it over to this list too.. since it's been pretty quiet, I guess I've gotten folks stumped. If that's a MySQL error, you're gonna be WAY better off asking on the MySQL mailing lists... At a guess, you're either trying to send a query that's WY too long, or get back waaay too much data, or your database server and internet server aren't doing TCP/IP packets nicely, or... It could mean a whole lot of things, actually. Google for the error message, and 'max_allowed_packet' and see what turns up. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] XML HTTP
On Fri, March 18, 2005 11:14 am, Jerry Swanson said: I create XML file, how to pass the XML file to another server through HTTP? Let's try it this way: What's the other server? Did you read their FAQ and their documentation? Here are functions that, depending on what you read on the other server, may be helpful: http://php.net/file (GET) http://php.net/fsockopen (POST) http://php.net/curl (SSL) The (WORD) indicates which function you would use, at a minimum, if you find that word in the other server's documentation. Note that in each case, you *could* use the next function down in my list, if you wanted to do it the hard way. :-) YMMV. NAIAA. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ODBC Errors and Undefined functions
Oh and Jay... since no one else has found the answer it would be nice if you could post your solution here when / if you find it. -- Teach a man to fish... NEW? | http://www.catb.org/~esr/faqs/smart-questions.html STFA | http://marc.theaimsgroup.com/?l=php-generalw=2 STFM | http://php.net/manual/en/index.php STFW | http://www.google.com/search?q=php LAZY | http://mycroft.mozdev.org/download.html?name=PHPsubmitform=Find+search+plugins signature.asc Description: OpenPGP digital signature
Re: [PHP] sessioncookies?
On Fri, March 18, 2005 8:30 am, William Stokes said: OK. so can I set 2 or more session cookies for the same user? Like this: setcookie(sess_id,$sess_id,0,/); setcookie(cookie2,$another_variable,0,/); If so is there a limit? The browser is not required to keep more than N cookies. I think N is 30. It *also* is not required to keep more than X kilobytes in all the cookies from your server combined. X is some reasonable number. It doesn't matter because... Or is it a bad idea for some other reason? It's a Bad Idea because it's just more crap going back and forth over HTTP (slow) and more annoying to those of us who surf with some discretion over Cookies. If your site sends too many Cookies for me to decide if they are okay or not, buh-bye. Use session_start() which sends *ONE* cookie, and then you can store whatever you want in $_SESSION to tie it all to me -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] preg_replace with rawurlencoded?
On Fri, March 18, 2005 8:18 am, BlackDex said: I have a litle problem with replaceing a string in some HTML code. the html code is: --- img width=240 height=180 src=01%20-%20Raptor%20AMD%20Sempron_image001.jpg --- I want to change the 01%20-%20Raptor%20AMD%20Sempron_image001.jpg becouse the location of the file will be changed after the upload. the location for instains will be /images/uploaded/01%20-%20Raptor%20AMD%20Sempron_image001.jpg $html = str_replace('src=', src=/images/uploaded/', $html); -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: refreshing an included php file
Richard had got it spot on! Have solved it by using iframes. AD AndreaD [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I have a file, index.php and this has an included file, lets call it calculate.php. When I insert values in text boxes and hit submit the values are written as cookies. The question is how can I refresh calculate.php so it shows the new value. AD -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] getting text with strange encodng
On Fri, March 18, 2005 5:40 am, Diana Castillo said: no, its not html entity, it doesnt have a semicolon, its exactly as I But some versions of Microsoft IE will display reg without the semi-colon as an HTML-entity, in complete violation of HTML specifications. Yes, really. So some idiot may have though this was a Good Idea, and, after all, it works in their browser, so it MUST be right! Good Luck! -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Reading all headers sent
Search php.net for RAW HTTP Maybe. On Fri, March 18, 2005 3:28 am, martin said: Thanks for the answer, what I'm trying to achieve is a php proxy that receives any GET/POST request with correspoding headers and brings back the results to the caller. Let's say I do a google search request with curl: // I would like all this to be sent by another page --- (header + xml) $data =soapreq.xml; $handle = fopen ($data, r); $send = fread ($handle, filesize($data) ); fclose($handle); $header[] =MessageType:CALL; $header[] =Content-Type:text/xml; // -- I don't know if what I want can be achieved this way, but maybe this explains better the idea. $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, http://api.google.com/search/beta2;); curl_setopt($ch, CURLOPT_POST,1); curl_setopt($ch, CURLOPT_POSTFIELDS,$send); curl_setopt ($ch, CURLOPT_HTTPHEADER, $header); $data = curl_exec($ch); Best regards, MARTIN Jesper Goos wrote: The $SERVER variable is an array, so try this: ? echo pre; print_r($_SERVER); echo /pre; ? regards Jesper martin wrote: Hi, I wanted to know if there is some way to expose the full headers sent to a php page. I found in google that for windows there is $_SERVER['ALL_HTTP'] to read all the headers sent but I'm using php on linux/apache. There is any way to get in a variable the full headers sent to a page ? Best regards, MARTIN -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Custom errors handling class problem
On Fri, March 18, 2005 12:46 am, Mihai Frisan said: I use a custom errors handling class, which set one of its methods as the php errors handler. All works well when I use this class in a file with only procedural code (all errors are caught by the custom errors handling class), but if I instantiate another class in this file, and in this class I have a error, this error is not caught by the custom errors handling class that I defined, instead is caught by the implicit php error handler. My question is what can I do to make my custom error handling class catch all the errors, even if they are in another class that I have instantiated? Some errors are simply too heinous for PHP set_error_handler to catch. See user notes on php.net/set_error_handler for discussion. I think that's where it is... Maybe in bugs.php.net At any rate, if you are hitting one of these errors, it has nothing to do with your class, and everything to do with what set_error_handler simply cannot cope with. If your PHP source code simply cannot be parsed, those errors will not get caught by set_error_handler. That could be what's in your class file. You'd have to tell us the error message and maybe even show us the lines near the PHP error message. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: can you help me ??
On Wed, March 16, 2005 1:57 am, Wahyu SP said: dear webmaster i would like to ask few questions : 1. can php determine the mime type of file without uploading a file ?? No. It's none of your damn business what's on my hard drive. :-) -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Files upload - Encrypt into a variable - Do not injectinto db (PHP/Apache/MySQL)
Steven Altsman wrote: Got packet bigger than 'max_allowed_packet' ... Gotta love mysql_error(); If I find out what causes this, I'll bring it over to this list too.. since it's been pretty quiet, I guess I've gotten folks stumped. I think you can put the encrypted file to the database in chunks. Split the file up and append it to the column in a loop. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] something stupid... split().
On Thu, March 17, 2005 3:16 am, Chris Knipe said: Lo all, echo ConvertTime($AcctSessionTime/90); # Returns: 03:17:46.77 I am trying to drop the .whatever.. Thus, list($Duration, $none) = split('.', ConvertTime($AcctSessionTime/90), 2); However, $Duration is empty, and $none has the whole string from ConvertTime As I said, something silly ;) split does regular expressions. Where '.' means any character So you *could* do '\\.' instead of '.' But http://php.net/explode is the better answer here. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] opt-in mail list best practice
On Thu, March 17, 2005 2:37 am, Scott Haneda said: on 3/16/05 12:46 PM, Todd Trent at [EMAIL PROTECTED] wrote: - This could be hosted on shared hosting server. - Opt-in list could be less than 100 or in the 1000¹s. - May need a way to track sending success. Check this out: http://phpmailer.sourceforge.net/ I use it to create HTML emails, send them to 1000's of people. I think I did a test to 30K or so, it handled it fine using mail locally. As for tracking, what we do is embed a image bug in the html and track when that loads, it is getting less reliable in todays anti spam world, but in my case these are paying subscribers so they generally want to get these emails. To track your users, at least the bounces we set the bounce address (return-path) to [EMAIL PROTECTED] and POP check domain.com every few seconds. We then scan for the bounce address and mark that user as bouncing x times, if they go over y we cancel the account. So I could forge a bunch of bounces from somebody else's email account and guess/use their ID in your table, and get them kicked off your service? Cool! [that was light sarcasm] You might maybe wanna use some kind of one-time token such as that described on http://php.net/uniqid instead... PS Yes, some semi-legitimate spammers will drop you from their lists if you bounce email. The total scum spammmers won't -- Their return address isn't even their own, much less something they check. I *WISH* all email clients had a Bounce button to return emails as if they had bounced... -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SimpleXML and xpath woes
On Wed, March 16, 2005 9:39 am, Simon Turvey said: (Apologies for the larger than normal wrapping - there are some long lines) I'm playing with SimpleXML for reading REST responses from Amazon Web Services. Having successfuly read the response to my request I'd like to perform an xpath query on the result. I've pared down the original response to a static XML file for testing purposes containing the following: WILD GUESS: The static XML you have saved is out-dated from their session/whatever?... -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: can you help me ??
Richard Lynch wrote: On Wed, March 16, 2005 1:57 am, Wahyu SP said: dear webmaster i would like to ask few questions : 1. can php determine the mime type of file without uploading a file ?? No. It's none of your damn business what's on my hard drive. :-) Using javascript, you can read the value property of your file input. You can get the extension from this value, this should be sufficient enough. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] obscure error message - PHP Notice: (null)(): Permission denied (errflg=2) in Unknown on line 0
On Wed, March 16, 2005 2:32 pm, Zinovi Boyadjiev said: I am getting this strange error while developing imap mail to mysql inporting script : PHP Notice: (null)(): Permission denied (errflg=2) in Unknown on line 0 This looks like a custom error message and/or something coming about as a result of using http://php.net/eval -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP source code formatter for OS X
On Wed, March 16, 2005 8:11 pm, DuSTiN KRySaK said: Does anyone know of a PHP source code formatter to clean up sloppy code that runs on OS X? http://php.net/highlight_string may or may not do some cleanup. Probably not enough. I think there's a PHP pretty-printer at http://phpclasses.org You should Google for PHP pretty print and you will find solutions. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Full-text searches sucks?
Hey all, I just put in a search function for a site using mySql full text, i am running it on my local server for now. I am running it on two fields: ad_sub and ad_text The results i getting are really quite bad, this is how i am testing it out: 1. I wrote an insert statement and looped it 700 times, so i have 700 test records in the db which are identical 2. I found two words which are in the ad_text of the insert statement and wrote a search statement like so: SELECT *, MATCH(ad_sub, ad_text) AGAINST('want to') AS score FROM blk_ads WHERE MATCH(ad_sub, ad_text) AGAINST('want to') ORDER BY score DESC LIMIT 0,40; 2a. I have checked many times and this text want to use a full. is present in the ad_text field but mysql gives me no results. Reading up on full-text I came accross this useful piece of info: you should add at least 3 rows to the table before you try to match anything, and what you're searching for should only be contained in one of the three rows. This is because of the 50% threshold. If you insert only one row, then now matter what you search for, it is in 50% or more of the rows in the table, and therefore disregarded which means because I i getting a match for well over 50% of the records...its disregarding it. Now i am in two minds if i should use this or go back to the same old dirty way...of exploding the search and using LIKE '%%' for each word Comments/suggestions? Thanks, Ryan -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.308 / Virus Database: 266.7.4 - Release Date: 3/18/2005 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ODBC Errors and Undefined functions
Oh and Jay... since no one else has found the answer it would be nice if you could post your solution here when / if you find it. Accoding to the source, these two functions require something to exist: #ifdef PHP_ODBC_HAVE_FETCH_HASH PHP_FUNCTION(odbc_fetch_array); PHP_FUNCTION(odbc_fetch_object); #endif Elsewhere in the source is this: #if defined(HAVE_DBMAKER) || defined(PHP_WIN32) || defined(HAVE_IBMDB2) || defined(HAVE_UNIXODBC) # define PHP_ODBC_HAVE_FETCH_HASH 1 #endif So you need to meet one of the above requirements to have those two functions available. According to the changelog, many of these checks were added in early 2003 (4.3.2) not that this has to do with you but when documented these should be taken into account. I'll add this documentation later this week :) Regards, Philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Full-text searches sucks?
which means because I i getting a match for well over 50% of the records...its disregarding it. Yes, this is exactly the problem. Now i am in two minds if i should use this or go back to the same old dirty way...of exploding the search and using LIKE '%%' for each word FULLTEXT searches are great; it's your testing of them that is poor. What validity is there is searching through X number of identical records? This isn't a real test at all. Also, FULLTEXT searches are improved as the number of __different__ records increase. If you want to see some results, regardless of the 50% threshold, use the IN BOOLEAN MODE feature. Keep in mind, though, that in your case any search will return either 0 or 700 results. Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: fopen
Thanks for that! John Richard Lynch wrote: On Sat, March 19, 2005 6:48 am, John Taylor-Johnston said: chmod($defaultfile, 666); http://php.net/chmod has examples that tell you exactly why this is wrong... 666 is decimal. The 666 you want is Octal. They ain't the same number. What does the at_sign mean at the start of this line? @ $results = fopen($datafilename, w+); @ means you are IGNORING any errors this generates. It's usually a really bad idea unless you have some more code for error checking. if (!$results) { die (Our results file could not be opened for writing. Your score was not recorded. Please contact the person responsible and try again later.); } flock($results, 2); #lock file for writing fwrite($results, $filestr); #write $filestr to $results flock($results, 3); #unlock file fclose($results); #close file This is an incorrect way to try to flock a file for writing. You should: 1) Open the file for READING. 2) flock that file handle, so only YOU have access to that file. 3) Re-open the file for WRITING, now that you have control. 4) Write your data 5) Release the lock. Your application, as it stands now, has a race condition between the open for writing and the flock, which sooner or later, WILL bite you in the ass. Probably. Maybe. If $filestr is small enough, the Linux OS has locking built-in. Windows may or may not (and I don't care enough about Windows to remember, much less look it up). FreeBSD and other OSes may or may not also have locking at OS layer. I wouldn't rely on it, though, since it's trivial to do the 5 steps above. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Apache user can't use exec(), passthru(), etc.
If I run this PHP script: ?php echo 'pre'; echo exec('whoami'); echo '/pre'; ? from the web, the output is pre/preand from the command line running as the apache user(webuser), the output is. Content-type: text/html X-Powered-By: PHP/4.3.9 pre/preBut if I run from the command line as root, the output is: Content-type: text/html X-Powered-By: PHP/4.3.9 preroot/preand from the command line as a user in the root group, the output is: Content-type: text/html X-Powered-By: PHP/4.3.9 prejimpoz/preSafe mode is turned off. As webuser (or any non-root-group user), no shell commands work. Not echo, not ls, not whoami, not touch. And no shell functions work: no exec(), no passthru(), no shell_exec(), no backticks. Every command I'm trying to run is world-readable and world-executable. If I turn safe mode on, it gives me a safe mode is on warning only about lines that call shell_exec(), and not for exec() or any of the others. Other than that, it doesn't hang or give any kind of error or anything when it comes to a shell function call; apparently it just ignores them. Anyone know what's wrong? I've been staring at this thing for three days and have come up empty. Thanks, Jim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Full-text searches sucks?
Hey! Thanks for replying. FULLTEXT searches are great; it's your testing of them that is poor. Kind of true, but I would have still been happy if it had found some records rather than 0 results. Also, FULLTEXT searches are improved as the number of __different__ records increase. Yep, I understood that from reading the docs. If you want to see some results, regardless of the 50% threshold, use the IN BOOLEAN MODE feature. Keep in mind, though, that in your case any search will return either 0 or 700 results. I dont want to do that as its only mysql 4.1+ compatable, I presently DO have a 4.1 setupbut if we shift hosts...i dont want it to break my code. Thanks, Ryan On 3/21/2005 8:03:39 PM, [EMAIL PROTECTED] wrote: which means because I i getting a match for well over 50% of the records...its disregarding it. Yes, this is exactly the problem. Now i am in two minds if i should use this or go back to the same old dirty way...of exploding the search and using LIKE '%%' for each word FULLTEXT searches are great; it's your testing of them that is poor. What validity is there is searching through X number of identical records? This isn't a real test at all. Also, FULLTEXT searches are improved as the number of __different__ records increase. If you want to see some results, regardless of the 50% threshold, use the IN BOOLEAN MODE feature. Keep in mind, though, that in your case any search will return either 0 or 700 results. Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.308 / Virus Database: 266.8.0 - Release Date: 3/21/2005 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Full-text searches sucks?
Thanks for replying. You're quite welcome. If you want to see some results, regardless of the 50% threshold, use the IN BOOLEAN MODE feature. Keep in mind, though, that in your case any search will return either 0 or 700 results. I dont want to do that as its only mysql 4.1+ compatable, IN BOOLEAN MODE was added in version 4.0.1 not 4.1, for what it's worth. Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: fopen
Richard, thanks. chmod($defaultfile, 666); http://php.net/chmod has examples that tell you exactly why this is wrong... The 666 you want is Octal. chmod($defaultfile, 0666); Check. Thanks. Didn't pay enough attention to that. What does the at_sign mean at the start of this line? @ $results = fopen($datafilename, w+); @ means you are IGNORING any errors this generates. Hmm. Thanks. Decent to know. flock($results, 2); #lock file for writing fwrite($results, $filestr); #write $filestr to $results flock($results, 3); #unlock file fclose($results); #close file This is an incorrect way to try to flock a file for writing. You should: 1) Open the file for READING. 2) flock that file handle, so only YOU have access to that file. 3) Re-open the file for WRITING, now that you have control. 4) Write your data 5) Release the lock. Could you show me a correct method, or example please? I admit I'm a little too newbie with flock. I have not used it since my Perl days, and even then ... http://l-i-e.com/artists.htm Didn't know that! Thanks, John -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] access violation
hi all All of a sudden, my local install of Apache has started throwing access violation errors. It's happening pretty frequently, particularly when hitting the refresh button on a page generated from POST data, causing a re-POST, but isn't 100% reproducible. Anyone else had a problem like this? I couldn't find anything in the php or apache bug databases that sounded like the same problem. If anyone has debug mapfiles for the php dlls, or even better, win32 debug builds of 4.3.10, would it be possible to send them to me. I don't have access to MSVC here, so I can't build them myself :( Any suggestions welcome! Windows XP pro SP2 Apache/1.3.33 (Win32) PHP/4.3.10 stack trace: 7C910C27 C:\WINDOWS\system32\ntdll.dll 7C910D5C C:\WINDOWS\system32\ntdll.dll 77C2C2DE C:\WINDOWS\system32\msvcrt.dll 77C39AE9 C:\WINDOWS\system32\msvcrt.dll 77C35F5D C:\WINDOWS\system32\msvcrt.dll 77C35FEC C:\WINDOWS\system32\msvcrt.dll 10047D4E c:\php4\php4ts.dll or sometimes: 77C46137 C:\WINDOWS\system32\msvcrt.dll 100CA6AE c:\php4\php4ts.dll 60002E50 c:\php4\php4apache.dll 6000186F c:\php4\php4apache.dll dll base addresses: 0x6000 php4apache.dll 0x1000 php4ts.dll Rob Agar Web Site Consultant Wild Lime Media - [EMAIL PROTECTED] Studio 1, 70 McLeod Street, Cairns 4870 Tel: 07 4081 6677 | Fax: 07 4081 6679 Web and Software Development Services - www.wildlime.com Search Engine Optimisation Services - search.wildlime.com Professional Website Hosting Services -www.hostonlime.com.au Winner 2004 Telstra North QLD Media Awards - Best Website - Online Content Information -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Different approach?
Jochem, what is the context of the code you posted? ... in a function? class? part of an app? whats its purpose? A singular, tutorial example I put together to show a basic way to connect and write if the table exists, if not create table. why do you need to check/create the table dynamically? Newbie protection. why do you think the way its done now is 'bad'? I'm not that skilled. Just checking with real coders. I'm more of a well-meaning academic who wants to share an idea with other teachers and show them an easy, applicable example of sending score results to a mysql server. It's part of a bigger tutorial: http://compcanlit.usherbrooke.ca/eslcafe/hotpotatoes/hot-potatoes_104.htm I'm still working on it. John Taylor-Johnston wrote: I've read: http://dev.mysql.com/doc/mysql/en/create-table.html Would anyone code/approach this differently? # $server = localhost; $user = myname; $pass = mypass; $db = mydb; $table = demo_assignment1; # $myconnection = mysql_connect($server,$user,$pass); # $sql = CREATE TABLE IF NOT EXISTS `demo_assignment1` ( `StudentNumber` varchar(8) NOT NULL default '', `Exercise1` varchar(100) NOT NULL default '', `Exercise2` varchar(100) NOT NULL default '', `TimeStamp` timestamp(14) NOT NULL, PRIMARY KEY (`TimeStamp`) ) TYPE=MyISAM COMMENT='place something here';; mysql_select_db($db,$myconnection); mysql_query($sql) or die(print mysql_error()); # $sql = INSERT INTO $table (StudentNumber,Exercise1,Exercise2) values ('$StudentNumber','$Exercise1','$Exercise2'); mysql_select_db($db,$myconnection); mysql_query($sql) or die(print mysql_error()); mysql_close($myconnection); -- John Taylor-Johnston - °v° Bibliography of Comparative Studies in Canadian, Québec and Foreign Literatures /(_)\ Université de Sherbrooke ^ ^ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Different approach?
On Thu, Mar 17, 2005 at 11:01:44AM -0500, John Taylor-Johnston wrote: Hi, I've read: http://dev.mysql.com/doc/mysql/en/create-table.html Would anyone code/approach this differently? [...] $sql = INSERT INTO $table (StudentNumber,Exercise1,Exercise2) values ('$StudentNumber','$Exercise1','$Exercise2'); mysql_select_db($db,$myconnection); mysql_query($sql) or die(print mysql_error()); your example looks pretty solid, but the code above does not escape the $StudentNumber, $Exercise1, and $Exercise2 variables. If any of these variables contain data that when placed into the SQL string interferes with the SQL itself, you'll have unexpected failures and also a security hole if untrusted users can populate those variables. The solution is to wrap any strings or untrusted input like that in a call to mysql_escape_string(), like so: $sql = INSERT INTO $table (StudentNumber,Exercise1,Exercise2) values ('. mysql_escape_string($StudentNumber).','. mysql_escape_string($Exercise1).','. mysql_escape_string($Exercise2).'); -jw -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Authorization header is missing from apache_request_headers() array
Richard Lynch wrote: I could be *WAY* wrong, but I thought nobody ever bothered with Digest Auth because, e. It's not better/safer than HTTP Auth? HTTP Basic Authorization send login:password in clear text (only base64 encoded) so it can be 'eavesdropped' in HTTP Digest Authorization password is hashed md5(...) co can not be direct readed. Digest is more secure than Basic and was developed as replacement of Basic You might as well go with SSL if you go to that much trouble? Yes SSL is solution, but when ISP does not support it ... ? Not enough browsers support it? I have tested it with IE5.x, FireFox 1, Opera 7 and all works OK Okay, so clearly I don't remember why I thought this. Google for PHP HTTP Digest Authentication and see what turns up... But don't be surprised if the answer is Not supported -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] obscure error message - PHP Notice: (null)():
Richard Lynch wrote: On Wed, March 16, 2005 2:32 pm, Zinovi Boyadjiev said: I am getting this strange error while developing imap mail to mysql inporting script : PHP Notice: (null)(): Permission denied (errflg=2) in Unknown on line 0 This looks like a custom error message and/or something coming about as a result of using http://php.net/eval actually, last time I saw something like this was when I prepended a (php) file via the auto_append_file setting, and that file /included/ or opened another file that it didn't have access to. :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Drop down list - persistant value
I am using PHP. I have a registration page where the user has to select his country form a drop down list. If the username that the user selected for himself exists in the database I am sending him back to the registration form with all the fields completed with the values he previously entered. This is easy to do for a textfield but how do I indicate on the drop down list which country he originally selected? Please help. Jacques -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Drop down list - persistant value
Jacques wrote: I am using PHP. I have a registration page where the user has to select his country form a drop down list. If the username that the user selected for himself exists in the database I am sending him back to the registration form with all the fields completed with the values he previously entered. This is easy to do for a textfield but how do I indicate on the drop down list which country he originally selected? Set the attribute selected on the country, ie : option value=12 selected=selectedUnited States/option This is really a HTML question, not PHP related. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php