php-general Digest 31 Mar 2007 20:49:32 -0000 Issue 4708
php-general Digest 31 Mar 2007 20:49:32 - Issue 4708 Topics (messages 251824 through 251844): Re: Saving css state in javascript and passing to php via form submit 251824 by: Tijnema ! 251829 by: Tijnema ! 251835 by: Jochem Maas Re: FastCGI + PHP5 251825 by: Mario Guenterberg 251827 by: Mario Guenterberg Re: Parsing database variables 251826 by: Jim Lucas 251836 by: Jake McHenry 251837 by: Jochem Maas 251842 by: Jochem Maas Re: tabbed navegation PHP 251828 by: Jim Lucas newbie question about debuging 251830 by: buFka 251831 by: Tijnema ! 251832 by: buFka 251833 by: Tijnema ! 251834 by: buFka Re: Alternative/Addition to using a CAPTCHA 251838 by: tedd 251839 by: tedd 251840 by: Tijnema ! 251841 by: tedd 251843 by: Tijnema ! Speed of apache/php4 on windows 251844 by: Don Don Administrivia: To subscribe to the digest, e-mail: [EMAIL PROTECTED] To unsubscribe from the digest, e-mail: [EMAIL PROTECTED] To post to the list, e-mail: php-general@lists.php.net -- ---BeginMessage--- On 3/31/07, Jochem Maas [EMAIL PROTECTED] wrote: Tijnema ! wrote: On 3/30/07, Jochem Maas [EMAIL PROTECTED] wrote: Tim wrote: ... personally I prefer JSON formatted data, for which there are even a couple of functions available in newer versions of php (otherwise you can find code on the net easily enough to handle JSON data creation/parsing): http://php.net/json I prefer not to do a lot of processing in Javascript, what i usually do is send plain HTML and directly output it inside a div 'processing' JSON formatted data is a matter of running a single eval() line in javascript!?! just outputting HTML directly into a div is useful in many simple situations but it doesn't leave a whole lot of room for any real client sided application logic ... All that client side application logic can also be done in PHP. Where's the sense in learning to work with JSON, if it can be done in PHP too? PHP is a lot faster then javascript right? Tijnema Tijnema Regards, Tim ---End Message--- ---BeginMessage--- On 3/31/07, Tijnema ! [EMAIL PROTECTED] wrote: On 3/31/07, Jochem Maas [EMAIL PROTECTED] wrote: Tijnema ! wrote: On 3/30/07, Jochem Maas [EMAIL PROTECTED] wrote: Tim wrote: ... personally I prefer JSON formatted data, for which there are even a couple of functions available in newer versions of php (otherwise you can find code on the net easily enough to handle JSON data creation/parsing): http://php.net/json I prefer not to do a lot of processing in Javascript, what i usually do is send plain HTML and directly output it inside a div 'processing' JSON formatted data is a matter of running a single eval() line in javascript!?! just outputting HTML directly into a div is useful in many simple situations but it doesn't leave a whole lot of room for any real client sided application logic ... All that client side application logic can also be done in PHP. Where's the sense in learning to work with JSON, if it can be done in PHP too? PHP is a lot faster then javascript right? Tijnema I've did a few test on this PC(AMD64 3200+), it's running EasyPHP (Apache+PHP+MySQL), and it shows me that PHP is about twice as fast then Javascript.(Tested using IE6, FF wasn't working because script took too long to execute, which generates messages on firefox, and which didn't let me finish the script) Tijnema ---End Message--- ---BeginMessage--- Tijnema ! wrote: On 3/31/07, Jochem Maas [EMAIL PROTECTED] wrote: Tijnema ! wrote: .. 'processing' JSON formatted data is a matter of running a single eval() line in javascript!?! just outputting HTML directly into a div is useful in many simple situations but it doesn't leave a whole lot of room for any real client sided application logic ... All that client side application logic can also be done in PHP. Where's the sense in learning to work with JSON, if it can be done in PHP too? PHP is a lot faster then javascript right? ok please shut up - you've completely missed the point. Tijnema Tijnema Regards, Tim ---End Message--- ---BeginMessage--- On Fri, Mar 30, 2007 at 07:00:07PM -0400, Stevie wrote: Hi all. anyone have any decent docs getting the config working? i guess not many people using FastCGI w/PHP because it's seems so complicated to setup. btw i have already installed the fastcgi libs and mod_fastcgi. what should an apache configure line look like when you complie php/fastcgi with it.. am i suppose to install apache first? some people say you have to install apache first but if you install apache first how will it locate the php libs? Hi.. Try this
Re: [PHP] Saving css state in javascript and passing to php via form submit
Tijnema ! wrote: On 3/30/07, Jochem Maas [EMAIL PROTECTED] wrote: Tim wrote: ... personally I prefer JSON formatted data, for which there are even a couple of functions available in newer versions of php (otherwise you can find code on the net easily enough to handle JSON data creation/parsing): http://php.net/json I prefer not to do a lot of processing in Javascript, what i usually do is send plain HTML and directly output it inside a div 'processing' JSON formatted data is a matter of running a single eval() line in javascript!?! just outputting HTML directly into a div is useful in many simple situations but it doesn't leave a whole lot of room for any real client sided application logic ... Tijnema Regards, Tim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Saving css state in javascript and passing to php via form submit
On 3/31/07, Jochem Maas [EMAIL PROTECTED] wrote: Tijnema ! wrote: On 3/30/07, Jochem Maas [EMAIL PROTECTED] wrote: Tim wrote: ... personally I prefer JSON formatted data, for which there are even a couple of functions available in newer versions of php (otherwise you can find code on the net easily enough to handle JSON data creation/parsing): http://php.net/json I prefer not to do a lot of processing in Javascript, what i usually do is send plain HTML and directly output it inside a div 'processing' JSON formatted data is a matter of running a single eval() line in javascript!?! just outputting HTML directly into a div is useful in many simple situations but it doesn't leave a whole lot of room for any real client sided application logic ... All that client side application logic can also be done in PHP. Where's the sense in learning to work with JSON, if it can be done in PHP too? PHP is a lot faster then javascript right? Tijnema Tijnema Regards, Tim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] FastCGI + PHP5
On Fri, Mar 30, 2007 at 07:00:07PM -0400, Stevie wrote: Hi all. anyone have any decent docs getting the config working? i guess not many people using FastCGI w/PHP because it's seems so complicated to setup. btw i have already installed the fastcgi libs and mod_fastcgi. what should an apache configure line look like when you complie php/fastcgi with it.. am i suppose to install apache first? some people say you have to install apache first but if you install apache first how will it locate the php libs? Hi.. Try this http://www.fastcgi.com/docs/faq.html#PHP Greetings Mario -- - | havelsoft.com - Ihr Service Partner für Open Source | | Tel: 033876-21 966 | | Notruf: 0173-277 33 60 | | http://www.havelsoft.com| | | | Inhaber: Mario Günterberg | | Mützlitzer Strasse 19 | | 14715 Märkisch Luch | - signature.asc Description: Digital signature
Re: [PHP] Parsing database variables
Jake McHenry wrote: Ok, this is working good, except for one problem... I have variable $pay_rate and $pay_rate_bap ... It finds $pay_rate first and then it never finds $pay_rate_bap because it changes it to say.. 21_bap... Anyone know of anything else that may work? I have been messing around with eval, and I havn't gotten it to work even once yet... Always comes back with error at line 5 of eval'd And line 5 of the paragraph is a blank line... Line 4 is plain text... Not even a variable until line 12... Fine, just switch the order you are adding them to the two different arrays. instead of this: $find[] = '$pay_rate'; $find[] = '$pay_rate_bap'; $replace[] = $pay_rate; $replace[] = $pay_rate_bap; do this $find[] = '$pay_rate_bap'; $find[] = '$pay_rate'; $replace[] = $pay_rate_bap; $replace[] = $pay_rate; find the longer one first I guess next I will play around with preg_replace, but I'm thinking I will have the same problem as I did with str_replace... As long as the variable names have any kind of similar names Correct? I can resolve this I suppose, but the data is already in place and trying to work around it... Thanks, Jake -Original Message- From: Jim Lucas [mailto:[EMAIL PROTECTED] Sent: Friday, March 30, 2007 7:32 PM To: Jake McHenry Cc: php-general@lists.php.net Subject: Re: [PHP] Parsing database variables Jake McHenry wrote: Hi everyone, I have been searching and trying to do this for the past hour without success yet I have a database table with this in it: p$namep Period Ending Date: $ppep Etc... And in my script, these variables exist and have values. Is there a way for me to get the output from mysql_query to use the current script variables in place of the same variable name within the database output? Thanks, Jake If I read the manual correct about how to setup the input values for str_replace() you should be able to do the following. This is completely untested, since I have now system like yours. But here is goes... #setup the entries that you want to find. $find[] = '$name'; $find[] = '$ppe'; #setup the values to be replaced. #Mind you to keep the indexes the in sync with $find... $replace[] = $name; $replace[] = $ppe; echo 'pre'; while ( $row = mysql_fetch_assoc($resultHandle) ) { $row = str_replace($find, $replace, $row); // do something with $row. Display it maybe... var_dump($row); } echo '/pre'; Basically replace $find[0] with $replace[0] in any of the values of the return $row then replace the previous $row values with the newly modified values... Then go to the next index of $find[1] and $replace[1] and do the same thing until you are out of indexes. But this is a much better way of doing this than using eval(). eval is an evil little function! -- Enjoy, Jim Lucas Different eyes see different things. Different hearts beat on different strings. But there are times for you and me when all such things agree. - Rush -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.446 / Virus Database: 268.18.23/740 - Release Date: 3/30/2007 1:15 PM -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] FastCGI + PHP5
On Fri, Mar 30, 2007 at 07:00:07PM -0400, Stevie wrote: or this: http://www.webhostingtalk.com/archive/index.php/t-509127-p-1.html Greetings Mario -- - | havelsoft.com - Ihr Service Partner für Open Source | | Tel: 033876-21 966 | | Notruf: 0173-277 33 60 | | http://www.havelsoft.com| | | | Inhaber: Mario Günterberg | | Mützlitzer Strasse 19 | | 14715 Märkisch Luch | - signature.asc Description: Digital signature
Re: [PHP] tabbed navegation PHP
Dwayne Heronimo wrote: Dear All, I have made a tabbed navegation with CSS. And if you set class=active to one of the tabs, it will then be highlighted. So I thought to make this dymamic with PHP. Using the $_GET variable I can get the page name above with something like. $page_name = $_GET['page'] ; so I can tell the class when to be active to what page. Should I use the isset function for this? I am very new to PHP but here is my try, but of course its not working: ?php if (isset ($_GET['page'])) { $page_name = $_GET['page'] ; if ($page_name = default) { $flg_page_default=1; } if ($page_name = about) { $flg_page_about=1; } } ? a ?php if(!isset($flg_page_default)) echo 'class=active'; else echo ''; ? href=index.php?page=defaultspanhome/span/a a ?php if(!isset($flg_page_about)) echo 'class=active'; else echo ''; ? href=index.php?page=defaultspanabout/span/a Of should I stick to just static html :( Dwayne Close, but this is probably how you should do it $links = array(); url display $links['default'] = Home; $links['about'] = About; etc... foreach($links AS $url = $text) { $class = ''; if ( isset($_GET['page']) $_GET['page'] == $url ) { $class = ' class=active'; } echo a href='index.php?page={$url}'{$class}span{$text}/span/a\n; } This will allow you to change one piece of code, instead of twenty lines later on. Use a little of the DRY principle. Jim Lucas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Saving css state in javascript and passing to php via form submit
On 3/31/07, Tijnema ! [EMAIL PROTECTED] wrote: On 3/31/07, Jochem Maas [EMAIL PROTECTED] wrote: Tijnema ! wrote: On 3/30/07, Jochem Maas [EMAIL PROTECTED] wrote: Tim wrote: ... personally I prefer JSON formatted data, for which there are even a couple of functions available in newer versions of php (otherwise you can find code on the net easily enough to handle JSON data creation/parsing): http://php.net/json I prefer not to do a lot of processing in Javascript, what i usually do is send plain HTML and directly output it inside a div 'processing' JSON formatted data is a matter of running a single eval() line in javascript!?! just outputting HTML directly into a div is useful in many simple situations but it doesn't leave a whole lot of room for any real client sided application logic ... All that client side application logic can also be done in PHP. Where's the sense in learning to work with JSON, if it can be done in PHP too? PHP is a lot faster then javascript right? Tijnema I've did a few test on this PC(AMD64 3200+), it's running EasyPHP (Apache+PHP+MySQL), and it shows me that PHP is about twice as fast then Javascript.(Tested using IE6, FF wasn't working because script took too long to execute, which generates messages on firefox, and which didn't let me finish the script) Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] newbie question about debuging
Hello, I would like to install pOWL (http://aksw.informatik.uni-leipzig.de/Projects/Powl) with ORACLE. I obey the installation steps. I log in: http://www.picvalley.net/u/26/25123_331.PNG and then then i get this error message http://www.picvalley.net/u/26/25124_335.PNG How can I find out what causes the mistake? There are several php files, however, I am not so fit in php and cannot find the error. If I use pOWL with MySQL instead of ORACLE, everything works perfectly. I think, i must change something here: http://www.nabble.com/file/7585/include.php include.php . Thanks in advance! -- View this message in context: http://www.nabble.com/newbie-question-about-debuging-tf3496894.html#a9767223 Sent from the PHP - General mailing list archive at Nabble.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] newbie question about debuging
On 3/31/07, buFka [EMAIL PROTECTED] wrote: Hello, I would like to install pOWL (http://aksw.informatik.uni-leipzig.de/Projects/Powl) with ORACLE. I obey the installation steps. I log in: http://www.picvalley.net/u/26/25123_331.PNG and then then i get this error message http://www.picvalley.net/u/26/25124_335.PNG How can I find out what causes the mistake? There are several php files, however, I am not so fit in php and cannot find the error. If I use pOWL with MySQL instead of ORACLE, everything works perfectly. I think, i must change something here: http://www.nabble.com/file/7585/include.php include.php . Thanks in advance! Something went wrong with installation i think. You should check that the database testdb exists. Tijnema -- View this message in context: http://www.nabble.com/newbie-question-about-debuging-tf3496894.html#a9767223 Sent from the PHP - General mailing list archive at Nabble.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] newbie question about debuging
The Database exists: [EMAIL PROTECTED]:~$ sqlplus SYSTEM/[EMAIL PROTECTED] SQL*Plus: Release 10.2.0.1.0 - Production on Sa Mrz 31 15:44:09 2007 Copyright (c) 1982, 2005, Oracle. All rights reserved. Verbunden mit: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production With the Partitioning, OLAP and Data Mining options SQL -- View this message in context: http://www.nabble.com/newbie-question-about-debuging-tf3496894.html#a9767365 Sent from the PHP - General mailing list archive at Nabble.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] newbie question about debuging
On 3/31/07, buFka [EMAIL PROTECTED] wrote: The Database exists: [EMAIL PROTECTED]:~$ sqlplus SYSTEM/[EMAIL PROTECTED] SQL*Plus: Release 10.2.0.1.0 - Production on Sa Mrz 31 15:44:09 2007 Copyright (c) 1982, 2005, Oracle. All rights reserved. Verbunden mit: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production With the Partitioning, OLAP and Data Mining options SQL Hmm, in your image i see Database 'testdb' not found. Followed by a link. What happens if you click on that link? I don't know anything about Oracle/pOWL, but it looks like the script can't connect to your Oracle database. Did you check if the database settings are correct? Like I said i don't know anything about Oracly, i use MySQL, but it requires a host, username, password too i think, so you should check if these are correct. Tijnema -- View this message in context: http://www.nabble.com/newbie-question-about-debuging-tf3496894.html#a9767365 Sent from the PHP - General mailing list archive at Nabble.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] newbie question about debuging
Tijnema ! wrote: Hmm, in your image i see Database 'testdb' not found. Followed by a link. What happens if you click on that link? I don't know anything about Oracle/pOWL, but it looks like the script can't connect to your Oracle database. Did you check if the database settings are correct? Like I said i don't know anything about Oracly, i use MySQL, but it requires a host, username, password too i think, so you should check if these are correct. Tijnema The click on the link is the next step - this create some tables (but for this i must change the querys first). pOWL is using the ADODB, and i have made small script, witch make connection via ADODB and execute select query (see this: http://www.nabble.com/file/7587/adodb_test_oracle_connection.php adodb_test_oracle_connection.php ). This works perfectlythe result: Array ( [0] = 1 [MODELID] = 1 [1] = http://powl.sf.net/SysOnt/0.1# [MODELURI] = http://powl.sf.net/SysOnt/0.1# [2] = [BASEURI] = ) Have someone another idea, how to solve the problem? -- View this message in context: http://www.nabble.com/newbie-question-about-debuging-tf3496894.html#a9767564 Sent from the PHP - General mailing list archive at Nabble.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Saving css state in javascript and passing to php via form submit
Tijnema ! wrote: On 3/31/07, Jochem Maas [EMAIL PROTECTED] wrote: Tijnema ! wrote: .. 'processing' JSON formatted data is a matter of running a single eval() line in javascript!?! just outputting HTML directly into a div is useful in many simple situations but it doesn't leave a whole lot of room for any real client sided application logic ... All that client side application logic can also be done in PHP. Where's the sense in learning to work with JSON, if it can be done in PHP too? PHP is a lot faster then javascript right? ok please shut up - you've completely missed the point. Tijnema Tijnema Regards, Tim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Parsing database variables
Yep, that's what I did last night right after I sent the email out... All is working good now.. THANKS! Jake -Original Message- From: Jim Lucas [mailto:[EMAIL PROTECTED] Sent: Saturday, March 31, 2007 4:15 AM To: Jake McHenry Cc: php-general@lists.php.net Subject: Re: [PHP] Parsing database variables Jake McHenry wrote: Ok, this is working good, except for one problem... I have variable $pay_rate and $pay_rate_bap ... It finds $pay_rate first and then it never finds $pay_rate_bap because it changes it to say.. 21_bap... Anyone know of anything else that may work? I have been messing around with eval, and I havn't gotten it to work even once yet... Always comes back with error at line 5 of eval'd And line 5 of the paragraph is a blank line... Line 4 is plain text... Not even a variable until line 12... Fine, just switch the order you are adding them to the two different arrays. instead of this: $find[] = '$pay_rate'; $find[] = '$pay_rate_bap'; $replace[] = $pay_rate; $replace[] = $pay_rate_bap; do this $find[] = '$pay_rate_bap'; $find[] = '$pay_rate'; $replace[] = $pay_rate_bap; $replace[] = $pay_rate; find the longer one first I guess next I will play around with preg_replace, but I'm thinking I will have the same problem as I did with str_replace... As long as the variable names have any kind of similar names Correct? I can resolve this I suppose, but the data is already in place and trying to work around it... Thanks, Jake -Original Message- From: Jim Lucas [mailto:[EMAIL PROTECTED] Sent: Friday, March 30, 2007 7:32 PM To: Jake McHenry Cc: php-general@lists.php.net Subject: Re: [PHP] Parsing database variables Jake McHenry wrote: Hi everyone, I have been searching and trying to do this for the past hour without success yet I have a database table with this in it: p$namep Period Ending Date: $ppep Etc... And in my script, these variables exist and have values. Is there a way for me to get the output from mysql_query to use the current script variables in place of the same variable name within the database output? Thanks, Jake If I read the manual correct about how to setup the input values for str_replace() you should be able to do the following. This is completely untested, since I have now system like yours. But here is goes... #setup the entries that you want to find. $find[] = '$name'; $find[] = '$ppe'; #setup the values to be replaced. #Mind you to keep the indexes the in sync with $find... $replace[] = $name; $replace[] = $ppe; echo 'pre'; while ( $row = mysql_fetch_assoc($resultHandle) ) { $row = str_replace($find, $replace, $row); // do something with $row. Display it maybe... var_dump($row); } echo '/pre'; Basically replace $find[0] with $replace[0] in any of the values of the return $row then replace the previous $row values with the newly modified values... Then go to the next index of $find[1] and $replace[1] and do the same thing until you are out of indexes. But this is a much better way of doing this than using eval(). eval is an evil little function! -- Enjoy, Jim Lucas Different eyes see different things. Different hearts beat on different strings. But there are times for you and me when all such things agree. - Rush -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.446 / Virus Database: 268.18.23/740 - Release Date: 3/30/2007 1:15 PM -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.446 / Virus Database: 268.18.23/740 - Release Date: 3/30/2007 1:15 PM -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.5.446 / Virus Database: 268.18.23/740 - Release Date: 3/30/2007 1:15 PM -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parsing database variables
Myron Turner wrote: Jake McHenry wrote: ... I would suggest writing a function in which the parameters are passed in as references. In the function itself have set a variables using the heredoc syntax, which incorporates the variables, and then return the heredoc variable. Coming from Perl, my impulse is to use a reference for the return value, but the manual says not to, that PHP is smart enough to know how to optimize itself. Perhaps someone can tell us whether the same is true for the parameters. The manual is mum on that one. same is true for the parameters. don't use references unless you need to - namely when you expect to actually change the passed in value. function set_func($var1, $var2 . . . var17) { $return_var = RETURNVAR this is $var1 and $var2. . . .; RETURNVAR ; return $return_var; } _ Myron Turner http://www.room535.org http://www.bstatzero.org http://www.mturner.org/XML_PullParser/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Alternative/Addition to using a CAPTCHA
At 4:04 PM -0400 3/30/07, Jake McHenry wrote: Tijnema John: The above link I've already done a long time ago. But check out my dot CAPTCHA here: http://sperling.com/examples/p-captcha Maybe I'm going blind.. But I don't see a circle on that page anywhere? Everywhere I click it fails.. Jake Jake: As I stated, not all browsers support alpha channel images. Unfortunately, IE 5.5 and IE 6 fails while everything else (including IE 5.2 and IE 7) passes -- just another example of why people should use a different browser than IE 5.5 and IE 6. In fact, just consider using *anything* but IE (IMO). See below screen-shots: http://www.browsercam.com/public.aspx?proj_id=336219 Everything that has a blue dot works AND everything except for IE 5.5 and IE 6 has a blue dot. 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] Re: Alternative/Addition to using a CAPTCHA
At 3:48 PM -0400 3/30/07, Jason Pruim wrote: On Mar 30, 2007, at 3:17 PM, tedd wrote: At 12:54 PM -0400 3/30/07, [EMAIL PROTECTED] wrote: Maybe I'm missing something.. if the intent is to have 'hidden' fields that a user would end up submitting but a bot wouldn't.. that wouldn't work very well. A bot could easily see the hidden fields and submit them along with whatever other data they were sending. I know that I can provide hidden text that bots can see but users can't -- as demonstrated by this: http://www.webbytedd.com/examples/offleft/ As such, I wonder if that may provide a twist to this. However, it would only exist for sighted users. I think that what Steve suggest may have some merit. I need to think of some examples. Cheers, tedd Would you be able to name a text field something really common like e-mail, place it off screen and then check to see if a certain value is in there and if not don't submit the form? I remember someone somewhere doing that. Such as prefill the that text field with [EMAIL PROTECTED] and if it has anything else reject the form? Yeah, that would be the idea -- I was just trying to fathom some really clever way to use the technique -- forgive me I'm strange that way. My brain works are different. 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] Alternative/Addition to using a CAPTCHA
On 3/31/07, tedd [EMAIL PROTECTED] wrote: At 4:04 PM -0400 3/30/07, Jake McHenry wrote: Tijnema John: The above link I've already done a long time ago. But check out my dot CAPTCHA here: http://sperling.com/examples/p-captcha Maybe I'm going blind.. But I don't see a circle on that page anywhere? Everywhere I click it fails.. Jake Jake: As I stated, not all browsers support alpha channel images. Unfortunately, IE 5.5 and IE 6 fails while everything else (including IE 5.2 and IE 7) passes -- just another example of why people should use a different browser than IE 5.5 and IE 6. In fact, just consider using *anything* but IE (IMO). See below screen-shots: http://www.browsercam.com/public.aspx?proj_id=336219 Everything that has a blue dot works AND everything except for IE 5.5 and IE 6 has a blue dot. Cheers, tedd I remember that from the Invison Board version 2.1.0 and above. They also use Alpha PNG images. But they have some kind of javascript function that fixes that, atleast that's what the comments say. I don't know how it works but you might want to take a look at it. AFAIK it is only using Javascript, so you would be able to see full source code :) Tijnema -- --- 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Alternative/Addition to using a CAPTCHA
At 3:33 PM -0400 3/30/07, [EMAIL PROTECTED] wrote: Ah ok.. that makes a bit more sense. Even still.. anyone who's going out of their way to program a bot to defeat your specific CAPTCHA mechanism will probably notice the failure in testing. Unless you made a failure behave similar to a success but put them in a situation where ultimately they still can't post messages or access anything useful. I remember reading about either 3D Studio or Maya (one of the 3D modeling programs) and their copy protection method. They, at one point, made I guess an obvious segment of code for the software pirates to 'crack' that appeared to have totally deprotected the program. It turns out that it only sort of de-protected it. They put in multiple mechanisms that were more subtle. The one I'm thinking of apparently made it so that after 250 right mouse clicks, it would render everything in lower and lower qualities of rendering. Or not render at all. OR menus stopped working or something. But it was something that wasn't obvious at all until people really started using the pirated copy for a while. Tricky bastards. I love it. hah -TG Yeah, me too! In one of my applications, I put in a self-check for size. If anyone change a single byte, the program crashed. In the old Apple days, I knew one developer who wrote a program that when it thought is was being altered initialized it's floppy -- it bit harsh I think. :-) I wrote one that when altered would continue working, but gave the wrong results. I was amused when people would contact me and complain about their pirated copy not working properly. I wrote one, didn't mass release it, but if it detected alteration, it would send me an email telling me where it was and other specifics about the user. I thought that was kind of neat, but it violated privacy issues I wasn't comfortable with. However, I could have init their hard-drive if I had wanted. I wonder what affect that technique would have on pirating software. Oh well, enough off-topic chatter. Thanks for all the review and comments. 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] Parsing database variables
Chris Boget wrote: But this is a much better way of doing this than using eval(). eval is an evil little function! eval() isn't so bad if you have absolute, total and complete control over the data you are pulling or using. it remains bad if there is another way to do the same thing. eval() is the matchete you use as the last resort when your backed into the corner by a group of hungry zombies ... unless you have a zombie problem keep your machete holstered ;-) having absolute, total and complete control over the input to eval() is the entry price for even thinking of using it. ok this is slight scare mongering but the fact remains: eval() is capable of causing you serious damage and it's also comparitively slow! But once someone else becomes involved (particularly the front end user), you are probably better off looking at alternatives. thnx, Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Alternative/Addition to using a CAPTCHA
On 3/31/07, tedd [EMAIL PROTECTED] wrote: At 3:33 PM -0400 3/30/07, [EMAIL PROTECTED] wrote: Ah ok.. that makes a bit more sense. Even still.. anyone who's going out of their way to program a bot to defeat your specific CAPTCHA mechanism will probably notice the failure in testing. Unless you made a failure behave similar to a success but put them in a situation where ultimately they still can't post messages or access anything useful. I remember reading about either 3D Studio or Maya (one of the 3D modeling programs) and their copy protection method. They, at one point, made I guess an obvious segment of code for the software pirates to 'crack' that appeared to have totally deprotected the program. It turns out that it only sort of de-protected it. They put in multiple mechanisms that were more subtle. The one I'm thinking of apparently made it so that after 250 right mouse clicks, it would render everything in lower and lower qualities of rendering. Or not render at all. OR menus stopped working or something. But it was something that wasn't obvious at all until people really started using the pirated copy for a while. Tricky bastards. I love it. hah -TG Yeah, me too! In one of my applications, I put in a self-check for size. If anyone change a single byte, the program crashed. This kind of protection is still used these days. A cracker could atleast use programs like SoftICE to temporaly change bytes. And then he only needs to find where that protection exists and break that too :) In the old Apple days, I knew one developer who wrote a program that when it thought is was being altered initialized it's floppy -- it bit harsh I think. :-) I wrote one that when altered would continue working, but gave the wrong results. I was amused when people would contact me and complain about their pirated copy not working properly. That's a good one :) I wrote one, didn't mass release it, but if it detected alteration, it would send me an email telling me where it was and other specifics about the user. I thought that was kind of neat, but it violated privacy issues I wasn't comfortable with. However, I could have init their hard-drive if I had wanted. I wonder what affect that technique would have on pirating software. Oh well, enough off-topic chatter. Thanks for all the review and comments. Cheers, tedd Yeah, privacy issues They suck.. LOL. You can only try to create programs that are unbreakable, not that send you information about the cracker. The nicest thing to do is just making applications that format ur HDD when changing a byte :) If a hacker just does a first try, then clean up the HDD :) Tijnema -- --- 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Speed of apache/php4 on windows
Hi all, i've got apache/php4 running on windows xp with good hardware configuration etc. However, the speed of execution of php pages is really slow. When testing on my local development machine it takes a few more seconds executing php files than it should normally take. How can I up the speed of execution ? is this possible ? On my hosting server its really really fast ! and I will like the same settings for my local machine as it has a very good hardware configuration and memory. cheers - Expecting? Get great news right away with email Auto-Check. Try the Yahoo! Mail Beta.
[PHP] Re: Speed of apache/php4 on windows
Few seconds more? Even a second is a lot, typically, you measure the speed of a php script in microseconds. I have PHP5+Apache running on my windows XP laptop (which is not state of the art) and it's quite fast. I believe you have an installed software on your machine that is causing this. Try to run a PHP script with nothing running in the background and see what'll happen. -- itoctopus - http://www.itoctopus.com Don Don [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi all, i've got apache/php4 running on windows xp with good hardware configuration etc. However, the speed of execution of php pages is really slow. When testing on my local development machine it takes a few more seconds executing php files than it should normally take. How can I up the speed of execution ? is this possible ? On my hosting server its really really fast ! and I will like the same settings for my local machine as it has a very good hardware configuration and memory. cheers - Expecting? Get great news right away with email Auto-Check. Try the Yahoo! Mail Beta. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Speed of apache/php4 on windows
Few seconds more? Even a second is a lot, typically, you measure the speed of a php script in microseconds. I have PHP5+Apache running on my windows XP laptop (which is not state of the art) and it's quite fast. I believe you have an installed software on your machine that is causing this. Try to run a PHP script with nothing running in the background and see what'll happen. -- itoctopus - http://www.itoctopus.com Don Don [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi all, i've got apache/php4 running on windows xp with good hardware configuration etc. However, the speed of execution of php pages is really slow. When testing on my local development machine it takes a few more seconds executing php files than it should normally take. How can I up the speed of execution ? is this possible ? On my hosting server its really really fast ! and I will like the same settings for my local machine as it has a very good hardware configuration and memory. cheers - Expecting? Get great news right away with email Auto-Check. Try the Yahoo! Mail Beta. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PDO and buffered queries
So there's no PDO experts out there, eh? :-( On Wednesday 28 March 2007 11:14 pm, Larry Garfield wrote: HI all. The PHP.net manual is somewhat unclear on this point, so I thought I'd ask here. Does PDO automatically buffer queries the way that the mysql_* extension does, in order to allow multiple result sets open at the same time? Or is that something that has to be set on the connection, and if so, is that available for all drivers? I ask because I am running into a problem with a query segfaulting on me, but only under PHP 5.1 with PDO from pecl. It ran fine in PHP 5.2.0. The only mention in the manual on this subject is: http://us2.php.net/manual/en/ref.pdo-mysql.php If this attribute is set to TRUE on a PDOStatement, the MySQL driver will use the buffered versions of the MySQL API. If you're writing portable code, you should use PDOStatement::fetchAll() instead. The sample code there suggests that nothing does buffered queries except the MySQL driver. I find no mention of that anywhere else, though, one way or another. Of course, using fetchAll(), as it suggests, means that I only get arrays, not objects. (Unless I'm misreading those docs, too.) Any PDO experts out there able to shed some light on the situation? I'm thoroughly confused at this point, and the manual is quite unclear on all of the important details I care about. :-) -- Larry GarfieldAIM: 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 -- 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] Security Best Practice: typecast?
So, after a recent thread on data filtering, I'm wondering... Is this good enough in ALL possible Unicode/charset situations: $foo_id = (int) $_POST['foo_id']; $query = insert into whatever(foo_id) values($foo_id); Or is it possible, even theoretically possible, for a sequence of: [-]?[0-9]+ to somehow run afoul of ANY charset? Perhaps more interesting, how about this: $foo = (float) $_POST['foo']; Is there any way for any PHP output from (float), even with decimal overflow/underflow in various databases, for that to go wrong? Should one be ultra-conservative and just do: $foo_sql = mysql_real_escape_string($connection); or is that just being silly? -- 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] Speed of apache/php4 on windows
On Sat, March 31, 2007 3:49 pm, Don Don wrote: Hi all, i've got apache/php4 running on windows xp with good hardware configuration etc. However, the speed of execution of php pages is really slow. When testing on my local development machine it takes a few more seconds executing php files than it should normally take. How can I up the speed of execution ? is this possible ? On my hosting server its really really fast ! and I will like the same settings for my local machine as it has a very good hardware configuration and memory. Just for fun, throw an Ubuntu disk in the box, and time your PHP scripts without Windows being in the way -- That will give you a baseline for YOUR hardware, independent of the webhosting hardware. Did you install Apache with PHP as a CGI (rather than Module)? If so, php.exe has to start up, in its own process/thread/whatever, for each page hit. This can add significant time, I believe. You can check using ?php phpinfo();? in a script and seeing if your SAPI is CGI or Module There are also a zillion things in Windows that could be running, many of which are real dogs. What does your process list show? (control-alt-del will get you to it) Presumably there are general process profiling tools on Windows, akin to valgrind/callgrind on Linux. Find one, and see if it can shed any light on the matter. -- 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] Google-Yahoo venture and PHP
I really dont see what all the fuss is about. If MS is going to have us all running on thin clients, and Google/Yahoo want to beat them to the punch, is this really going to matter who we pay? The article on digg.com http://digg.com/tech_news/Google_Yahoo_Merger_Redefines_Access simply means we will be getting our desktop as a service, and MS have the same goal. PHP will only be a small part of this if Zend decide to throw thier lot in also. Matt
Re: [PHP] newbie question about debuging
On Sat, March 31, 2007 8:53 am, Tijnema ! wrote: On 3/31/07, buFka [EMAIL PROTECTED] wrote: Hmm, in your image i see Database 'testdb' not found. Followed by a link. What happens if you click on that link? I don't know anything about Oracle/pOWL, but it looks like the script can't connect to your Oracle database. Did you check if the database settings are correct? Like I said i don't know anything about Oracly, i use MySQL, but it requires a host, username, password too i think, so you should check if these are correct. Oracle also needs environment variables which are not present in a typical PHP install. You typically need to do something not unlike: PutEnv('ORACLE_HOME=/path/to/oracle/home'); I forget the exact syntax, and there well may be other variables Oracle needs. The fancy POWL thing (whatever it is) probably has settings in its config file for these. You really should be asking the POWL folks, though, as we're just making wild guesses here... Kind of like asking an M.D. to take a look at your teeth. You need a dentist, not an M.D. -- 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] FastCGI + PHP5
On Fri, March 30, 2007 6:00 pm, Stevie wrote: Hi all. anyone using FastCGI + PHP + Apache 1.3. ? I've been trying for two days and i can't seem to configure apache with php fastcgi. i have php set with: ../configure --enable-fastcgi \ --enable-discard-path \ --enable-force-cgi-redirect \ --with-mysql=/usr/local/mysql \ --with-xml \ --with-gd \ --with-freetype-dir=/usr/lib \ --with-jpeg-dir=/usr/lib \ --with-png-dir=/usr/lib \ --with-xpm --enable-magic-quotes \ --with-pear \ --enable-gd-native-ttf \ --enable-memory-limit \ --with-zlib that seems to be ok, php is running as (cgi-fcgi). my problem is getting apache to run php cgi. anyone have any decent docs getting the config working? i guess not many people using FastCGI w/PHP because it's seems so complicated to setup. btw i have already installed the fastcgi libs and mod_fastcgi. what should an apache configure line look like when you complie php/fastcgi with it.. am i suppose to install apache first? some people say you have to install apache first but if you install apache first how will it locate the php libs? The apache first part is, I think, that you need the Apache headers and configure scripts from Apache's ./configure (and maybe make) for PHP to be able to find them. And FrontPage extensions, if you want those, first, because they change Apache headers, and PHP won't work if it isn't working with the changed headers. This is for sure with Apache and PHP as Module. Whether it's needed for FCGI is beyond my ken. As far as the Apache config lines for FCGI, I should think the Apache manual would have that laid out pretty well. http://apache.org/ They've got very very good docs there, once you figure out their organizational schema for docs, which is pretty clear. -- 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] Parsing database variables
Document in your code that the order is significant -- so you don't screw up on a year or so and re-order it more pretty. Been there. Done that. On Fri, March 30, 2007 7:00 pm, Jake McHenry wrote: Ok, this is working good, except for one problem... I have variable $pay_rate and $pay_rate_bap ... It finds $pay_rate first and then it never finds $pay_rate_bap because it changes it to say.. 21_bap... Anyone know of anything else that may work? I have been messing around with eval, and I havn't gotten it to work even once yet... Always comes back with error at line 5 of eval'd And line 5 of the paragraph is a blank line... Line 4 is plain text... Not even a variable until line 12... I guess next I will play around with preg_replace, but I'm thinking I will have the same problem as I did with str_replace... As long as the variable names have any kind of similar names Correct? I can resolve this I suppose, but the data is already in place and trying to work around it... Thanks, Jake -Original Message- From: Jim Lucas [mailto:[EMAIL PROTECTED] Sent: Friday, March 30, 2007 7:32 PM To: Jake McHenry Cc: php-general@lists.php.net Subject: Re: [PHP] Parsing database variables Jake McHenry wrote: Hi everyone, I have been searching and trying to do this for the past hour without success yet I have a database table with this in it: p$namep Period Ending Date: $ppep Etc... And in my script, these variables exist and have values. Is there a way for me to get the output from mysql_query to use the current script variables in place of the same variable name within the database output? Thanks, Jake If I read the manual correct about how to setup the input values for str_replace() you should be able to do the following. This is completely untested, since I have now system like yours. But here is goes... #setup the entries that you want to find. $find[] = '$name'; $find[] = '$ppe'; #setup the values to be replaced. #Mind you to keep the indexes the in sync with $find... $replace[] = $name; $replace[] = $ppe; echo 'pre'; while ( $row = mysql_fetch_assoc($resultHandle) ) { $row = str_replace($find, $replace, $row); // do something with $row. Display it maybe... var_dump($row); } echo '/pre'; Basically replace $find[0] with $replace[0] in any of the values of the return $row then replace the previous $row values with the newly modified values... Then go to the next index of $find[1] and $replace[1] and do the same thing until you are out of indexes. But this is a much better way of doing this than using eval(). eval is an evil little function! -- Enjoy, Jim Lucas Different eyes see different things. Different hearts beat on different strings. But there are times for you and me when all such things agree. - Rush -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.446 / Virus Database: 268.18.23/740 - Release Date: 3/30/2007 1:15 PM -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.5.446 / Virus Database: 268.18.23/740 - Release Date: 3/30/2007 1:15 PM -- 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
[PHP] Re: 0x9f54
MySQL? MSSQL? PgSQL? Tijnema It seems he wanted to insert a Chinese character with that hex value. Yes... I tried the insert with PHP, including the use of mysql_real_escape_string(), but MySQL still gave me a blank only. -- .~. Might, Courage, Vision, SINCERITY. http://www.linux-sxs.org / v \ Simplicity is Beauty! May the Force and Farce be with you! /( _ )\ (Ubuntu 6.10) Linux 2.6.20.4 ^ ^ 13:34:01 up 8 days 46 min 0 users load average: 1.04 1.01 1.00 news://news.3home.net news://news.hkpcug.org news://news.newsgroup.com.hk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Saving css state in javascript and passing to php via form submit
On Fri, March 30, 2007 9:45 am, Tim wrote: My issue is on page reload, i have a form on the same page, when a category is clicked, the categorie info displays and you can update the info through this form (table and form on same page). My issue comes when i post the data, the page comes back and my category tree folds up which is normal because all divs are set to display:none;. Just fought through something like this today... form id=styles_saver ... input type=submit onclick=save_styles(); / /form script type=text/javascript function save_styles(){ var div; var styles_saver=document.getElementById('styles_saver'); foreach(divs as d){ div = divs[d]; styles_saver.innerHTML += 'input type=hidden name=style[' + d + '] value=' + div.style ' /'; } styles_saver.submit(); /script This is all JS, obviously... What are the technologies IF there are any and what should i look up to find docs that cover this type of datatransfer ie: javascript-php. So now in the PHP part, to force this at least nominally on-topic, you have a nice array in $_POST['styles'] with an index by div in order, that you'd process like any $_POST value which is an array: if (isset($_POST['styles']) is_array($_POST['styles'])){ foreach($_POST['styles'] as $d = $style){ //do something with div's $style, indexed by $d } } You could presumably get each div's id with div.id or somesuch, and use that instead of 'd' above. -- 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] Saving css state in javascript and passing to php via form submit
On Sat, March 31, 2007 4:11 am, Tijnema ! wrote: I've did a few test on this PC(AMD64 3200+), it's running EasyPHP (Apache+PHP+MySQL), and it shows me that PHP is about twice as fast then Javascript.(Tested using IE6, FF wasn't working because script took too long to execute, which generates messages on firefox, and which didn't let me finish the script) On a LARGE and BUSY server, the question probably isn't which is faster. It's which are there more of? :-) In other words, if you have 100 $40,000 Sun servers, and you have two options: Throw some PHP on them all, to process this stuff in 0.03 seconds Throw some JS out, and let the client side process it in 0.06 seconds Note that you probably have zillions of visitors with over-powered desktop machines, for the most part. Which is going to make your overloaded servers seem faster? Not that I've ever done this, mind you, but I suspect that it's another case where a raw benchmark isn't really applicable in the Real World, for most cases where you'd even want to benchmark it. YMMV NAIAA IANAL -- 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] Saving css state in javascript and passing to php via form submit
On Fri, March 30, 2007 12:13 pm, Juergen Wind wrote: Tijnema ! wrote: You can use session within javascript too i believe. no, sessions are completely serverside, but you can use js to pass variables using the query string when sending a xmlHttpRequest. [pedantic] Actually, the cookie for a session, if it's using cookies and not trans_sid, lives on the client, and can (I think) be affected in JS. One can even store up to 4K of session data *in* the cookie, sufficiently encrypted with a 2-way encryption with the private key server-side, and achieve server-neutrality in a server farm, if one is so inclined. So it's POSSIBLE for one to architect a system wherein the session all lives on the client. If you're willing to expose your entire inner workings of your application (e.g., it's Open Source anyway, or there's just nothing worth hiding in the first place) you wouldn't NEED to encrypt the data. None of this would be useful in the context of this particular thread. [/pedantic] -- 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] tabbed navegation PHP
You've not quite caught the trick of the difference between == and = if ($page_name = 'default') does not TEST $page_name -- It changes it, and then returns the new value. So, pretty much, your $page_name will ALWAYS be 'default' after you hit this line, no matter what it started out as. When in doubt about a script, toss in some: echo $page_name; statements here and there, to see if the variables are what you think they are. This usually lets you narrow down pretty quickly where things are wrong, and then the why part is usually fairly simple. ... Though I confess I just blew half a day figuring out that: script type=text/javascrpt was not right. :-( [note spelling] Must have read that line 100 times in the course of the day, trying to figure out why the alert('hello'); right after it wasn't working. :-( Firefox, Firebug, HTMLValidator... Not one of them bothered to tell me unknown type :-( On Fri, March 30, 2007 8:05 am, Dwayne Heronimo wrote: Dear All, I have made a tabbed navegation with CSS. And if you set class=active to one of the tabs, it will then be highlighted. So I thought to make this dymamic with PHP. Using the $_GET variable I can get the page name above with something like. $page_name = $_GET['page'] ; so I can tell the class when to be active to what page. Should I use the isset function for this? I am very new to PHP but here is my try, but of course its not working: ?php if (isset ($_GET['page'])) { $page_name = $_GET['page'] ; if ($page_name = default) { $flg_page_default=1; } if ($page_name = about) { $flg_page_about=1; } } ? a ?php if(!isset($flg_page_default)) echo 'class=active'; else echo ''; ? href=index.php?page=defaultspanhome/span/a a ?php if(!isset($flg_page_about)) echo 'class=active'; else echo ''; ? href=index.php?page=defaultspanabout/span/a Of should I stick to just static html :( Dwayne -- 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] simple page not found 404 script - PHP
On Fri, March 30, 2007 8:18 am, Zoltán Németh wrote: actually I don't know what the problem is, but I would do it in a much shorter way: $pagename = $_GET['catcode']; if(file_exists($pagename)) { include $pagename; } else { include 404.php; } You really ought to be filtering the $_GET data here... http://example.com/categories.php?pagename=/etc/passwd will pretty much blindly dump out a file you should not be exposing. Also, as a matter of style: $pagename is just kinda silly... It takes a string and embeds it into a string with, err, nothing else, and so you end up with the same string, only making PHP do extra work to get there. Actually, I suppose PHP might be smart enough to optimize this away... But it looks silly, on the surface at least. -- 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] Alternative/Addition to using a CAPTCHA
On Thu, March 29, 2007 7:33 pm, John Comerford wrote: I was reading the current tread on CAPTCHA and possible cracks and I thought maybe I'd throw this out to the group to see what you think. Recently I saw a forum where in order to post you first had to click on a div that was placed at a random location on the page, it read something like, Click here if you are human. I was thinking that maybe you could put together a system that looks something like this: http://people.aapt.net.au/JComerford/ClickMe.htm I was thinking you could use it in a couple of ways: 1) As a replacement to a CAPTCHA image 2) When you click the image a CAPTCHA image is loaded into the 'Click Me' container The main problem is how to tell the server that the div has been clicked, in a way that can't be simulated. I am not an expect with either JS or PHP, but maybe some of the bigger brains out there could throw in their 2 cents.. Clicking on it in JS would be pretty trivial with webmonkey, I should think. Even if it wasn't, and you made it an image and only stored the correct pixels server-side, you're still subject to the same kind of AI Vision / OCR type of thing that a traditional CAPTCHA is subject to, really. Virtually *any* barrier you toss up will stop the brunt of the stoopid spambots. Even the Chris Shifflet method (see his blog) probably gets rid of all the junk. NO barrier will stop a dedicated human-architected attack. The better CAPTCHAs are almost as hard for humans as they are for the scripts designed to beat them -- Not really a win as they hurt usability too much. I would suggest using the method least likely to hurt your usability/accessibility, and easiest to implement. Unless you have somebody out there who is out to get you, it will work. If there IS somebody out to get you, nothing will work anyway. -- 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: Alternative/Addition to using a CAPTCHA
On Fri, March 30, 2007 11:54 am, [EMAIL PROTECTED] wrote: Maybe I'm missing something.. if the intent is to have 'hidden' fields that a user would end up submitting but a bot wouldn't.. that wouldn't work very well. A bot could easily see the hidden fields and submit them along with whatever other data they were sending. If the intention is to trick a bot into sending data a user wouldn't, then again.. doesn't work because a user is going to send the hidden fields as well. The user is going to send BLANKS for the hidden fields, since they can't fill them in. The 'bot is a stupid blind spider that will see the honeypot email field and cram in its spam there. If the 'bot-makers are savvy enough to detect hidden inputs and ignore them, then this doesn't help. It also doesn't hurt, though, as a normal users has zero accessibility or usability issues with a hidden field they are not supposed to fill in. (At least I assume a hidden field is presented to a visually-impared user in a reasonable manner...) -- 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] Gnome and MIME types
exec takes a couple optional args to get your error code and output. Use them. Then use perror on the command line to see what error code means. Or I guess you could install my perror extension, if you were bored: http://l-i-e.com/perror All that said, I'm not at all sure why you are trying to do what you are doing, so can't really guess the best way to do it. Where do the files come from? Why do you want to guess their mime type? PHP can't do much useful with a mime type of an MS Office Document anyway... Unless you are running PHP on Windows, and want to use http://php.net/com to open up the document... On Thu, March 29, 2007 2:29 pm, Nathan Ziarek wrote: I'm having a hard time getting solid MIME Types of various files. On my Ubuntu/Apache2/PHP5 system, I first attempted to install fileInfo. That didn't go so well (on Safari even running $finfo = finfo_open(FILEINFO_MIME); causes it to complain that it lost the network connection; Firefox prompts me to download the file_ and seeing as it is not really ready for release, I thought I should stay away from that. I then tried running system(file -i -m /usr/share/docs/mim file) which worked, but file doens't provide very good mime types -- all Microsoft Office Documents returned nothing, for example. I then stumbled upon gnomevfs-info that provided the information I wanted. I don't know what mime database it is using (couldn't find it) but it sure seemed more complete than anything else I had used. Problem is, I can't seem to run it from within a PHP script (system, exec, etc). I used the full path (/usr/bin/gnamevfs-info) so I don't believe that to be the problem, and the page has no errors (I am using error_reporting(E_ALL)). Any tips or suggestions? Thanks! Nate -- 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