Re: [PHP] php running as module or cgi?
On 11/11/2010 02:14 PM, Didier Gasser-Morlay wrote: On 11/11/2010 12:04 PM, Richard Quadling wrote: On 11 November 2010 00:46, Aln...@ridersite.org wrote: Briefly, what are the trade offs on a typical shared host? I've done a little research and can't seem to find anything outstanding either way. Seems like as an Apache module is faster. This argument makes sense. CGI is more secure, this argument doesn't seem too persuasive to me. Maybe I'm missing something. Thanks As a module, any misbehaving script is running within the same space as all the other scripts. If a script is able to knock out PHP (for any reason), all the script go. With CGI, they are run in separate spaces. No direct communication (unless the scripts are sharing memory by some way). If a script knocks out PHP, that script dies. Everything else keeps on going. The main downside to CGI (as I understand things), is that for each invocation of the script, PHP has to do the complete build up and tear down every single time. For every single script. With FastCGI, when the server starts, a pool of ready to go php instances are created. So a script is called, the build up part is already done. In terms of speed, I'd guess you'd have to be working pretty hard to see the difference between module/isapi and fast-cgi. If I am not mistaken, An apache module can even bring down the whole web server if it really misbehaves. So this leaves the choice between CGI FatsCGI. CGI setup/teardown is only an issue for site with a fairly high traffic. It really depends on the type of site you intend to build. To me, the main security issue with mod_php in a virtual domain configuration is that it runs as the apache user and therefore any php code can read any files accessible to apache. If you have clients maintaining their own php code, they can access the code (and passwords and databases) of your other clients. I've never used cgi but I hope that it allows you to avoid this problem. Am I correct? --John -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] STRING TO ASCII CHARACTERS
Ahmed Saad wrote: On 23/06/06, cajbecu [EMAIL PROTECTED] wrote: $data .= #.ord(substr($string,$i,1)).;; and I think there's no need for substr.. just $data .= #.$string[$i].;; /ahmed And, for the record, you are not converting a string to ASCII, rather an ASCII string to its decimal equivalent. -J -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Running two versions of PHP locally
Just a quick sanity check from a php4 user who's thinking of trying php5: With PHP3 and PHP4 (I thought) you could install both Apache modules and invoke them on a page by page basis based on the extension you assign them in Apache ( .php v. .php4 for example). Are you all saying you can't do that with PHP4 and PHP5? Why not? Thanks, ---J Richard Lynch wrote: With Apache, find Rasmus' post regarding Proxy PHP4 PHP5 in the archives of this very list. You're on your own with IIS. On Fri, May 19, 2006 11:07 am, Phillip S. Baker wrote: Greetings Gents, I am interested in running two versions of of PHP. I want to see if I can get my boss to buy into migrating to PHP 5. I want to set it up locally. Locally I am running apache on a windows XP box with PHP 4. I would like I would like to be able to set up PHP 5 as well on the server and have some folders/virtual hosts set up in php 4 and others in php 5? Is this possible? How would I go about doing it? Thanks Phillip -- 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] Running two versions of PHP locally
Scott Hurring wrote: You should be able to do that with PHP4 and PHP5. However, most people don't wnat to have to use php5 and php4 as file extensions but rather want to be able to say, everything on blah.com use php5 and everything on foo.org use php4... or even to specify differeing versions within a single host (on a per-directory basis) I would think you could do this on a domain-by-domain basis by using the AddType directive for that domain's root directory. But you would need to associate different 'types' for php4 and php5. It looks like 'application/x-httpd-php' is the default type for php4. Does php5 have a different type? Is there a way to explicitly assign a new type to a module? To be more explicit: When installing php5, what do I need to do to make this configuration work: VirtualHost *:80 ServerName myPhp4domain.com DocumentRoot /allmydomains/myPhp4domain ... Directory /allmydomains/myPhp4domain AddType application/x-httpd-php .php ... /Directory /VirtualHost VirtualHost *:80 ServerName myPhp5domain.com DocumentRoot /allmydomains/myPhp5domain ... Directory /allmydomains/myPhp5domain AddType application type assigned to php5 .php ... /Directory /VirtualHost If this is possible, it would be a much cleaner upgrade path than mixing a module and a cgi setup. After all, the goal is to be able to upgrade from php4 to php5, gradually, on a domain-by-domain or even page-by-page basis. Forcing a transition to cgi along with a transition to PHP5 compounds the complexity of the task. (I've never run under cgi, but it's my impression that module and cgi installations have some signifcantly different behaviors, not a transition that should be done without good reason.) After I started writing this Richard Lynch posted: Are you all saying you can't do that with PHP4 and PHP5? Why not? I think because the internal Apache/PHP hacks that made that possible in 3/4 are not as readily done in 4/5 Feel free to submit a patch, though if you think it can be done. :-) If this can't be done, I would think it would be a major impediment to the adoption of PHP5 at existing PHP4 installations. Someone (probably more proficient at C than I am) should be doing a patch. --John You can easily accomplish this by using PHP4 as a module and PHP5 as CGI (and i'm sure other ways as well, but ive only personally done it this way) It makes it very easy to selectively downgrade (or upgrade) depending on your needs without having to jump through file-naming hoops or proxy ports, etc... On 5/19/06, John Hicks [EMAIL PROTECTED] wrote: Just a quick sanity check from a php4 user who's thinking of trying php5: With PHP3 and PHP4 (I thought) you could install both Apache modules and invoke them on a page by page basis based on the extension you assign them in Apache ( .php v. .php4 for example). Are you all saying you can't do that with PHP4 and PHP5? Why not? Thanks, ---J Richard Lynch wrote: With Apache, find Rasmus' post regarding Proxy PHP4 PHP5 in the archives of this very list. You're on your own with IIS. On Fri, May 19, 2006 11:07 am, Phillip S. Baker wrote: Greetings Gents, I am interested in running two versions of of PHP. I want to see if I can get my boss to buy into migrating to PHP 5. I want to set it up locally. Locally I am running apache on a windows XP box with PHP 4. I would like I would like to be able to set up PHP 5 as well on the server and have some folders/virtual hosts set up in php 4 and others in php 5? Is this possible? How would I go about doing it? Thanks Phillip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] safe_mode
tedd wrote: Hi gang: Please excuse me for asking another dumb-ass question, but here goes. I'm finding that setting safe_mode to ON is more difficult than I first thought. In my phpinfo, safe_mode is set to OFF However, if I try to set it to ON in my .htaccess such as: php_value safe_mode 1 It doesn't work. If I set it in my code, such as: ini_set( 'safe_mode', '1' ); It still doesn't work. You would think the fine manual would explain this here: http://us3.php.net/manual/en/features.safe-mode.php Table 42-1. Security and Safe Mode Configuration Directives Name: safe_mode Default: 0 Changeable: PHP_INI_SYSTEM but you have to look here http://us3.php.net/manual/en/ini.php to find just what PHP_INI_SYSTEM means: Table G-2. Definition of PHP_INI_* constants Constant: PHP_INI_SYSTEM Value: 4 Meaning: Entry can be set in php.ini or httpd.conf i.e. *not* in .htaccess or by ini_set() --John -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Need help calling PHP page from another server.
Robert Filipovich wrote: I am using a chat program and trying to call the status page from another server and the graphic that the page returns does not show up. It works if you are calling from the webserver that the chat program is working so i feel it is some type of config problem or security issue. http://www.hidho.com/chattest.htm is the page that uses the code a href=javascript:pophelp(' http://chat.siuprem.com/siupchat/client.php',500,500)img src= http://chat.siuprem.com/siupchat/statusimage.php;/a and it works on http://chat.siuprem.com/siupchat/chattest.htm which is the windows IIS sesrver where PHP is running. Do you have access to the source of statusimage.php? (I have a hunch it is checking the request's referer.) --J -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Need help calling PHP page from another server.
John Hicks wrote: Robert Filipovich wrote: I am using a chat program and trying to call the status page from another server and the graphic that the page returns does not show up. It works if you are calling from the webserver that the chat program is working so i feel it is some type of config problem or security issue. http://www.hidho.com/chattest.htm is the page that uses the code a href=javascript:pophelp(' http://chat.siuprem.com/siupchat/client.php',500,500)img src= http://chat.siuprem.com/siupchat/statusimage.php;/a and it works on http://chat.siuprem.com/siupchat/chattest.htm which is the windows IIS sesrver where PHP is running. Do you have access to the source of statusimage.php? (I have a hunch it is checking the request's referer.) --J Since this is open source code ('phpOnline') available at http://www.dayanahost.com/phponline.cfm I guess it's safe to post an excerpt here: ... [a number of mysql statements without error checking or other exits] ... [concluding with:] header (Content-type: image/jpeg); if($LastAdmLoginTime==0 || $LastAdmLoginTime($TTime-120)) { echo implode('', file('pathtooffline.jpg')); $OnlineStatus = 0; } else { echo implode('', file('pathtoonline.jpg')); } Since both of these images are present (i.e. can be accessed directly) and since there isn't any exit prior to the execution of the above statement, I conclude that the program must be erring out before it gets here. Check your php error log first. If you don't find anything there then edit the program to add error checking for all the sql commands. You might also find help at the phpOnline forums: http://www.dayanahost.com/forum2/index.php?act=SFf=11; If you can't find the problem, since the program is short, you could post it to the list. --J -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Need help calling PHP page from another server.
Please reply to the list. Robert Filipovich wrote: I got this in the event viewer when I enabled suslogging. The description for Event ID ( 2000 ) in Source ( php ) cannot be found. The local computer may not have the necessary registry information or message DLL files to display messages from a remote computer. The following information is part of the event: php[144], PHP Notice: Undefined index: HTTP_REFERER in C:\siupchat\statusimage.php on line 52. I can't grok this easily since it looks like it's coming from a strange OS, but if I were you, I would begin by looking at line 52. --J P.S. Please reply to the list. On 5/18/06, *Robert Filipovich* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Why do you think it works on the local site? Is it access to MySQL? Seems weird since the provcessing should still be server side on the MySQL stuff. I will see what I can find in the log. /Robert On 5/18/06, *John Hicks* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: John Hicks wrote: Robert Filipovich wrote: I am using a chat program and trying to call the status page from another server and the graphic that the page returns does not show up. It works if you are calling from the webserver that the chat program is working so i feel it is some type of config problem or security issue. http://www.hidho.com/chattest.htm is the page that uses the code a href=javascript:pophelp(' http://chat.siuprem.com/siupchat/client.php',500,500) http://chat.siuprem.com/siupchat/client.php',500,500)img src= http://chat.siuprem.com/siupchat/statusimage.php http://chat.siuprem.com/siupchat/statusimage.php/a and it works on http://chat.siuprem.com/siupchat/chattest.htm http://chat.siuprem.com/siupchat/chattest.htm which is the windows IIS sesrver where PHP is running. Do you have access to the source of statusimage.php? (I have a hunch it is checking the request's referer.) --J Since this is open source code ('phpOnline') available at http://www.dayanahost.com/phponline.cfm http://www.dayanahost.com/phponline.cfm I guess it's safe to post an excerpt here: ... [a number of mysql statements without error checking or other exits] ... [concluding with:] header (Content-type: image/jpeg); if($LastAdmLoginTime==0 || $LastAdmLoginTime($TTime-120)) { echo implode('', file('pathtooffline.jpg')); $OnlineStatus = 0; } else { echo implode('', file('pathtoonline.jpg ')); } Since both of these images are present (i.e. can be accessed directly) and since there isn't any exit prior to the execution of the above statement, I conclude that the program must be erring out before it gets here. Check your php error log first. If you don't find anything there then edit the program to add error checking for all the sql commands. You might also find help at the phpOnline forums: http://www.dayanahost.com/forum2/index.php?act=SFf=11; http://www.dayanahost.com/forum2/index.php?act=SFf=11; If you can't find the problem, since the program is short, you could post it to the list. --J -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Object Array?
Jay Paulson wrote: I have an object from using simpleXML and inside that object is an array holding even more objects. However, it's not acting like an array and therefore I can't go through it. (i.e. I can't use the count function to see how big it is and loop through it) This below should be an array: $xml-RES-R When I use print_r($xml-RES) I get the below. As you can see [R] = Array but yet in the above example it is an object. I'm so confused and lost. Can anyone help? PHP version 5.0.4 SimpleXMLElement Object ( [M] = 2010 snip [R] = Array ( [0] = SimpleXMLElement Object ( [U] = http://.../benefits/ snip ) [1] = SimpleXMLElement Object ( [U] = http://.../benefits/benefits_websites.html snip ) [2] = SimpleXMLElement Object ( [U] = http://www..com/jobs//benefits.html You are right: $xml-RES-R is an array. If it doesn't act like an array, you might try assigning it to a new variable. Maybe something like this: $MyArray = $xml-RES-R; print_r($MyArray); Others might have better ideas. Keep trying. --J -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Need help calling PHP page from another server.
Robert Filipovich wrote: Looks like all of these are happening. The description for Event ID ( 2000 ) in Source ( php ) cannot be found. The local computer may not have the necessary registry information or message DLL files to display messages from a remote computer. The following information is part of the event: php[400], PHP Notice: Undefined index: ocode in C:\siupchat\statusimage.php on line 39. The description for Event ID ( 2000 ) in Source ( php ) cannot be found. The local computer may not have the necessary registry information or message DLL files to display messages from a remote computer. The following information is part of the event: php[1812], PHP Notice: Undefined index: ocode in C:\siupchat\statusimage.php on line 39. The description for Event ID ( 2000 ) in Source ( php ) cannot be found. The local computer may not have the necessary registry information or message DLL files to display messages from a remote computer. The following information is part of the event: php[1444], PHP Notice: Undefined index: HTTP_REFERER in C:\siupchat\statusimage.php on line 52. It is on an IIS server. Any ideas what PHP.ini setting is causing this error? Thanks, /Robert I see no reason why the trouble would lie with php.ini. I'll bet it has something to do with undefined variables. But these are merely notices, not errors, so they don't explain why you never get to the bottom of the program. Have you patched statusimage.php yet to report mysql errors? (Display your sql statements while you are at it.) I posted the (GNU open) source here: http://johnhicks.org/statusimage.phps in case someone else on the list would care to look. --J On 5/18/06, *John Hicks* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Please reply to the list. Robert Filipovich wrote: I got this in the event viewer when I enabled suslogging. The description for Event ID ( 2000 ) in Source ( php ) cannot be found. The local computer may not have the necessary registry information or message DLL files to display messages from a remote computer. The following information is part of the event: php[144], PHP Notice: Undefined index: HTTP_REFERER in C:\siupchat\statusimage.php on line 52. I can't grok this easily since it looks like it's coming from a strange OS, but if I were you, I would begin by looking at line 52. --J P.S. Please reply to the list. On 5/18/06, *Robert Filipovich* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Why do you think it works on the local site? Is it access to MySQL? Seems weird since the provcessing should still be server side on the MySQL stuff. I will see what I can find in the log. /Robert On 5/18/06, *John Hicks* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: John Hicks wrote: Robert Filipovich wrote: I am using a chat program and trying to call the status page from another server and the graphic that the page returns does not show up. It works if you are calling from the webserver that the chat program is working so i feel it is some type of config problem or security issue. http://www.hidho.com/chattest.htm is the page that uses the code a href=javascript:pophelp(' http://chat.siuprem.com/siupchat/client.php',500,500) http://chat.siuprem.com/siupchat/client.php',500,500)img src= http://chat.siuprem.com/siupchat/statusimage.php http://chat.siuprem.com/siupchat/statusimage.php http://chat.siuprem.com/siupchat/statusimage.php/a and it works on http://chat.siuprem.com/siupchat/chattest.htm http://chat.siuprem.com/siupchat/chattest.htm which is the windows IIS sesrver where PHP is running. Do you have access to the source of statusimage.php? (I have a hunch it is checking the request's referer.) --J Since this is open source code ('phpOnline') available at http://www.dayanahost.com/phponline.cfm http://www.dayanahost.com/phponline.cfm http://www.dayanahost.com/phponline.cfm I guess it's safe to post an excerpt here: ... [a number of mysql statements without error checking or other exits] ... [concluding with:] header
Re: [PHP] Need help calling PHP page from another server.
Stut wrote: John Hicks wrote: Robert Filipovich wrote: Looks like all of these are happening. The description for Event ID ( 2000 ) in Source ( php ) cannot be found. The local computer may not have the necessary registry information or message DLL files to display messages from a remote computer. The following information is part of the event: php[400], PHP Notice: Undefined index: ocode in C:\siupchat\statusimage.php on line 39. The description for Event ID ( 2000 ) in Source ( php ) cannot be found. The local computer may not have the necessary registry information or message DLL files to display messages from a remote computer. The following information is part of the event: php[1812], PHP Notice: Undefined index: ocode in C:\siupchat\statusimage.php on line 39. The description for Event ID ( 2000 ) in Source ( php ) cannot be found. The local computer may not have the necessary registry information or message DLL files to display messages from a remote computer. The following information is part of the event: php[1444], PHP Notice: Undefined index: HTTP_REFERER in C:\siupchat\statusimage.php on line 52. It is on an IIS server. Any ideas what PHP.ini setting is causing this error? Thanks, /Robert I see no reason why the trouble would lie with php.ini. I'll bet it has something to do with undefined variables. But these are merely notices, not errors, so they don't explain why you never get to the bottom of the program. Short answer... change the value of error_reporting in php.ini to not report notices. I'm guessing the script isn't working because it's outputting the errors, in which case doing this should fix it. Long answer... ignoring notices leads to sloppy coding and should be avoided where possible. If I were you and I had the opportunity I'd drop this OSS package in favour of something where the developers do not cut corners. -Stut Stut and Richard make a good point that these notices shouldn't be taking place, but I don't believe they would cause your program to err out (although you *are* using a strange OS, so I could be wrong). Try to catch your mysql errors (as I've sid before) and throw in a few debug displays to narrow it down. --J -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] touch()ing it....advise needed.
Ryan A wrote: Hey, Heres my setup, I have a directory full of files and I get a request with an array of filenames For this example: a.txt b.txt c.txt if the above files dont already exist I need to create them (I am using touch() instead of fopen()) My question is which would you recommend, doing a readdir() and getting all the existing filenames in an array then doing a loop to see which exists and create the others OR just taking the new filenames, doing a while/for loop with a files_exists() on each and then creating the files I am favouring the second approach as in the first approach there are a lot of files the array could be pretty big which would cause other problems, but I would rather be corrected now if my thinking is flawed. It depends on: --the number of files in the directory --the the number of files being added/updated --the liklihood that a file in the request will be new Here are a couple of general principles to follow: --KISS. Start with the simplest solution. Complicate it only to optimize it and then only if optimization is really necessary. --A system call is relatively expensive and time-consuming. If you are literally only touching the files that don't exist (to create an empty file), consider building a shell script that does the whole batch in one system call. --John -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] getting $_GET params from iFrame window to parent
blackwater dev wrote: would like to put the search form somewhere else on their site (it is currenly all on my page within the iframe) and then call their search page to do the search, (This is an html/DOM thing, not PHP.) That's what the 'target' property of the form tag does: the response from the request from that form is directed to a different window (or to a different frame within the current frameset). You give the receiving window a name (when you create it) and refer to that name in the target argument. --John -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php parsing and db content [RESOLVED]
Schalk Neethling wrote: Chris wrote: Schalk wrote: Chris wrote: Chris wrote: actually if it's only one variable, this might do it for you: $content = str_replace('?php echo _root ?', _root, $content); but that's still a bad way to do this. Chris, This works: $breadcrumb = $row_pathway['pathway']; $breadcrumb = str_replace('?php echo _root ?', _root, $breadcrumb); echo $breadcrumb; However, I would still like to know why this is a bad way to do this and hopefully find a better way. Still learning all the aspects of PHP so any input is appreciated. Because you're including your config details in your data (I don't think you should do this, but others may disagree). The str_replace method should be pretty fast and won't introduce any security issues like the 'eval' method I originally mentioned would. Thank you for all of your help Chris. Much appreciated. But how did you resolve it? (You should have been able to include a file containing ?php echo ... ? directives and have them correctly interpreted.) --John -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] getting $_GET params from iFrame window to parent
blackwater dev wrote: On 5/11/06, *John Hicks* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: blackwater dev wrote: would like to put the search form somewhere else on their site (it is currenly all on my page within the iframe) and then call their search page to do the search, (This is an html/DOM thing, not PHP.) That's what the 'target' property of the form tag does: the response from the request from that form is directed to a different window (or to a different frame within the current frameset). You give the receiving window a name (when you create it) and refer to that name in the target argument. --John Sorry John, I thought this might not be a php issue so I'll do more research on it now. So I gave my iFrame a name: IFRAME name=mysite align=middle marginWidth=0 marginHeight=0 frameBorder=0 src= http://www.mysite.com; width=100% height=9000/IFRAME Then on the parent page have a form: form name=search method=get action= parent.htm target=mysite input type=hidden name=aid value=6 input type=submit /form Can I really specify another target other than _parent, _self, etc? No, it was a joke. I was kidding. Maybe you will believe the FM: http://www.w3.org/TR/html4/present/frames.html#adef-target Remember to post your replies to the list!! --J -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] BDC to ASCII Conversion
Jay Blanchard wrote: I have been searching, but does anyone know of a BDC to ASCII conversion tool for PHP right off the top of their head? If not, I'll have to write one I haven't heard of BDC. Did you mean BCD (binary coded decimal)? Or possibly EBCDIC? (What platform is this data coming from?) If it's EBCDIC data, there are plenty of translation tables you can use, (but you won't find a one-to-one correspondence in their character sets). --J -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Status report on mailing list?
Spam has suddenly swamped the PHP mailing lists. (Some of you may have better filters than I and not noticed it.) Apparently the list had been moved to a new server and it hasn't been configured properly yet. I fear many will unsubscribe and the list will lose much of its utility if it's not fixed soon. Does anyone have any info on what happened and when it will be fixed? --J -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Quotation marks considered harmful
John Wells wrote: Personally, I get tired (and confused) when having to escape all of those quotes like in the string you're trying to echo above. Perhaps you'd consider HEREDOC as an alternative approach: Here's n idea I've had and never expressed publicly before. I wonder if some of you haven't thought the same thing: Why not develop a language syntax that has distinct open and close string delimiters? So (in an ideal world) the code in question echo td width=\25%\ align=\center\ a href=\javascript:open_window('$php_self?action=view_recorduserid=$userid');\ view/a a href=\$php_self?action=delete_recorduserid=$userid\ onclick=\return confirm('are you sure?');\delete/a/td ; would be rendered something like this: echo { td width={25%} align={center} a href={javascript:open_window({$php_self?action=view_recorduserid=$userid});} view/a a href={$php_self?action=delete_recorduserid=$userid} onclick={return confirm({are you sure?});}delete/a/td }; or like this: echo [ td width=[25%] align=[center] a href=[javascript:open_window([$php_self?action=view_recorduserid=$userid]);] view/a a href=[$php_self?action=delete_recorduserid=$userid] onclick=[return confirm([are you sure?]);]delete/a/td ]; Of course, having separate characters for opening and closing double or single quotes would work, but that would require changing the basic ASCII set. I believe some European languages use and as quotation marks. What ASCII characters do they use? I have seen some JavaScript code that uses curly braces to delimit a string, but can't find that documented anywhere. Thoughts anyone? --J -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] javascript
darren wrote: I have a form that resides within a php function(). And, I would like to call a javascript function from an onChange event of a selection tag (a drop down list box). Your page's problem is entirely a Javascript problem. Has nothing to do with PHP: Try moving the onchange from the option tag to the enclosing select tag. (It is the value of the select that changes when a different option is selected.) Now for the lecture: Is there any problem with trying to call a javascript function from within a php function? Yes, it's impossible. PHP is executed on the server. Javascript is executed in the browser. So Javascript cannot be called from PHP running on the server. PHP is a document generator. You can use it to generate Javascript the exact same way you use it to generate HTML. But the resulting Javascript won't be executed till it gets to the browser. The main problems you'll have generating Javascript from PHP are: --keeping control of all the embedded quotes. --keeping control of the embedded logic (and remembering to remember that the Javascript part isn't being executed just yet :) Regards, -J -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Possible?
René Fournier wrote: Simple problem: Many client apps need to send data to a server. By default each client will open a persistent TCP socket connection to a common IP address:port (10.10.10.10:1234) and write to it (which the server will save/log, etc.). My question is, what should be ready to listen at the IP:port? I was thinking of writing a PHP command-line socket server that listens at that port. But there will be a potentially huge number of clients connecting simultaneously (1000s), not transmitting a lot of data per se, but a lot of connections... Anyway, instead I thought writing a simple PHP script—say, listener.php—that gets executed by the web server and enters a socket_read loop until the client terminates the connection (set_time_limit(0)). Does this sound like a good way to do it? This way, Apache handles all the connections, and PHP is instantiated each time, but without having to fork processes, etc, and without having to do PHP CLI. Anyway, I've started looking at this, but I'm not quite sure if it's even possible. I mean, can something send a request to Apache, and continue to write data along that TCP socket? Normally, HTTP requests include GET or POST for such data, but this is not a a web browser that's opening the connection. Hope I'm somewhat clear. Just struggling through some options here Anyway, thanks in advance for any suggestions. ...Rene each client will open a persistent TCP socket connection to a common IP address:port (10.10.10.10:1234) (If you want simultaneous connections, each TCP connection will be to a different port.) But rather than write a client and a server application from scratch, why not just use HTTP POSTs? Keep It Simple, Stewart. --John -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] RegExp for preg_split()
Weber Sites LTD wrote: Hi I'm looking for the RegExp that will split a search string into search keywords. while taking into account. From what I managed to find I can get all of the words into an array but I would like all of the words inside to be in the same array cell. You want to use preg_match_all, not preg_split: $String = 'Medaillons, Listels, custom stuff, more things, entryway, accents, showplace'; $MyRegEx = '/[^]+|[^\s,]+/'; preg_match_all($MyRegEx, $String, $Tokens); echo 'pre'; var_dump($Tokens); produces: array(1) { [0]= array(7) { [0]= string(10) Medaillons [1]= string(7) Listels [2]= string(14) custom stuff [3]= string(13) more things [4]= string(8) entryway [5]= string(7) accents [6]= string(9) showplace } } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] CMS for Auto Parts
CK wrote: Hi, On Apr 22, 2006, at 1:26 PM, John Hicks wrote: CK wrote: Hi, I've been commissioned to design a web application for auto parts sales. The Flash Front end will communicate with a MySQL DB via PHP. In addition, PHP/XML should be used with a client-side Web GUI to upload images, part no., descriptions and inventory into the DB; a Product Management System. I am curious as to how you plan to using XML for the client's back end? (I don't see any reason to use it.) Using XML to keep an inventory dynamically, was the thought. The XML file would be updated with each entry, then could be imported into a spreadsheet. If you are storing your inventory in an XML document, then what are you using the MySQL database for? After Googling the returned queries have been slim, any leads on more specific examples? What specifically are you looking for and how are you googling for it? --John -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] CMS for Auto Parts
CK wrote: Hi, I've been commissioned to design a web application for auto parts sales. The Flash Front end will communicate with a MySQL DB via PHP. In addition, PHP/XML should be used with a client-side Web GUI to upload images, part no., descriptions and inventory into the DB; a Product Management System. I am curious as to how you plan to using XML for the client's back end? (I don't see any reason to use it.) After Googling the returned queries have been slim, any leads on more specific examples? What specifically are you looking for and how are you googling for it? --John -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Run Apache/PHP/MySQL from CD?
Jay Paulson wrote: I have no idea if this is possible or not but is there a way to run Apache, PHP, and MySQL from a CD? I'd like it to be possible to run it on Windows, Mac OSX and *nix. If it is possible could someone point me in the right direction? Thanks! XAMPP is a distribution of Apache, MySQL, PHP and Perl and is available for Linux, Windows, OS X, and Solaris. http://www.apachefriends.org/en/xampp.html XAMPP-on-a-stick takes that a step further and installs it on a USB drive. http://forum.textdrive.com/viewtopic.php?id=3081 Hope that helps. --John -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Timestamp needed in error log
I would like to configure my PHP 4.3 to include a timestamp in its error messages. It appears that PHP defaults to no timestamp. I can't a find a directive that allows me to configure this. Do I have to recompile? I've never looked at the source before. Any pointers on where I should look for the error message generation? I posted a similar query a week ago and got no response. Any response would be appreciated: --Does anyone have a PHP that is configured with a timestamped error log? --Is there a reason not to have a timestamp? --Would you, like me, like to have the date and time in the error messages? Thanks, John Hicks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php newbie having trouble going to detail page
David Doonan wrote: I'm having trouble getting the correct results on a display page. The first query is pulling the name of active authors from the d/b and sending a request to only return essay titles by the requested author. The list page however is displaying essay titles by all authors. No doubt something is wrong with the where clause in the List page query. I've tried countless variations on the syntax for Author.ID = Author.ID without success. Sorry for so basic a question. - author page query = $query_GetAuthors = SELECT Distinct Author.Autholr_Name, Author.ID, Writings.Writings_Author FROM Author, Writings WHERE Author.Autholr_Name = Writings.Writings_Author and Author.ID = Author.ID; $GetAuthors = mysql_query($query_GetAuthors, $connDerbyTrail) or die (mysql_error()); $row_GetAuthors = mysql_fetch_assoc($GetAuthors); $totalRows_GetAuthors = mysql_num_rows($GetAuthors); author page link = a href=author.php?ID=?php echo $row_GetAuthors['ID']; ??php echo $row_GetAuthors['Autholr_Name']; ?/a - List page query = $query_GetAuthorList = SELECT Writings.Writings_Author, Writings.Writings_Title, DATE_FORMAT(Writings_Date, '%M %D, %Y') as Writings_Date, Writings.Writings_Text, Writings.ID, Author.Autholr_Name, Author.ID FROM Writings, Author WHERE Writings.ID = Writings.ID AND Author.Autholr_Name = Writings.Writings_Author AND Author.ID = Author.ID ORDER BY Writings.Writings_Date desc; $GetAuthorList = mysql_query($query_GetAuthorList, $connDerbyTrail) or die(mysql_error()); $row_GetAuthorList = mysql_fetch_assoc($GetAuthorList); $totalRows_GetAuthorList = mysql_num_rows($GetAuthorList); david David-- First of all, yours is purely a SQL problem, so would get better response from the PHP-DB or MySQL list. But a quick glance at your SQL shows that your second query returns all writings by all authors because you don't include anything to narrow it down to one author: WHERE Writings.ID = Writings.ID AND Author.Autholr_Name = Writings.Writings_Author AND Author.ID = Author.ID First of all: Writings.ID = Writings.ID and Author.ID = Author.ID are nonsense. Every query will match those crieria. In other words, you'd probably best take an hour or so to RTF 'Intro to SQL M.' Here's another hint: You have no PHP variable in your SQL query. That means you execute the same exact query every time you run it. So you will get the same exact results every time. So your solution is this: Include a PHP variable in your SQL query to specify which author you want to select. You probably want something like this: WHERE Author.Author_Name = Writings.Author_Name AND Author.ID = '$MySelectedAuthorID' (but remember to define $MySelectedAuthorId before running it :) Good luck and post again with your progress. John -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] include path file errors
kmh496 wrote: 2006-04-08 (토), 18:20 +0900, kmh496 쓰시길: hi, my webroot is /a/b/current/ i am in /a/b/current/d/file.php file.php has a line require_once ($_SERVER[document_root]./d/common.php); common.php has a line which says require_once ($_SERVER[document_root]./_common.php); // main include file for whole site it sends me no errors about missing files, but the variables inside main include file _common.php are not set and don't exist in file.php where is my mistake? I am going to say this is screwed up. i can't include a file inside another included file and access its variables. all i can do is include the main file in every single file in a backwards manner -- reaching down the chain -- because i find that if i do 2 includes then the initail data is no longer included. but sometimes there is magic going on, but then i move one file and then the whole system breaks, it makes me crazy. even more so because i can't explain it well because it's so freaky. is there no tutorial on advanced php with all this include stuff? i RTMFM but the page didn't address advanced questions like that. and despite my english i believe i am advanced level. thankx everybody. joseph Just a thought: Are your variable definitions, by any chance, inside functions? That would explain why they aren't set when you continue. The 'global' statement will help in that case. I can assure you that includes are not advanced PHP. You should be able to do what you are trying to do. There is no doubt a simple explanation for your problem. Finding it is always the hard part. Patience and perserverence and calm rational thought will get you there. Good luck. John -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] include path file errors
kmh496 wrote: hi, my webroot is /a/b/current/ i am in /a/b/current/d/file.php file.php has a line require_once ($_SERVER[document_root]./d/common.php); common.php has a line which says require_once ($_SERVER[document_root]./_common.php); // main include file for whole site it sends me no errors about missing files, but the variables inside main include file _common.php are not set and don't exist in file.php where is my mistake? muchas gracias. KMH-- It's hard to say without seeing your code, but here are a few thoughts. Remember that require_once is conditional. A given file will only be included once for an entire response. (You might patch them from 'require_once' to 'require' to see if that makes a difference, although of course it may break something else.) You may need to do some basic trace debugging: i.e. inserting displays (echos to the output or error_log() entries) to trace exactly what is happening. Good luck! John -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php newbie having trouble going to detail page
David Doonan wrote: On Apr 8, 2006, at 11:24 AM, John Hicks wrote: So your solution is this: Include a PHP variable in your SQL query to specify which author you want to select. You probably want something like this: WHERE Author.Author_Name = Writings.Author_Name AND Author.ID = '$MySelectedAuthorID' (but remember to define $MySelectedAuthorId before running it :) John, Taken your suggestion and added a variable, but the list page is now returning no records. The ID, which is showing up in the URL, is being passed from the first page to the list page (http://localhost/ Der/writings/author.php?ID=5) but the list page is not accepting that variable New Query for list page= mysql_select_db($database_connDer, $connDer); $recordID = $_GET['recordID']; $query_GetAuthorList = SELECT Writings.Writings_Author, Writings.Writings_Title, DATE_FORMAT(Writings_Date, '%M %D, %Y') as Writings_Date, Writings.Writings_Text, Writings.ID, Author.Autholr_Name, Author.ID FROM Writings, Author WHERE Author.Autholr_Name = Writings.Writings_Author and Author.ID = '$recordID' ORDER BY Writings.Writings_Date desc; $GetAuthorList = mysql_query($query_GetAuthorList, $connDerl) or die (mysql_error()); $row_GetAuthorList = mysql_fetch_assoc($GetAuthorList); $totalRows_GetAuthorList = mysql_num_rows($GetAuthorList); If this were a ColdFusion page, I would simply replace Author.ID = '$recordID' with ID = #ID#. I'll take your suggestion and post in the PHP-DB list. david David-- Note that your request URL has a value for 'ID' whereas your program is looking for a value for 'recordID'. Try displaying your SQL query on the output page. I have a hunch it'll say Author.ID = '' --John -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How to get a timestamp in error log?
My RHES4 configuration omits the timestamp when generating a PHP error message in the (Apache) error log. But regular apache errors *do* have a timestamp. Is this normal? How can I get the timestamp for the PHP errors as well? Thanks, John -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Do I need to recompile Apache2 --with-apxs for PayPal PHP SDK?
I'm trying to install and configure PayPal Website Payments Pro using the PayPal PHP SDK. The first step in the SDK Quickstart instructions is: Enable Apache modules and APXS (Apache Extension Tool) In your Apache root directory, run: ../configure ?enable-mod=so --with-apxs /usr/local/apache/bin/apxs (sic) I think of the ./configure directive as a precursor to compiling with make, yet there is no mention made of running make. I'm running RHEL 4.1 with Apache 2 precompiled. I can see that modules are enabled, but I'm guessing it wasn't compiled with apxs since I just installed apxs 10 minutes ago. (FWIW, it's part of the httpd-devel package.) But, then, when I search the Apache site, I see no mention of a --with-apxs directive for Apache 2 (only for Apache 1.3). So I'm thinking the instructions may be a little off. Is there such a directive for Apache 2? So I'm wondering if this step is really necessary. I hate to futz with a perfectly fine Red Hat installation if it isn't. Does anyone know how PayPal uses apxs? Does it actually build its own module to be loaded into apache? If I proceed without recompiling Apache, how will I be able to tell if my existing installation of Apache is inadequate? Any help would be appreciated. Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Permissions on uploaded image don't allow for over writing
Dave wrote: PHP List, The Situation: I am building a content management system where users can, among other things, upload images into a directory. The Problem: The image uploads fine, but once it's there, it can't be over written. So if a user uploads an image, and then changes his or her mind and wants to upload a new version over it, the file upload fails. What I've Tried So far: I can manually edit the file permissions using chmod and setting the files to 777. But of course that's not something I want to have to do every time someone uploads a file. I don't know enough about file permissions and settings to know how I can set these permissions at the time that someone makes the upload. The Question: How do I allow a user, who is uploading via the web, place an image on the server with permissions that allow the file to be over written? Check the permissions on the file you have uploaded. Who is the owner? Does the user running PHP have the 'w' permission? Try 'chown'ing the image directory to the user that is running PHP. -John -John -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Writing static file from dynamic PHP page
Chris Bruce wrote: Hi, I am looking for a way to write to a file what the browser would see (raw html) when viewing a dynamic PHP page. I have numerous include files, MySQL db queries, loops etc. and I want to generate the static result of that file and save it as an html page. I have toyed a little with output buffering to no avail. Is there an easy way to do this? Thanks, Chris Here's a great article on the subject from the Zend website: http://www.zend.com/zend/art/scriptcaching.php It's a little more complex than you would hope but is well thought out. --Separate directories is set up to hold the php source and the cached html. --The cached html directory is initially empty. --An Apache ErrorDocument directive is used to intercept the 404 document not found error when someone is requesting a page and to redirect it to a single caching script. --This caching script uses fopen() to open and then read the php script and to write the output to the cached html directory. Hats off to Zend for publishing this. It competes with their Zend Cache product. From the article: If your site contains a few small scripts, you may not need to bother with caching at all. On the other hand, if you rely on complex scripts and fresh data, you should use a much more sophisticated solution, such as the Zend Cache http://www.zend.com/store/products/zend-cache.php. But if you are somewhere in between, I hope this article will be of help to you. If you have any comments, please feel free to email me. (Sorry to take so long to post this. I had remembered reading the article but couldn't find it. Finally thought to do a Google for 404 php cache.) Hope this helps, -John -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] searching and sorting
Michael Sims wrote: Richard Lynch wrote: Brian A. Anderson wrote: [...] I am thinking of incrementally adding the resultant hits into two associative arrays with the link to the data and a calculated relevance value, and sorting this array by these relevences. [...] One Axiom: Keep as much of the scoring/sorting in your SQL as possible -- That's what SQL engines are best at. I suggest the original poster look into some of the full text indexing capabilities of his SQL server. A lot of these (for PostgreSQL and MySQL anyway) will automatically return a relevance value and handle sorting based on that. As you said, that'll be a heck of a lot more efficient and easier to implement that doing it in PHP. Agreed. I use MySQL's full-text indexing and sort by the relevance score, and it works well. If you do a search for a business at this (now retired) site: http://lwcc.gulfbridge.com , you'll see the relevance scores in parentheses next to each result. One trick I use to limit the display to the most relevant items is to look for a significant drop in this score from one item to the next. I stop listing when the score drops by 40% or so from the last item displayed. -John -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP - mail problems - HELP!!! PLEASE
Kelly wrote: I am having trouble with PHP 5.0.3. I am running Apache 1.3.29. I am running Solaris 9 x86 on an Intel box. I get no errors when I start Apache. I get no errors when I run configtest. My problem is mail() does not work. It does invoke sendmail as there is activity in sendmail log. When I get an error page it does not display PHP is exposed. It is exposed in php.ini. register_globals is turned on right now. Variables to parse into values. $MESG = $_POST['comments']; parses to values. This is the log from sendmail. The first is sending mail from WEBMIN. The second is sending from PHP mail(). 'WEBMIN' Jan 14 20:03:13 www sendmail[17613]: [ID 801593 mail.info] j0F23DBA017613: [EMAIL PROTECTED], size=889, class=0, nrcpts=1, msgid=[EMAIL PROTECTED], [EMAIL PROTECTED] Jan 14 20:03:14 www sendmail[17616]: [ID 801593 mail.info] j0F23D4b017616: from=[EMAIL PROTECTED], size=1083, class=0, nrcpts=1, msgid=[EMAIL PROTECTED], proto=ESMTP, daemon=MTA-v4, relay=localhost [127.0.0.1] Jan 14 20:03:14 www sendmail[17613]: [ID 801593 mail.info] j0F23DBA017613: [EMAIL PROTECTED], [EMAIL PROTECTED] (0/1), delay=00:00:01, xdelay=00:00:01, mailer=relay, pri=30889, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (j0F23D4b017616 Message accepted for delivery) Jan 14 20:03:15 www sendmail[17618]: [ID 801593 mail.info] j0F23D4b017616: to=[EMAIL PROTECTED], ctladdr=[EMAIL PROTECTED] (0/1), delay=00:00:01, xdelay=00:00:01, mailer=esmtp, pri=121083, relay=boredomsoftware.com. [67.18.56.2], dsn=2.0.0, stat=Sent (OK id=1CpdH0-00067K-Lb) 'PHP mail()' Jan 14 20:04:41 www sendmail[17630]: [ID 801593 mail.info] j0F24f8b017630: from=nobody, size=200, class=0, nrcpts=0, msgid=[EMAIL PROTECTED], [EMAIL PROTECTED] Can someone please help me figure this out? I am desperate!! I am also at my wits end. I have been fighting with this for a week. Kelly What do you mean by: When I get an error page it does not display PHP is exposed. It is exposed in php.ini. Is mail() returning an error? If so, what is it? Have you had the same PHP code working in a different environment? If you haven't figured out the problem yet, post your PHP code here. -John -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] RE: [suspicious - maybe spam] [PHP] [suspicious - maybe spam] strange in MySQL Query.
Santa wrote: MySQL don't know what is UNION http://dev.mysql.com/doc/mysql/en/UNION.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Strange results from file_get_contents using an url as filename
Ewout de Boer wrote: I'm getting unexpected data from my file_get_contents function using an url as filename. The function does not return false, i do get data from it. Problem is that is is not the data is requested. $data = file_get_contents(http://somehost.com/xmlonl.asp?custid=00prodid=0 ); if ($data) { ... the string this function returns is the webpage from the default website of the server where this php code is running at and not the data from the remote site (which is not on the same server). i tried the url from my shell on the server using telnet and it gets the data i expected. I can't figure out why php is getting the wrong results while telnet on the same host gets the correct data. Is this a (known) error with php or is it a apache/php/server configuration problem ? regards, Ewout *Check your PHP runtime config to see if 'allow_url_fopen' is enabled. (You can view your configuration using 'phpinfo'. You can change it in your php.ini file.) (See the first tip in the fine manual: http://us4.php.net/manual/en/function.file-get-contents.php ) ** -John * -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] UPDATE
Steve Marquez wrote: I am trying to insert information into the database, have it automatically place an ID Number, then update that particular record and replace the word delete with the link. The mysql_insert_id() does seem to be working. It does put in an id number of 0 However, the code in general gives me an error everytime. It says that it is near 'delete = a href...' Can anyone help me with this? Thanks! -- Steve ?php // log into our local server using the MySQL root user. $dbh = mysql_connect( localhost, username, password ); // select the database. mysql_select_db( imagesdb ) or die ( mysql_error() . \n ); ? -- snip -- ?php //This is for the text description of the gallery and the link $insert_data2 = INSERT into images_upload_description (delete, name, description) VALUES ('delete', 'a href=\http://www.domain.org/gallery/bomb/bottom_images.php?gallery_name=$ga llery_name\ target=\bottom\$name/a', '$description');; $response = mysql_query( $insert_data2, $dbh ); $id_num = mysql_insert_id(); $update_data = UPDATE images_upload_description SET delete = a href=\http://www.domain.org/gallery/admin/delete.php?gallery_name=$gallery_ nameid_num=$id_num\ target=\bottom\Delete/a WHERE id_num = \$id_num\; $response = mysql_query( $update_data, $dbh ); if(mysql_error()) die ('database error'. mysql_error()); ? You forgot to put single quotes around the string that begins 'a href= ... ' in the line beginning: $update_data = UPDATE images_upload_description SET delete = a href=\http://www.domain.org/gallery/admin/delete.php?gallery_name=$gallery_nameid_num=$id_num\; target=\bottom\Delete/a WHERE id_num = \$id_num\; -John -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Web Mail
On Monday 05 July 2004 07:33 am, I.A. Gray wrote: Thanks- looked at Squirrel Mail. Looks really good, however we use POP3- I don't think Squirrel Mail uses POP3 does it? Most if not all web-based mail clients use IMAP since a web-based (i.e. browser-based) client can't store the received mail on the local computer the way a POP3-based email client does. Besides, the whole reason for using a web-based client is to be able to log in from various computers. Why would you not want to store the mail back on the server the way IMAP does. POP3 delivers the mail to the client and then drops it. --John -Original Message- From: Jose Leon [mailto:[EMAIL PROTECTED] Sent: 05 July 2004 12:09 To: I.A. Gray Cc: [EMAIL PROTECTED] Subject: Re: [PHP] PHP Web Mail Hello, Does anyone know a good PHP-based (free if possible) web mail other than UebiMiau that they would recommend? Why not Squirrel Mail? http://www.squirrelmail.org Regards. -- qadram :: software development http://www.qadram.com -- 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] PHP Web Mail
Check with your hosting company. It's not that difficult for them to give you IMAP access also. You could write a server-based application that would retrieve your users' mail via POP3 and then store it in your users' home directory so it could be accessed from any computer via a web interface. But you would merely be reinventing IMAP!! --John On Monday 05 July 2004 02:22 pm, I.A. Gray wrote: Hi all, Thanks for all your info. The hosting company I use gives us POP3 accounts. To be honest I don't have a clue about IMAP- I've only heard the name, and don't understand the way it works. I assume because we only have POP3 accounts, we have to use a POP3 webmail service. We want all our customers to be able to have a webmail service so that they can check their POP3 accounts from any computer round the world. And, of course it has to be in PHP- what other language is there? Thanks again, Ian -Original Message- From: John Hicks [mailto:[EMAIL PROTECTED] Sent: 05 July 2004 18:01 To: I.A. Gray; Jose Leon; [EMAIL PROTECTED] Subject: Re: [PHP] PHP Web Mail On Monday 05 July 2004 07:33 am, I.A. Gray wrote: Thanks- looked at Squirrel Mail. Looks really good, however we use POP3- I don't think Squirrel Mail uses POP3 does it? Most if not all web-based mail clients use IMAP since a web-based (i.e. browser-based) client can't store the received mail on the local computer the way a POP3-based email client does. Besides, the whole reason for using a web-based client is to be able to log in from various computers. Why would you not want to store the mail back on the server the way IMAP does. POP3 delivers the mail to the client and then drops it. --John -Original Message- From: Jose Leon [mailto:[EMAIL PROTECTED] Sent: 05 July 2004 12:09 To: I.A. Gray Cc: [EMAIL PROTECTED] Subject: Re: [PHP] PHP Web Mail Hello, Does anyone know a good PHP-based (free if possible) web mail other than UebiMiau that they would recommend? Why not Squirrel Mail? http://www.squirrelmail.org Regards. -- qadram :: software development http://www.qadram.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] export from mysql to csv file
On Friday 11 June 2004 10:16 pm, Dustin Krysak wrote: Can anyone point me to an existing script or tutorial to learn this? Thanks in advance! d There is a mysql utility that does this: mysqldump -p mypassword -T mytargetdirectory mydatabasename [mytablenames] (The -T tells it to dump the data in tab-limited format. Otherwise it generates a series of insert statements.) See: http://dev.mysql.com/doc/mysql/en/mysqldump.html One pointer: the mysql daemon does the writing so the mysql user must have write permission on the target directory. Hope this helps. John --- John Hicks Gulfbridge, Inc. Putting the Web to work for your business. http://gulfbridge.com 561-586-8116 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] gethostbyaddr
Hi Alicia. Welcome to the list. On Friday 11 June 2004 12:58 pm, Alicia Riggs wrote: Hi guys, I am new to this list, and signed up specifically for this problem. If any one has any ideas it would be greatly appreciated. I am writing a function to allow users from a specific intranet permission to view a directory. I am getting very different results from IE and Netscape. I have written this in JavaScript as well as PHP, and I am getting the same error in both languages. Are you talking about regular old (browser-based) Javascript? Javascript and (server-based) PHP are like apples and oranges. You can't really get the same error from each because they are doing completely different things in completely different places. When I use the gethostbyaddr call, in IE I get a domain name the majority of the time, with a few exceptions. When I use the gethostbyaddr call in Netscape I only receive a domain name if there is a DNS entry. If there is no DNS entry, Netscape returns an IP address. PHP functions are executed by the server. The browser (Netscape and IE) have nothing to do with them. gethostbyaddr is a simple reverse-DNS lookup (of the REMOTE_ADDR ip address) requested by your server to its nameserver. This never goes near the user's IE or Netscape browser. The IP address used is the one your webserver is using in its HTTP (TCP) connection with the browser (or its agent -- a firewall or proxy, for example). If there is no DNS entry for the ip address, there should be no hostname returned because by definition there is no host name to be returned. I am not sure what IE is using to get the domain names when there is no DNS entry. How do I get the correct info to be returned from Netscape? Here is the code I am using *** ?php //echo pre; //print_r($_SERVER); //echo /pre; $hn = gethostbyaddr($_SERVER['REMOTE_ADDR']); echo host by addr = . $hn . \nbr; $darr = explode(., $hn); $cnt = count($darr); $host = $darr[$cnt - 2] . . . $darr[$cnt - 1]; echo host = . $host . \nbr; /* if($host == xyz.com) header(Location: xyz.html); else if($host == abc.com) header(Location: abc.html); else header(Location: error.html); */ ? For debugging purposes, I would add more verbose echos: particularly for IP address and full host name returned ($hn). How are you deducing that you are getting different results based on the user's browser? Are there firewalls or web proxies involved? This could account for getting conflicting IP addresses for the same user reported by the browser (via Javascript) and server. Thanks in advance for any ideas! Alicia Riggs PSG - Web Development Engineer 214-550-7452 Hope this helps. Regards, John --- John Hicks Gulfbridge, Inc. Putting the Web to work for your business. http://gulfbridge.com 561-586-8116 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Random Character Generator
On Monday 10 November 2003 07:32 pm, Jason Williard wrote: I would like to have a script that randomly generates alpha-numeric characters. Does anyone know of any scripts that can do this or perhaps the basic code to generate random characters? Thank You, Jason Williard How about the function uniqid() ? --John -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Downloading MySQL Files
On Monday 10 November 2003 08:07 pm, Stephen Craton wrote: I have a database which keeps some normal files in LONGBLOBS. I then call up a file called download.php to retrieve the file from the database, echo out its contents, and its type, and all that so they download it. However, if the user clicks the download link, they download the actual download.php file and if they open it, its blank. Here is where you begin to get confused. The output of your php page will always be called download.php, no matter what is in it. The users are not downloading the contents of your download.php file since that file is obviously not blank. Rather they are downloading the output generated by your download.php, which is nothing. Ive attached the code to download.php. Any ideas why this is happening and how to fix it? Are you getting any PHP errors? (Check your log.) Are you getting any MySQL errors? (You should include an error check in your statements.) If no to the above, then break the program down into parts and output debug statements. E.g. echo that the if conditional is being executed, echo the contents of the first SQL statement, echo the variables of the output, etc. Hope this helps. --John ?php if (isset($HTTP_GET_VARS['id'])) { include('Connections/default.php'); mysql_select_db($database_default, $default); $id = $HTTP_GET_VARS['id']; $query = SELECT * FROM files WHERE id='$id'; $result = mysql_query($query, $default); $row = mysql_fetch_array($result); $new = $row['downloads'] + 1; $query = UPDATE files SET downloads='$new' WHERE id='$id'; $result = mysql_query($query, $default); $type = $row[ftype]; $name = $row[fname]; $size = $row[fsize]; $id = $row[id]; $data = urldecode($row[fdata]); header(Content-type: $type); header(Content-length: $size); header(Content-Disposition: attachment; filename=$name); header(Content-Description: PHP Generated Data); echo $data; exit(); } ? Thanks, Stephen Craton HYPERLINK http://www.melchior.ushttp://www.melchior.us -- HYPERLINK http://www.melchior.us/portfoliohttp://www.melchio r.us/portfolio --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.532 / Virus Database: 326 - Release Date: 10/27/2003 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Newbie
Hi John-- Your name caught my eye, so I had to reply! Unfortunately I run PHP on Linux so can't be sure about your situation with Windex. But I think your problem is that you are opening your phpinfo.php file from your local file system. You should instead open it through your webserver. (i.e. enter your local domain name or IP address into your browser). To explain: phpinfo() is a PHP function that simply lists a lot of useful information about your PHP setup. But for it to be invoked, it must be run through the PHP interpreter. If you open it via your local file system, you bypass PHP. (When you installed Dreamweaver, it probably configured Winduhs to invoke DW whenever you open a .php file locally.) Hope this helps. Regards, (Another) John Hicks On Sunday 05 October 2003 01:28 pm, John Hicks wrote: Hi list, I have just installed PHP4.3.3-Win32. I have a book that said create a phpinfo.php ( ? phpinfo(); ? ) file and place it in my Apache 2 htdocs file. I did this and when I run it opens in a blank page of DreamweaverMX. I tried to open with Internet Explorer and it does nothing. My question is what file would tell it to open in DWMX or how do I get to the opening set-up page of PHP. I used php4.3.3-installer.exe but I got the message that it would have to be installed manually. Any help or direction would be appreciated. John H. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Newbie
Hi list, I have just installed PHP4.3.3-Win32. I have a book that said create a phpinfo.php ( ? phpinfo(); ? ) file and place it in my Apache 2 htdocs file. I did this and when I run it opens in a blank page of DreamweaverMX. I tried to open with Internet Explorer and it does nothing. My question is what file would tell it to open in DWMX or how do I get to the opening set-up page of PHP. I used php4.3.3-installer.exe but I got the message that it would have to be installed manually. Any help or direction would be appreciated. John H. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to smart refresh php section using iframe?
On Saturday 27 September 2003 02:43 am, ascll wrote: Greetings, I'm newbie in php and I would like to develop a .php page that constantly retrieves data from MySQL database, but I having difficulties to doing so. Please show me the complete code, if possible. This has nothing to do with PHP. Refreshing is handled by the client's browser, based solely on the HTML and Javascript your server sends it. I believe refreshing can be done in either of two ways, using either HTML headers or Javascript, either of which is contained in the page that is to be refreshed. (You could probably also use Javascript in the containing page to refresh the iframe, but Keep It Simple Sammy, they say.) Hope this helps. (If you need more, get out your HTML reference book or post your question an an HTML or Javascript list.) Good luck! --John Thanks in advance. = index.php = html body table !-- // SECTION A // = // Load one only, no need to refresh -- tr tdColumn1/td tdColumn2/td tdColumn3/td tdColumn4/td tdColumn5/td /tr !-- // SECTION B // = // Using .php to retrieve data from MySQL database (no problem) // together with iframe (I don't know how to configure iframe) // and also use javascript to auto refresh this section every 1-second (SECTION B ONLY) // since the data show on section B would keep on changing (I don't know the codes) -- tr td . $Column1 . /td td . $Column2 . /td td . $Column3 . /td td . $Column4 . /td td . $Column5 . /td /tr !-- // SECTION C // = // Auto refresh this section every 30-second (SECTION C ONLY and I don't know the codes) -- tr td . $Column1 . /td td . $Column2 . /td td . $Column3 . /td td . $Column4 . /td td . $Column5 . /td /tr !-- // SECTION D // = // Load one only, no need to refresh -- tr tdEnd of Record/td /tr /table /body /html = index.php = -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Are left joins more efficient?
Dennis-- You might get a more authoritative answer from the mysql general discussion list at: http://lists.mysql.com --John On Monday 25 August 2003 12:59 pm, [EMAIL PROTECTED] wrote: Hello, I program for a website that gets massive loads of traffic. Optimisation has become an important issue lately. At the moment, all queries on the website follow the same format when joining tables: SELECT * FROM table1,table2 WHERE table1.id=table2.id; My question is, would this format be more efficient? SELECT * FROM table1 LEFT JOIN table2 ON table1.id=table2.id; Over the last couple of years I have read and heard two different answers. Years ago it was said that doing Left Joins are faster and more efficient. But with recent updates to MySQL I have read that both queries are broken down and optimised the same way by MySQL. Any thoughts? I havn't come across any comparisons on the web, so any answers would be appreciated. (couldn't find any mysql specific groups so i'm posting in the next best thing!) Thanks -Dennis -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sending POST-data
Simon-- Why not follow the KISS approach? Generate the GET or POST directly from the client. No PHP or server-side processing needed. --John On Friday 25 July 2003 10:09 am, Simon Fredriksson wrote: I'm making a search-engine script for my site that redirects users to other search engines. Point is that on the website, there's a drop-down box with some engines and one textfield. 1. User enter the search query. 2. User selects which engine to use. 3. User submits. 4. PHP scripts checks which engine and redirects the user and the query to the selected engine. Now the thing is that some of these engines use POST method, which makes it a bit harder to redirect the query. For those who use GET I just have to use something like Header(Location: http://somewnine.com/query=$query;); So, does anyone have any good solution to this problem? //Simon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] CHECKING IF A SESSION IS ACTIVE OR NOT
There is no reliable way for the server (Apache, PHP, etc) to know when a user closes a session by closing his browser window. That's one reason why session-management sytems always employ a timeout on sessions. I don't know what the default timeout is for the PHP session-management system, but I believe you can set it. But that raises the question: If you are already storing session IDs in a database table, why don't you do your own session managment instead of using the PHP system? --John On Thursday 10 July 2003 09:42 am, Nagib Abi Fadel wrote: HI, I'm storing the sessions ids in a database table. I want to run a script that reads from the table every session id and check if this session is active or not. I know that session information is stored in a directory (/tmp by default) and removed from there when the session is closed. But if the user close his browser without deconnecting from the session the session file is still in the /tmp directory. How can i know if a session is still active or not !! ??? I have searched the session functions and didn't find anything that could help Thx for any Help N. __ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] is my server working
Merry-- No, it's not working. Does your Apache httpd.conf file load the PHP modules? Try changing your tags from ? ... ? to ?php ... ? Try a page that contains only this one line: ?php phpinfo(); ? Good luck. --John On Sunday 15 June 2003 01:09 am, Khoo Merry wrote: I'm using windows me, server apache 1.3 for php. I had wrote this code and tried it at local host, but the php code didn't work. The code is like this: ? $Greet = Hello World $Today = date(l F d, Y); ? html body Today's date is ? print($Today\n); print($Greet); ? /body /html Istead of print Today's date is Sunday June 14, 2003 Hello World The out put is only Today's date is. Is my server working with php? I am really appreciate if anyone can answer my problem. Thank you. merry - Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] which is quicker? XML or database?
Hi Justin-- I've been wrestling with a similar problem. You say: I'm considering: a) storing this data in a MySQL table (a fairly simple query) b) storing this data in a pseudo XML format like: id24/id authorJustin French/author author_email[EMAIL PROTECTED]/author_email date_published2003-11-28/date_published introThis is my intro/intro bodyThis is my text and html -- say 1000 words?/body Um, the above isn't pseudo XML. It's actually perfectly fine XML. Nothing pseudo about it. I'd love to hear any opinions about which would form of data retrieval would cause less of a performance burden on the server. . . I've been wrestling with the same (or very similar) question: I'm trying to devise a flexible templating system where I can give my users control over content and inline formatting (allowing them to use, for example, p, em, span, ul) but retain control over page layout myself. It does seem to me that XML should play a role here, but I haven't been able to find the right XML tools. Ideally, the content would be stored in an XML document as you described. Your PHP page would use XPATH to address elements (or nodes) of the XML to set the value of PHP variables which would then be plugged into the HTML page. XPATH allows you to do that much. But every implementation of XPATH I've seen returns only the CDATA of an XML node, i.e. it strips out all the tags contained in the node. Thus you can't imbed formatting tags in the content. (I've been tempted to go ahead and do a quick and dirty system using a relational DB, but such a system would break down from complexity over time. You would need a new table for each set of page components [or else devise a very messy and unnormal system with one grand table of columns with multiple uses].) Am I missing something? Is there an implementation of xpath that does return the full contents of a node and not just the CDATA? I guess you could use regular top-level PHP to parse an XML document chracter by character, storing in an array pointers to the beginning and ending characters of each element (i.e. the first character following the start tag and the last character before the end tag). Then you could look up in the array each desired element and use substr() to read its value and set a PHP variable to it. Ideally, you would want a system that included a facility to edit the XML document as well as read it. This would be used in the user's interface for editing his content. I would think an easy first step would be to recreate (or reassemble) the XML document after each edit session. --John On Friday 13 June 2003 11:30 pm, Justin French wrote: Hi all, I'm looking at a site where there will be a lot of articles, all of which will be added once, and rarely edited again... Let's say each article consisted of 6 data types: - id - author - authorEmail - datePublished - introduction - bodyText I'm considering: a) storing this data in a MySQL table (a fairly simple query) b) storing this data in a pseudo XML format like: id24/id authorJustin French/author author_email[EMAIL PROTECTED]/author_email date_published2003-11-28/date_published introThis is my intro/intro bodyThis is my text and html -- say 1000 words?/body I plan on doing my own performance tests, but I'd love to hear any opinions about which would form of data retrieval would cause less of a performance burden on the server (MySQL is on the same box as the htdocs and apache). TIA, Justin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Translate easy the language of the web site
On Friday 13 June 2003 03:00 pm, you wrote: On Saturday 14 June 2003 02:19, Jacob Marble wrote: Amen; machine-translators are no good for something that you don't want confused. ie- english season could be sazon or estacion in Spanish, which mean two different things. Never mind translation, season in English has more than one meaning. I think that was his point. And the two meanings correspond to two different words in Spanish. Most translation programs attempt to determine the intended meaning of such a word from its context. But it's an imperfect science. -J -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Persistent connections with mysql_pconnect()
On Tuesday 25 March 2003 09:02 am, skate [EMAIL PROTECTED] wrote: leaving the connection open creates security questions, and also leaves resources open, what if a user closes his browser window, how do you know to close the connection? So are you saying that persistent connections [ i.e. mysql_pconnect() ] should never be used? if you really want to make it simple, you can edit your php.ini to have the username and password as default in there, but again, this can be a security risk. i'm afraid the best way is to include connection code on every page... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Please point me in the right direction
PHP is extremely easy for an experienced programmer to pick up quickly (assuming you know the basics of tcp/ip and web architecture). But experienced programmers also know the importance of the KISS principle. Why rewrite a system when you can port it? Kylix allows you to use Delphi on Linux. If it limits you to using Redhat 7.2, that should be no problem provided you apply all relevant security patches (which Redhat is pretty good at providing). In the meantime, start learning PHP. It is object oriented in its own way. When you are ready for a complete rewrite of the system, PHP may be all you need. A hybrid CGI/PHP system sounds unecessarily messy. (PHP can run in a CGI environment but is usually run in the more efficient Apache module environment.) The above is just my two cents' worth. I haven't used Kylix or Delphi, but believe both are descended from Borland's original (Turbo) Pascal. I've been programming since '72 but am new to PHP. I've been extremely gratified by how easy it's been to put together a relatively sophisticated system for a client in just a month or two after struggling for months to get Java and JSP to do much simpler tasks. --Frappy On Tuesday 25 March 2003 11:09 am, you wrote: Hi All, I have a CGI application written in Delphi web services and I want to port it to the Linux environment. I was going to use Kylix but I'm concerned that Borland isn't keeping up with the fast paced Linux development (ie they are still on Redhat 7.2 and Redhat is about to release version 9.0 next month). The current CGI is a little complicated and relies heavily on OOP data structures. It processes the data then sends a stream to the web server for display in the browser. It's very fast and I am happy with the performace, but I must port it over to Linux. As I am very unfamiliar with the PHP environment, can someone point in the right direction? If I use PHP for the front-end, what is the best tool to create the CGI? I was considering using Python, but would Pearl be better? Any direction to get me started and headed in the right direction would be very appreciated Thanks, Jerry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] [php] nomenclature
$result = mysql_query($sql) ; ^ while ($rec = mysql_fetch_object($results)) ^ On Saturday 22 March 2003 11:56 pm, you wrote: Hi, I'm writing an academic paper detailing how my bibliographic database works. $myinput = mysql_query($sql) or die(print font color=red.mysql_error()./font); while ($mydata = mysql_fetch_object($myinput)) { } What is the usual, normal, standard nomenclature for $myinput and $mydata? How do people usually declare/name/type $myinput and $mydata?, usually speaking? I want to pick something normal they might encounter in their travels at www.php.net etc. Thanks, John compcanlit.ca -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php