[PHP] Vertical Search Engine
Dear Friends, I am planning to launch a Vertical Jobs Search Engine (Ref: www.linkup.com and www.indeed.com) which crawls, spiders and Indexes the job listings. I have com across couple of open sources like Nutch and Lucene which are very compatable for Java. But, I would like to know similiar ones for PHP. Please advise Thanks Neil
Re: [PHP] V4 Vs V5 Issue
Hi Thanks to those who got back to me on this. Turns out the issue was HTTP_POST_VARS..GET, SERVER being so depreciated that they no longer worked at all. Changed all to _POST..._GET, _SERVER etc and all worked fine. I guess they will make a programmer of me yet...hmmm one day maybe. Anyway thanks again Cheers Neil At 01:27 AM 2/07/2008, Neil wrote: Hi First Post here, I hope this is the right place for this post. This is probably not a php problem, I think it may a configuration issue, but sorry I just dont know where to look I have a V4 site the calls an on line editor and part of the process is by window.onload. If I had to explain how it all works I could'nt JS is not my thing and this is a fairly old piece of code. anyways -- Have a bit of code that looks like this . . body leftmargin=2 marginwidth=2 topmargin=2 marginheight=2 onResize=blockDefault(); content; include($settings['app_dir'].'/js/core_js.php'); echo content script LANGUAGE=Javascript window.onload=initEditor /script table border=0 cellpadding=5 cellspacing=0 width=100% height=100% class=framed . . . -- Under My V4 Sever it works fine .the Java script loads and an all is fine. On my V5 Sever I get the following Errors Line: 68 Char: 21 Error: Syntax error Code: 0 URL: .. and then Line: 600 Char: 11 Error 'initEditor' is undefined Code 0 URL Now the thing is, when I view source code in IE off both servers the the core_js.php is being read and is visible, the initEditor function is there for all the world to see. If I rename the initEditor function on the V5 version and add a new empty function I still get the same error messages. I dont have much hair and I am tearing out the rest as we speak :).I have no idea where to look so I am just hoping someone can point me in the right direction. Like I said in the beginning I think it must be a configuration issue but I just dont know what or where. Anyways TIA Cheers Neil -- 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] V4 Vs V5 Issue
Hi First Post here, I hope this is the right place for this post. This is probably not a php problem, I think it may a configuration issue, but sorry I just dont know where to look I have a V4 site the calls an on line editor and part of the process is by window.onload. If I had to explain how it all works I could'nt JS is not my thing and this is a fairly old piece of code. anyways -- Have a bit of code that looks like this . . body leftmargin=2 marginwidth=2 topmargin=2 marginheight=2 onResize=blockDefault(); content; include($settings['app_dir'].'/js/core_js.php'); echo content script LANGUAGE=Javascript window.onload=initEditor /script table border=0 cellpadding=5 cellspacing=0 width=100% height=100% class=framed . . . -- Under My V4 Sever it works fine .the Java script loads and an all is fine. On my V5 Sever I get the following Errors Line: 68 Char: 21 Error: Syntax error Code: 0 URL: .. and then Line: 600 Char: 11 Error 'initEditor' is undefined Code 0 URL Now the thing is, when I view source code in IE off both servers the the core_js.php is being read and is visible, the initEditor function is there for all the world to see. If I rename the initEditor function on the V5 version and add a new empty function I still get the same error messages. I dont have much hair and I am tearing out the rest as we speak :).I have no idea where to look so I am just hoping someone can point me in the right direction. Like I said in the beginning I think it must be a configuration issue but I just dont know what or where. Anyways TIA Cheers Neil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] V4 Vs V5 Issue
Thanks Wolf I have replied to all, I hope that is the correct way here. A configuration issue on the PHP V5 Server . thats my problem, I dont know where I should be looking. The source code, php and JS is absolutely identical on both machines. Cheers Neil At 01:36 AM 2/07/2008, Wolf wrote: Neil [EMAIL PROTECTED] wrote: Hi First Post here, I hope this is the right place for this post. This is probably not a php problem, I think it may a configuration issue, but sorry I just dont know where to look Configuration issue of what? I have a V4 site the calls an on line editor and part of the process is by window.onload. If I had to explain how it all works I could'nt JS is not my thing and this is a fairly old piece of code. anyways !-- SNIP -- Line: 68 Char: 21 Error: Syntax error Code: 0 It's probably all JS, but if this is a PHP page that you've actually cut/pasted from, look at lines 67 and 68 and check to make sure you have a ; at the end of line 67. Or a ) or a } or some other closing brace that you could be using previously. Otherwise, check with a javascript list to see what the javascript errors are. HTH, Wolf -- 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] V4 Vs V5 Issue
Hi Thanks I have tested the path, that works fine. I set up a dummy file on the same path just to check that, it found that and printed out some echo'd text from that file. I can see the content of core_js.php file in the the IE view source view. At 01:43 AM 2/07/2008, Eric Butera wrote: On Tue, Jul 1, 2008 at 11:27 AM, Neil [EMAIL PROTECTED] wrote: Hi First Post here, I hope this is the right place for this post. This is probably not a php problem, I think it may a configuration issue, but sorry I just dont know where to look I have a V4 site the calls an on line editor and part of the process is by window.onload. If I had to explain how it all works I could'nt JS is not my thing and this is a fairly old piece of code. anyways -- Have a bit of code that looks like this . . body leftmargin=2 marginwidth=2 topmargin=2 marginheight=2 onResize=blockDefault(); content; include($settings['app_dir'].'/js/core_js.php'); echo content script LANGUAGE=Javascript window.onload=initEditor /script table border=0 cellpadding=5 cellspacing=0 width=100% height=100% class=framed . . . -- Under My V4 Sever it works fine .the Java script loads and an all is fine. On my V5 Sever I get the following Errors Line: 68 Char: 21 Error: Syntax error Code: 0 URL: .. and then Line: 600 Char: 11 Error 'initEditor' is undefined Code 0 URL Now the thing is, when I view source code in IE off both servers the the core_js.php is being read and is visible, the initEditor function is there for all the world to see. If I rename the initEditor function on the V5 version and add a new empty function I still get the same error messages. I dont have much hair and I am tearing out the rest as we speak :).I have no idea where to look so I am just hoping someone can point me in the right direction. Like I said in the beginning I think it must be a configuration issue but I just dont know what or where. Anyways TIA Cheers Neil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Compare your rendered output from the v4 and the v5. You might see something in the php5 version that has some sort of error displaying to screen that causes a parse error inside your JS block that wasn't there before. Something might have changed about the way your settings variable works too. Do a var_dump($settings['app_dir'].'/js/core_js.php') and see if it actually prints out a real path to a file that exists. -- 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: V4 Vs V5 Issue
Hi Unfortunately this editor does not run in any other browsers. however I do not believe that it is the java script that is the problem because it runs and works and has done so for years on the current and earlier V4 servers. Cheers Neil At 07:10 AM 2/07/2008, Jon Drukman wrote: Neil wrote: Hi Thanks I have tested the path, that works fine. I set up a dummy file on the same path just to check that, it found that and printed out some echo'd text from that file. I can see the content of core_js.php file in the the IE view source view. debugging javascript in IE is about as much fun as slamming your head in a car door. try it in firefox with firebug installed, it should give you much better feedback about what is going on. -jsd- -- 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] V4 Vs V5 Issue
Thanks Jim Two things come to mind. 1) Is their any PHP inside you javascript file that needs to be parsed? And if so, is the new V5 install configured in such a way that it parses/processes javascript files? where the old install was processing javascript files. This would be a configuration issue from the actual web server POV. i.e. Apache, lighttpd, etc... Once reconfigured, make sure you restart your web server. Yes there is PHP inside the javascript that is being passed. As an exorcise I was just looking at deleting it all out of the code and seeing what happens, however it is everywhere. The Webserver with the V5 PHP is Apache 2.2.4, but I can not really see where I would make the changes you are suggesting. The older server with V4 is Apache 1.34.4 2) Is your code using short tags in php? This allows the programmer to use ? instead of ?php . In this case you might want to enable short tags in the new version of PHP. I think php 5 comes with short tags disabled and version 4 had it enabled by default. This setting would be found in your php.ini file on the server. If you need to change the setting, make sure you restart your httpd server before testing. Short tags is enabled and working most of the application is short tagged. Cheers Neil Just a couple of thoughts -- Jim Lucas Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them. Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] V4 Vs V5 Issue
Thanks Jim Will add some more to this. The PHP that is parsed inside this file and the JS is I think working correctly because the values are populated in the JavaScript output that is being displayed in the IE source viewer. For instance there is a stack of variable that are defined up front, these get information from PHP, these have the same information as the V4 server and I can therefore only presume the correct information. Cheers N Two things come to mind. 1) Is their any PHP inside you javascript file that needs to be parsed? And if so, is the new V5 install configured in such a way that it parses/processes javascript files? where the old install was processing javascript files. This would be a configuration issue from the actual web server POV. i.e. Apache, lighttpd, etc... Once reconfigured, make sure you restart your web server. Yes there is PHP inside the javascript that is being passed. As an exorcise I was just looking at deleting it all out of the code and seeing what happens, however it is everywhere. The Webserver with the V5 PHP is Apache 2.2.4, but I can not really see where I would make the changes you are suggesting. The older server with V4 is Apache 1.34.4 2) Is your code using short tags in php? This allows the programmer to use ? instead of ?php . In this case you might want to enable short tags in the new version of PHP. I think php 5 comes with short tags disabled and version 4 had it enabled by default. This setting would be found in your php.ini file on the server. If you need to change the setting, make sure you restart your httpd server before testing. Short tags is enabled and working most of the application is short tagged. Cheers Neil Just a couple of thoughts -- Jim Lucas Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them. Twelfth Night, Act II, Scene V by William Shakespeare -- 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] Sending Pictures to Cell Phones
On Wednesday 14 November 2007 18:47, Daniel Brown wrote: | On Nov 14, 2007 1:27 PM, [EMAIL PROTECTED] wrote: | Hey list, | | I'm doing some RD for a project at my job and my boss wants the | ability to send pictures to cell phones. I was wondering if | anyone had any experience with this or could point me in the | right direction to get started. | | Thanks, | Jeremy Hi Jeremy Delivering MMS can be done, but the ease with which it can be done with PHP depends on how well defined your target audience is. If they all use a specific phone, it will be easier than if you are aiming at handsets of indeterminate screen size and display capability. There are plenty of avenues to explore for getting multimedia messages to mobiles. -- Neil Bellamy (( aql.com )) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] stftime differences on Windows/Linux platforms
Hi All, I'm experiencing some differences in in the return values of strftime on Windows Linux platforms on PHP 5.2.1. I've knocked up a test case to demonstrate the bug: ?php $UNIX_TIME = mktime(0,0,0,5,31,2008); echo Time Made for 31-05-2008: $UNIX_TIME\n; echo Expected Time for 31-05-2008: 1212188400\n; echo Formated generated: . strftime(%d-%m-%Y, $UNIX_TIME) . \n; echo Formated expected: . strftime(%d-%m-%Y, 1212188400) . \n; echo Difference between expected and generated: . ($UNIX_TIME - 1212188400); echo \n\n; ? OUTPUT DEVELOPMENT: C:\php -e c:\test.php Time Made for 31-05-2008: 1212188400 Expected Time for 31-05-2008: 1212188400 Formated generated:31-05-2008 Formated expected: 31-05-2008 Difference between expected and generated: 0 OUTPUT PRODUCTION: Time Made for 31-05-2008: 1212192000 Expected Time for 31-05-2008: 1212188400 Formated generated:31-05-2008 Formated expected: 30-05-2008 Difference between expected and generated: 3600 Development Config: PHP Version 5.2.1 PHP API 20041225 PHP Extension 20060613 Zend Extension 220060519 Production Config: PHP Version 5.2.1 Build Date Apr 25 2007 18:04:12 PHP API 20041225 PHP Extension 20060613 Zend Extension 220060519 Am I missing something obvious here? Any help gratefully received. Cheers, Neil. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] stftime differences on Windows/Linux platforms
Hi Robin, Thanks for your reply. The times are exactly synchronized. I'm looking at the date section in the output of phpinfo(), and get the following: Development: D:\Documents and Settings\neil.saundersdate The current date is: 06/11/2007 D:\Documents and Settings\neil.saunderstime The current time is: 12:47:06.46 date date/time support enabled Timezone Database Version 2006.16 Timezone Database internal Default timezoneEurope/London Directive Local Value Master Value date.default_latitude 31.7667 31.7667 date.default_longitude 35.2333 35.2333 date.sunrise_zenith 90.58 90.58 date.sunset_zenith 90.58 90.58 date.timezone no valueno value Production: [~]# date Tue Nov 6 12:49:25 GMT 2007 date date/time support enabled Timezone Database Version 2006.16 Timezone Database internal Default timezoneUTC Directive Local Value Master Value date.default_latitude 31.7667 31.7667 date.default_longitude 35.2333 35.2333 date.sunrise_zenith 90.58 90.58 date.sunset_zenith 90.58 90.58 date.timezone no valueno value Although the timezones are different, my understanding is the UTC is a synonym for GMT, which is based in London. This appears to be confirmed by looking at the default latitudes and longitudes and they match up. Either way, setting the timezone to Europe/London in production fixed the issue. Thanks again for your help. Cheers, Neil. On Nov 6, 2007 12:01 PM, Robin Vickery [EMAIL PROTECTED] wrote: On 06/11/2007, Neil Saunders [EMAIL PROTECTED] wrote: Hi All, I'm experiencing some differences in in the return values of strftime on Windows Linux platforms on PHP 5.2.1. I've knocked up a test case to demonstrate the bug: ?php $UNIX_TIME = mktime(0,0,0,5,31,2008); echo Time Made for 31-05-2008: $UNIX_TIME\n; echo Expected Time for 31-05-2008: 1212188400\n; echo Formated generated: . strftime(%d-%m-%Y, $UNIX_TIME) . \n; echo Formated expected: . strftime(%d-%m-%Y, 1212188400) . \n; echo Difference between expected and generated: . ($UNIX_TIME - 1212188400); echo \n\n; ? OUTPUT DEVELOPMENT: C:\php -e c:\test.php Time Made for 31-05-2008: 1212188400 Expected Time for 31-05-2008: 1212188400 Formated generated:31-05-2008 Formated expected: 31-05-2008 Difference between expected and generated: 0 OUTPUT PRODUCTION: Time Made for 31-05-2008: 1212192000 Expected Time for 31-05-2008: 1212188400 Formated generated:31-05-2008 Formated expected: 30-05-2008 Difference between expected and generated: 3600 Development Config: PHP Version 5.2.1 PHP API 20041225 PHP Extension 20060613 Zend Extension 220060519 Production Config: PHP Version 5.2.1 Build Date Apr 25 2007 18:04:12 PHP API 20041225 PHP Extension 20060613 Zend Extension 220060519 Am I missing something obvious here? Any help gratefully received. Well, either the clocks on your dev and production servers are exactly 6 hours out or there's a difference in their locale settings such that one thinks it's in a timezone 6 hours ahead of the other. -robin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] if inside an echo.
Or another way... for ($value = 0; $value = 2000; $value += 100) { echo sprintf(option value=\%s\%s%s/option, $value, (($min_rent==$value) ? selected=\selected\ : NULL), $value); } Hulf wrote: ** This Email Has Been Virus Swept ** I am outputting a selectbox and want to do the follwoing. How can I add the IF statement inside the the echo? for ($value = 0; $value = 2000; $value += 100) { echo option value=\$value\ if ($min_rent==$value) {echo selected=selected } $value/option; } *** ATTENTION: E-mail addressed to the [EMAIL PROTECTED] will only be delivered for a limited period. Please update your address book using the From address on this e-mail. This communication is confidential to the intended recipient(s). If you are not that person you are not permitted to make use of the information and you are requested to notify the sender immediately of its receipt and then destroy the copy in your possession. Any views or opinions expressed are those of the originator and may not represent those of L-3 Communications ASA Ltd. Sent from L-3 Communications ASA Ltd. Registered in England and Wales Company No. 1730717 Registered Office: 5th Floor, Chiswell Street, London EC1Y 4UP *** This Email has been Virus Checked *** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Virtual includes of PHP into SSI pages.
=0x297150) at request.c:1855 #18 0x000382a4 in handle_include (ctx=0x283660, bb=0xffbfef78, r=0x289118, f=0x28a9c0, head_ptr=0x2876e8, inserted_head=0xffbfeee8) at mod_include.c:782 #19 0x0003fa58 in send_parsed_content (f=0x28a9c0, bb=0x28abb0) at mod_include.c:3309 #20 0x0004093c in includes_filter (f=0x28a9c0, b=0x28abb0) at mod_include.c:3591 #21 0x000fe614 in ap_pass_brigade (next=0x28a9c0, bb=0x28abb0) at util_filter.c:512 #22 0x0010cde0 in default_handler (r=0x289118) at core.c:3640 #23 0x000e3c28 in ap_run_handler (r=0x289118) at config.c:152 #24 0x000e4848 in ap_invoke_handler (r=0x289118) at config.c:364 #25 0x00094aac in ap_process_request (r=0x289118) at http_request.c:249 #26 0x0008bac0 in ap_process_http_connection (c=0x2831d8) at http_core.c:251 #27 0x000f9820 in ap_run_process_connection (c=0x2831d8) at connection.c:43 #28 0x000f9e04 in ap_process_connection (c=0x2831d8, csd=0x283100) at connection.c:176 #29 0x000e1574 in child_main (child_num_arg=0) at prefork.c:610 #30 0x000e16c0 in make_child (s=0x1b80b0, slot=0) at prefork.c:650 #31 0x000e1878 in startup_children (number_to_start=5) at prefork.c:722 #32 0x000e1f8c in ap_mpm_run (_pconf=0x16cda8, plog=0x1b2ec0, s=0x1b80b0) at prefork.c:941 #33 0x000eced8 in main (argc=2, argv=0xffbff77c) at main.c:618 Regards, -- Neil HoggarthDepartmental Computing Manager [EMAIL PROTECTED] Laboratory of Physiology http://www.physiol.ox.ac.uk/~njh/ University of Oxford, UK -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Visit to Germany
Greetings, I'm hoping to visit the Stuttgart area* for one week ~ ten days commencing c.Friday 19 August, to visit my brother-in-law and take a short vacation. If there are any PHP-related gatherings or activities I would be interested to meet up (last time I tried, I missed out by one week...) NB My grasp of the German language is in the feeble~abysmal range, but I promise to read at least page one of my language tutorial before I come! Regards, =dn * Dettingen-unter-Teck, Kirchheim/Teck, Notzingen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Checking requested range
Is there anything in PHP which would allow me to check the requested range of bytes by an client? Basically one of the download scripts I made some time ago got hit by a load of requests for a file, but the server was giving back 416 Requested Range Not Satisfiable. I assume that the user is trying to use a download agent of some kind, but this was killing my server by soaking up all the memory with all these requests. What I wanted to do was check this request and then drop the connection straight away, if it seems suspect, is this possible? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Checking requested range
Marek Kilimajer wrote: Try http://pear.php.net/package/HTTP_Download Cheers for that, I think I just found a reasonable method to do a short term fix, though I might totally redesign my download application to support resumable download agents. I looked on the HTTP 1.1 protocol and found the request headers used when requesting parts of a file is Range:. For now I put this at the top of my script :- $headers = apache_request_headers(); foreach ($headers as $header = $value) { if (stristr($header, range) != FALSE) { die; } } Using the apache_request_headers to check for the range request and die if it recieves it, does it look reasonable to you? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php4 can't find tnsnames.ora oracle9 but can connect if description hardcoded
Hello, I have test script that can connect to the oracle database. It doesn't require tnsnames.ora because I define the database alias in the script itself. It looks like this: echo TWO_TASK=.getenv(TWO_TASK).br; echo LD_LIBRARY_PATH=.getenv(LD_LIBRARY_PATH).br; echo ORACLE_BASE=.getenv(ORACLE_BASE).BR; echo ORACLE_HOME=.getenv(ORACLE_HOME).BR; echo TNS_ADMIN=.getenv(TNS_ADMIN).BR; echo NLS_LANG=.getenv(NLS_LANG)..br; # this allows a successful connection $db = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP) (HOST =testdb.boo.com)(PORT = 1521)) (CONNECT_DATA= (SID = testdb)) ); // these don't work.. php can't seem to find tnsnames.ora # $db = testdb.boo.com; //$db = testdb.boo.com; # $db = testdb; //echo $testdb; $odbc = OCILogon(test/test,test,$db); if ($odbc == false){ $msg = OCIError($odbc).BR; } else { echo success!!!br; } My problem is is that when I try to use the database alias in tnsnames.ora I get an ora-12154 error. I get this despite the facts that oracle_home, tns_admin and everything else is defined in the script and the tnsnames.ora contains exactly the same alias as I use in the hardcoded version (see the uncommented $db above). sqlnet.ora contains a value name_domain that apparently is appended to the alias in tnsnames.ora but accounting for this still doesn't let me connect to oracle . It's as if tnsnames.ora cannot be found. I've changed the permissions to 777 for the whole directory structure and I can successfully use tnsnames.ora with sqlplus or tnsping. Does anybody have any ideas what is going wrong? Is this a bug? thanks, neil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] uploading files with a single quote in the filename
Hi When uploading files using a type=file in a form, if a file is uploaded with a single quote the file gets truncated to whatever is after the quote eg. blah'sblah.txt will be uploaded as sblah.txt Is this a magic quotes issue? What is the best way to deal with it? Neil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] uploading files with a single quote in the filename
Thanks some answers: turning magic quotes on and off seemed to make no difference 1. single quotes aren't important to me but this application allows users to upload photos which often use descriptive filenames which sometimes have single quotes eg. my mum's car.jpg. I replace the spaces with underscores but I can't get to the filename before the single quote and the text before it have been stripped. 2. the original filename is only important insofar as it often has descriptive information in it. 3. I can't really answer this question very well except to say that it happens in my development environment (IE6 on win2k with apache on win2k) as well as on my hosting server (IE6 on win2k and apache on linux). Jochem Maas [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi When uploading files using a type=file in a form, if a file is uploaded with a single quote the file gets truncated to whatever is after the quote eg. blah'sblah.txt will be uploaded as sblah.txt Is this a magic quotes issue? I don't think so, test it by turning it on/off. What is the best way to deal with it? couple of questions: 1. are single quotes really necessary in filenames? 2. is the original filename really that important to you? 3. does this happen on just one browser/[client]platform? it could be a browser bug (i.e. it gets stripped on the clientside which would means thats its nothing to do with a PHP bug/setting/feature/misunderstanding/etc) Neil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] uploading files with a single quote in the filename
Thanks Bret I have tried turning all reporting on - error_reporting(E_ALL); but that doesn't reveal anything significant I have looked in the logs but there is nothing significant there. Because the type is file in the form it is not handled like a post - the values go into an array called $_FILES There seems to be no way to intercept this before the filename gets truncated Thanks again Neil Bret Hughes [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Wed, 2005-02-23 at 06:49, [EMAIL PROTECTED] wrote: Hi When uploading files using a type=file in a form, if a file is uploaded with a single quote the file gets truncated to whatever is after the quote eg. blah'sblah.txt will be uploaded as sblah.txt Is this a magic quotes issue? What is the best way to deal with it? I ran into a similar deal with a textbox and a while back but I think the issue was sending it back to the browser after the browser sent it up. In the absence of direct help, I would first look to see where the truncation is occurring ie; what is the browser sending? can you post the value and see what your browser is sending it as? is there anything in the logs with error_reporting set to E_ALL? I found trouble shooting the upload process cumbersome since it would fail without any messages but that was before I started setting the error_reporting to also log messages. Not much help but all I got. Bret -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] uploading files with a single quote in the filename
Hi Brett My form is effectively identical to yours form enctype=multipart/form-data action=/uploadfiles.php method=post bUpload a file:/b input name=userfile type=file size=100 No the first part of the file name is just dropped and the file with the truncated name is saved in the correct place. But with it escaping the quote do you mean that you end up with a file with \ in it? That would be an illegal filename. Neil Bret Hughes [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Wed, 2005-02-23 at 16:40, [EMAIL PROTECTED] wrote: Thanks Bret I have tried turning all reporting on - error_reporting(E_ALL); but that doesn't reveal anything significant I have looked in the logs but there is nothing significant there. Because the type is file in the form it is not handled like a post - the values go into an array called $_FILES There seems to be no way to intercept this before the filename gets truncated Well for another data point when I uploaded a file using our upload form the ' gets escaped on both IE6 (win98 running in win4lin) and galeon. test's qoutes.jpg becomes test\'s quotes.jpg on a fedora server with apache and php of course. I don't suppose the file gets put into a directory named with the first portion of the file? FWIW here is what my form tag looks like form enctype=multipart/form-data action=uploadFiles.php method=POST and the filechooser input name=userfile type=file Bret -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Underscores within echo statements
Just a quick question. What is the purpose of the underscore character within the following echo statement? I had a quick look in the manual and archives but couldn't find any reference to it. ?php echo _(Username) ? Thanks, Neil This communication is confidential to the intended recipient(s). If you are not that person you are not permitted to make use of the information and you are requested to notify the sender immediately of its receipt then destroy the copy in your possession. Any views or opinions expressed are those of the originator and may not represent those of Advanced System Architectures Ltd. *** This Email Has Been Virus Checked *** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Underscores within echo statements
Marek Kilimajer wrote: *** This Email Has Been Virus Swept *** Neil Freeman wrote: Just a quick question. What is the purpose of the underscore character within the following echo statement? I had a quick look in the manual and archives but couldn't find any reference to it. ?php echo _(Username) ? see gettext extension Thanks, Neil Could you turn this of? This communication is confidential to the intended recipient(s). If you are not that person you are not permitted to make use of the information and you are requested to notify the sender immediately of its receipt then destroy the copy in your possession. Any views or opinions expressed are those of the originator and may not represent those of Advanced System Architectures Ltd. *** This Email Has Been Virus Checked *** OK - great. Thanks for the quick reply John and Marek. Marek - sorry about the rather lengthy signature. It's appended to all e-mails sent out by our company and is therefore out of my hands :( This communication is confidential to the intended recipient(s). If you are not that person you are not permitted to make use of the information and you are requested to notify the sender immediately of its receipt then destroy the copy in your possession. Any views or opinions expressed are those of the originator and may not represent those of Advanced System Architectures Ltd. *** This Email Has Been Virus Checked *** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] A bit stuck with $$
Not sure if its me or the configuration of PHP I am trying to get the value of a variable, a variable variable ie // From Form $name = My Name; --- // from a list of values in a file $var=name; $value=$$var; i// I thought I could do something as simple as this to get the correct value My Name into $value. print $value ; // should print My Name, I zip. I have played around with this bit of code from operators part of the manual and this does not appear to work, well for me at least. $foo = test; $$bar = this is; echo ${$bar} $foo; // prints this is test Note: it is the same as echo $test $foo; // * for me it only prints out test Any Ideas Cheers Neil Regards Chester Cairns - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] A bit stuck with $$
For me echo $test -- $foo; results in avalue -- Neil At 02:56 PM 27/08/2004, Curt Zirzow wrote: * Thus wrote Neil: Not sure if its me or the configuration of PHP variable variables are rather standard and dont have any configuration settings. I have played around with this bit of code from operators part of the manual and this does not appear to work, well for me at least. $foo = test; $$bar = this is; echo ${$bar} $foo; // prints this is test Everything is working so far as expected Note: it is the same as echo $test $foo; // * for me it only prints out test You are throwing me here.. the problem seems to be that $test hasn't been assign. By using your examples I can make $test actually be a value by doing this with the variable variable: $$foo = 'avalue'; // $test is assinge 'avalue' Is equivalent as doing: $test = 'avalue'; // $test is assinge 'avalue' And thus, without the actual $test assignment: echo $test $foo; will result in: avalue test HTH, Curt -- First, let me assure you that this is not one of those shady pyramid schemes you've been hearing about. No, sir. Our model is the trapezoid! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Regards Chester Cairns - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Using php_value in .htaccess files
[EMAIL PROTECTED] wrote: *** This Email Has Been Virus Swept *** Is there anything special one has to do in order to enable the use of the php_value directive in the context of an apache .htaccess file? I notice that on some hosts I can drop in something like: php_value auto_prepend_file groove.php with impunity. Other hosts, it causes Apache to generate an internal server error. -Weston Although this may not be your problem it's always a good idea to test for the existence of the module before attempting to change any of it's values: IfModule mod_php5.c php_value auto_prepend_file groove.php /IfModule Neil This communication is confidential to the intended recipient(s). If you are not that person you are not permitted to make use of the information and you are requested to notify the sender immediately of its receipt then destroy the copy in your possession. Any views or opinions expressed are those of the originator and may not represent those of Advanced System Architectures Ltd. *** This Email Has Been Virus Checked *** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help Loading MySQL Extension with PHP5/Apache1.3
John Holmes wrote: *** This Email Has Been Virus Swept *** Okay... I've done this before but can't get it working now. I've got PHP5 working correctly, but I'm trying to load the MySQL php_mysql.dll file. I'm using Apache 1.3 on Windows XP. No matter what I use for extension_dir in php.ini, it can't seem to find the file. An error dialog will pop up saying Unable to load dynamic library 'c:\php\ext\php_mysql.dll' - The specified module could not be found. even though that's where the [EMAIL PROTECTED]@ file is! I've tried putting the .dll in c:\php and c:\windows\system32, also, but I always get the same error even though the path it shows in the error is the correct path. I've tried c:/php, c:/php/ext/, c:\php\ext, c:\php, blank, etc with and without trailing slashes... The everyone user has full control over the entire c:\php directory and subdirectories. Any ideas? Going back to PHP4 until I can get this sorted out... Examples from Apache error log of paths to file apache couldn't find: '\php\ext\php_mysql.dll' 'c:/php/ext\php_mysql.dll' 'c:/php/ext\php_mysql.dll' 'c:\php\ext\php_mysql.dll' 'c:/php/ext/php_mysql.dll' 'c:\php\ext\php_mysql.dll' './php_mysql.dll' 'c:/php/ext/php_mysql.dll' 'c:\php\ext\php_mysql.dll' 'c:/php/ext\php_mysql.dll' 'c:/php/ext\php_mysql.dll' '\php\ext\php_mysql.dll' 'c:/php/ext/php_mysql.dll' 'c:\windows\system32\php_mysql.dll' I had a similar problem which I eventually resolved. Here are my settings: extension_dir = C:/PHP/ext/ extension=php_mysql.dll Remember to copy 'libmysql.dll' to your Windows System directory (e.g. C:\Windows\System32\). If I remember correctly I also had to remove PHP 4's 'php4ts.dll' from the System directory - maybe this was just getting PHP5 running though? Restart Apache and hope for the best. Neil This communication is confidential to the intended recipient(s). If you are not that person you are not permitted to make use of the information and you are requested to notify the sender immediately of its receipt then destroy the copy in your possession. Any views or opinions expressed are those of the originator and may not represent those of Advanced System Architectures Ltd. *** This Email Has Been Virus Checked *** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Control structure - easier way than repeating conditions in IF?
Why not just use a switch?... switch ($x) { case $a: case $b: case $c: case $d: //do whatever you need break; default: //catch any other values here break; } Neil BOOT wrote: *** This Email Has Been Virus Swept *** Hello! Can anyone tell me if there is an easier/shorthand for: if (($x == $a) || ($x == $b) || ($x == $c) || ($x == $d) ... ) {;} I understand the logic of why the following does not work: if ($x == ($a || $b || $c || $d)) {;} Thanks! -- -- www.curvedvision.com -- This communication is confidential to the intended recipient(s). If you are not that person you are not permitted to make use of the information and you are requested to notify the sender immediately of its receipt then destroy the copy in your possession. Any views or opinions expressed are those of the originator and may not represent those of Advanced System Architectures Ltd. *** This Email Has Been Virus Checked *** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Switching First Last Names in List
Take a look at explode() www.php.net/explode Neil Jeff Oien wrote: *** This Email Has Been Virus Swept *** If I have a list like this: Firstname1 LastName1 Firstname2 Lastname2 etc. I can split the names by \n to put them into an array which will then be output into an option list for a form. But how do I reverse the names so that the last name is first? Also, how do I handle people with three names? Thanks. Jeff Oien -- -- www.curvedvision.com -- This communication is confidential to the intended recipient(s). If you are not that person you are not permitted to make use of the information and you are requested to notify the sender immediately of its receipt then destroy the copy in your possession. Any views or opinions expressed are those of the originator and may not represent those of Advanced System Architectures Ltd. *** This Email Has Been Virus Checked *** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_GET, expressions and conditional statements
How about this - untested by the way: $order = ASC; if (isset($_GET[ORDER])) { $value = $_GET[ORDER]; if (($value == ASC) || ($value == DESC)) { $order = $value; } else if ($value == RAND) { $order = RAND(); } } $SPORDER = $order; I.A. Gray wrote: *** This Email Has Been Virus Swept *** Hi everyone, I know this is probably really simple, but I am not very good at expressions and conditional statements. I am wanting to show a list from a MYSQL database. I am using the URL to store the variables that control the output. The variable $ORDER can be set to ASC (Ascending), DESC (Descending and RAND (Random). What I want the script to do is set $SPORDER to this value. If $_GET['ORDER'] is not set then it gets the default value (ASC), if this is any other than ASC, DESC or RAND (ie. someone has messed with the variables in the URL) then it also gets the default (ASC). Finally if $_GET['ORDER'] is set to RAND then I want $SPORDER to equal RAND() so that I can use the value in the SQL query. Here is part of the script: ?php if (!isset($_GET['ORDER'])) { // Checks if the 'ORDER' variable from the URL is set. If it is NOT set the following happens... $SPORDER = ASC; // The variable $SPORDER is given the value ASC, since ASC (Ascending Order) is the default value. } else { // The following happens if the 'ORDER' variable IS set... $SPORDER = $_GET['ORDER']; // The variable $SPORDER is given the value of the variable 'ORDER' taken from the URL. if ( (($SPORDER !== ASC) ($SPORDER !== DESC)) ($SPORDER !== RAND)) { // If the variable $SPORDER does NOT have the value of either ASC (Ascending), DESC (Descending) or RAND (Random) then the following happens... $SPORDER == ASC; // The variable $SPORDER is given the default value ASC } else { // If the variable $SPORDER DOES have the value of either ASC, DESC or RAND then the following happens... if ($SPORDER == RAND) { // If $SPORDER has the following of RAND (Random Order) then... $SPORDER == RAND(); // $SPORDER is given the value RAND() which is the correct value for submission to the MYSQL query. } } } // End of the Conditional Statements regarding the ORDER variable. ? I think the problem part could be: if ( (($SPORDER !== ASC) ($SPORDER !== DESC)) ($SPORDER !== RAND)) I am trying to say if $SPORDER does not equal ASC, DESC or RAND then do the following. There maybe other problems in my code as well that are not making this work. I would be grateful if you could shed some light on it! Best wishes, Ian Gray -- -- www.curvedvision.com -- This communication is confidential to the intended recipient(s). If you are not that person you are not permitted to make use of the information and you are requested to notify the sender immediately of its receipt then destroy the copy in your possession. Any views or opinions expressed are those of the originator and may not represent those of Advanced System Architectures Ltd. *** This Email Has Been Virus Checked *** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Parse error ???
If I remember correctly the second parameter of move_uploaded_file() needs to be the full filename, ie path plus required filename. so... if(!move_uploaded_file($_FILES['myfile']['tmp_name'], (/var/www/html/upload/ . $_FILES['myfile']['name']))) Neil Mike Mapsnac wrote: *** This Email Has Been Virus Swept *** brackets solve the probleb. But why I have the warning messages? The permission on the directory is correct. Any ideas what can cause such messages? Warning: move_uploaded_file(/var/www/html/upload/): failed to open stream: Is a directory in /var/www/html/uploadproc.php on line 11 Warning: move_uploaded_file(): Unable to move '/tmp/phpiMrdlQ' to '/var/www/html/upload/' in /var/www/html/uploadproc.php on line 11 Error Moving the uploaded file failed. From: Michael Nolan [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: [PHP] Re: Parse error ??? Date: Thu, 04 Mar 2004 13:40:46 + Mike Mapsnac wrote: The script should upload files (images). Error message is give below, any ideas why I get this errror message? Parse error: parse error in /var/www/html/uploadproc.php on line 3 die() needs brackets around its arguments, eg: die(Error! The expected file wasn't a part of the submitted form); Mike -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ One-click access to Hotmail from any Web page download MSN Toolbar now! http://clk.atdmt.com/AVE/go/onm00200413ave/direct/01/ -- -- www.curvedvision.com -- This communication is confidential to the intended recipient(s). If you are not that person you are not permitted to make use of the information and you are requested to notify the sender immediately of its receipt then destroy the copy in your possession. Any views or opinions expressed are those of the originator and may not represent those of Advanced System Architectures Ltd. *** This Email Has Been Virus Checked *** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Unexpected ;
You're missing a right bracket within the if statement. Paul Furman wrote: *** This Email Has Been Virus Swept *** I don't see what's wrong with this if statement: while ... and ... { if (($pic_num + 1) = $thumb_num { $tab = ((($pics * $page) - 1) + $pic_num); } Error unexpected ; on the last line there. I added some extra () to make sure I had everything together not two statements or something odd like that. The while loop above works with the if statement removed. -- -- www.curvedvision.com -- This communication is confidential to the intended recipient(s). If you are not that person you are not permitted to make use of the information and you are requested to notify the sender immediately of its receipt then destroy the copy in your possession. Any views or opinions expressed are those of the originator and may not represent those of Advanced System Architectures Ltd. *** This Email Has Been Virus Checked *** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to open a webpage
Or with PHP you could do: Header(Location:$launch); die; Make sure that nothing is outputted before this is called though. The variable $launch should also be an absolute URL. Neil Richard Davey wrote: *** This Email Has Been Virus Swept *** Hello bernard, Monday, January 12, 2004, 1:47:39 PM, you wrote: b I have a field with an URL b The value of this in a variable $launch. b How can I open this URL automatically ?? PHP itself cannot open a web page, it's a server-side language and doesn't have any control over the client like that. What it can do however is echo out the HTML required to make it happen. Either some JavaScript, or a link with the TARGET attribute set to be $launch. -- -- www.curvedvision.com -- This communication is confidential to the intended recipient(s). If you are not that person you are not permitted to make use of the information and you are requested to notify the sender immediately of its receipt then destroy the copy in your possession. Any views or opinions expressed are those of the originator and may not represent those of Advanced System Architectures Ltd. *** This Email Has Been Virus Checked *** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP function for length of the array???
Or you can use sizeof() which is an alias for count() Scott Fletcher wrote: *** This Email Has Been Virus Swept *** Ah! Thanks!!! Chris Hayes [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] At 15:44 6-1-04, you wrote: Hi! Anyone know what is the php function for finding the length of the array? I haven't found the answer at http://us3.php.net/manual/en/ref.array.php . looking for the number of elements? -count($arrayname) -- -- www.curvedvision.com -- This communication is confidential to the intended recipient(s). If you are not that person you are not permitted to make use of the information and you are requested to notify the sender immediately of its receipt then destroy the copy in your possession. Any views or opinions expressed are those of the originator and may not represent those of Advanced System Architectures Ltd. *** This Email Has Been Virus Checked *** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Php Windows server
You will need to ensure that the session save path is set to a valid directory: e.g. session.save_path = C:/Temp Neil E. Ricardo Santos wrote: *** This Email Has Been Virus Swept *** Somebody could say to me if something special exists to form for the treatment of the sessions in a Php Windows server? I have a code that works perfectly in Apache, nevertheless, when executing it in a Windows server the sessions do not activate. I am using php 4.3.3 like ISAPI. There is something I must define in php.ini? Thanks -- -- www.curvedvision.com -- This communication is confidential to the intended recipient(s). If you are not that person you are not permitted to make use of the information and you are requested to notify the sender immediately of its receipt then destroy the copy in your possession. Any views or opinions expressed are those of the originator and may not represent those of Advanced System Architectures Ltd. *** This Email Has Been Virus Checked *** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] CHMOD...
How about: exec(chmod -R 755 /somedir/); [EMAIL PROTECTED] wrote: *** This Email Has Been Virus Swept *** Is there anyway to use CHMOD: chmod (/somedir/somefile, 0755); but have it set all files, folders etc to the CHMOD setting I want? I have a folder, and within that, I wanna quickly, jsut set it all to CHMOD 777. all sub DIR's and files etc... can it be done simply? E.G. : chmod (/somedir/%, 0755); * The information contained in this e-mail message is intended only for the personal and confidential use of the recipient(s) named above. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this document in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail, and delete the original message. *** -- -- www.curvedvision.com -- This communication is confidential to the intended recipient(s). If you are not that person you are not permitted to make use of the information and you are requested to notify the sender immediately of its receipt then destroy the copy in your possession. Any views or opinions expressed are those of the originator and may not represent those of Advanced System Architectures Ltd. *** This Email Has Been Virus Checked *** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Calculating difference between two timestamps
Hi there, Does anyone have any suggestions as to how I can calculate whether one timestamp is within one second of another timestamp. e.g. Timestamp 110:59:59 Timestamp 211:00:00 Essentially I need to create a function which'll take two parameters and return whether the two parameters are within one second of each other. Any suggestions would be great. Neil -- -- www.curvedvision.com -- This communication is confidential to the intended recipient(s). If you are not that person you are not permitted to make use of the information and you are requested to notify the sender immediately of its receipt then destroy the copy in your possession. Any views or opinions expressed are those of the originator and may not represent those of Advanced System Architectures Ltd. *** This Email Has Been Virus Checked *** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Calculating difference between two timestamps
Perfect - thanks Bogdan Bogdan Stancescu wrote: *** This Email Has Been Virus Swept *** Neil Freeman wrote: Hi there, Does anyone have any suggestions as to how I can calculate whether one timestamp is within one second of another timestamp. e.g. Timestamp 110:59:59 Timestamp 211:00:00 Essentially I need to create a function which'll take two parameters and return whether the two parameters are within one second of each other. Any suggestions would be great. Neil Have you looked at http://www.php.net/manual/en/function.mktime.php? Bogdan -- -- www.curvedvision.com -- This communication is confidential to the intended recipient(s). If you are not that person you are not permitted to make use of the information and you are requested to notify the sender immediately of its receipt then destroy the copy in your possession. Any views or opinions expressed are those of the originator and may not represent those of Advanced System Architectures Ltd. *** This Email Has Been Virus Checked *** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Old version of PHP
them some slack! It is for your own good (and the good of others). Though painful, it is an unfortunate fact of life. Switching ISP's generally will get you the latest version, for the moment... That honeymoon doesn't last very long. The first time you pressure them into an upgrade that breaks 20 other customers, they will be wiser and you won't get much help from them anymore. Most likely, your current ISP has been here. thx, Neil behaviour is caused, and the causes are many - Original Message - From: Justin French [EMAIL PROTECTED] To: Dan Phiffer [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Thursday, August 07, 2003 9:43 PM Subject: Re: [PHP] Old version of PHP On Friday, August 8, 2003, at 09:21 AM, Dan Phiffer wrote: I'm working on an ongoing project that depends on a shared webserver running an old version of PHP (4.1.2 I believe). Is there any good reason to stick with an older version of PHP, or might it be a valid suggestion to have it upgraded to something a bit more recent? I have a notion that upgrade attempts may have been snubbed out by the way things like register_globals are now handled by default, the perception being that newer versions of PHP are incompatible with older code. the register globals event happened on 4.1 (from memory), so any install over that should be straight forward. in any case, it's just one simple directive that needs to be changed in the php.ini file... can't see how this should be an issue. i think the best reason to keep up-to-date on the versions is that each new release is better, more stable, etc etc... i haven't ever heard anyone on this list say i prefer 4.2.3 over 4.2.4 :) as a programmer, i hate it how some hosts refuse to keep on top of the upgrades... really useful functions in newer versions aren't available. Mainly I'm concerned that code I test on our in-house server running version-current PHP will depend on function calls and language constructs that the production server's vintage PHP interpreter lacks. exactly... there isn't a HUGE number of differences between the current release and what they've got on the live server, but there are exceptions... i was making good use of file_get_contents() on my LAN, but had to write a user-function to replicate it when running on the live server which is stuck at 4.2.3 for the moment. it's almost a case of don't upgrade your LAN until the production server upgrades, but I prefer convince you host to upgrade, or move host :) Justin -- 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] Open Source Software Survey
Dear PHP Contributors, I am studying for a Master's degree with Henley Management College in the UK, and in the past have used a variety of Open Source Software. As part of my course I am conducting a survey in an attempt to identify the critical success factors for Open Source projects. If you are a user or developer for PHP, I would be very grateful if you could spare 2 or 3 minutes to fill in my questionnaire at the following URL: http://surveys.ideoconcepts.com/surveyor/index.php?sid=4projectid=PHP This survey is completely confidential. Please accept my apologies if this is regarded as an off-topic posting. Thank you very much for your help, Neil Hambleton Email: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] getallheaders() in PHP 4.2.3
I believe getallheaders() has been supported since v4.0.0 Ananth Kesari wrote: *** This Email Has Been Virus Swept *** Hi, For some reason, getallheaders() is not working with the NetWare port of PHP 4.2.3 even while we have not modified the related code for NetWare as such. So, I am just wondering if getallheaders() is implemented for PHP 4.2.3? The document doesn't mention from which PHP version this supported. But it does mention that in PHP 4.3.0 and above, getallheaders() is aliased to apache_request_headers(). Thanks, Ananth. -- -- www.curvedvision.com -- This communication is confidential to the intended recipient(s). If you are not that person you are not permitted to make use of the information and you are requested to notify the sender immediately of its receipt then destroy the copy in your possession. Any views or opinions expressed are those of the originator and may not represent those of Advanced System Architectures Ltd. *** This Email Has Been Virus Checked *** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Empty session directory
IVáN DÃAz wrote: Hi everyone! I would like to know if I need to empty from time to time the directory where the session files are stored. I'm running windows nt4.0 and Apache. Thanks in advance. Hi Ivan That would probably be a good idea yes. On linux and unix based OS's sessions are usually stored in /tmp which gets periodically cleaned of old junk files. Depending on how your windows machine is set up, you might need to clean the dir every now and again, i dont remember anything that did this in the NT4 OS, but its been a long time since I used it. That said if you have allot of space it could probably go without cleaning for years :) Cheers Neil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Synchronize MYSQL
Khuram Noman wrote: Dear Members How to Synchronize two MYSQL databases in php Thanks khuram noman __ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com Hello as usual there are a few ways to do tackle this job. My preference is to stop mysql and use rsync to transfer the data , then restart it. Mysql4+ supports clustering also. If you do not stop mysql while u do the sync you risk a corruption of copied data. See man rsync and mysql.com for details of each way. The clustering seems like allot of work to me , it depends how up to date you need to keep Cheers Neil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] strip tags not working - any ideas ?
Hello all I am trying to strip all HTML and other tags from a document, I have read the docs and written a 4 line script that should do the job (from my point of view ! ). However it seems to have literally no effect. Heres the script : ? $file=readfile(http://namx.co.uk/webstats/;); if (!($string = strip_tags($file))) print br error ! br; $strings = strtolower($string); print strings: $strings; ? It doesnt lower case anything and it no strips no tags at , bascially its still the same source as it was unchanged. Obviously theres something I am missing here, but what ? Thanks for your thoughts Neil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] strip tags not working - any ideas ?
Jason Wong wrote: On Wednesday 18 June 2003 18:27, Neil wrote: I am trying to strip all HTML and other tags from a document, I have read the docs and written a 4 line script that should do the job (from my point of view ! ). However it seems to have literally no effect. Heres the script : ? $file=readfile(http://namx.co.uk/webstats/;); $file is an array ... if (!($string = strip_tags($file))) print br error ! br; $strings = strtolower($string); .. you're trying to perform string ops on an array. Normally if you to to print() an array, you get Array returned. This is not the case, I know that file() returns arrays, but i think readfile() returns a string. any other ideas ? Neil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] strip tags not working - any ideas ?
John W. Holmes wrote: Jason Wong wrote: On Wednesday 18 June 2003 18:27, Neil wrote: I am trying to strip all HTML and other tags from a document, I have read the docs and written a 4 line script that should do the job (from my point of view ! ). However it seems to have literally no effect. Heres the script : ? $file=readfile(http://namx.co.uk/webstats/;); $file is an array ... Actually, it's an integer telling how many bytes was read by readfile(). us2.php.net/readfile if (!($string = strip_tags($file))) print br error ! br; $strings = strtolower($string); .. you're trying to perform string ops on an array. you mean an integer... Use fopen() or file() to actually read the file data into a variable. Indeed fopen and fread works fine. Thanks for the heads up Neil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Add new loadable module in php
Skon Lapamnuaypol wrote: We use PHP 4.3.1 on Apache 1.3.27 (RedHat 7.3). We got a binary PHP rpm package from rpmfind.com. The problem occurred on v-webmail from phpguru.org. I already copied imap.so into /usr/lib/php4 and add an extension of imap.so on /etc/php.ini, then restart httpd. But, the application still can't see the imap module. I wonder that in the extension of php.ini, all of extension (.dll - windows platform) was commmented only mysql.so and imap.so were added. But, phpinfo command show a lot of loadable module. Just curious that where does phpinfo get the information from. - Original Message - From: Marek Kilimajer [EMAIL PROTECTED] To: Skon Lapamnuaypol [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Wednesday, June 18, 2003 4:43 PM Subject: Re: [PHP] Add new loadable module in php What platform are you running, where did you get php, do you have imap.so in the extension directory, did you restart webserver after changing its configuration? Skon Lapamnuaypol wrote: Hi, I'm newbie in PHP and tried to install webmail appliction on PHP engine. That webmail require a module IMAP,but my engine haven't have it yet. I tried to put a extenstion = imap.so in php.ini. But, the application still can't detect this module. Can I add php module without recompile PHP source. Thanks in advance, Skon L. Hello Where modules are concerned , you will need to stop and then start apache , as a reload/restart does not check for modules changes . I am not 100% sure of my explanation, but i know in pratice this is the case. Cheers Neil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] header() and mozilla - HELP!
Ensure that you have a die; after the Header() line. Neil deno vichas wrote: *** This Message Was Virus Checked With : SAVI 3.70 June 2003 Last Updated/Checked 12th June 2003 *** i'm runnig into a random problem of having all the headers being displayed instead on the actual web page in mozilla, Ie doesn't seem to suffer from this, when using header(location: www.url.com); this is happening randomly. has anybody seen this or have a fix? -deno i'm running: php 4.3.2 apache 1.3.27 redhat 8.0 php is configed with: './configure' '--prefix=/usr/local' '--with-apache=/home/deno/Apachetoolbox-1.5.66/apache_1.3.27' '--enable-exif' '--enable-track-vars' '--with-calendar=shared' '--enable-magic-quotes' '--enable-trans-sid' '--enable-wddx' '--enable-ftp' '--enable-inline-optimization' '--enable-memory-limit' '--with-mcrypt=/usr/local' '--with-pdflib=/usr/local' '--with-tiff-dir=/usr' '--with-jpeg-dir=/usr' '--with-zlib-dir=/usr' '--with-openssl=/usr/local/ssl' '--with-curl=/usr' '--with-dom=/usr' '--with-zlib-dir=/usr' '--with-pgsql' '--with-ldap' -- -- www.curvedvision.com -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How do I replace browser history using Header()?
Hi, I am using Header(Location:http://www.mysite.com/mypage.php;); to do a browser redirect. This works fine. The problem though is that doing this adds a page to the browser's window.self.history() collection. Is there any way that I can do a PHP Header() statement that does the equivalent of JavaScript's window.self.location.replace(http://www.mysite.com/mypage.php;)? In other words I would like to use PHP's Header statement to replace the current page in the brower's history, not just add another location onto the collection. Any help much appreciated. Neil -- -- www.curvedvision.com -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How do I replace browser history using Header()?
Hmmm. As I thought. Thanks anyway Mark. Neil Mark Charette wrote: *** This Message Was Virus Checked With : SAVI 3.70 June 2003 Last Updated/Checked 12th June 2003 *** -Original Message- From: Neil Freeman [mailto:[EMAIL PROTECTED] Is there any way that I can do a PHP Header() statement that does the equivalent of JavaScript's window.self.location.replace(http://www.mysite.com/mypage.php;)? No. JavaScript (if turned on) is your only choice. -- -- www.curvedvision.com -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] setlocale() changes?
Try removing the double quotes around LC_TIME Neil Mike At Spy wrote: *** This Message Was Virus Checked With : SAVI 3.69 May 2003 Last Updated/Checked 2nd June 2003 *** I've been getting a warning on one of my scripts since I upgraded from 4.1.2 to the most recent version of PHP. The warning is: Warning: setlocale(): Passing locale category name as string is deprecated. Use the LC_* -constants instead The script at the line that is failing sez: setlocale (LC_TIME, $locale); This script isn't mine off hand - what do I look for? I'm not sure I understand the error message. :\ Thanks! -Mike -- -- www.curvedvision.com -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: textarea new line
Adi wrote: i want to add in textarea a string with new line tag in it. how to do that? my try: $string=-line1n\ -line2 n\-line3; echo brtextarea name='aria' cols='50' rows='2'$string/textarea; but i see a single line instead of: -line1 -line2 -line3 tx in advance for any help Hello For a new line in a text area you cant use html br's You need to use either \n OR \r\n Thanks Neil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Removing the #!/usr... from cgi output?
Colin McDonald wrote: Did you try it without that line at all? I'm pretty sure you can setup apache (you are using apache right?) to use /usr/.../bin/php for all files with the extension .php colin David Brannlund wrote: Example: #!/usr/local/bin/php ?php print foo; ? becomes #!/usr/local/bin/php foo Hi there yes , the shebang ( the #!/usr/local/bin/php ) is not needed for use with dynamic webpages wether they be perl , php or whatever Shebangs are used only with shell based scripts. Your webserver should be configured to know what to do with the file by extension, e.g. .php files should be processed by php in apache This link describes how to configure a webserver to do this http://www.php.net/manual/en/install.unix.php ( a unix server , but its nearly the same for windows ) Thanks Neil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: File upload problem
John M wrote: Hello, I have the code below. It's a simple file upload. But it doesn't work. Before the line if(isset( $Submit )) is an echo which can I read. But after choosing a file and press a submit nothing happens. Why is if(isset( $Submit )) always false? Maybe my apache or php config is wrong? I use WinXp Prof, Apache 2.0.43, PHP 4.2.3, safe_mode is on , upload_tmp_dir is c:\tmp\ and upload_max_filesize is 2M in PHP config file. try a double \\ in windows paths Thanks! html head titleUntitled Document/title meta http-equiv=Content-Type content=text/html; charset=iso-8859-1 /head body form name=form1 method=post action= enctype=multipart/form-data you will need to put a form action url in above line , like action=http://www.domain-name.com/script.php; input type=file name=imagefile input type=submit name=Submit value=Submit ? echo Before submit br\n; if(isset( $Submit )) { echo After submit br\n; if ($_FILES['imagefile']['type'] == image/gif){ copy ($_FILES['imagefile']['tmp_name'], files/.$_FILES['imagefile']['name']) or die (Could not copy); echo Name: .$_FILES['imagefile']['name'].; } else { echo ; echo Could Not Copy, Wrong Filetype (.$_FILES['imagefile']['name'].); } } ? /form /body /html Thanks Neil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $header = Location:........ being ignored!
Looks like you're missing a closing bracket on the IF statement as well. Neil Shams wrote: ** This Message Was Virus Checked With : SAVI 3.61 September 2002 Last Updated 17th January 2003 ** Hi Group, I basically have some simple code such as: == if ( $_POST['passwd'] != $db['password'] {header(Location: loginfailed.html); } //else $header = Location: success.html; == however, when I run this code, using a FORM to submit password, username, etc.. if the passwords do not match, the page is forwarded to success.html ! Is there anything obvious that I am doing wrong? Thanks, Shams p.s. I don't want to use else{} because I have lots of if() checks! -- -- www.curvedvision.com -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Newbie Questions
Have a look on devshed.com Bryan Cassidy wrote: Could someone point me to a VERY good doc for learning PHP for a NEWBIE!!! Something I can understand from the beginning to the end. YES I am willing to put my time into learning and reading docs as long as they are clear and made for what they say they are made for. I wont waste my time with something for a second if it isn't clear to me and easy to understand. Thanks in advance. -- -- www.curvedvision.com -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Sessions 'funny' and Zone Alarm Pro 3
It does sound like you're right. Like ZA is perhaps allowing the user's request to go twice. This is akin to people who double click on links because that's what they're used to doing on windows icons. However, it seems a bit odd how it selects to do it. It seems that if it did it twice on every call, one would expect the count to go immediately to 2 rather than start at one. Or does the session only begin after that first item is clicked? The strange thing is that it is not necessarily twice. Say I buy 2 items and then I buy 5 items, it will take 7 (2+5) and add that onto the first purchase of 2 giving me 9 items (when I should only have 7). As you can imagine, the more you buy the more this problem escalates. Have you tested this on several machines? No I haven't I'm afraid. Mike Another thing I have noticed is that the problem only occurs if I use ONE PHP script to do everything (i.e. display and add to the cart) If I split the code accross different scripts I then get nothing added to the cart at all (even though the SID automatically gets inserted inside each form, everytime I sumbit and look at the code the SID changes). I think this is probably to do with the fact that I have used the Rewrite rule in an .htaccess file and the SID (if in the URL) is not getting passed on to the script - not sure about that though. Hmm, still scratching my head although I have the items being correctly added to the cart when no ZA and now I have them not being added at all when Privacy is on. This is after having split the code into multiple files. Don't know why it should make a difference over multiple files though? Thanks Neil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Sessions 'funny' and Zone Alarm Pro 3
Hi, I've started developing a shopping cart and was just testing and found that I get strange results when Zone Alarm's Cookie Control is set to anything other than Off. If anything, I would expect the shopping cart to forget its contents between pages but instead I am getting weird results. (I have many other files/classes being called from this test.php file) test.php html head ?php // I include all my necessary files/functions (none of which require the session // to already be started) session_start(); if ( !isset( $_SESSION[ 'cart' ] ) ) { $_SESSION[ 'cart' ] = new Cart(); } ? /head body ?php $f_id = isset( $_POST[ 'f_id' ] ) ? $_POST[ 'f_id' ] : 1; $f_price = isset( $_POST[ 'f_price' ] ) ? $_POST[ 'f_price' ] : 0; $f_qty = isset( $_POST[ 'f_qty' ] ) ? $_POST[ 'f_qty' ] : 1; $f_desc = isset( $_POST[ 'f_desc' ] ) ? $_POST[ 'f_desc' ] : ''; // Form action $f_act = isset( $_POST[ 'f_act' ] ) ? $_POST[ 'f_act' ] : ''; if ( $f_act == 'add' ) { $_SESSION[ 'cart' ] - add_item( $f_id, $f_qty, $f_desc, $f_price, '' ); } elseif ( $f_act == 'remove' ) { $_SESSION[ 'cart' ] - remove_item( $f_id ); } elseif ( $f_act == 'update' ) { $_SESSION[ 'cart' ] - update_item( $f_id, $f_qty, $f_price, false ); } else { echo 'pre'; print_r ($_SESSION); echo '/pre'; } ? form action=?php echo $_SERVER[ 'PHP_SELF' ]; ? method=post input type=hidden name=f_price value=10.00 / Product = CD input type=hidden name=f_desc value=CD / input type=hidden name=f_id value=1 / Qty:input type=text name=f_qty size=3 maxlength=4 value=1 / input type=submit name=f_act value=add class=button / input type=submit name=f_act value=remove class=button / input type=submit name=f_act value=update class=button / /form ?php echo 'pre'; print_r ($_SESSION); echo '/pre'; ? /body /html -- This script obviously calls itself (not sure if that is part of the problem?) Scenario (with ZA cookie control set to Medium) --- Leave the quantity set to 1 and click add, the session then shows that there is one item in the cart. Click add again and there are 3 items in the cart. Click again and there are 5 items. If I now change the quantity to say 10, there will be 16 items (the 5 that were there a minute ago plus the 10 plus what appears to be the value that quantity was previously set to i.e. 1. Thus if I then go and set the quantity to 5, it will take the previous value (10) plus the new value (5) and add it to the cart (16), giving 31. Turning ZA OFF and all works as expected. Since my cart is a serious of objects/arrays, I changed the following to try and track down the problem. Changed: session_start(); if ( !isset( $_SESSION[ 'cart' ] ) ) { $_SESSION[ 'cart' ] = new Cart(); } ? To: --- session_start(); if ( !isset( $_SESSION[ 'cart' ] ) ) { $_SESSION[ 'cart' ] = new Cart(); $_SESSION[ 'count' ] = 0; } $_SESSION[ 'count' ]++; echo $_SESSION[ 'count' ]; ? The count variable was also going up in the same fashion as the cart items which makes me think that the page itself is being called several times before being displayed. I'm tearing my hair out here and I can't leave it as is and the cart has to go into production and I can't have people buying 31 items when they wanted 3 :) Anyone any suggestions at all. Regards, Neil Stiron -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Editors
Take a look at Maguma Studio Light (www.maguma.com) Neil Nilza Lafayette wrote: ** This Message Was Virus Checked With : SAVI 3.61 September 2002 Last Updated 2nd January 2003 ** I'm running Apache 2.0 as a service and PHP (like a module) onto a Windows Advanced Server. I´m looking for a good and free Editor to use with PHP (With debugging features). Can anyone with experience guide me? Thanks. Janine. __ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com -- -- www.curvedvision.com -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_SERVER['DOCUMENT_ROOT'] on localhost
Rolf, the document_root just doesn't show up in my phpinfo(); do windows machines have one anyway? I have used this var before, just not testing it locally. It normally shows up when I use phpifno on the server. Please check/compare the entries for doc_root = in the two PHP.INI files. Are they the same/given a value. NB: ; The root of the PHP pages, used only if nonempty. ; if PHP was not compiled with FORCE_REDIRECT, you SHOULD set doc_root ; if you are running php as a CGI under any web server (other than IIS) ; see documentation for security issues. The alternate is to use the ; cgi.force_redirect configuration below ;doc_root =;; Regards, =dn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parse Errors
Andy, I am a PHP beginner so this error may be a stupid one. Anyway, I'm trying to write a simple addition script. The client enters two numbers, then my script (adder.php) adds them. However, when the script is run, I get Parse Error On Line 3 I have no idea exactly what I have done wrong. Here is the script. ? print (Your first number is:$firstnumber\n) print (Your second number is:$secondnumber\n) $answer=$firstnumber+$second number echo (The answer is: $answer\n) ? Any help would be greatly appreciated. Thank you. PHP code lines must end with a semi-colon (;). Also, HTML newlines are br (not \n) Some PHPs won't like the short tags, recommend: ?PHP Regards, =dn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Difference between 2 Dates
Colin, I have a similar problem. I am trying to figure out which of two dates is greater. Both are in the -mm-dd format. Is there any easy function that allows this sort of comparison or am I missing something? Treat the dates as strings not numbers: $DateOne = 2002-12-13; $DateTwo = 2001-11-12; if ( $DateOne = $DateTwo ) echo DateOne comes first; You can do comparisons like this but don't try any 'arithmetic'! Regards, =dn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Proposal: New list etiquette/rule
Spam Arrest Sender VerificationYesterday we held an amusing discussion which highlighted the futility of using (badly implemented) technological 'solutions' to a social problem... Herewith I attach a response received pursuant to a list contribution. Does this 'gentleman' seriously expect every list contributor to provide him with a personal service requesting permission to be allowed to post to him? What happens if dozens of his colleagues join up? BTW I will, happily, for my hourly fee (minimum charge four hours)! Suggest that the list 'rules' be updated to point out that such requirements are unlikely to be received favorably, so if he wants to join the community he needs to do 'join' us (not vice-versa). NB I know that technically I've broken my/the list's rules by reproducing this in HTML, and have done so that those who can, are able to see the stupidity in its full glory/know which service NOT to use... Regards, =dn - Original Message - From: Kadir To: [EMAIL PROTECTED] Sent: Thursday, December 12, 2002 11:51 AM Subject: RE: Re: [PHP-DB] Formatting txt from a database (verification) Kadir here, I'm protecting myself from receiving junk mail. Just this once, click the link below so I can receive your emails. You won't have to do this again. http://spamarrest.com/a?33905301:611961 You are receiving this message in response to your email to Kadir, a Spam Arrest customer. Spam Arrest requests that senders verify themselves before their email is delivered. When you click the above link, you will be taken to a page with a graphic on it. Simply read the word in the graphic, type it into the form, and you're verified. You will only need to do this once per Spam Arrest customer.
Re: [PHP] ExpertRating launches PHP Certification Exam
I must be a suspicious character, but I haven't come across Expert Rating before, nor do I know what Pete's connection with Expert Rating is, so I went and looked at the PHP web site (where we are led to believe that we would expect to find a lot of excitement) but a site-wide search fails to yield a single hit. Ok I'll go straight to the horse's mouth and look at their own web site, where I get to thinking about a certification body in the UK (based in Bristol) that has its prices set in USD. Question: who has achieved this distinction and how many employers have commented that the Expert Rating evaluation was the MAJOR selling point? =dn Good news for the PHP developer community- a href=http://www.expertrating.com;ExpertRating/a, the global skills assessment provider has launched an online PHP Certification exam. Candidates who pass the exam will be mailed a hardcopy certificate of accomplishment. The launch of this exam has generated a lot of excitement in the PHP developer community. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem relating to images in email
Hello khuram, Iam new at this mailing list . =welcome to our happy band! I have a problem in php is that i want to store the images on local hard disk that are in email (pop3 account) by runing a php file. how can i do that. please help me asap. =there are a number of classes available that you can absorb into your project. I use email classes from PHPguru.org. =In this case it seems that you will require the ability to first read msgs off the POP server (also check out PHP's IMAP functions), then split them into components, then identify the MIME encoded graphics and store them away. Haven't done all of that myself, but it sounds 'easy' enough... =Regards, =dn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] fgetcsv Help
Richard, I am parsing a csv file with fgetcsv and the fields are surrounding by double quotes, now I am running into a problem periodically that when there are quotes within the value it is treating it like another value instead of the same value. Any ideas on how to get around that? I am thinking I might have to convert all quotes to quot; and then turn all quot;,quot; back into quotes and then the first quot; in the file and then last one since obviously they will not have a comma in between them. This seems like a while lot of work.. Ideas? The first idea is that the system that outputs a .CSV with quotes within a quoted field is broken big-time and that's the part that needs fixing! I'm on the same wavelength as you describe: you can't use any automated csv function on such a file. Quotes should only appear in pairs. The closing quote must therefore appear immediately prior to a field separator (eg comma) - whitespace not withstanding, unless it is the last field on a line, in which case it will appear immediately prior to a record separator. One possibility is to write a 'filter' script to do this - and thus leave your existing code intact. The filter could take in the file, explode on quotes, and then cycle through the resultant array looking at the first non-whitespace data in every second element, clean/recode where necessary, and then implode and output. Alternatively could join/unset consecutive array elements which have been split inappropriately (by 'internal' quotes), and then implode using the other style of quotes/another separator, if this can be made to work later in the process... What a palaver! =dn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: Re[2]: [PHP] Script not working from one computer
I have a feeling it's going to work out to be something stupidly simple... like these problems always do. :) =embarrassingly so! If you're taking this all off a user's say-so, then it sounds like an eyeball job to me... I never did solve it, but it came down to a weird cookie problem. The Session cookie was being set and accepted correctly, but regular cookies would never set. Other web sites could set cookies, but none from this web site were ever written. I don't know if it's because of SSL or what. It's one of those things that worked fine yesterday and now doesn't work and the user didn't do anything. Oh well... IE allows quite a bit of control over the handling of cookies. Most admins would probably focus on the Security tab and the possibilities it offers. However there is also a vicious back-hander under the Privacy tab (that you can't see/get no warning about, under normal operation) and with a simple command one can ban cookies from any nominated web site(s) - hence everything works fine for accessing (eg) the NYTimes but blows up in your face (sorry SeaBee humor) when you access the nominated site. Could be done by FOBCAK, user brilliance=ignorance, or deliberate sabotage/cynical Admin baiting! Couldn't access various online purchasing sites from a hardened laptop, so if they didn't say that they required cookies and I called their HelpDesk, much going round-and-round resulted... Herewith another argument for keeping sessions/controls exclusively server-side! =dn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Filter vulger / controversial words - need word source
Hi Jon, I think we've seen this discussion on the list before (so Christopher, check the archives!) I'm wondering if someone has a great source for a master-list of controversial and vulger words that I can use on my site. I would like to pattern match input text against this master-list in order to prevent vulger and controversial words from appearing on my site. Once you've got the routine working, post it here, because there are many people who would like to know how to do this properly. The problems that others have experienced in the past are: - what happens with misspellings, e.g. fsck? - what happens with dodgy formatting, e.g f s c k? - what happens with words like Scunthorpe? Problem 1: add likely/popular mis-spellings to the list of vulger/vulgar language Problem 2: (contrived) very few single-letter words exist so remove intervening white space prior to analysis Problem 2a: (the more popular f*ck - someone suffering the misapprehension that (s)he is somehow NOT guilty of using bad language/being offensive when (s)he plainly is not only doing so but attempting to be deceptive as well...) see response to Problem 1 (the probably habit would be to replace/remove vowels) Problem 3: Scunthorpe contains an unfortunate series of letters (amongst the town's many disadvantages) however the critical four are not a word in and of their own right so employ whitespace (\s) in the RegEx or token analysis. May I suggest, rather than picking your way through this minefield, you provide a report abusive comment link instead? Most sensible! The employment of a technological solution to a social problem is somewhat shooting the messenger. However some countries are now legislating responsibility that ISPs/employers must discharge (shooting the person who shoes the horses that the Pony Express messenger is riding!?) In this case perhaps one could analyse the incoming text and place an embargo on its publication on the web site until it has been reviewed by a human editor? If we were talking about filtering incoming email, then perhaps the original message could be forwarded/wrapped with a message from the EmailAdmin/System pointing out that a message has arrived from xyz (etc) and has been flagged for a stated reason (but that there is room for interpretation within the mechanical observation) and that the message should not be opened by anyone fearing offence. (this similar to 'security' gateways that don't allow msgs with attachments unless the 'employee' first authorises a 'pass-through') Euro 0.02's worth? =dn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] date() on two diff. servers
Mike, No complaints about explanations in PHP manual - I often say that it IS a cut-above the average. However it does NOT explain the underlying concepts of timestamps, (quite rightly) expecting that we pick up such from other/more appropriate sources. Hence my comments are refering to such sources/attempting to find such sources... Like you, when I re-read that entry in the PHP manual (after your informative reply) I 'saw' the logic and discovered that I had to move the 'location' in my mind-map where I had framed the GMT/TZ adjustment. Fortunately it didn't nullify any design decisions I've made/relied upon. Unfortunately *NIX sources thus far consulted don't seem to feel it necessary to do the same/print anything confirming (and many of them most careless in your GMT point) - and hence the discomfort. It is always difficult to learn new things, and if not more so, can be v.awkward trying to adapt from one philosophy to another, eg Windows to *NIX. Getting the terminology straight is one thing, getting the model worked out another. I don't doubt what you say/am happy to be shown to be wrong, but would sure like to 'prove' it. As I say, am probably just barking up the wrong (Christmas) tree(s). No worries - it's familiar territory! Thanks for your help, =dn -Original Message- From: DL Neil [mailto:[EMAIL PROTECTED]] Sent: 10 December 2002 19:52 =as a Windows user I struggle to cope with some of these UNIX concepts, so I hit Google - with no joy, and ripped through the SuSE manuals (I'm a closet Linux user - will become one, just as soon as I can find the necessary spare machine (and time!) - till then, the box of manuals, CD-ROMs etc lives in the closet!) Would you believe, none appear to clarify this (maybe I'm using the wrong terminology/barking up the wrong trees...). Well, I think the PHP manual is pretty good about this -- all the pages I've looked at are careful to add the GMT timezone indicator when referring to the base date of the Unix epoch, which is pretty much what tipped me off to the correct interpretation. (If you find a reference there that doesn't include the GMT indicator, I reckon that would be worth a bug report in the Documentation problem category.) Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Filter vulger / controversial words - need word source
if you want a partial list of offensive terms - try looking at the meta keywords on a few porn sites ... Excellent idea! Unfortunately I'd have to explain that to my boss... No, really, I'm doing some research... =guess monopolising the color printer for a whole afternoon would give you away, huh? =but won't your gateway/web server's filter prevent access to such sites anyway? =dn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Filter vulger / controversial words - need word source
Jason, there simply is no definitive list of words The fact is content filtering does not work without a heavy dose of human intervention. It is quite shocking that large numbers of well known corporations deploy misconfigured content-filtering software which rejects perfectly innocent email. Earlier contributions highlight this admirably. I was at an Information show last week where a stand displayed the good work of the EU organisation in the field. I spoke to a Brussels(*) wonk/weenie/suit about such legislation (proposed and awaiting national enactment). I suggested that it would be unfair to 'bring to justice' anyone for apparently offending some employee/user's sensitivities without first defining WHAT would cause offence (eg the requested list of vulgar words). Otherwise the first you might know about it is when a court decides (against you) that is unacceptable in polite company. Accordingly I suggested that his department publish such a list (in all of the languages/cultures of the EU???), but observed that he would have a serious problem being able to distribute it without his own office prosecuting itself! As is to be expected, he failed to see the humor (and failed to see the sense/requirement to do so)... The joke is on our Indian friends @upv.pertamina.co.id whose 'filter' simply bounces messages containing Dirty Words, because as you say there is no human involvement so they can't even benefit from Jon's observations. This policy means that every contact/contract with Sc*nthorp that they lose, is deservedly so, and an unfortunate advertisement not to use that country for out-sourcing if the culture-gap is so great!? Summary attitude: hey I'll code it if you want it/pay me to do so, but what are you going to do when you meet the rest of society as soon as you come off the email system? NB it has 'always' been illegal to use such language in (British, and many others) phone conversations, but who does that stop/what filters are in place there? =dn *for the benefit of more distant members: Brussels is the home of many European Union (EU) offices, and the source of much bureaucratic 'stupidity' such as the legislation mentioned earlier. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mail() problem
i setting php.ini [mail function] ;For Win32 only SMTP = hermes.ica.gov.co sendmail_from = [EMAIL PROTECTED] =it is impressive to see that the Greeks' messenger has made it all the way over to Colombia! Wasn't he also held responsible for dealing with people who were guilty of indiscreet speech - good name for an email server... =I'm immediately suspicious of the sub-domain address for the SMTP server. What do you have for server identification in your email package? Make the two definitions the same. =Whereas this might be the name of your MS-Exchange box, what happens if you remove the hermes. and just go with the domain name? =Regards, =dn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Snoopy Class
Hi UberGoober, Thanks for your (unique) reply. Specifically: am playing with web pages/link continuity checking and suchlike. So HTTP; as an improvement over the facilities offered by fopen(). Have worked through the readme examples, and dived into the script's code, as you would expect. Was hoping for something that explains in a little more depth, eg why this combination/sequence; to see if there is more that I can learn and/or more that I am missing/can make use of... - being ignorant allows me to pose the question, but by definition, not to define an answer for you! Any pointers to material, or advice from your experience would be most welcome, =dn A tutorial to help you do *what* exactly? The readme provides plenty of examples: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/snoopy/Snoopy/README?rev=1.6; content-type=text/vnd.viewcvs-markup (pardon the pun) Please recommend a Snoopy tutorial, =dn PS Google has not been my friend! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: Re[2]: [PHP] Script not working from one computer
Hi John, You mention that it is a login script and that input is rejected. Is it rejected when it is initially typed in, or is it reported as rejected when ensuing pages are served? Please check the IE on the offending machine. Does it have security settings that forbid cookies? Check the ipconfig/all settings against other machines/check any contents of HOSTS file (and the other MS one, if used) Check execution of phpinfo() against similar on other/working machines. Regards, =dn Tuesday, December 10, 2002, 2:31:48 AM, you wrote: Have you checked: Browser versions? (is the browser the same type/version as on the other machines) Is it a laptop? If so, are you using the internal keyboard with Numlock 1JWH on? Is the machine in question set-up on the network correctly, i.e. has it 1JWH got domain, gateway addresses etc setup - this would only affect it if the Intranet server is set-up to only allow a certain range of IP addresses or doamin/hostnames etc. 1JWH Browser's are the same (128bit). It's not a laptop. The web page can pull up 1JWH any other external web page correctly. 1JWH What gets me is that the computer can pull up the log in page. It can pull 1JWH up another, unprotected page from that web server. But, no matter who tries 1JWH to log in from that machine, I get a bad username and password, even though 1JWH they are right. It's like the browser is sending bad data to a script that 1JWH works fine from every other computer. 1JWH Anyone else have any other ideas? 1JWH ---John Holmes... I know, PHP is executed server side, so it shouldn't matter about the computer, but... I've got a basic log in script that takes username and password and does 1JWH the typical SELECT to find a match. If it's good, it sets some session 1JWH variables and redirects to a main page, otherwise redirects back to the login page with an error message. The script works from all computers but one. The login page will come up, but no matter what, it says the username and password are bad. They are correct though, caps lock isn't on, etc. I've cleared the cookies and 1JWH cache and it still does the same thing. The script is on an intranet. One computer that had this issue was fixed 1JWH by using https://computername.company.army.mil instead of just https://computername. But for this computer, both addresses give the same result. So, I'm sure it's not the PHP script, so I'm looking for ideas of what I should check, settings wise, on the client computer? Any help is greatly appreciated. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to test php.info from command line
I agree with Jason, it seems strange to have a command line option (that can only apply to command line operation) and yet the output be in browser/non-command line format... However with PHP-CLI 'coming soon', maybe that sorts things out. Meantime may I suggest combining the two answers: php -i /tmp/test_php.html (note file type) Thereafter chuck test_php.html into your browser for convenient viewing/to 'get rid' of the tags/static. (when I do this, the graphics don't print out, eg PHP logo at page top - which is a convenient way of differentiating between phpinfo() from the command line and from a web server!) Hope it helps, =dn How to test php.info from command line: #echo ?php phpinfo()? | php to the standard output (screen) - or if you want to a file like this way: #echo ?php phpinfo()? | php /tmp/test_php.txt Oliver Etzel .eu - domain are coming soon www.t-host.com Or simply #php -i It would be nice if there was a text-only version without all the HTML gunge. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Different output on two different servers
Hi Steve, Have you solved this already? If not, when you copied the code between machines was there some effort to ensure that the 'copy' points to the RDBMS/tbls on the same box/different box - or does the original box have code that points to tbls on itself, and the second box have code that runs on 'it' but (still) points to tbls on the first box (not on itself)? [make sense?] Regards, =dn PS what's the difference between production and live? (in my jargon they are synonyms) I have set-up a production server and a live server. The problem is with the production server. I am using PHP version 4.2.3 and MySQL 3.23.39 on both servers. We have just configured the production server to mimick the live server (which incidentally works fine) and the code from both servers is identical. I dumped all the data into the production MySQL database then copied the code from the live server to our production one and there didn't seem to be any problems. However today my boss asked for a new category to go into our webshop with a new product. I went into MySQL and updated the database fine then when I went to check the section of the site to see if the extra category and product are there I get my own PHP encoded error 'No categories currently available'. It fails on the first function: function display_categories($cat_array) { //display all categories in the array passed in if (!is_array($cat_array)) { echo brNo categories currently available.br; } else { //create table echo table width = \760\ border='0' background='images/shopbg.gif'; etc. Now it works superbly on my live server and did work fine until I tried adding another field to the database on the production server. Where should I start looking to de-bug this? Steve Jackson Web Developer Viola Systems Ltd. http://www.violasystems.com [EMAIL PROTECTED] Mobile +358 50 343 5159 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: Re[2]: [PHP] Script not working from one computer
John, You mention that it is a login script and that input is rejected. Is it rejected when it is initially typed in, or is it reported as rejected when ensuing pages are served? When it's initially typed in. =do you have multiple 'environments' (eg VHosts or even physical servers) on your PHP/web server? If you run the errant machine against a copy of the script in another 'environment' does the same happen? =can you put a DEBUG line into the code and have the data displayed prior to it leaving the PC/form, and as the login 'result' is being processed/returned to the user? Where does it 'break'? =is there anything silly about the person's login/pswd? Is it just the one person's login that's at issue, or everybody's when they use that particular PC-client? Please check the IE on the offending machine. Does it have security settings that forbid cookies? No, it's a default install of IE6. I have a check that'll put up an error if cookies are turned off and that's not the error I get. I get the error saying that the username or password didn't match anything in the database. =not something dopey like a zero-oh transliteration error, eg passw0rd instead of password? Check the ipconfig/all settings against other machines/check any contents of HOSTS file (and the other MS one, if used) Check execution of phpinfo() against similar on other/working machines. Is it a plain old login script, or is it one which uses javascript to MD5 the password? If the latter, you may want to check you've enabled javascript. It's just a plain log in script. I'm going to troubleshoot it more today and throw in some tracing to the functions to see where everything is going and what the login/password values are all the time. I just haven't had a chance to make it over to that computer yet. I have a feeling it's going to work out to be something stupidly simple... like these problems always do. :) =embarrassingly so! If you're taking this all off a user's say-so, then it sounds like an eyeball job to me... =dn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] date() on two diff. servers
=now let's take a look at the UNIX Epoch. Various 'quotations' have surfaced in this email, and I don't recall that it is well discussed within the PHP manual (it being a UNIX definition after all...). The epoch 'began' 1Jan1970, sure enough (exactly as quoted). HOWEVER it is defined as beginning at Greenwich: 1Jan1970 at midnight UTC in Greenwich... =So a timestamp of 'zero' in London (UTC) would see the east coast of Australia at 39600 local (TZ of +1100 (hours)). Er -- no, I think you've got that backwards. Unix timestamps are, as you rightly say, seconds since 00:00 1-Jan-1970 GMT, so, at any instant, the Unix timestamp is the same at every point on the globe. It's only the *local* *times* (on the server, of course) that change. So, the Unix timestamp of 0 represents: 00:00 1-Jan-1970 GMT 19:00 31-Dec-1969 on the east coast of Canada/USA (5 hours behind GMT) 09:30 1-Jan-1970 in Australia's Northern Territory (9.5 hour ahead of GMT -- I know this one 'cos my sister lives there!) From this, you can see why the same time stamp might give you different dates if your servers are in different timezones -- espacially ones as widely different as Australia and Canada! =which is about where we came in, IIRC =if at that very time I was in London and you in TZ+1100 and we waited one hour, the asked for the current timestamp: I would get 3600 and you 43200. Again, no: if I, at 01:00 local in GMT, and he at 12:00 local in a GMT+1100 timezone -- that is, the very same instant -- both asked for the current UNIX timestamp, we would both get the same answer. =uh-oh. I may misunderstand UNIX timestamps then - perhaps I am assuming too much similarity to date()? =Date() is local-TZ aware, so I appear to have assumed that a timestamp is also. What you are saying is that a timestamp is always GMT (regardless of machine/opsys TZ) and only when passed to date() or somesuch is the 'time' value manipulated (as well as its format) to become local. Correct? I thought timestamps were set at the time on the local clock, and thus would be different across TZs - date() is... =as a Windows user I struggle to cope with some of these UNIX concepts, so I hit Google - with no joy, and ripped through the SuSE manuals (I'm a closet Linux user - will become one, just as soon as I can find the necessary spare machine (and time!) - till then, the box of manuals, CD-ROMs etc lives in the closet!) Would you believe, none appear to clarify this (maybe I'm using the wrong terminology/barking up the wrong trees...). =Like you (Mike), I'm living in Zulu-TZ (although unlike you, I'm not always 'here'), where it's not so easy to test for myself (and I'm not prepared to jump onto client machines to 'play', at this moment). - I double-checked with Asia this morning and things work exactly as they should (at the application level) so I'm (relieved) confident that all is well with the code. =So as far as any processing goes, whatever I understood was the 'model' was good enough to get the job done, however my 'model' of the way UNIX/PHP works is slightly shaken, so I'm not a happy bunny... =With relief that I didn't mislead Justin: the fact remains/we are completely agreed - if you want to have a consistent database (for example) with temporal data arriving from/going to different TZs, then the gm*() functions are the ones that will offer the required international consistency to convert timestamps to readable dates and v-v... =The reality is that everyone works off UTC (NB GMT whilst widely used/terminology within PHP is not the internationally PC term) - including the (alert) Americans - the US military refers/referred to UTC/GMT as Zulu time (which has more to do with the alphabet than warriors). So if I'm in Germany and I'm phoning you early/late in the day, to avoid holding our conversation in a less socially-acceptable climate I would first compare my time against UTC (+0100) and then compare your time against UTC (+1100), do the math to get a difference of +10 hours, add that to my local time, and thereafter place/delay the call... (try doing this calculation based upon something like Indian Standard Time, and add a Daylight Saving/Summer-Time adjustment into the mix, just for 'fun'!?) Well, the time/date functions provided in PHP can do all this for you. =and do so, very nicely, thank you! =In conclusion, (based upon my, cough, cough, many years of wrestling with this sort of thing) make all stored times UTC (gm*()) Yes -- as the Unix timestamp is an *absolute*, always expressed in GMT regardless of where you are (or, rather, where your server is!), this is the one to use as your base. - the RDBMS should not 'filter' timestamps - MySQL does not (for example), and then if you want 'local' times you can 'do the math' for either the server's TZ or
Re: [PHP] date() on two diff. servers
Justin, Jumping in late... Daylight Savings Time? John, I think Daylight Saving Time creates a difference of 1 hour and not 1 day :) True... but I checked it anyway -- by adding just one and two hours to the stamp... which made no difference... but when I added 86400 to the stamp, it all worked. =depends upon the time of day! (its a logic 'twister', like saying even a stopped clock is correct twice per day) Justin, it depends how you got your timestamp in the first place, I think... I could be wrong again here but aren't these different? mktime() gmmktime() =absolutely! One just 'works', the other relates everything back to GMT before performing the same calcs. Actually, they were created with strtotime(). Note, I don't believe there's anything wrong with the stamp itself. The point is, the stamp is displaying as two different dates using date() on two different servers, and I believe this is not what date() is supposed to do. Shouldn't the stamp for 12-09-2002 22:13:09 be the same on every server? =yes, no, not necessarily! My rationale for this is that no matter where you are in the world, it is always a certain number of seconds since 01-01-1970 00:00:00. =yes, no..., watch out for the interpretations that are applied EVERY time you call a function! Perhaps strtotime() is NOT running off GMT, and perhaps date() is... there has to be SOME confusion there -- either on my side, or in my choice of functions, or SOMETHING :) =any call to system time will get you the time that has been set on the SERVER (although there is a PHP function for local-time, somewhere - have never used it). So the first question is, where is the server? The second question is, what time zone (TZ) has it been set to run within? (NB you can run a server in Sydney, but set its clock so that it 'appears' to be in Perth - if you really want to...) =now let's take a look at the UNIX Epoch. Various 'quotations' have surfaced in this email, and I don't recall that it is well discussed within the PHP manual (it being a UNIX definition after all...). The epoch 'began' 1Jan1970, sure enough (exactly as quoted). HOWEVER it is defined as beginning at Greenwich: 1Jan1970 at midnight UTC in Greenwich... =So a timestamp of 'zero' in London (UTC) would see the east coast of Australia at 39600 local (TZ of +1100 (hours)). =if at that very time I was in London and you in TZ+1100 and we waited one hour, the asked for the current timestamp: I would get 3600 and you 43200. So whereas I can subtract zero from current time and get one hour, you must subtract 39600 from 43200 to get the correct answer - in other words, don't use zero, but 'Epoch-zero' adjusted for TZ. =as soon as you start to twist your mind around all this, you realise why Dr Who was a bit loopy about the size of telephone boxes, etc! Time travel is not for the faint-hearted (nor the mathematically-challenged/regular lottery ticket purchasers)! =PHP provides a solution in the gm*() series. The best/only solution is to find a common timebase. I've worked with American (and one Japanese) companies who (initially) insisted on time-basing everything to HEAD OFFICE (caps to demonstrate scale of self-importance, eg this report must be in by 1700 in ...), and usually they end up tripping themselves up, and thus provide me with the 'proof' of the illustrations/arguments I made at the design stage (that they chose not to listen to...) =The reality is that everyone works off UTC (NB GMT whilst widely used/terminology within PHP is not the internationally PC term) - including the (alert) Americans - the US military refers/referred to UTC/GMT as Zulu time (which has more to do with the alphabet than warriors). So if I'm in Germany and I'm phoning you early/late in the day, to avoid holding our conversation in a less socially-acceptable climate I would first compare my time against UTC (+0100) and then compare your time against UTC (+1100), do the math to get a difference of +10 hours, add that to my local time, and thereafter place/delay the call... (try doing this calculation based upon something like Indian Standard Time, and add a Daylight Saving/Summer-Time adjustment into the mix, just for 'fun'!?) =In conclusion, (based upon my, cough, cough, many years of wrestling with this sort of thing) make all stored times UTC (gm*()) - the RDBMS should not 'filter' timestamps - MySQL does not (for example), and then if you want 'local' times you can 'do the math' for either the server's TZ or (if you're really masochistic (?is that the word?)) the browser-client's local time. The 'silver lining' is that you can now easily accommodate temporal input/presentations to/from anyone, anywhere in the world - it is also easy to produce code to calculate the server's local time (for example), so that the same routine works regardless of where the server is located - where next year's new 'mirror' is to be located, anywhere in the world! =Yes, you may have a chunk
[PHP] Snoopy Class
(pardon the pun) Please recommend a Snoopy tutorial, =dn PS Google has not been my friend! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: Re[2]: [PHP] Simple text editor for Windows?
Hi Tom, I know the text editor question has been beat to death, but I'm looking for a simple editor with syntax highlighting that can be installed in Windows by a general user. It would have to be something that didn't access the registry, as normal users can't do that. Does anyone know of a program like this? Thanks. Take a look at this one it seemed to be pretty good, the closest I've seen to homesite functionality without the bloat. http://www.crimsoneditor.com/ Looks interesting - and no registry finagling you say! One expects that John meant PHP syntax highlighting. From where is the PHP control file made available? Please advise, =dn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] empty string parameters to backslashes?
Hey Andy, I'm trying to track down a problem with someone else's code. Our hosting service changed PHP versions on us (up to 4.0.6), and everything broke. I think I have tracked down at least part of the problem. We have a ... Ascertain differences by printing out a phpinfo() report for the new config and comparing with previous (obvious logic flaw noted!). It is as important for developers (as for installers) to read the ChangeLog (http://www.php.net/ChangeLog-4.php) to see what's new/different between versions. But the output of the print statement looks like this: funA START: file: productBrief, name: \, alt: \, size: 177\ So where did the darned backslashes come from? Any ideas? Magic_quotes will do this. Check out manual: LXXIX. PHP OptionsInformation - the hosting service may have changed the setting on you. Follow links to learn how to SET and GET from within scripts. Regards, =dn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Checking for Overlapping Dates
Hi Thomas, SELECT * from $DB_TBLName WHERE (Trim(WorkerEmail)='$userReplacementEmail') AND AND OR OR OR OR OR This is all a bit complicated, and a simple boy like me gets lost too easily. KISS principle: Keep it simple... You have two employees: A, so named because he Already has Annual leave Approved, and B, so named because he is Begging to Be allowed to Break out. Let's imagine we're playing with a wall-chart/wall-planner to assess requests prior to granting approval. So we mark off which days A will be away and then view which days B would like to go against existing requests. Month A Month BMonth C Month etc A --- B Assuming the email/fonts haven't mucked-up my sketch, you can see that B's request should be denied, because A has already booked the time-out. Now let's use the diagram to build an algorithm. How many ways are there that A and B could overlap? (hint: four) Not overlap? (hint: two) Which is the easiest to implement in code? Now you can ask, which language should I code in? Answer: stay as close to the source as possible, ie use SQL (or in this case pseudo-SQL(!)). SELECT a AS Colleague, CONCAT( astart - afinish ) AS PermissionDenied FROM tbl WHERE bstart afinish OR bfinish astart; Before this will work, you will need to add another WHERE clause to establish who is the employee's replacement. The above lists a reason for rejection - you can reverse the logic, at your peril. Trust this assists, =dn PS The complicating question I wanted to ask from the word go is: what if one person can have more than one other employee act as his/her replacement? Background: I've created a vacation-request application for our company's intranet. When an employee requests a vacation, he has to list the name of another employee who will 'fill in' for him while he is gone. Before a vacation request can be saved in MySQL, I need to check to make sure that the person listed as the employee's replacement during this time has not already requested a vacation during the same time period...to check to be sure that the two vacation periods do not overlap. Date Ranges: I have fields saved in MySQL called unixStartDate unixEndDate that are unix timestamps for the first day of the employee's vacation and the last day of the emplosyee's vacation. I have tried to do a check using purely SQL, but this doesn't account for all possibilities of overlapping dates: (unixStartDate is the unix timestamp for the replacement, whereas the PHP var $unixStartDate is the unix timestamp for the employee who wants to post a new vacation request) $checkSQL = SELECT * from $DB_TBLName WHERE (Trim(WorkerEmail)='$userReplacementEmail') AND (Status 40) AND ( ( ($unixStartDate = unixStartDate) ) OR ( ($unixEndDate = unixEndDate) ) OR ( ($unixStartDate = unixEndDate) ) OR ( ($unixEndDate = unixStartDate) ) OR ( (unixStartDate $unixStartDate) (unixEndDate $unixEndDate) ) OR ( (unixStartDate $unixStartDate) (unixEndDate $unixEndDate) ) ) ; So I think what I instead need to do is use PHP code instead of SQL to check for overlapping dates in the 2 date ranges I have. My two ranges would be like this: Replacement's Date Range: $unixStartDateReplacementVacation ...to... $unixEndDateReplacementVacation Employee's Date Range: $unixStartDateEmployeeVacation ...to.. $unixEndDateEmployeeVacation ...so i need to check that none of the dates occuring in the first date range listed above appear in the second date range. unfortunately, i have no basic idea of how i should go about doing this...should i use arrays of dates, for-loops, or what? thanks a whole lot in advance, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Fw: [PHP] Checking for Overlapping Dates
Thomas (and list), The solution, as previously posted, is flawed/incomplete - mea culpa. Excuse: I was interrupted three times from typing the word SELECT until pressing Send, and then rushing to get on to the next call on my time... WHERE bstart afinish OR bfinish astart; Check back with the diagram and you will see that a bstart clause needs to also check that bstart = astart to trigger rejection - if the leave starts AND finishes before the 'replacement's' leave, then all is well - similarly for second clause. Now, if you prefer to inform a positive response, eg leave may be granted, then when you turn things around, pay special attention to the relationship and changing ORs and ANDs. Better if we change the whole logic around and say when can we grant annual leave? because then the answer becomes: if bfinish astart or fstart afinish. This has the additional advantage of 'scaling', if the employee has more than one potential 'replacement'! In all approaches beware the special case: that the 'replacement' has no outstanding request for leave! Again apologies, =dn SELECT * from $DB_TBLName WHERE (Trim(WorkerEmail)='$userReplacementEmail') AND AND OR OR OR OR OR This is all a bit complicated, and a simple boy like me gets lost too easily. KISS principle: Keep it simple... You have two employees: A, so named because he Already has Annual leave Approved, and B, so named because he is Begging to Be allowed to Break out. Let's imagine we're playing with a wall-chart/wall-planner to assess requests prior to granting approval. So we mark off which days A will be away and then view which days B would like to go against existing requests. Month A Month BMonth C Month etc A --- B Assuming the email/fonts haven't mucked-up my sketch, you can see that B's request should be denied, because A has already booked the time-out. Now let's use the diagram to build an algorithm. How many ways are there that A and B could overlap? (hint: four) Not overlap? (hint: two) Which is the easiest to implement in code? Now you can ask, which language should I code in? Answer: stay as close to the source as possible, ie use SQL (or in this case pseudo-SQL(!)). SELECT a AS Colleague, CONCAT( astart - afinish ) AS PermissionDenied FROM tbl WHERE bstart afinish OR bfinish astart; Before this will work, you will need to add another WHERE clause to establish who is the employee's replacement. The above lists a reason for rejection - you can reverse the logic, at your peril. Trust this assists, =dn PS The complicating question I wanted to ask from the word go is: what if one person can have more than one other employee act as his/her replacement? Background: I've created a vacation-request application for our company's intranet. When an employee requests a vacation, he has to list the name of another employee who will 'fill in' for him while he is gone. Before a vacation request can be saved in MySQL, I need to check to make sure that the person listed as the employee's replacement during this time has not already requested a vacation during the same time period...to check to be sure that the two vacation periods do not overlap. Date Ranges: I have fields saved in MySQL called unixStartDate unixEndDate that are unix timestamps for the first day of the employee's vacation and the last day of the emplosyee's vacation. I have tried to do a check using purely SQL, but this doesn't account for all possibilities of overlapping dates: (unixStartDate is the unix timestamp for the replacement, whereas the PHP var $unixStartDate is the unix timestamp for the employee who wants to post a new vacation request) $checkSQL = SELECT * from $DB_TBLName WHERE (Trim(WorkerEmail)='$userReplacementEmail') AND (Status 40) AND ( ( ($unixStartDate = unixStartDate) ) OR ( ($unixEndDate = unixEndDate) ) OR ( ($unixStartDate = unixEndDate) ) OR ( ($unixEndDate = unixStartDate) ) OR ( (unixStartDate $unixStartDate) (unixEndDate $unixEndDate) ) OR ( (unixStartDate $unixStartDate) (unixEndDate $unixEndDate) ) ) ; So I think what I instead need to do is use PHP code instead of SQL to check for overlapping dates in the 2 date ranges I have. My two ranges would be like this: Replacement's Date Range: $unixStartDateReplacementVacation ...to... $unixEndDateReplacementVacation Employee's Date Range: $unixStartDateEmployeeVacation ...to.. $unixEndDateEmployeeVacation ...so i need to check that none of the dates occuring in the first date range listed above appear in the second date range. unfortunately, i have no basic idea of how i should go
Re: [PHP] mail function() with MS
Hi Anthony, I'm using MS Win 98 and my ISP has PHP installed on a MS server. I'd like to display a HTML form box on my site for users to type in a message utilizing the PHP mail() function. I've tested this using Apache on my drive with a html form and a php script to receive the data and it works fine - but when the site goes live it will be hosted with an ISP with a MS server - not Apache. Is it possible to utilize the PHP mail function under these conditions? I was led to believe that I could change the configurations in my php.ini file from: SMTP: localhost to SMTP: mail.yourisp.com I use Win2000Prof with Apache, and have Win2000Svr with IIS. In each case I use a separate and external SMTP server. This is the relevant section of PHP.INI: [mail function] ; For Win32 only. SMTP=smtp.ISPs.domain ; For Win32 only. sendmail_from=MyAddress@MyDomain When you use PHP provided by a service, you will need to establish what they have set up as SMTP server, and if it is not acceptable to you (for whatever reason that might be) work out how to override it. I use a script/class from PHPguru.org, and I can't say for sure that it even looks at the PHP.INI settings because I set them directly/again within the mail function's code. Highly recommended! Regards, =dn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mail function() with MS
Hi Anthony Qusetion: 1: What would happen if I changed the php.ini settings to: SMTP=mail.yourisp.com sendmail_from=MyAddress@MyDomain as opposed to: SMTP=smtp.ISPs.domain =as long as the SMTP server is accessible and you have access rights, then it can be anyone's/anywhere... When you use PHP provided by a service, you will need to establish what they have set up as SMTP server, and if it is not acceptable to you (for whatever reason that might be) work out how to override it. I'm not sure why I would not think it is not acceptable. Please advise. =Some web-hosts only have the one PHP.INI. That means you would have to use what they define as SMTP server. I don't know (a) what the host may define, (b) what you will find acceptable... ie it may or may not result in an issue/be relevant to you. Also...let's say I'm developing another site with a mail form box using Win98 and Apache Do I then have to reconfigure the php.ini files back to localhost from: SMTP=mail.yourisp.com =each PHP/web server has its own PHP.INI file. Thus each defines its own (default) SMTP server. =it may not be necessary to move SMTP servers: remember that your FROM: address can be [EMAIL PROTECTED] even though the PHP-defined SMTP server is smtp.isp.domain. =if you use a good script/class, each application you build can define its own SMTP parameters and have its own domain/From address, etc. Thank you. =a pleasure. =did I understand the intent of the question correctly? =dn TR I use a script/class from PHPguru.org, and I can't say for sure that it even looks at the PHP.INI settings because I set them directly/again within the mail function's code. Highly recommended! --- [This E-mail scanned for viruses by gonefishingguideservice.com] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mail() problems...
Anthony, Do you have an SMTP server on your Win98 localhost? Recommend you change the PHP.INI SMTP= to say the same as your email package's server definitions. =dn I'm using MS Win98 and Apache and getting the following after submitting the mail form: .. Warning: Failed to Connect in c:\program files\apache group\apache\htdocs\send_simpleform.php on line 14 The html and php scripts follow along with my php.ini settings. Any help would be appreciated. Thank you. Tony Ritter The following e-mail has been sent: Your Name: Linda Your E-Mail Address: [EMAIL PROTECTED] Message: Test . //this is the html form HTML HEAD TITLESimple Feedback Form/TITLE /HEAD BODY FORM METHOD=post ACTION=send_simpleform.php PstrongYour Name:/strongbr INPUT type=text NAME=sender_name SIZE=30/p PstrongYour E-Mail Address:/strongbr INPUT type=text NAME=sender_email SIZE=30/p PstrongMessage:/strongbr TEXTAREA NAME=message COLS=30 ROWS=5 WRAP=virtual/TEXTAREA/p PINPUT TYPE=submit NAME=submit VALUE=Send This Form/p /FORM /BODY /HTML .. //this is the php script ? if (($sender_name == ) ($sender_email == ) ($message == )) { header(Location: http://localhost/simple_form.html;); exit; } $msg = E-MAIL SENT FROM WWW SITE\n; $msg .= Sender's Name:$sender_name\n; $msg .= Sender's E-Mail: $sender_email\n; $msg .= Message: $message\n\n; $to = [EMAIL PROTECTED]; $subject = Web Site Feedback; $mailheaders = From: My Web Site \n; $mailheaders .= Reply-To: $sender_email\n\n; mail($to, $subject, $msg, $mailheaders); ? HTML HEAD TITLESimple Feedback Form Sent/TITLE /HEAD BODY H1The following e-mail has been sent:/H1 PstrongYour Name:/strongbr ? echo $sender_name; ? PstrongYour E-Mail Address:/strongbr ? echo $sender_email; ? PstrongMessage:/strongbr ? echo $message; ? /BODY /HTML My php.ini settings are: [mail function] SMTP = localhost ;for win32 only sendmail_from = [EMAIL PROTECTED] ;for win32 only ;sendmail_path = ;for unix only, may supply arguments as well (default is sendmail -t) -- 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] mail() problems...
Anthony, I'm not sure I understand. =that makes one more! This feature is a bit of a minefield - but once you get a handle on it, its too useful to be without... I had this working a few months ago by changing the php.ini settings to: SMTP = localhost ;for win32 only sendmail_from = [EMAIL PROTECTED] ;for win32 only and I was able to run that script on my box and get an e-mail returned to me. Now, I getting a failed to connect. I'm using MS OE5. =this can only work if: a) there is an SMTP server on the localhost (and the DNS finds it), or b) the code wrapped around mail() specifies a valid and reachable SMTP server, or c) the code sidesteps the PHP mail facility completely by doing something else, or d) its not a Win box (and needs a completely different approach) =if it was working, it was working; I'm not sure what has been updated/replaced since - but let's not even go down that track. =I assume that the Win98 machine has outbound email working from some MTA, eg Outlook [Express]. Check its definition for an SMTP server. Cut-and-paste from there into PHP.INI. =also (because I'm a simple boy), forget all the optional headers etc, just use a stripped down/simple email stub-script for testing/proving. =If PHP's mail() can be persuaded to work, thereafter it (and any scripts) can be 'tweaked'/made better - or we can look back and compare... =dn - Original Message - From: DL Neil [EMAIL PROTECTED] To: Anthony Ritter [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Friday, December 06, 2002 10:37 AM Subject: Re: [PHP] mail() problems... Anthony, Do you have an SMTP server on your Win98 localhost? Recommend you change the PHP.INI SMTP= to say the same as your email package's server definitions. =dn I'm using MS Win98 and Apache and getting the following after submitting the mail form: .. Warning: Failed to Connect in c:\program files\apache group\apache\htdocs\send_simpleform.php on line 14 The html and php scripts follow along with my php.ini settings. Any help would be appreciated. Thank you. Tony Ritter The following e-mail has been sent: Your Name: Linda Your E-Mail Address: [EMAIL PROTECTED] Message: Test . //this is the html form HTML HEAD TITLESimple Feedback Form/TITLE /HEAD BODY FORM METHOD=post ACTION=send_simpleform.php PstrongYour Name:/strongbr INPUT type=text NAME=sender_name SIZE=30/p PstrongYour E-Mail Address:/strongbr INPUT type=text NAME=sender_email SIZE=30/p PstrongMessage:/strongbr TEXTAREA NAME=message COLS=30 ROWS=5 WRAP=virtual/TEXTAREA/p PINPUT TYPE=submit NAME=submit VALUE=Send This Form/p /FORM /BODY /HTML .. //this is the php script ? if (($sender_name == ) ($sender_email == ) ($message == )) { header(Location: http://localhost/simple_form.html;); exit; } $msg = E-MAIL SENT FROM WWW SITE\n; $msg .= Sender's Name:$sender_name\n; $msg .= Sender's E-Mail: $sender_email\n; $msg .= Message: $message\n\n; $to = [EMAIL PROTECTED]; $subject = Web Site Feedback; $mailheaders = From: My Web Site \n; $mailheaders .= Reply-To: $sender_email\n\n; mail($to, $subject, $msg, $mailheaders); ? HTML HEAD TITLESimple Feedback Form Sent/TITLE /HEAD BODY H1The following e-mail has been sent:/H1 PstrongYour Name:/strongbr ? echo $sender_name; ? PstrongYour E-Mail Address:/strongbr ? echo $sender_email; ? PstrongMessage:/strongbr ? echo $message; ? /BODY /HTML My php.ini settings are: [mail function] SMTP = localhost ;for win32 only sendmail_from = [EMAIL PROTECTED] ;for win32 only ;sendmail_path = ;for unix only, may supply arguments as well (default is sendmail -t) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- [This E-mail scanned for viruses by gonefishingguideservice.com] --- [This E-mail scanned for viruses by gonefishingguideservice.com] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Failed to install Mod_cURL under Windows/Apache
PHP v4.2.3 with Apache 1.3.24 under Win2000 Prof SP2 Downloaded the full v4.2.3 zip package/Win binary, some weeks ago. Installation went fine. Extensions are happily included. Have had several weeks of operations. Decided to install cURL to do some URL (strangely enough) link verification-checking. Started at manual: XII. CURL, Client URL Library Functions with sent me to http://curl.haxx.se and in turn http://curl.haxx.se/libcurl/php/ Downloaded curl-7.10.2-win32-nossl which (really) only contains CURL.EXE. I cannot see any instructions telling me what to do with this/where to put it!? Moved it to the same location as PHP.EXE. It runs happily from the command line (so that's something!) Moved both the .dlls around, checked the MVC file, and uncommented the PHP.INI line - and verified it with PHPINFO(). However when a PHP script (copied straight off the PHP manual) calls curl_init () it causes Apache to crash: Apache.exe has generated errors and will be closed by Windows. You will need to restart the program. An error log is being created. - restarting the Apache service and re-running results in the same error - rebooting the whole system and re-running also. - the v-server's error log shows nothing and the access log only shows the PHPINFO() mentioned - there's nothing in the Windows Event log - I can't figure out where this error log is created Help! I've missed something... =dn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regular Expresion Work on IP address
Dev, Nice work! Thanks for implementing the book's algorithm/proving it in PHP-PCRE, and I do like your extension into an internal/external function. I've not implemented your code (bookmarked for later) but some initial comments: - don't forget some of the other 'funnies' in the IP addressing scheme, most notably 127.0.0.1 = localhost (which is also an 'internal' address) - I'd need to read/remind myself of others... - in the $parts[0]=255 type of construct, remember that the is superfluous - or the RegEx is overly specific (hence the discussion point earlier) - also the $parts[0] is a string, so 255 will be (marginally) faster - similarly you could make $ip_state=0; into a boolean expression (and function return value) which might enable the function call to read more smoothly - regardless, $ip_state is currently sometimes treated as a string and once as an integer. - I don't know your IP allocations but in net_check() shouldn't all the if() logical ops be ANDs? Any thoughts of extending it to work with IPng addresses (or whatever they're calling it these days)? Great stuff, keep it coming! (and when you've finished perhaps you could submit it to one of the script libraries/improve on what they might already have?) =dn Well after reading John'ss and DL Neil's replys i came up with 2 functions. The first is to check to see if the entry is a valid IP address and the Next is to determine if it is a Private Network IP or not!. You can see this in action at: http://www.my-tangled-web.net/codebank/code/ip_check.php and the sorce for that page is at: http://www.my-tangled-web.net/codebank/getsource.php?dir=file=ip_check.php Please if you test it and find a problem let me know! Thanks function ipcheck($ip_chk){ $parts=explode(.,$ip_chk); if (preg_match (/^([01]?\d\d?|2[0-4]\d|25[0-4])\.([01]?\d\d?|2[0-4]\d|25[0-4])\.([01]?\d\d ?|2[0-4]\d|25[0-4])\.([01]?\d\d?|2[0-4]\d|25[0-4])$/, $ip_chk)) { if($parts[0]==0 || $parts[0]=255 ||$parts[1]=255 || $parts[2]=255 || $parts[3]=255){ $ip_state=0; } elseif($parts[0]255 $parts[1]255 $parts[2]255 $parts[3]255){ $ip_state=1; } } else { $ip_state=0; } $this=that; return $ip_state; } function net_check($ip_2_chk){ $parts=explode(.,$ip_2_chk); if($parts[0]==10){ $network=internal; } elseif($parts[0]==172 $parts[1]=16 || $parts[1]=31){ $network=internal; } elseif($parts[0]==192 $parts[1]==168){ $network=internal; } else { $network=external; } return $network; }; At 07:47 PM 12/4/2002 +, DL Neil wrote: John, I think it'd be hard to verify the range with a regex. ip2long and long2ip do not validate. So, an option would be to write your own little function that splits the $ip on the period, verifies there are 4 parts, then checks that each part is between 1 and 255 inclusive. My other post on the subject notwithstanding, I agree. When I get time/when I get a round tuit, I'd like to do a performance test on the (short) IP RegEx against what you have outlined: explode against . run resultant array through 0-255 validation function - and still have the semantic issues of 0.0.0.0, etc... Meantime, will sit here whistling and quietly muttering into my beard (and dreaming of tuits), =dn -- 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] Regular Expresion Work on IP address
Hello Dev, Now I am continuing on with the same script and I need to check for valid IP address form. Currently I have: $ip=255.255.255.0; if (preg_match (/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/, $ip)) { print Good Ip; } else { print Bad Ip; } This does work kinda. It checks to see if the 4 sets of numbers are well there and numbers. The problem I am having is that it does not check to see if the IP is in a proper range ie less than 255.255.255.255 So you could enter 256.256.256.999 and it will say that it is a good IP. Any clue how I would change it to check for that I'm reading my way through Friedl's, Mastering Regular Expressions, O'Reilly, 2002. This is discussed in pp187-9, but I haven't had a chance to 'play' with it yet (!) and indeed he comments that it is one of those topics that you can attempt to refine and refine, but may be equally well off by sticking with what you have (surround the individual octet values with parentheses and then perform the semantic checking in PHP - as you discuss). What he comes up with observes the shorter range of digits for the first two digit positions of a (possible) three digit octet expression (in decimal), eg the first digit is either 0, 1, or 2 or not present at all. So if the first digit is a 1, then the next digits can be anything. If the first digit is a 0 or a space/non-existent then... However if the first digit is a 2, then the next digit may not exceed 5 [0-5]. If it is 5 then the last digit is similarly constrained, but if the second digit is less than 5, the third can be any digit. NB the 0.0.0.0 and 255.255.255.255 issues remain Thus the main component (handling each octet) is the basic code: ([01]?\d\d?|2[0-4]\d|25[0-5])\. which in English comes out as something like: a zero and a one may be present and followed by a digit and possibly another digit, or a two will be present, followed by a digit in the range 0 through 4, followed by another digit, or a two and a five will be present followed by a digit in the range 0 through 5, and then a dot/separator. This turns the whole shebang into: ^([01]?\d\d?|2[0-4]\d|25[0-5])\.([01]?\d\d?|2[0-4]\d|25[0-5])\.([01]?\d\d?|2 [0-4]\d|25[0-5])\.([01]?\d\d?|2[0-4]\d|25[0-5])$ I'm sorry, but that's going to be diabolic to read after the email has had at it. The ^ and $, begin/end are necessary to ensure that there aren't over-running digits afore or aft of the IP addr. NB this is NOT tested (by me). I'm not sure if this code (the options in particular), as it is written, can be pasted straight into PHP's version of PCRE. YMMV! If you try it, please send feedback, =dn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regular Expresion Work on IP address
John, I think it'd be hard to verify the range with a regex. ip2long and long2ip do not validate. So, an option would be to write your own little function that splits the $ip on the period, verifies there are 4 parts, then checks that each part is between 1 and 255 inclusive. My other post on the subject notwithstanding, I agree. When I get time/when I get a round tuit, I'd like to do a performance test on the (short) IP RegEx against what you have outlined: explode against . run resultant array through 0-255 validation function - and still have the semantic issues of 0.0.0.0, etc... Meantime, will sit here whistling and quietly muttering into my beard (and dreaming of tuits), =dn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] My first post
Hi Victor, Welcome to the wonderful world of PHP! I'm new in PHP. Could you point me where can i download a sample script about how can i paginate some results? PHP essentially exists to output HTML. You cannot paginate in HTML (although there is some fancy CSS that could be employed). Sorry, =dn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] date
Hi Shaun, please could someone tell me how i can return a month in text from an int ie getMonth(12) returns Decmber. Is this possible? No. If you want to stick with this, write your own function to look up a text array. If the 12 is part of more data coming in from a form or db (for example), then give us the wider picture and a 'built-in' solution may become possible. =dn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to give parameters to a console php-script?
Hello Martin, I start a console app with php myscript.php4 (just prints ok). How can I give parameters to it? I tried: php myscript.php4 myparameter php myscript.php4?myparameter php myscript.php4?param=myparameter But always php just returns without doing nothing (not even giving an error or printing Ok!) I'm using PHP 4.2.3. on Windows2000). I'm using the same version/platform and things work fine (for me). Manual: Chapter 23. Using PHP from the command line You are correct the first time. What do argv and argc tell you? Is the php.ini file set up so that these variables are shown/valid? Regards, =dn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to give parameters to a console php-script?
Martin, Ah yes, the famous 'read the upgrade notes - gotcha'! Well done, you figured it out... =dn ll I found a register_argc_argv = On in my php.ini, which should work then. But I also found, that I have to use print Ok: .$_SERVER[argv][1]; instead of print Ok: .$argv[1]; Martin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Test links?
Beth, When fopen successfully opens a file it populates an array $http_response_header, which you can examine to see if the link works or not - I don't believe you can actually get the file itself, but since that's not what we're after that's not a problem! I noticed this reference to $http_response_header and straightaway quizzed the manual, only to find that the only references to it (eg file open) lead nowhere. Have gone through a few other pages, looking to see if I might happen upon some detail, but failed. Sadly you don't refer to it in the code snippet provided (below). Any code I've attempted blindly has failed/reported errors. Please point me in the right direction (otherwise I guess it'll be time to download the new v4.3.0-RC and risk the bleeding edge - which according to the manual does something different anyway...) =dn Having said that, fopen produces a very annoying error if it doesn't find the page, but I found the following works: ?php $SQL = SELECT linkurl, linkID FROM links; $result = mysql_query($SQL); while($linkdata = mysql_fetch_array($result)){ $fp = fopen($linkdata['linkurl'],r); if($fp) { echo p.$linkdata['linkurl']. is still valid./p; }else{ echo p.$linkdata['linkurl']. is invalid. Updating database... ; $SQL = UPDATE links SET status = 0 WHERE linkID = '.$linkdata['linkID'].'; $result2 = mysql_query($SQL); if($result2) { echo Database updated/p; } } } ? Rather than deleting the link, it's probably better to set a flag to show it was invalid last time you checked, but check it again next time. Or you could keep a count of the number of failed attempts, and delete if it goes beyond 3 or so. Not sure how to supress the warning message that PHP automatically does when you haven't got a valid URL though. Hope this works for you! Beth Gore -- http://bethanoia.dyndns.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Test links?
Rob/Beth, The code should also consider: 1 updating the db if the link is 'valid', ie if previously it had been 'down'! 2 putting an @ to prevent any errors causing a hard-stop at the fopen line 3 that the url/database must contain protocol information, ie http://www.nytimes.com not www.nytimes.com. Thanks for the discussion, =dn Rob Packer wrote: Okay, I'm confused... file, fopen, and fsockopen seem to say not found on alot valid URLs... does this look to be correct usage? $url = $row[0]; // just get the url from the db $fp = implode ('', file ($url)); if (!$fp) {echo font color=redbUnable to access file/b/font; } else { fclose($fp); echo The link is working!; } It seems I always get this warning... Warning: Supplied argument is not a valid File-Handle resource in /web/home/nrc.net/www/robert/links4.php on line 11 If someone can tell me what I'm doing wrong, I'd appreciate it. Thanks, Robert When fopen successfully opens a file it populates an array $http_response_header, which you can examine to see if the link works or not - I don't believe you can actually get the file itself, but since that's not what we're after that's not a problem! Having said that, fopen produces a very annoying error if it doesn't find the page, but I found the following works: ?php $SQL = SELECT linkurl, linkID FROM links; $result = mysql_query($SQL); while($linkdata = mysql_fetch_array($result)){ $fp = fopen($linkdata['linkurl'],r); if($fp) { echo p.$linkdata['linkurl']. is still valid./p; }else{ echo p.$linkdata['linkurl']. is invalid. Updating database... ; $SQL = UPDATE links SET status = 0 WHERE linkID = '.$linkdata['linkID'].'; $result2 = mysql_query($SQL); if($result2) { echo Database updated/p; } } } ? Rather than deleting the link, it's probably better to set a flag to show it was invalid last time you checked, but check it again next time. Or you could keep a count of the number of failed attempts, and delete if it goes beyond 3 or so. Not sure how to supress the warning message that PHP automatically does when you haven't got a valid URL though. Hope this works for you! Beth Gore -- http://bethanoia.dyndns.org -- 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] Triggering a PHP Script
Ryan, My Problem: I've got a PHP script (running on Apache) that can take several hours to complete. The script sends out a newsletter to those who have requested it. When calling this script from a web browser, the browser hangs until the script has fully executed. If the user hits Stop while the script is running, it will terminate the script. My Questions: What is the best way to trigger this script? Is there a way to do it without using a CGI script? I am basically wondering if there is a way to create a trigger this php page script that will run the script on Apache and not hang the browser. Also, are there any problems calling MySQL from a PHP CGI script? First: trust that you are only sending to opted-in clients!? (we're kind of sensitive about spammers around here!) The manual is your friend: Chapter 23. Using PHP from the command line. Add code to prevent PHP from timing-out (see another current thread) and that takes care of your program. It will now run, outside the browser, in the background, and you/your user can carry on using the browser... As far as trigger goes, you can type the command into the command line, or run some sort of 'job', or set it up to run off a scheduler, eg CRON or AT/Scheduled Tasks. Regards, =dn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Detecting email bounces sent by the mail function?
Hello Ade, Is it possible to detect with PHP whether an email sent using the PHP 'mail' function has bounced back or has not been delivered? I currently all ready check the email address using the 'ereg' function before the mail function is called, but this only checks the format is valid beforehand. Yes, and No! If you use the ReturnPath header SOME/most email servers will bounce msgs that they can't deliver to an actual mailbox back to you (others drop such msgs onto an Admin somewhere, lose them in the ether (the msgs not the Admins...) etc, etc). Accordingly, use a distinct address for this/email filing rules. Opt-in email schemes which send a welcome/confirm email to new customers do so for this reason - the only way to verify an email address is to use it (and get some feedback from the addressee). Of course, once you have 'located' a new user, you still have to cope with those who close email accounts without advising you... It's a wonderful world! =dn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php