Re: [PHP] [RFC] HTTP timezone
On Sunday 10 June 2007, Tijnema wrote: > On 6/9/07, Richard Lynch <[EMAIL PROTECTED]> wrote: > > On Sat, June 9, 2007 8:06 am, Stefanos Harhalakis wrote: > > > Timezone: +0200 > > > > > > that will specify their timezone offset. This way scripts will be able > > > to > > > provide appropriate date/time strings/representations and/or content. > > > > It's pretty useless and unreliable since user's clocks/timezone > > settings are incorrect far too often... > > > > YMMV > > I agree with you, clock settings are incorrect way too often, I just > checked my own, and I see that the time is correct, but the Timezone > is at GMT, while i live in GMT+1, but in summer, it's GMT+2. > That brings me to the next point, what about DST? > I've read your complete draft, and it doesn't say anything about DST, > What should browsers send for my country? +0100 or +0200? In DST the offset from UTC is adjusted and thus it will become +2 in your case. Perhaps a note about DST would be usefull. The original idea was to use the POSIX 1003.1 timezone string that optionally includes the DST information but this introduces a lot of complexity and was changed to include just the current offset. > Ps. what's the next thing we send to the browser? We already sent a > lot of info through the user-agent header... Next year we send our > computers specs to the server so that we get a site that is made for > the performance of our computer? Perhaps you didn't had a need about this in the past. Have you ever tried looking at graphs that include time information in them? Just have a look at mrtg graphs or stock graphs and try to figure what time each point is supposed to represent. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Going from simple to super CAPTCHA
Robert , Thank you for replying. No, PHP can do it. If you can work with pixels (and you can) then you can do any advanced mutation of an image... the only issue is how long it takes to perform the mutations. That's good to know. I think I can live with a little server time to generate the images, so long as they work well. Check out the freecap code perhaps I'm assuming you mean this one: http://www.puremango.co.uk/cm_php_captcha_script_113.php Good CAPTCHA - bots can't figure it out Bad CAPCTHA - bots can figure it out Well, yes, but what exactly determines that is not obvious to me. I came across this page: http://sam.zoy.org/pwntcha/ ... which conveys a feeling that some CAPTCHAs that look good actually aren't. According to this page, the Yahoo CAPTCHA image, which looks quite minimal to me, is actually one of the better ones. -- Dave M G Ubuntu Feisty 7.04 Kernel 2.6.20-15-386 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] [RFC] HTTP timezone
On 6/10/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: Well, there is some use for a correct user timezone. I wrote php code that offers a different css file depending on the server time of day. So for example at noon it would use nice bright colors, and at midnight blacks and red, and ... you get the picture. Trouble was, this representation only worked for the timezone the server was in, and not for the timezone the visitor was in. Here's the simple PHP timezone code in css_rotate.php: $hour = date("G"); //echo $hour; switch($hour) { case 0: // theme: sleep case 1: case 2: case 3: case 4: $current_css = "sleep.css"; break; case 5: // theme 'dawn' case 6: case 7: case 8: $current_css = "dawn.css"; break; case 9: // theme 'morning' case 10: case 11: case 12: $current_css = "morning.css"; break; case 13: // theme 'afternoon' case 14: case 15: case 16: $current_css = "afternoon.css"; break; case 17: // theme 'dusk' case 18: case 19: case 20: $current_css = "dusk.css"; break; case 21: // theme 'night life' case 22: case 23: $current_css = "night.css"; break; default: $current_css = "generic.css"; } //$current_css = "sleep.css"; // for testing each css file .. and the invocation in the external css call: include( INSTALL_DIR . "css/css_rotate.php"); LINK rel="stylesheet" type="text/css" href="css/"> .. and that produced a timezone flavored website look and feel. I wanted to add that I have found more than one server time to be incorrectly set too, so you cannot count 100% on the server either, but i would give it odds over a user passed timezone. sincerely, Rob http://phpyellow.com From: Stefanos Harhalakis <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] Date: Sun, 10 Jun 2007 03:15:33 +0300 CC: php-general@lists.php.net Subject: Re: [PHP] [RFC] HTTP timezone On Sunday 10 June 2007, Richard Lynch wrote: > On Sat, June 9, 2007 8:06 am, Stefanos Harhalakis wrote: > > Timezone: +0200 > > > > that will specify their timezone offset. This way scripts will be able > > to > > provide appropriate date/time strings/representations and/or content. > > It's pretty useless and unreliable since user's clocks/timezone > settings are incorrect far too often... I'm only considering the timezone information. I believe that this is not the proper way to think before making a start. The fact that many user's timezone is incorrect doesn't mean that this is not needed. Lets just hope that one day Windows will do the right thing and keep the time in UTC while displaying it using the appropriate timezone. Well, in this case you could use javascript to get the time of the client, and then update the CSS code according to the time. To get back to the point, I think that the timezone should be defined on what time it actually is at his PC, and what time it is on time.nist.gov for example, and not lookng at some setting... Timezone setting is often wrong, people just update their time to match the time of their watch. This sets the UTC time wrong too, but still displays the right time to the user. So if you compare this time to time on web servers that are allways right, and you compare the difference between that, then you know the timezone that is probably right. Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] session.cookie_path problem
Hi, I am having some trouble with my sessions cookie_path - it doesn't seem to work - or maybe I am not working, I don't know at the moment :) Apache 2.2.3 and PHP 5.3.2 as module. What I want to achieve, is 2 separate sessions in the same website - in different directories of course. My test setup is the following: http://sessiontest.dev.codefrog.dk/app1/.htaccess contains php_value session.cookie_path /app1/ http://sessiontest.dev.codefrog.dk/app1/index.php contains and http://sessiontest.dev.codefrog.dk/app2/.htaccess contains php_value session.cookie_path /app2/ http://sessiontest.dev.codefrog.dk/app2/index.php contains I visit /app1/ and $_SESSION contains 'val1' => 'test1' - as expected. I then visit /app2/ and $_SESSION then contains both 'val1' => 'test1' and 'val2' => 'test2' - not as expected. I would expect that each $_SESSION would only hold its own data. And I can see from the print_r(session_get_cookie_params()) that the cookie has changed its path like it should according to my .htaccess file. Am I missing something obvious? -- Kind Regards Lasse Brandt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] [RFC] HTTP timezone
On Sunday 10 June 2007, Tijnema wrote: > To get back to the point, I think that the timezone should be defined > on what time it actually is at his PC, and what time it is on > time.nist.gov for example, and not lookng at some setting... Timezone > setting is often wrong, people just update their time to match the > time of their watch. This sets the UTC time wrong too, but still > displays the right time to the user. So if you compare this time to > time on web servers that are allways right, and you compare the > difference between that, then you know the timezone that is probably > right. Timezone is a property of the user and some times of the session. It is not a property of a system. Different users of a system may use different timezones (unless they use Windows where they can't). Anyway, I strongly believe that the issue of providing the correct timezone should be a concern of the end user and the browser. Any error checking and workarounds should be performed by those two and not by the server side scripts. In any way, there is no guarantee that the timezone information provided by clients will be correct. That's why it should only be used for informational purposes and not for security etc. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: session.cookie_path problem
Am I missing something obvious? I am so sorry - I was missing something obvious. At some early stage of my test, I had a /index.php on my test website doing a: session_start() And the apparently made my session work in both sub directories and thus poisoning my test result. After closing my browser and going straight to /app1/ and then /app2/ I actually got the correct result. So sorry to disturb you - have a nice day :) -- Kind Regards Lasse Brandt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] [RFC] HTTP timezone
On 6/10/07, Stefanos Harhalakis <[EMAIL PROTECTED]> wrote: On Sunday 10 June 2007, Tijnema wrote: > To get back to the point, I think that the timezone should be defined > on what time it actually is at his PC, and what time it is on > time.nist.gov for example, and not lookng at some setting... Timezone > setting is often wrong, people just update their time to match the > time of their watch. This sets the UTC time wrong too, but still > displays the right time to the user. So if you compare this time to > time on web servers that are allways right, and you compare the > difference between that, then you know the timezone that is probably > right. Timezone is a property of the user and some times of the session. It is not a property of a system. Different users of a system may use different timezones (unless they use Windows where they can't). Anyway, I strongly believe that the issue of providing the correct timezone should be a concern of the end user and the browser. Any error checking and workarounds should be performed by those two and not by the server side scripts. In any way, there is no guarantee that the timezone information provided by clients will be correct. That's why it should only be used for informational purposes and not for security etc. Sure, but if this setting will be incorrect for 90-95% of the time, then there won't be a lot people that are actually gonna use it, because why do we want to know information that is probably wrong? Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Transparent image resizing using php 4.4.x
On 6/9/07, Sukhwinder Singh <[EMAIL PROTECTED]> wrote: I have tried many ways to resize a transparent gif but it works on my local server which has php 5.1.6 but none works using php 4.4.x Also the below works when using imagecopyresized and not imagecopyresampled. I have no clue why that is the case as imagecopyresampled is supposed to produce better results. I have php version 5.1.6 locally (windows) and this works: But the above doesn't work using php 4.4.x and creates images with lots of white lines/dots in it. Some pixel is transparent and some it isn't. I have no knowedge about image manuplation like alpha channels etc. Could anyone please provide me a solution which works using php 4.4.x Sukhwinder Singh I don't think it has anything to do with the PHP version, but with the version of the GD library used. What version of GD are you using on both systems? You can see it with phpinfo: Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Undefined index error
On 6/10/07, Christian Cantrell <[EMAIL PROTECTED]> wrote: I'm getting this error in my Apache log file, and I can't figure out why: Undefined index: password in /path/to/file.php on line 82 Some searching on Google turned up a bunch of questions, but no answers. Any idea what this warning message is referring to? Thanks, Christian Yes, you're probably trying to get a value from an array by using a key that isn't in the array. Something like this: "test", "foo"=>"bar"); $value = $array['password']; // Key "password" doesn't exist! ?> Check the line number and print out the array with var_dump/print_r to see what's in the array.. Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Server side issue with
My host company must have an installation/configuration issue. Variables from forms are not being passed to the php scripts that are sent via Has anyone heard of this and know of the fix? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Server side issue with
My host company must have an installation/configuration issue. Variables from forms are not being passed to the php scripts that are sent via Has anyone heard of this and know of the fix? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Server side issue with
On 6/10/07, Roy W <[EMAIL PROTECTED]> wrote: My host company must have an installation/configuration issue. Variables from forms are not being passed to the php scripts that are sent via Has anyone heard of this and know of the fix? I don't think that's possible, please show us part of your code, as I expect the problem to be there. Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Server side issue with
On 6/10/07, Tijnema <[EMAIL PROTECTED]> wrote: On 6/10/07, Roy W <[EMAIL PROTECTED]> wrote: > My host company must have an installation/configuration issue. > > Variables from forms are not being passed to the php scripts that are sent > via > > Has anyone heard of this and know of the fix? I don't think that's possible, please show us part of your code, as I expect the problem to be there. Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Are you attempting to call the variables globally? If that's the case, try $_GET if you're calling the form as a GET request, $_POST as a POST request, or $_REQUEST to get anything sent along (including cookie information). Your host may have register_globals = Off in their php.ini, and that's an option you can't override. -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: php-cli vs python OT
On 6/10/07, Robert Cummings <[EMAIL PROTECTED]> wrote: On Thu, 2007-06-07 at 23:33 +0100, Colin Guthrie wrote: > Robert Cummings wrote: > > On Thu, 2007-06-07 at 16:36 -0400, Daniel Brown wrote: > >> Are you using Amarok on Windows, Linux, or other? I have Amarok > >> 1.3.1 on KDE 3.4.2 on Mandriva 2006.0 Community on 2.6.12-12mdksmp on > >> an i686 Intel(R) Pentium(R) 4 CPU 2.60GHz w/ 1GB RAM on a desk with a > >> bunch of crap on it, and all it does is crash for me. I use Totem > >> instead, occasionally using xine for audio, and usually for video > >> (different subject). Just wondering how stable Amarok is for you. > > > > I'm running Amarok 1.4.3 (using KDE 3.5.5) on Ubuntu 6.10 (I'm actually > > a Gnome user). I used Mandrake up till 10.0, I'll never go back. My > > desktop is an Athlon 2400 with 2 gigs of memory (though consumption > > rarely goes past half gig unless I'm running several VMWare OSes at the > > same time). I started using it about 3 days ago, I've had a few crashes, > > but mostly when doing something major like re-scanning my collection > > (8000+). Had no trouble grabbing covers, creating playlists, editing > > 100s of tags within Amarok, etc. Only complaint really is that it's pig > > slow when switching to or sorting columns on large playlists (well the > > whole 8000 heheh). > > I'm a Mandriva dev and would have to say that if you've not used it for > a while I think you'll be pleasently surprised these days. It's come a > long, long way since 10.0! > > Also the older Amarok run by Daniel is faily unstable (I'm also a bit of > a KDE dev when I get a mo'!) is fairly old and bug ridden. Whatever your > distro, I'd upgrade your Amarok to the latest stable for the best > experience. FWIW, if you add your sources correctly you can just urpmi > your 2006.0 machine to 2007.1 relatively easily. I've done it on several > machines now (a couple of them remotely!). FYI, after a few days of using Amarok I've found it to be extremely prone to hanging. To try and correct the problem I downloaded the latest stable source (1.4.5) and built it myself. Still hanging all over the place (simple selection of new mp3, re-arranging queued songs, etc). It also appears to keep NFS file handles open (possibly with locks) since my NFS hung a few times after it died and I had to force an unmount. Definitely not NFS itself, I've transferred 100s of gigs over months of uptime without a problem... only seen it hang on an Amarok hang (more than once now). Anyways, I'll keep giving it a go, I created a wrapper script when starting it up now that checks the process list and kills all related Amarok processes before relaunching... makes it a little more bearable). BTW, I know this isn't your issue or anything Colin, just passing along my experience for Dan :) Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' Are you using journaling? It may be something we have in common that's causing both of our problems. Really OT for the PHP list, but maybe we can whip up a replicated issue for a bug report nonetheless. -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP5 or PHP4 this is the question
On Saturday 09 June 2007, Robert Cummings wrote: > On Sat, 2007-06-09 at 19:18 -0500, Larry Garfield wrote: > > You should get a new server that supports PHP 5.2.1. PHP 4 is dead. > > Must be a zombie then because I see it running almost EVERYWHERE. Yep, it is. PHP 4 is trying to eat your brains. BRINS! -- Larry Garfield AIM: LOLG42 [EMAIL PROTECTED] ICQ: 6817012 "If nature has made any one thing less susceptible than all others of exclusive property, it is the action of the thinking power called an idea, which an individual may exclusively possess as long as he keeps it to himself; but the moment it is divulged, it forces itself into the possession of every one, and the receiver cannot dispossess himself of it." -- Thomas Jefferson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP5 or PHP4 this is the question
On 6/10/07, Larry Garfield <[EMAIL PROTECTED]> wrote: On Saturday 09 June 2007, Robert Cummings wrote: > On Sat, 2007-06-09 at 19:18 -0500, Larry Garfield wrote: > > You should get a new server that supports PHP 5.2.1. PHP 4 is dead. > > Must be a zombie then because I see it running almost EVERYWHERE. Yep, it is. PHP 4 is trying to eat your brains. BRINS! PHP4 Zombie attack!! -- Larry Garfield AIM: LOLG42 [EMAIL PROTECTED] ICQ: 6817012 "If nature has made any one thing less susceptible than all others of exclusive property, it is the action of the thinking power called an idea, which an individual may exclusively possess as long as he keeps it to himself; but the moment it is divulged, it forces itself into the possession of every one, and the receiver cannot dispossess himself of it." -- Thomas Jefferson -- 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] Going from simple to super CAPTCHA
At 12:27 PM +0900 6/10/07, Dave M G wrote: Tips on what differentiates a good CAPTCHA from a bad one would also be really sweet. Dave: From a visual disability standpoint, all graphic CAPTCHA's are bad. From the not-disabled standpoint, most intelligible graphic CAPTCHA's that can be read, can also be read by bots. So, it doesn't make much difference to create variations of the theme, because the theme can always be broken if it is to remain solvable by the sighted. In other words, anything you can read, so can a bot. Of course, you must also keep in mind what you are trying to protect. If it's something popular and thus would return something of value, then no CAPTCHA is going to keep evil-doers from accessing it. On the other hand, if what you're trying to protect has no real significance, then no one is going to brother breaking your CAPTCHA. So, why use a CAPTCHA at all? Instead use something simple such as "1 + 1 = ?". That will stop most cursory bots. If your site is popular, then nothing easy like a CAPTCHA is going to work anyway -- you'll have to come up with another method. However, if you insist on making a CAPTCHA for your site (as clients, not knowing better, sometimes insist), then also add an alternative "way in" for the visually disabled like so: http://sperling.com/examples/captcha/ If you want the code, just ask and I'll provide. My thought is if you want to do image alteration, you might put your skills to better use by writing routines for various photographic effects, such as "Fish-Eye" or "Oval Cut-Outs" or whatever -- rather than beating the dead horse CAPTCHA. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Going from simple to super CAPTCHA
On Sun, 2007-06-10 at 17:09 +0900, Dave M G wrote: > Robert , > > Thank you for replying. > > No, PHP can do it. If you can work with pixels (and you can) then you > > can do any advanced mutation of an image... the only issue is how long > > it takes to perform the mutations. > > > That's good to know. I think I can live with a little server time to > generate the images, so long as they work well. > > > Check out the freecap code perhaps > I'm assuming you mean this one: > http://www.puremango.co.uk/cm_php_captcha_script_113.php Yes, that's the one. It was the first I stumbled upon that I felt would offer some degree of protection. I imagine at some point when I have more time I will create my own CAPTCHA, wrapping ugly code makes me feel dirty inside :) > > Good CAPTCHA - bots can't figure it out > > Bad CAPCTHA - bots can figure it out > > > Well, yes, but what exactly determines that is not obvious to me. I came > across this page: > http://sam.zoy.org/pwntcha/ > ... which conveys a feeling that some CAPTCHAs that look good actually > aren't. > > According to this page, the Yahoo CAPTCHA image, which looks quite > minimal to me, is actually one of the better ones. The yahoo one does some morphing and disturbs alignment and angle. Then the black lines running through make edge detection difficult as well as detection of colour distribution patterns. As they say though, sometimes it's difficult for a human to understand what is presented. Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP5 or PHP4 this is the question
On Sun, 2007-06-10 at 11:01 -0500, Larry Garfield wrote: > On Saturday 09 June 2007, Robert Cummings wrote: > > On Sat, 2007-06-09 at 19:18 -0500, Larry Garfield wrote: > > > You should get a new server that supports PHP 5.2.1. PHP 4 is dead. > > > > Must be a zombie then because I see it running almost EVERYWHERE. > > Yep, it is. PHP 4 is trying to eat your brains. BRINS! Not mine... I'm a level 60 Necromancer :) Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Going from simple to super CAPTCHA
On Sun, 2007-06-10 at 12:29 -0400, tedd wrote: > > From a visual disability standpoint, all graphic CAPTCHA's are bad. Sure, but from the perspective of protecting visitors from hard-core porn link, sex toys links, scams, etc etc, it has strong merit. Trust me, I've seen sites get completely messed up just because they used a forum that had no captcha... of course, I've also seen sites get completely messed up because the default captcha sucked... yes I'm looking at you PHPBB. > From the not-disabled standpoint, most intelligible graphic CAPTCHA's > that can be read, can also be read by bots. So, it doesn't make much > difference to create variations of the theme, because the theme can > always be broken if it is to remain solvable by the sighted. In other > words, anything you can read, so can a bot. Yes and no. There are levels of difficulty for both. There are somethings that a computer find more difficult than a human and vice versa. A good captcha will try to exploit a computer's weaknesses. > Of course, you must also keep in mind what you are trying to protect. > If it's something popular and thus would return something of value, > then no CAPTCHA is going to keep evil-doers from accessing it. By having a single captcha layer you allow yourself a single entry point at which to change CAPTCHA across your site. So even if you're popular you can make sitewide changes to your captcha system from a single point. You can employ multiple captcha libs, you can try and keep ahead of the bots as they knock down each wall. This is what I do. > On the other hand, if what you're trying to protect has no real > significance, then no one is going to brother breaking your CAPTCHA. Wrong. If you are protecting something completely worthless and your using a popular blog or forum software then you will undoubtedly inherit it's deficiencies regardless of the content of your site. > So, why use a CAPTCHA at all? Instead use something simple such as "1 > + 1 = ?". If your site is popular enough this will be thwarted easily also. See your original argument. > That will stop most cursory bots. If your site is popular, > then nothing easy like a CAPTCHA is going to work anyway -- you'll > have to come up with another method. Or constantly adapt. Sounds like fun :) > However, if you insist on making a CAPTCHA for your site (as clients, > not knowing better, sometimes insist), then also add an alternative > "way in" for the visually disabled like so: Now I'm not going to argue this point to any real depth. You obviously don't have statistics for the efficacy of CAPTCHA and I don't want to invoke erroneous logic by pointing out that if Slashdot, Yahoo, Google, etc are all using it then it must have some usefulness :) > http://sperling.com/examples/captcha/ > > If you want the code, just ask and I'll provide. > > My thought is if you want to do image alteration, you might put your > skills to better use by writing routines for various photographic > effects, such as "Fish-Eye" or "Oval Cut-Outs" or whatever -- rather > than beating the dead horse CAPTCHA. I'm in a time crunch right now, I'll explore more options later ;) Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP5 or PHP4 this is the question
At 10:05 PM -0400 6/9/07, Robert Cummings wrote: On Sat, 2007-06-09 at 19:18 -0500, Larry Garfield wrote: You should get a new server that supports PHP 5.2.1. PHP 4 is dead. Must be a zombie then because I see it running almost EVERYWHERE. Cheers, Rob. Rob: You raise an excellent and obvious point. There are significant differences between 4 and 5 and if we are to code for clients who are still in 4, then using 5 routines won't work. For those clients, we must either dumb-down or get them to smarten-up. Considering that I never get anyone to do anything, I know where that leaves me. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Going from simple to super CAPTCHA
On 6/10/07, tedd <[EMAIL PROTECTED]> wrote: At 12:27 PM +0900 6/10/07, Dave M G wrote: >Tips on what differentiates a good CAPTCHA from a bad one would also >be really sweet. Dave: From a visual disability standpoint, all graphic CAPTCHA's are bad. From the not-disabled standpoint, most intelligible graphic CAPTCHA's that can be read, can also be read by bots. So, it doesn't make much difference to create variations of the theme, because the theme can always be broken if it is to remain solvable by the sighted. In other words, anything you can read, so can a bot. Of course, you must also keep in mind what you are trying to protect. If it's something popular and thus would return something of value, then no CAPTCHA is going to keep evil-doers from accessing it. On the other hand, if what you're trying to protect has no real significance, then no one is going to brother breaking your CAPTCHA. So, why use a CAPTCHA at all? Instead use something simple such as "1 + 1 = ?". That will stop most cursory bots. If your site is popular, then nothing easy like a CAPTCHA is going to work anyway -- you'll have to come up with another method. However, if you insist on making a CAPTCHA for your site (as clients, not knowing better, sometimes insist), then also add an alternative "way in" for the visually disabled like so: http://sperling.com/examples/captcha/ If you want the code, just ask and I'll provide. My thought is if you want to do image alteration, you might put your skills to better use by writing routines for various photographic effects, such as "Fish-Eye" or "Oval Cut-Outs" or whatever -- rather than beating the dead horse CAPTCHA. Cheers, tedd Tedd: Please don't spread the code of your Audio CAPTCHA, we had a big discussion about it, and we concluded that it was quite easy to crack. I remember i've cracked some other CAPTCHAs, but if you still think your Audio CAPTCHA isn't hard to crack, then just let me know and i'll start cracking it :) Dave: The point is not only if the image itself is readable by a bot, you must also keep a note of how you pass the check around your site. I also suggest you read 3 threads, that are relative to each other, from the past: http://marc.info/?l=php-general&m=117518641415178&w=2 http://marc.info/?l=php-general&m=117521475815904&w=2 http://marc.info/?l=php-general&m=117596132004021&w=2 I think you remember the thread tedd ;) Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Transparent image resizing using php 4.4.x
At 1:12 AM +0500 6/10/07, Sukhwinder Singh wrote: -snip- Could anyone please provide me a solution which works using php 4.4.x Sukhwinder Singh Instead of: imagecolortransparent($img_resized, $transparent); try: imagecolortransparent($img,imagecolorat($img,0,0)); Look-up imagecolorat(). Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP5 or PHP4 this is the question
On Sunday 10 June 2007, tedd wrote: > At 10:05 PM -0400 6/9/07, Robert Cummings wrote: > >On Sat, 2007-06-09 at 19:18 -0500, Larry Garfield wrote: > >> You should get a new server that supports PHP 5.2.1. PHP 4 is dead. > > > >Must be a zombie then because I see it running almost EVERYWHERE. > > > >Cheers, > >Rob. > > Rob: > > You raise an excellent and obvious point. There are significant > differences between 4 and 5 and if we are to code for clients who are > still in 4, then using 5 routines won't work. For those clients, we > must either dumb-down or get them to smarten-up. Considering that I > never get anyone to do anything, I know where that leaves me. Actually, several open source projects are trying to band together to push for PHP 5 compatibility. We're still in early stages, but if you work on an open source project and are interested in joining together on this, contact me off list. :-) -- Larry Garfield AIM: LOLG42 [EMAIL PROTECTED] ICQ: 6817012 "If nature has made any one thing less susceptible than all others of exclusive property, it is the action of the thinking power called an idea, which an individual may exclusively possess as long as he keeps it to himself; but the moment it is divulged, it forces itself into the possession of every one, and the receiver cannot dispossess himself of it." -- Thomas Jefferson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Is it possible to get the name of the top most calling script?
If the scripts are using a common file, [e.g., config, functions, etc.] you could define two constants. define("ORG_FILE", __FILE__); define("ORG_LINE", __LINE__); barophobia wrote: Hello, I know that __FILE__ and __LINE__ report on the file and line that they occur in. What I want is to be able to get the file name and line of the calling script. The only way I can do this so far is by passing the values through function arguments. Is there any way around this? Thanks, Chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Transparent image resizing using php 4.4.x
try: imagecolortransparent($img,imagecolorat($img,0,0)); Look-up imagecolorat(). I had tried it earlier. As I have written in my other emails. I have tried almost all solutions. I am really wondering that no one has every faced any such problem. I'll try what you have suggested. But I think I have already and it didn't work. But I'll let you know after trying again. Sukhwinder Singh - Original Message - From: "tedd" <[EMAIL PROTECTED]> To: "Sukhwinder Singh" <[EMAIL PROTECTED]>; Sent: Sunday, June 10, 2007 10:08 PM Subject: Re: [PHP] Transparent image resizing using php 4.4.x At 1:12 AM +0500 6/10/07, Sukhwinder Singh wrote: -snip- Could anyone please provide me a solution which works using php 4.4.x Sukhwinder Singh Instead of: imagecolortransparent($img_resized, $transparent); try: imagecolortransparent($img,imagecolorat($img,0,0)); Look-up imagecolorat(). Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Server side issue with
Here is the code: index.html Your name: Cost of a lunch: Days Buying Lunch: index.php Today's Date: $Today\n"); print("$YourName, you will be out "); print($CostOfLunch * $DaysBuyingLunch); print(" dollars this week.\n"); ?> Returns: Today's Date: 1 June 10, 2007 , you will be out 0 dollars this week. Thanks in advance for any feedback! "Tijnema" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] On 6/10/07, Roy W <[EMAIL PROTECTED]> wrote: > My host company must have an installation/configuration issue. > > Variables from forms are not being passed to the php scripts that are sent > via > > Has anyone heard of this and know of the fix? I don't think that's possible, please show us part of your code, as I expect the problem to be there. Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Going from simple to super CAPTCHA
> On the other hand, if what you're trying to protect has no real significance, then no one is going to brother breaking your CAPTCHA. Wrong. If you are protecting something completely worthless and your using a popular blog or forum software then you will undoubtedly inherit it's deficiencies regardless of the content of your site. If you mean that your blog software inherits security deficiencies and thus open for spam injection and other such evil stuff, then I see your point. But, that's like putting makeup on a pig -- you can only cover up so much. The problem remains regardless. --- Or constantly adapt. Sounds like fun :) I agree -- fun and money. My only derivation from your path is trying to accommodate the visually disabled along the way. --- > However, if you insist on making a CAPTCHA for your site (as clients, not knowing better, sometimes insist), then also add an alternative "way in" for the visually disabled like so: Now I'm not going to argue this point to any real depth. You obviously don't have statistics for the efficacy of CAPTCHA and I don't want to invoke erroneous logic by pointing out that if Slashdot, Yahoo, Google, etc are all using it then it must have some usefulness :) First, I would listen and consider your thoughts far more than I would follow after Slashdot, Yahoo, and Google practices. You're in the front lines and have first hand experience. They have their ultimate decisions diluted by management -- the brightest ideas have to pass through the dimmest minds to be implemented. The cutting edge is not sharpened by the dullest minds. Second, as for the efficacy of CAPTCHA, true I don't have any statistics. But the following does give rise for concern: http://sam.zoy.org/pwntcha/ Do graphic CAPTCHA's really work? I dunno, but from this it appears not. So, in my mind, if you're going to do something that doesn't work anyway, then why punish the disabled? > http://sperling.com/examples/captcha/ If you want the code, just ask and I'll provide. My thought is if you want to do image alteration, you might put your skills to better use by writing routines for various photographic effects, such as "Fish-Eye" or "Oval Cut-Outs" or whatever -- rather than beating the dead horse CAPTCHA. I'm in a time crunch right now, I'll explore more options later ;) Cheers, Rob. Arr -- please don't release the Cracken. I think we're pretty much all in agreement about the problem and what can, and cannot, be done. Your multi-CAPTCHA approach is certainly more difficult for a bot to crack than a single one, like changing session ID's in the middle of a user's visit to deter session high-jacking. But even that can be broken, am I not correct? My point was not about the security of my method, but rather the accessibility of it. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Going from simple to super CAPTCHA
Tedd: Please don't spread the code of your Audio CAPTCHA, we had a big discussion about it, and we concluded that it was quite easy to crack. I remember i've cracked some other CAPTCHAs, but if you still think your Audio CAPTCHA isn't hard to crack, then just let me know and i'll start cracking it :) Dave: Dave: The point is not how easy my Audio CAPTCHA is to crack, but rather one of accessibility. If one insist on using a graphic CAPTCHA, which in most cases can be cracked, then at least add an Audio CAPTCHA to allow access for the visually disabled. Or, is the point here to allow bots and block the visually disabled -- I think not. Look at the CAPTCHA's use here: http://sam.zoy.org/pwntcha/ and their efficiently at blocking bots, which next to nil. So, if people are going to believe in the false notion that CAPTCHA's block bots, then why not provide a way for the visually disabled to obtain access as well? Why just block the visually disabled? I think you remember the thread tedd ;) I remember the threads, but nothing that was said there is counter to what I said here. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Transparent image resizing using php 4.4.x
At 12:42 AM +0500 6/11/07, Sukhwinder Singh wrote: try: imagecolortransparent($img,imagecolorat($img,0,0)); Look-up imagecolorat(). I had tried it earlier. As I have written in my other emails. I have tried almost all solutions. I am really wondering that no one has every faced any such problem. I'll try what you have suggested. But I think I have already and it didn't work. But I'll let you know after trying again. Sukhwinder Singh I've seen it mentioned before that down-sizing a transparent image presents a problem to the algorithm that calculates what colors are more relevant. As such, if you redefine the color that you want to be transparent at 0,0 -- then the imagecolortransparent() function has an easier time of it. At least, that's my take on it -- could be wrong. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Server side issue with
On Sun, 2007-06-10 at 14:50 -0500, Roy W wrote: > Here is the code: > > index.html > > > > > Your name: > > Cost of a lunch: > > Days Buying Lunch: > > > > > > > > index.php > > > $Today = date("1 F d, Y"); > > ?> > > > > Today's Date: > > print("$Today\n"); > > print("$YourName, you will be out "); > print($CostOfLunch * $DaysBuyingLunch); > print(" dollars this week.\n"); > ?> > > > > > Returns: > > Today's Date: > 1 June 10, 2007 > , you will be out 0 dollars this week. You are relying on a deprecated and dangerous feature called "register_globals". It is now disabled by default. You should instead use the following code: > > index.php > > > $Today = date("1 F d, Y"); > > ?> > > > > Today's Date: > > echo "$Today\n"; > > echo $_POST['YourName'].", you will be out " ); > echo $_POST['CostOfLunch'] * $_POST['DaysBuyingLunch'] ); > echo " dollars this week.\n" ); > ?> > > > Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Going from simple to super CAPTCHA
On Sun, 2007-06-10 at 16:19 -0400, tedd wrote: > > > On the other hand, if what you're trying to protect has no real > >> significance, then no one is going to brother breaking your CAPTCHA. > > > >Wrong. If you are protecting something completely worthless and your > >using a popular blog or forum software then you will undoubtedly inherit > >it's deficiencies regardless of the content of your site. > > If you mean that your blog software inherits security deficiencies > and thus open for spam injection and other such evil stuff, then I > see your point. But, that's like putting makeup on a pig -- you can > only cover up so much. The problem remains regardless. > > --- > > >Or constantly adapt. Sounds like fun :) > > I agree -- fun and money. My only derivation from your path is trying > to accommodate the visually disabled along the way. Ah, but you suggest an auditory captcha in replacement of a visual captcha, when in fact you should be suggesting both if at all so that the deaf people of the world aren't left out while the blind and able listen with glee ;) > --- > > > > However, if you insist on making a CAPTCHA for your site (as clients, > >> not knowing better, sometimes insist), then also add an alternative > >> "way in" for the visually disabled like so: > > > >Now I'm not going to argue this point to any real depth. You obviously > >don't have statistics for the efficacy of CAPTCHA and I don't want to > >invoke erroneous logic by pointing out that if Slashdot, Yahoo, Google, > >etc are all using it then it must have some usefulness :) > > First, I would listen and consider your thoughts far more than I > would follow after Slashdot, Yahoo, and Google practices. You're in > the front lines and have first hand experience. They have their > ultimate decisions diluted by management -- the brightest ideas have > to pass through the dimmest minds to be implemented. The cutting edge > is not sharpened by the dullest minds. Well, you can be certain they are on the front lines also. Management, as slow moving as they can be, still moves quickly when pr0n and expletives show up in the wrong places :D > Second, as for the efficacy of CAPTCHA, true I don't have any > statistics. But the following does give rise for concern: > > http://sam.zoy.org/pwntcha/ > > Do graphic CAPTCHA's really work? I dunno, but from this it appears not. >From this it appears that some don't and some do. He lists them and states which ones work well and which ones do not. As such, we can learn from his site as to what constitutes difficult captcha. Preferably difficult for computers and not so difficult for homo sapiens. > So, in my mind, if you're going to do something that doesn't work > anyway, then why punish the disabled? Because it does work... and we're not punishing the disabled, we're hopefully giving them representative weight. By representative weight, I mean that if 1% of your visitors are unable to work with captcha, then really you have a 1% incentive to improve the situation. I think that 1% needs to be addressed, but it needs to be in context. Yes I know, something like 17% or so people have some kind of disability, but we're focusing right now on visual disability that makes captcha infeasible. > > > > > http://sperling.com/examples/captcha/ > >> > >> If you want the code, just ask and I'll provide. > >> > >> My thought is if you want to do image alteration, you might put your > >> skills to better use by writing routines for various photographic > >> effects, such as "Fish-Eye" or "Oval Cut-Outs" or whatever -- rather > >> than beating the dead horse CAPTCHA. > > > >I'm in a time crunch right now, I'll explore more options later ;) > Arr -- please don't release the Cracken. Was that a cracker pun on Kraken? I remember Clash of the Titans, all we need is Medusa's head >:) > I think we're pretty much all in agreement about the problem and what > can, and cannot, be done. Your multi-CAPTCHA approach is certainly > more difficult for a bot to crack than a single one, like changing > session ID's in the middle of a user's visit to deter session > high-jacking. But even that can be broken, am I not correct? > > My point was not about the security of my method, but rather the > accessibility of it. I understand that, but as with viruses, and malware in general, the problem is most likely always going to be an arms race. As such solutions will most likely always be in some need of adaptation to the changing techniques of the black hats. Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible a
Re: [PHP] [RFC] HTTP timezone
I agree with Tijnema he's hit the nail on the head. And the inability to handle daylight time really is a big potential snag - who in North America isn't on daylight time at some point in the year? If the timezone data is unreliable then no thinking developer will use it. The question then becomes: As a developer why WOULD you use unreliable timezone data? Sincerely, Rob // Flag images, ISO codes & PHP scripts for MySql Country data field // http://www.globalissa.com/demos/countries/about/index.php > > On 6/10/07, Stefanos Harhalakis <[EMAIL PROTECTED]> wrote: > > On Sunday 10 June 2007, Tijnema wrote: > > > To get back to the point, I think that the timezone should be defined > > > on what time it actually is at his PC, and what time it is on > > > time.nist.gov for example, and not lookng at some setting... Timezone > > > setting is often wrong, people just update their time to match the > > > time of their watch. This sets the UTC time wrong too, but still > > > displays the right time to the user. So if you compare this time to > > > time on web servers that are allways right, and you compare the > > > difference between that, then you know the timezone that is probably > > > right. > > > > Timezone is a property of the user and some times of the session. It is not > > a property of a system. Different users of a system may use different > > timezones (unless they use Windows where they can't). > > > > Anyway, I strongly believe that the issue of providing the correct timezone > > should be a concern of the end user and the browser. Any error checking and > > workarounds should be performed by those two and not by the server side > > scripts. > > > > In any way, there is no guarantee that the timezone information provided by > > clients will be correct. That's why it should only be used for informational > > purposes and not for security etc. > > Sure, but if this setting will be incorrect for 90-95% of the time, > then there won't be a lot people that are actually gonna use it, > because why do we want to know information that is probably wrong? > > Tijnema > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Undefined index error
Ah, you're right. Thanks, Tijnema. I'm just getting my feet wet with PHP, and you guys are a great help! Christian On 6/10/07, Tijnema <[EMAIL PROTECTED]> wrote: On 6/10/07, Christian Cantrell <[EMAIL PROTECTED]> wrote: > I'm getting this error in my Apache log file, and I can't figure out why: > > Undefined index: password in /path/to/file.php on line 82 > > Some searching on Google turned up a bunch of questions, but no answers. > Any idea what this warning message is referring to? > > Thanks, > Christian Yes, you're probably trying to get a value from an array by using a key that isn't in the array. Something like this: "test", "foo"=>"bar"); $value = $array['password']; // Key "password" doesn't exist! ?> Check the line number and print out the array with var_dump/print_r to see what's in the array.. Tijnema >
Re: [PHP] PHP Form isnt emailing me
if (preg_match("|\r\n|", $_POST['email'])){ die("Spammer."); } if (preg_match("|\r\n|", $_POST['subject'])){ die("Spammer."); } //and so on for anything you put into headers. //body can contain newlines, of course. On Sat, June 9, 2007 8:22 pm, Austin C wrote: > how can I tell them not to include new lines? > > On 6/9/07, Richard Lynch <[EMAIL PROTECTED]> wrote: >> >> The return value of http://php.net/mail only says whether or not PHP >> managed to queue up the email to go out. >> >> It does *NOT* imply that the email actually went anywhere. >> >> If your server isn't running through the queues and sending the >> emails, they don't go out. >> >> If your server is rejecting the emails as it runs through the queue, >> they don't go out. >> >> If your mail reader is marking them as spam and trashing them before >> you see them, they went out, but you never got them. >> >> *ALSO*, and this is aboslutely crucial, if you DO get email to go >> out, >> you've just built an OPEN RELAY that will cheerfully send out >> MILLIONS >> of spam mail! DON'T DO THAT!!! >> >> The problem is that a Bad Guy can put something like this in >> POST['contact']: >> >> "[EMAIL PROTECTED]> >> [EMAIL PROTECTED] >> [EMAIL PROTECTED] >> [EMAIL PROTECTED] >> . >> . >> . >> [EMAIL PROTECTED] >> <[EMAIL PROTECTED]" >> >> YOUR email script will then spew the same message to 1000 users! >> >> You need to sanitize user input -- Emails and names, for example, >> should NOT contain newlines. >> >> On Fri, June 8, 2007 8:48 pm, Austin C wrote: >> > Hello, I just finished making a PHP contact form for my webite, >> and I >> > can >> > run through the whole thing, and get no errors, but it doesnt >> email me >> > the >> > form contents. >> > >> > *Here is th actual form page:* >> > >> >Contact >> > Me >> > >> > >> > >> > >> > >> > >> > >> > >> > Please use this form to contact me: >> > >> > >> > Name: >> > Email Address/Method of Contact: > name="contact" >> > size="30"> >> > Reason for Contact: >> > Question >> > Suggestion >> > General Comment >> > Fan Mail >> > Other >> > >> > Message: > > cols="30"> >> > >> > >> > >> > >> > *Here is the form page processor:* >> > >> > >> > >> > Processing your information . . >> > . >> > >> > >> > >> > >> > >> > > bgcolor="#BFC4CB"> >> > >> > > color="#33"> >> > > > $name = $_POST['name']; >> > $email = $_POST['contact']; >> > $reason = $_POST['reasonforcontact']; >> > $message = $_POST['message1']; >> > >> > $to = "[EMAIL PROTECTED]"; >> > >> > $subject = "Contact Form Submitted at GWD-Dev"; >> > >> > $body = "Hello Austin, >> > >> > ".$name." has sent in a contact form at GWD-Dev. The reason >> he/she >> > contacted you was for ".$reason.". Here is the message they >> submitted >> > with >> > their form: >> > >> > >> > >> > ".$message." >> > >> > The contact field of the form contained the following >> information: >> > ".$email." >> > Please remember to get back to them ASAP!!"; >> > >> > $headers = "From: ".$name." <".$email.">\n"; >> > >> > >> > >> > echo "Collecting information . . . . . . . . . . DONE!"; >> > >> > $mail_sent = @mail($to, $subject, $body, $headers); >> > >> > echo $mail_sent ? "Sending contact form to webmaster . . . . >> . . >> > . . >> > DONE!" : "alert('The mail did not go >> through')"; >> > >> > >> > echo ". . . . . . . . . . . . . . . . . . . . . . . . . . . . >> . . >> > . . . >> > . . . ."; >> > >> > echo "Thank you for contacting us, please expect a reply in >> > anywhere >> > from 1 to 24 hours. Make sure that our email address, >> > [EMAIL PROTECTED]& >> > [EMAIL PROTECTED], are not sent to your spam >> folder."; >> > >> > >> > include("../footer.php"); ?> >> > >> > -- >> > Thanks, the webmaster of Galacticneo >> > >> >> >> -- >> Some people have a "gift" link here. >> Know what I want? >> I want you to buy a CD from some indie artist. >> http://cdbaby.com/browse/from/lynch >> Yeah, I get a buck. So? >> >> > > > -- > Thanks, the webmaster of Galacticneo > -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Intercepting fopen, mysql_connect, and similar functions for migration
Hello Kelly, u I don't think there is any lasting value or time saving in changing bad code, instead, my suggestion is to throw out the "badly written" code altogether and start with something else you can actually work with. ... but if you're going to keep it: Following is a description of how to replace with constants that may be univerally applied throughout your code, and changed in one place. This is pretty much a universal practise in apps which are moved from site to site, it sounds like you need it: In changing websites you need a way to identify: a. the changed absolute file path b. the changed domain url This may be achieved a number of ways. One way is: a. create a constant called ABSOLUTE_FILE_PATH b. create a constant called DOMAIN_URL define("ABSOLUTE_FILE_PATH", "/public_html/"); define("DOMAIN_URL", "http://domain.com/";); Save the constants in a file called config.php Include config.php in every file that needs it Invoke a path or url by using your new constants example include_once( "config.php" ); // bring in the constants include( ABSOLUTE_FILE_PATH . "subfolder/" ); // use a path echo""; // use a url This leaves the mysql connection stuff: do the same thing Put the connection data into config.php as constants: define("DBNAME", "enter_a_value_here" ); define("DBUSERNAME", "enter_a_value_here" ); define("DBPASSWORD", "enter_a_value_here" ); define("DBSERVERHOST", "enter_a_value_here" ); // sometimes localhost Include config.php (top of page) wherever you use database connects Replace your db connect code with your new constants Yes its a lot of work, but so is moving websites. When you're done you can move the code anywhere by changing one file. Sincerely, Rob http://phpyellow.com === Kelly wrote; >Date: Fri, 8 Jun 2007 19:42:10 -0600 >From: "Kelly Jones" <[EMAIL PROTECTED]> >To: php-general@lists.php.net >Subject: Intercepting fopen, mysql_connect, and similar functions for >>migration >I'm migrating a website from one server to another, and my file paths >and dbs have changed. >For example /a/b/c/foo.txt on the old machine is at /x/y/z/foo.txt on >the new machine. The MySQL db "foo" on the old machine is "bar" on the >new machine. > >Can I intercept fopen() and mysql_connect() so that when PHP does >fopen("/a/b/c/foo.txt"), I magically (using Zend functions or method >overloading or anything else) convert it at runtime to >fopen("/x/y/z/foo.txt"). > >Same thing so that mysql_connect("foo") becomes mysql_connect("bar"). > >The code is badly written: doing a search/replace in the code wouldn't >really work. I really want to "hook" fopen()/mysql_connect() and >similar commands so I can tweak their args before they actually >execute. Is there any hope? > >Sort of like an LD_PRELOAD for PHP? > >-- >We're just a Bunch Of Regular Guys, a collective group that's trying >to understand and assimilate technology. We feel that resistance to >new ideas and technology is unwise and ultimately futile. === -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Server side issue with
On Sun, June 10, 2007 9:06 am, Roy W wrote: > My host company must have an installation/configuration issue. > > Variables from forms are not being passed to the php scripts that are > sent > via > > Has anyone heard of this and know of the fix? Yes, lots. Usually right after an upgrade to PHP version that turned OFF register_globals by default. Fix your script to not rely on register_globals. -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] session.cookie_path problem
Is PHP sending the correct path in it headers for the cookie? Use FireFox + LiveHTTPHeader to find out. Is your BROWSER correctly honoring the path? It shouldn't be sending back the cookie for app1 in app2, but, if it does, PHP won't know it wasn't supposed to, I don't think... On Sun, June 10, 2007 6:15 am, Lasse Brandt wrote: > Hi, > > I am having some trouble with my sessions cookie_path - it doesn't > seem to work - or maybe I am not working, I don't know at the moment > :) > > Apache 2.2.3 and PHP 5.3.2 as module. > > What I want to achieve, is 2 separate sessions in the same website - > in different directories of course. > > My test setup is the following: > > http://sessiontest.dev.codefrog.dk/app1/.htaccess contains > php_value session.cookie_path /app1/ > > http://sessiontest.dev.codefrog.dk/app1/index.php contains > session_start(); > > $_SESSION['val1'] = "test1"; > > print_r($_SESSION); > print_r(session_get_cookie_params()); > ?> > > and > > http://sessiontest.dev.codefrog.dk/app2/.htaccess contains > php_value session.cookie_path /app2/ > > http://sessiontest.dev.codefrog.dk/app2/index.php contains > session_start(); > > $_SESSION['val2'] = "test2"; > > print_r($_SESSION); > print_r(session_get_cookie_params()); > ?> > > I visit /app1/ and $_SESSION contains 'val1' => 'test1' - as expected. > I then visit /app2/ and $_SESSION then contains both 'val1' => 'test1' > and 'val2' => 'test2' - not as expected. > > I would expect that each $_SESSION would only hold its own data. > > And I can see from the print_r(session_get_cookie_params()) that the > cookie has changed its path like it should according to my .htaccess > file. > > Am I missing something obvious? > > -- > > Kind Regards > Lasse Brandt > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Transparent image resizing using php 4.4.x
On Sun, June 10, 2007 12:08 pm, tedd wrote: > At 1:12 AM +0500 6/10/07, Sukhwinder Singh wrote: >>-snip- >>Could anyone please provide me a solution which works using php 4.4.x >> >>Sukhwinder Singh > > Instead of: > > imagecolortransparent($img_resized, $transparent); > > try: > > imagecolortransparent($img,imagecolorat($img,0,0)); > > Look-up imagecolorat(). I suspect that in various versions of GD, you may have troubles switching from a GIF (256 color pallette) to TrueColor (millions of colors) and back again... GD may well attempt to anti-alias, de-speckle, or who knows what in either of those transitions. I would suggest that you create images with the pallette[s] you want, and see if you get more consistent results. -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] None US ASCII characters not allowed in headers?
On Sun, June 10, 2007 12:48 am, Robert Cummings wrote: > On Sun, 2007-06-10 at 13:36 +0800, Crayon Shin Chan wrote: >> On Sunday 10 June 2007 04:05, Robert Cummings wrote: >> >> > Funny how the solution often presents itself after you make your >> > problem public *lol* :) Wonder if it falls under Murphy's Law. >> >> There should be a dummy list that people post to, if they don't work >> out >> the answer themselves 10 minutes after posting to the dummy list >> they can >> then post to the real list. > > *lol* The first time I read the above I thought you were suggesting a > list to which idiots could post :) No, I think we have that already... :-) :-) :-) Hey, *I* am here, right? -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Undefined index error
On Sat, June 9, 2007 11:53 pm, Christian Cantrell wrote: > I'm getting this error in my Apache log file, and I can't figure out > why: > > Undefined index: password in /path/to/file.php on line 82 > > Some searching on Google turned up a bunch of questions, but no > answers. > Any idea what this warning message is referring to? If you use something like: $_POST['password'] $_COOKIE['password'] // this is a REALLY Bad Idea $_GET['password'] //bad idea $_SESSION['password'] . . . but you don't actually *HAVE* a 'password' in the array, then you will get that error message. Your assumption that you have some kind of password is invalid. Check first: if (isset($whatever['password'])){ //rest of your code in here. } -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: php-cli vs python OT
On Sat, June 9, 2007 11:15 pm, Robert Cummings wrote: > On Thu, 2007-06-07 at 23:33 +0100, Colin Guthrie wrote: >> Robert Cummings wrote: >> > On Thu, 2007-06-07 at 16:36 -0400, Daniel Brown wrote: >> >> Are you using Amarok on Windows, Linux, or other? I have >> Amarok >> >> 1.3.1 on KDE 3.4.2 on Mandriva 2006.0 Community on >> 2.6.12-12mdksmp on >> >> an i686 Intel(R) Pentium(R) 4 CPU 2.60GHz w/ 1GB RAM on a desk >> with a >> >> bunch of crap on it, and all it does is crash for me. I use >> Totem >> >> instead, occasionally using xine for audio, and usually for video >> >> (different subject). Just wondering how stable Amarok is for >> you. >> > >> > I'm running Amarok 1.4.3 (using KDE 3.5.5) on Ubuntu 6.10 (I'm >> actually >> > a Gnome user). I used Mandrake up till 10.0, I'll never go back. >> My >> > desktop is an Athlon 2400 with 2 gigs of memory (though >> consumption >> > rarely goes past half gig unless I'm running several VMWare OSes >> at the >> > same time). I started using it about 3 days ago, I've had a few >> crashes, >> > but mostly when doing something major like re-scanning my >> collection >> > (8000+). Had no trouble grabbing covers, creating playlists, >> editing >> > 100s of tags within Amarok, etc. Only complaint really is that >> it's pig >> > slow when switching to or sorting columns on large playlists (well >> the >> > whole 8000 heheh). >> >> I'm a Mandriva dev and would have to say that if you've not used it >> for >> a while I think you'll be pleasently surprised these days. It's come >> a >> long, long way since 10.0! >> >> Also the older Amarok run by Daniel is faily unstable (I'm also a >> bit of >> a KDE dev when I get a mo'!) is fairly old and bug ridden. Whatever >> your >> distro, I'd upgrade your Amarok to the latest stable for the best >> experience. FWIW, if you add your sources correctly you can just >> urpmi >> your 2006.0 machine to 2007.1 relatively easily. I've done it on >> several >> machines now (a couple of them remotely!). > > FYI, after a few days of using Amarok I've found it to be extremely > prone to hanging. To try and correct the problem I downloaded the > latest > stable source (1.4.5) and built it myself. Still hanging all over the > place (simple selection of new mp3, re-arranging queued songs, etc). > It > also appears to keep NFS file handles open (possibly with locks) since > my NFS hung a few times after it died and I had to force an unmount. > Definitely not NFS itself, I've transferred 100s of gigs over months > of > uptime without a problem... only seen it hang on an Amarok hang (more > than once now). Anyways, I'll keep giving it a go, I created a wrapper > script when starting it up now that checks the process list and kills > all related Amarok processes before relaunching... makes it a little > more bearable). > > BTW, I know this isn't your issue or anything Colin, just passing > along > my experience for Dan :) FWIW: I've been using audacious for awhile now as a replacement for XMMS, and it seems to work okay for me. It does take FOREVER to time out when an MP3 link goes bad, though, and it's easier to kill it than to wait... -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Going from simple to super CAPTCHA
On Sat, June 9, 2007 10:27 pm, Dave M G wrote: > With a little help from the web, and help from this list, I have a > simple CAPTCHA image that works within the content system I'm > building. > > But it's *really* simple. Basically white text on a black background, > with a couple of white lines to obscure the text a little. > > I'm pretty sure that in its current state, my CAPTCHA image could be > cracked by OCR software from the 1950s. But does anybody CARE enough about whatever you have to spend the time to write an OCR routine to defeat it? I suspect the answer is "No" In which case you are just wasting your time making it "tougher," not to mention making it harder on real humans to actually use the dang thing. I put a CAPTCHA on a site with zero (0) distortion, noise, or anything remotely resembling anti-OCR, and haven't had a junk post in years. Had thousands a day before that, so it works. > So I'm hoping to take it up to the next level. > > I might be able to figure out how to add more lines, more colours, and > those kind of basic changes. > > But what I definitely can't comprehend is how some CAPTCHAs have that > really warped and distorted text. You can define a "transformation" in various axes, or with random matrix manipulation of an image. There are all kinds of image-mapping/transforming/projecting algorithms of that nature. It's the same way Photoshop "warps" an image onto a coffemug or whatever shape you want. > Is that possible with PHP? Do I have to make a library of pre-warped > text images or something? Nah. You have to have a library or random-generation of transforms, and a simple routine to apply them. > Is it possible to make backgrounds that are really crazy with textures > and gradients. Would that also rely on a pre-built library of images? Sure, you can. And then humans can't read the dang things either. :-) > Can someone maybe point me to an online instructional on how to get a > CAPTCHA image that really works? They all work. :-) Seriously. Wait until somebody hates you enough to spend 40 hours feeding your images to OCR to crack it. I suspect you'll never have a problem. > Tips on what differentiates a good CAPTCHA from a bad one would also > be > really sweet. No comment. :-) -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Difficulties including scripts from another folder (apache2.2, PHP5, Vista)
On Sat, June 9, 2007 9:04 pm, Robert Cummings wrote: > On Sun, 2007-06-10 at 01:02 +0100, brice wrote: >> Thanks a lot guys! >> >> Eventually Richard hit on the issue: >> >> >require(".\foo.inc.php"); ?># >> > >> >If you put .\ in there, then maybe PHP thinks you mean to NOT use >> the >> >include_path, but only the local directory? >> > >> >Take .\ out. >> >> it was the .\ that stopped it working. taking it out worked a treat! > > I never write any PHP code that relies on the include path. I hate > magical crap like that :) There is nothing magical about it. And it's certainly better than the home-brew screwed-up messes you get otherwise... Maybe yours is better, but I've lost enough hair trying to "fix" packages that have their include files in the web tree, and am not willing to go down that path again. I'd rather re-write than suffer that. -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Going from simple to super CAPTCHA
On Sun, June 10, 2007 3:19 pm, tedd wrote: > Do graphic CAPTCHA's really work? I dunno, but from this it appears > not. Properly implemented, they work great at thwarting 'bots (and the visually impaired) unless you have a determined attacker with a fair amount of time on their hands. If you have a determined attacker with a fair amount of time on their hands, then, like, probably not much you can do will work anyway. The pwntcha project isn't really "out there" attacking sites... -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Not getting expected result from file()
Hello, I'm using the file function create an array. I'm using a value from a form to see if it matches in elements in the array. My problem is I expect the condition to be true but info but my DB isn't populated as I in the right DB... =Code Begins== $theFileArray = file('C:\htdocs\folder1\file.txt'); if(isset($_POST['strName'], $_POST['strCity'], $_POST['strState'])) { $space = " "; $stringOne = $_POST['strName']. $space. $_POST['strCity']. $space . $_POST['strState']; } //I match the string "Grantsville Foodland Grantsville MD" letter for letter in the form and form info gets stored in unknown table and not central as it should...? if(in_array($stringOne, $theFileArray)) //Any Problem solvers, suggestions, or new ways to code welcome { $queryCentral = "INSERT INTO central (conName, conAddress, conCity, conState, conZip, conPhone, schName, schAddress, schCity, schState, schZip, strName, strCity, strState) VALUES('$regName', '$regAddress', '$regCity', '$regState', '$regZip', '$regPhone', '$sclName', '$sclAddress', '$sclCity', '$sclState', '$sclZip', '$stoName', '$stoCity', '$stoState')"; mysql_query($queryCentral, $connection) or die("Query failed: ". mysql_error($connection)); } else { $queryUnknown = "INSERT INTO unknown (conName, conAddress, conCity, conState, conZip, conPhone, schName, schAddress, schCity, schState, schZip, strName, strCity, strState) VALUES('$regName', '$regAddress', '$regCity', '$regState', '$regZip', '$regPhone', '$sclName', '$sclAddress', '$sclCity', '$sclState', '$sclZip', '$stoName', '$stoCity', '$stoState')"; mysql_query($queryUnknown, $connection) or die("Query failed: ". mysql_error($connection)); } THIS WHAT FILE LOOKS LIKE //Any Problem solvers and suggestion welcome = Begin Row 1 Grantsville Foodland Grantsville MD Deep Creek Foodland Fresh Mc Henry MD Oakland Foodland Oakland MD Bridgeport Foodland Bridgeport WV Grafton Foodland Grafton WV Morgan's Foodland Fresh Kingwood WV Petersburg Foodland Petersburg WV Rainelle Foodland Rainelle WV 6th Avenue Foodland St. Albans WV Weston Foodland Weston WV Ambridge Foodland Ambridge PA Curry Hollow Road Foodland Baldwin Pleasant Hills PA Tusca Plaza Foodland Fresh Beaver PA Bethel Park Foodland Bethel Park PA Lebanon Shops Foodland Castle Shannon PA Fatur's Foodland Delmont PA Ford City Ford City PA Glassport Foodland Glassport PA Mount Royal Foodland Glenshaw PA Grindstone Foodland Grindstone PA Kittanning Foodland Kittanning PA Mars Foodland Mars PA Fifth Avenue Foodland Mc Keesport PA Mckees Rocks Mckees Rocks PA Monessen Foodland Fresh Monessen PA Monongahela Foodland Monongahela PA Great Valley Foodland N. Versailles PA Gold Crown Foodland Nanty Glo PA New Brighton Foodland New Brighton PA J & J Foodland New Kensington PA Brownsville Road Foodland Pittsburgh PA Mt Washington Foodland Fresh Pittsburgh PA Beechview Foodland Pittsburgh PA Mcneilly Road Foodland Pittsburgh PA Rochester Road Foodland Pittsburgh PA Pines Plaza Foodland Pittsburgh PA Point Marion Foodland Point Marion PA Beulah Road Foodland Turtle Creek PA Midtown Foodland Uniontown PA Henderson Avenue Foodland Washington PA Interstate Foodland Washington PA Maiden Street Foodland Washington PA Buttermilk Hollow Foodland West Mifflin PA Village Foodland Fresh West Mifflin PA Wellston Foodland Wellston OH Westmoreland Foodland Fresh Huntington WV -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Not getting expected result from file()
kvigor wrote: > Hello, > > I'm using the file function create an array. I'm using a value from a > form to see if it matches in elements in the array. > > My problem is I expect the condition to be true but info but my DB isn't > populated as I in the right DB... > =Code > Begins== > $theFileArray = file('C:\htdocs\folder1\file.txt'); > Your problem starts here - file returns the file in an array. Each element of the array corresponds to a line in the file, with the newline still attached. When you compare to a string without the newline at the end, the comparison fails. If you have php > 5.0.0 you can use the FILE_IGNORE_NEW_LINES flag in the file() arguments, otherwise use trim() to remove trailing whitespace from the array elements. Cheers -- David Robley "I hate playing craps," Tom said dicily. Today is Boomtime, the 16th day of Confusion in the YOLD 3173. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Not getting expected result from file()
Sorry I re-wrote for problem clarity. FYI whenever I do a var_dump it always shows $stringOne as being 2 characters less e.g. var_dump($foodlandPA[45]); var_dump($storeInfo); string(31) "Wellston Foodland Wellston OH " string(29) "Wellston Foodland Wellston OH" ""kvigor"" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hello, > > I'm using the file function to create an array. I'm also using values > from a form to see if it matches any elements in the array. > > My problem is I expect the condition to be true, but my DB isn't > populated as it should be if condition was true. =Code Begins== > $theFileArray = file('C:\htdocs\folder1\file.txt'); > > > if(isset($_POST['strName'], $_POST['strCity'], $_POST['strState'])) > { > $space = " "; > $stringOne = $_POST['strName']. $space. $_POST['strCity']. $space . > $_POST['strState']; > > } > //I match the string "Grantsville Foodland Grantsville MD" letter for > letter in the form and form info gets stored in unknown table and not > central as it should...? > > if(in_array($stringOne, $theFileArray)) //Any Problem solvers, > suggestions, or new ways to code welcome > { > $queryCentral = "INSERT INTO central (conName, conAddress, conCity, > > conState, conZip, conPhone, schName, schAddress, schCity, schState, > schZip, strName, > > strCity, strState) VALUES('$regName', '$regAddress', '$regCity', > '$regState', > > '$regZip', '$regPhone', '$sclName', '$sclAddress', '$sclCity', > '$sclState', > > '$sclZip', '$stoName', '$stoCity', '$stoState')"; > > mysql_query($queryCentral, $connection) or die("Query failed: ". > > mysql_error($connection)); > } > > > else > { > $queryUnknown = "INSERT INTO unknown (conName, conAddress, conCity, > conState, > > conZip, conPhone, schName, schAddress, schCity, schState, schZip, strName, > strCity, > > strState) VALUES('$regName', '$regAddress', '$regCity', '$regState', > '$regZip', > > '$regPhone', '$sclName', '$sclAddress', '$sclCity', '$sclState', > '$sclZip', > > '$stoName', '$stoCity', '$stoState')"; > mysql_query($queryUnknown, $connection) or die("Query failed: ". > > mysql_error($connection)); > } > > THIS WHAT FILE LOOKS LIKE //Any Problem solvers and suggestion welcome > = > Begin Row 1 > Grantsville Foodland Grantsville MD > Deep Creek Foodland Fresh Mc Henry MD > Oakland Foodland Oakland MD > Bridgeport Foodland Bridgeport WV > Grafton Foodland Grafton WV > Morgan's Foodland Fresh Kingwood WV > Petersburg Foodland Petersburg WV > Rainelle Foodland Rainelle WV > 6th Avenue Foodland St. Albans WV > Weston Foodland Weston WV > Ambridge Foodland Ambridge PA > Curry Hollow Road Foodland Baldwin Pleasant Hills PA > Tusca Plaza Foodland Fresh Beaver PA > Bethel Park Foodland Bethel Park PA > Lebanon Shops Foodland Castle Shannon PA > Fatur's Foodland Delmont PA > Ford City Ford City PA > Glassport Foodland Glassport PA > Mount Royal Foodland Glenshaw PA > Grindstone Foodland Grindstone PA > Kittanning Foodland Kittanning PA > Mars Foodland Mars PA > Fifth Avenue Foodland Mc Keesport PA > Mckees Rocks Mckees Rocks PA > Monessen Foodland Fresh Monessen PA > Monongahela Foodland Monongahela PA > Great Valley Foodland N. Versailles PA > Gold Crown Foodland Nanty Glo PA > New Brighton Foodland New Brighton PA > J & J Foodland New Kensington PA > Brownsville Road Foodland Pittsburgh PA > Mt Washington Foodland Fresh Pittsburgh PA > Beechview Foodland Pittsburgh PA > Mcneilly Road Foodland Pittsburgh PA > Rochester Road Foodland Pittsburgh PA > Pines Plaza Foodland Pittsburgh PA > Point Marion Foodland Point Marion PA > Beulah Road Foodland Turtle Creek PA > Midtown Foodland Uniontown PA > Henderson Avenue Foodland Washington PA > Interstate Foodland Washington PA > Maiden Street Foodland Washington PA > Buttermilk Hollow Foodland West Mifflin PA > Village Foodland Fresh West Mifflin PA > Wellston Foodland Wellston OH > Westmoreland Foodland Fresh Huntington WV -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Not getting expected result from file()
kvigor wrote: Sorry I re-wrote for problem clarity. FYI whenever I do a var_dump it always shows $stringOne as being 2 characters less e.g. var_dump($foodlandPA[45]); var_dump($storeInfo); string(31) "Wellston Foodland Wellston OH " string(29) "Wellston Foodland Wellston OH" This would be because of the ' ' and "\n" at the end of the 31 char line use trim to remove the white space before your comparison and it should work. One other thing I noticed, in your SQL insert statement, are all variables coming from the post? If so, do you need to reference the $_POST['..'] array instead and clean them?? or have you already done that? ""kvigor"" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Hello, I'm using the file function to create an array. I'm also using values from a form to see if it matches any elements in the array. My problem is I expect the condition to be true, but my DB isn't populated as it should be if condition was true. =Code Begins== $theFileArray = file('C:\htdocs\folder1\file.txt'); if(isset($_POST['strName'], $_POST['strCity'], $_POST['strState'])) { $space = " "; $stringOne = $_POST['strName']. $space. $_POST['strCity']. $space . $_POST['strState']; } //I match the string "Grantsville Foodland Grantsville MD" letter for letter in the form and form info gets stored in unknown table and not central as it should...? if(in_array($stringOne, $theFileArray)) //Any Problem solvers, suggestions, or new ways to code welcome { $queryCentral = "INSERT INTO central (conName, conAddress, conCity, conState, conZip, conPhone, schName, schAddress, schCity, schState, schZip, strName, strCity, strState) VALUES('$regName', '$regAddress', '$regCity', '$regState', '$regZip', '$regPhone', '$sclName', '$sclAddress', '$sclCity', '$sclState', '$sclZip', '$stoName', '$stoCity', '$stoState')"; mysql_query($queryCentral, $connection) or die("Query failed: ". mysql_error($connection)); } else { $queryUnknown = "INSERT INTO unknown (conName, conAddress, conCity, conState, conZip, conPhone, schName, schAddress, schCity, schState, schZip, strName, strCity, strState) VALUES('$regName', '$regAddress', '$regCity', '$regState', '$regZip', '$regPhone', '$sclName', '$sclAddress', '$sclCity', '$sclState', '$sclZip', '$stoName', '$stoCity', '$stoState')"; mysql_query($queryUnknown, $connection) or die("Query failed: ". mysql_error($connection)); } THIS WHAT FILE LOOKS LIKE //Any Problem solvers and suggestion welcome = Begin Row 1 Grantsville Foodland Grantsville MD Deep Creek Foodland Fresh Mc Henry MD Oakland Foodland Oakland MD Bridgeport Foodland Bridgeport WV Grafton Foodland Grafton WV Morgan's Foodland Fresh Kingwood WV Petersburg Foodland Petersburg WV Rainelle Foodland Rainelle WV 6th Avenue Foodland St. Albans WV Weston Foodland Weston WV Ambridge Foodland Ambridge PA Curry Hollow Road Foodland Baldwin Pleasant Hills PA Tusca Plaza Foodland Fresh Beaver PA Bethel Park Foodland Bethel Park PA Lebanon Shops Foodland Castle Shannon PA Fatur's Foodland Delmont PA Ford City Ford City PA Glassport Foodland Glassport PA Mount Royal Foodland Glenshaw PA Grindstone Foodland Grindstone PA Kittanning Foodland Kittanning PA Mars Foodland Mars PA Fifth Avenue Foodland Mc Keesport PA Mckees Rocks Mckees Rocks PA Monessen Foodland Fresh Monessen PA Monongahela Foodland Monongahela PA Great Valley Foodland N. Versailles PA Gold Crown Foodland Nanty Glo PA New Brighton Foodland New Brighton PA J & J Foodland New Kensington PA Brownsville Road Foodland Pittsburgh PA Mt Washington Foodland Fresh Pittsburgh PA Beechview Foodland Pittsburgh PA Mcneilly Road Foodland Pittsburgh PA Rochester Road Foodland Pittsburgh PA Pines Plaza Foodland Pittsburgh PA Point Marion Foodland Point Marion PA Beulah Road Foodland Turtle Creek PA Midtown Foodland Uniontown PA Henderson Avenue Foodland Washington PA Interstate Foodland Washington PA Maiden Street Foodland Washington PA Buttermilk Hollow Foodland West Mifflin PA Village Foodland Fresh West Mifflin PA Wellston Foodland Wellston OH Westmoreland Foodland Fresh Huntington WV -- Jim Lucas "Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them." Unknown -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Not getting expected result from file()
OK, I trimmed the elements in the array. using var_dump() it shows strings are identical, however nothing is storing in DB still. view new code =//doesn't store in central still, also shows no MySQL errors. $theFileArray = file('C:\htdocs\folder1\file.txt'); function trim_value(&$value) { $value = trim($value); } array_walk($theFileArray, 'trim_value'); if(isset($_POST['strName'], $_POST['strCity'], $_POST['strState'])) { $space = " "; $stringOne = $_POST['strName']. $space. $_POST['strCity']. $space . $_POST['strState']; } if(in_array($storeInfo, $theFileArray)) { $queryCentral = "INSERT INTO central (conName, conAddress, conCity, conState, conZip, conPhone, schName, schAddress, schCity, schState, schZip, strName, strCity, strState) VALUES('$regName', '$regAddress', '$regCity', '$regState', '$regZip', '$regPhone', '$sclName', '$sclAddress', '$sclCity', '$sclState', '$sclZip', '$stoName', '$stoCity', '$stoState')"; mysql_query($queryCentral, $connection) or die("Query failed: ". mysql_error($connection)); } else { $queryUnknown = "INSERT INTO unknown (conName, conAddress, conCity, conState, conZip, conPhone, schName, schAddress, schCity, schState, schZip, strName, strCity, strState) VALUES('$regName', '$regAddress', '$regCity', '$regState', '$regZip', '$regPhone', '$sclName', '$sclAddress', '$sclCity', '$sclState', '$sclZip', '$stoName', '$stoCity', '$stoState')"; mysql_query($queryUnknown, $connection) or die("Query failed: ". mysql_error($connection)); } = "David Robley" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > kvigor wrote: > >> Hello, >> >> I'm using the file function create an array. I'm using a value from a >> form to see if it matches in elements in the array. >> >> My problem is I expect the condition to be true but info but my DB isn't >> populated as I in the right DB... >> =Code >> Begins== >> $theFileArray = file('C:\htdocs\folder1\file.txt'); >> > > Your problem starts here - file returns the file in an array. Each element > of the array corresponds to a line in the file, with the newline still > attached. When you compare to a string without the newline at the end, the > comparison fails. > > If you have php > 5.0.0 you can use the FILE_IGNORE_NEW_LINES flag in the > file() arguments, otherwise use trim() to remove trailing whitespace from > the array elements. > > > > Cheers > -- > David Robley > > "I hate playing craps," Tom said dicily. > Today is Boomtime, the 16th day of Confusion in the YOLD 3173. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Not getting expected result from file()
Trimmed elements in the array. I still can't get it to store in central table. No MySQL errors either. :-( (Also, all form values are escaped.) Strings compared in if condition are now identical. newcode === theFileArray = file('C:\htdocs\folder1\file.txt'); function trim_value(&$value) { $value = trim($value); } array_walk($theFileArray, 'trim_value'); if(isset($_POST['strName'], $_POST['strCity'], $_POST['strState'])) { $space = " "; $stringOne = $_POST['strName']. $space. $_POST['strCity']. $space . $_POST['strState']; } if(in_array($stringOne, $theFileArray)) // string were identical after I trimmed an did var_dump on $stringOne and $theFileArray[2] { $queryCentral = "INSERT INTO central (conName, conAddress, conCity, conState, conZip, conPhone, schName, schAddress, schCity, schState, schZip, strName, strCity, strState) VALUES('$regName', '$regAddress', '$regCity', '$regState', '$regZip', '$regPhone', '$sclName', '$sclAddress', '$sclCity', '$sclState', '$sclZip', '$stoName', '$stoCity', '$stoState')"; mysql_query($queryCentral, $connection) or die("Query failed: ". mysql_error($connection)); } else { $queryUnknown = "INSERT INTO unknown (conName, conAddress, conCity, conState, conZip, conPhone, schName, schAddress, schCity, schState, schZip, strName, strCity, strState) VALUES('$regName', '$regAddress', '$regCity', '$regState', '$regZip', '$regPhone', '$sclName', '$sclAddress', '$sclCity', '$sclState', '$sclZip', '$stoName', '$stoCity', '$stoState')"; mysql_query($queryUnknown, $connection) or die("Query failed: ". mysql_error($connection)); } "David Robley" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > kvigor wrote: > >> Hello, >> >> I'm using the file function create an array. I'm using a value from a >> form to see if it matches in elements in the array. >> >> My problem is I expect the condition to be true but info but my DB isn't >> populated as I in the right DB... >> =Code >> Begins== >> $theFileArray = file('C:\htdocs\folder1\file.txt'); >> > > Your problem starts here - file returns the file in an array. Each element > of the array corresponds to a line in the file, with the newline still > attached. When you compare to a string without the newline at the end, the > comparison fails. > > If you have php > 5.0.0 you can use the FILE_IGNORE_NEW_LINES flag in the > file() arguments, otherwise use trim() to remove trailing whitespace from > the array elements. > > > > Cheers > -- > David Robley > > "I hate playing craps," Tom said dicily. > Today is Boomtime, the 16th day of Confusion in the YOLD 3173. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] [RFC] HTTP timezone
On 6/10/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: I agree with Tijnema he's hit the nail on the head. And the inability to handle daylight time really is a big potential snag - who in North America isn't on daylight time at some point in the year? If the timezone data is unreliable then no thinking developer will use it. The question then becomes: As a developer why WOULD you use unreliable timezone data? Sincerely, Rob Yes, I think that you can compare it with the Referrer header, it's unreliable too, and which developer uses it these days? Tijnema > > On 6/10/07, Stefanos Harhalakis <[EMAIL PROTECTED]> wrote: > > On Sunday 10 June 2007, Tijnema wrote: > > > To get back to the point, I think that the timezone should be defined > > > on what time it actually is at his PC, and what time it is on > > > time.nist.gov for example, and not lookng at some setting... Timezone > > > setting is often wrong, people just update their time to match the > > > time of their watch. This sets the UTC time wrong too, but still > > > displays the right time to the user. So if you compare this time to > > > time on web servers that are allways right, and you compare the > > > difference between that, then you know the timezone that is probably > > > right. > > > > Timezone is a property of the user and some times of the session. It is not > > a property of a system. Different users of a system may use different > > timezones (unless they use Windows where they can't). > > > > Anyway, I strongly believe that the issue of providing the correct timezone > > should be a concern of the end user and the browser. Any error checking and > > workarounds should be performed by those two and not by the server side > > scripts. > > > > In any way, there is no guarantee that the timezone information provided by > > clients will be correct. That's why it should only be used for informational > > purposes and not for security etc. > > Sure, but if this setting will be incorrect for 90-95% of the time, > then there won't be a lot people that are actually gonna use it, > because why do we want to know information that is probably wrong? > > Tijnema > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Going from simple to super CAPTCHA
On 6/10/07, tedd <[EMAIL PROTECTED]> wrote: >Tedd: > >Please don't spread the code of your Audio CAPTCHA, we had a big >discussion about it, and we concluded that it was quite easy to crack. >I remember i've cracked some other CAPTCHAs, but if you still think >your Audio CAPTCHA isn't hard to crack, then just let me know and i'll >start cracking it :) > >Dave: Dave: The point is not how easy my Audio CAPTCHA is to crack, but rather one of accessibility. If one insist on using a graphic CAPTCHA, which in most cases can be cracked, then at least add an Audio CAPTCHA to allow access for the visually disabled. Or, is the point here to allow bots and block the visually disabled -- I think not. Surely not, but what you're doing with adding a weak audio CAPTCHA is adding more options for a hacker. Since the form can be submitted by either completing one of both CAPTCHA programs, the hacker can choose whichever way he likes. So if you have a very very strong Graphic CAPTCHA, but a very weak Audio CAPTHCA, than it isn't too hard to crack, as the hacker would only crack the Audio CAPTCHA... Look at the CAPTCHA's use here: http://sam.zoy.org/pwntcha/ and their efficiently at blocking bots, which next to nil. So, if people are going to believe in the false notion that CAPTCHA's block bots, then why not provide a way for the visually disabled to obtain access as well? Why just block the visually disabled? The question is not if the CAPTCHAs are crackable, because they are! But, like we said in the other thread, it's by finding the right way between the time needed to crack, and the time needed to type over/listen to CAPTCHA. Adding Audio CAPTCHA decreases time to crack... >I think you remember the thread tedd ;) I remember the threads, but nothing that was said there is counter to what I said here. Cheers, tedd It's atleast an interesting thread about CAPTCHA. Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php