php-general Digest 23 May 2010 20:28:19 -0000 Issue 6760
php-general Digest 23 May 2010 20:28:19 - Issue 6760 Topics (messages 305447 through 305460): Re: Multiple Login in a single PC should not be possible 305447 by: Karl DeSaulniers 305448 by: Karl DeSaulniers 305453 by: Robert Cummings 305454 by: Robert Cummings 305456 by: Nathan Rixham 305458 by: Nathan Rixham Is there a good way to extract the embed/object content in HTML with/without closing tag? 305449 by: Chian Hsieh 305457 by: Nathan Rixham Re: securing a custom app 305450 by: David Mehler 305452 by: Nilesh Govindarajan Re: Remove blank lines from a file 305451 by: tedd 305455 by: Robert Cummings 305459 by: Nathan Rixham 305460 by: Nathan Rixham Administrivia: To subscribe to the digest, e-mail: php-general-digest-subscr...@lists.php.net To unsubscribe from the digest, e-mail: php-general-digest-unsubscr...@lists.php.net To post to the list, e-mail: php-gene...@lists.php.net -- ---BeginMessage--- What about creating a java or ajax proxy that verifies the system mixed with PHP login security and cookies? Maybe mix it with some SSL?? Karl On May 22, 2010, at 10:37 PM, Karl DeSaulniers wrote: I am going to ask my flash guru buddies. Let me see if I can find anything out. Karl On May 22, 2010, at 10:10 PM, Robert Cummings wrote: Robert Cummings wrote: Karl DeSaulniers wrote: Wow. I'm going to stay away from that one. I'm just trying to help this guy secure his learning API and that would be one way to insure that two browsers were not logged in on the same system. Especially if you weren't using a browser in the first place. Have you ever programed in flash? Yes. But I prefer open source all the way :) BTW, I'm still not sure how you expect flash to solve the problem. I can just run a virtual machine with another flash instance. Seems to me like your trading cauliflower for broccoli... they're both vegetables. Cheers, Rob. -- E-Mail Disclaimer: Information contained in this message and any attached documents is considered confidential and legally protected. This message is intended solely for the addressee(s). Disclosure, copying, and distribution are prohibited unless authorized. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Karl DeSaulniers Design Drumm http://designdrumm.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Karl DeSaulniers Design Drumm http://designdrumm.com ---End Message--- ---BeginMessage--- Also, on the flash subject, I believe you can utilize the SharedObject class to achieve what they are wanting. I was told that you MUST remember to delete the SharedObject if the browser window is closed or crashes. Not sure on how this is done. Karl On May 23, 2010, at 3:59 AM, Karl DeSaulniers wrote: What about creating a java or ajax proxy that verifies the system mixed with PHP login security and cookies? Maybe mix it with some SSL?? Karl On May 22, 2010, at 10:37 PM, Karl DeSaulniers wrote: I am going to ask my flash guru buddies. Let me see if I can find anything out. Karl On May 22, 2010, at 10:10 PM, Robert Cummings wrote: Robert Cummings wrote: Karl DeSaulniers wrote: Wow. I'm going to stay away from that one. I'm just trying to help this guy secure his learning API and that would be one way to insure that two browsers were not logged in on the same system. Especially if you weren't using a browser in the first place. Have you ever programed in flash? Yes. But I prefer open source all the way :) BTW, I'm still not sure how you expect flash to solve the problem. I can just run a virtual machine with another flash instance. Seems to me like your trading cauliflower for broccoli... they're both vegetables. Cheers, Rob. -- E-Mail Disclaimer: Information contained in this message and any attached documents is considered confidential and legally protected. This message is intended solely for the addressee(s). Disclosure, copying, and distribution are prohibited unless authorized. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Karl DeSaulniers Design Drumm http://designdrumm.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Karl DeSaulniers Design Drumm http://designdrumm.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Karl DeSaulniers Design Drumm http://designdrumm.com ---End Message--- ---BeginMessage--- A virtual machine is like a separate computer, but running in the same computer. It would easily thwart this. Cheers, Rob. Karl DeSaulniers wrote: What about creating a java or ajax
Re: [PHP] securing a custom app
On Sun, May 23, 2010 at 12:40 AM, David Mehler dave.meh...@gmail.comwrote: Hello, I've got a custom app that interacts with a database. I want to use something stronger than .htaccess to protect it and ssl is not available as this is a shared host. There will be several user's accessing this app and updating the database through it. What i was thinking was giving each a unique username, password, and ID string, which would be somehow used to compute a hash and if that would match access could be granted. That's just a guess on my part, i'd appreciate any suggestions. Thanks. Dave. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php If you really, really can't get to SSL, you could develop the client-side code to use a java applet as a proxy, and the applet could handle the encryption (I've only done that once and it wasn't worth the work in the long-run, I should have just switched hosts OR clients.) You could also pull off the same effect with a FLEX application, too. And, if you really, really wanted to, you could even develop an ajax application that encrypted the traffic before sending and decrypted any incoming traffic using a hash of a nonce provided by the server and the password of the user (the server-side PHP would perform the complimentary actions.) However, this would be quite a bit of work, and I'm hoping that you can talk someone into a hosting upgrade :) For reference, here's a javascript implementation of AES I've used in the past (there's a port of the corresponding PHP to use linked on the same page): http://www.movable-type.co.uk/scripts/aes.html But, again, I hope you can just switch to a host with SSL. Adam -- Nephtali: PHP web framework that functions beautifully http://nephtaliproject.com
Re: [PHP] Multiple Login in a single PC should not be possible
What about creating a java or ajax proxy that verifies the system mixed with PHP login security and cookies? Maybe mix it with some SSL?? Karl On May 22, 2010, at 10:37 PM, Karl DeSaulniers wrote: I am going to ask my flash guru buddies. Let me see if I can find anything out. Karl On May 22, 2010, at 10:10 PM, Robert Cummings wrote: Robert Cummings wrote: Karl DeSaulniers wrote: Wow. I'm going to stay away from that one. I'm just trying to help this guy secure his learning API and that would be one way to insure that two browsers were not logged in on the same system. Especially if you weren't using a browser in the first place. Have you ever programed in flash? Yes. But I prefer open source all the way :) BTW, I'm still not sure how you expect flash to solve the problem. I can just run a virtual machine with another flash instance. Seems to me like your trading cauliflower for broccoli... they're both vegetables. Cheers, Rob. -- E-Mail Disclaimer: Information contained in this message and any attached documents is considered confidential and legally protected. This message is intended solely for the addressee(s). Disclosure, copying, and distribution are prohibited unless authorized. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Karl DeSaulniers Design Drumm http://designdrumm.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Karl DeSaulniers Design Drumm http://designdrumm.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Multiple Login in a single PC should not be possible
Also, on the flash subject, I believe you can utilize the SharedObject class to achieve what they are wanting. I was told that you MUST remember to delete the SharedObject if the browser window is closed or crashes. Not sure on how this is done. Karl On May 23, 2010, at 3:59 AM, Karl DeSaulniers wrote: What about creating a java or ajax proxy that verifies the system mixed with PHP login security and cookies? Maybe mix it with some SSL?? Karl On May 22, 2010, at 10:37 PM, Karl DeSaulniers wrote: I am going to ask my flash guru buddies. Let me see if I can find anything out. Karl On May 22, 2010, at 10:10 PM, Robert Cummings wrote: Robert Cummings wrote: Karl DeSaulniers wrote: Wow. I'm going to stay away from that one. I'm just trying to help this guy secure his learning API and that would be one way to insure that two browsers were not logged in on the same system. Especially if you weren't using a browser in the first place. Have you ever programed in flash? Yes. But I prefer open source all the way :) BTW, I'm still not sure how you expect flash to solve the problem. I can just run a virtual machine with another flash instance. Seems to me like your trading cauliflower for broccoli... they're both vegetables. Cheers, Rob. -- E-Mail Disclaimer: Information contained in this message and any attached documents is considered confidential and legally protected. This message is intended solely for the addressee(s). Disclosure, copying, and distribution are prohibited unless authorized. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Karl DeSaulniers Design Drumm http://designdrumm.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Karl DeSaulniers Design Drumm http://designdrumm.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Karl DeSaulniers Design Drumm http://designdrumm.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Is there a good way to extract the embed/object content in HTML with/without closing tag?
Hi, I want to extract all contents started with embed and object with/without closing tags. My solution is using a regular expression to get it work, but there is some exception I could not handle out. The REGEXs I used are: // With closing tag if (preg_match_all(#((object|embed)[^]+.*?/\\2)#is, $str, $matchObjs)) { // blahblah // Without closing tag } else if (preg_match_all(#((?:object|embed)[^]+)#,$str,$matchObjs)){ // blahblah } But it might be failed if the $str are mixed with/without closing tags: $str ='divdivobject type=application/x-shockwave-flashparam name=zz value=xx/object/divdivembed src=http://sample.com; //div' In this situation, it will only get the object type=application/x-shockwave-flashparam name=zz value=xx/object but I want to get the two results which are object type=application/x-shockwave-flashparam name=zz value=xx/object embed src=http://sample.com; / So, is there a good way to use one REGEX to process this issue? Thanks for your help. -- - Chi-An Hsieh
Re: [PHP] securing a custom app
Hello everyone, Thanks. I'm looking in to the ssl, I would like to use it, and it does seem much less work than the alternative. Thanks. Dave. On 5/23/10, Adam Richardson simples...@gmail.com wrote: On Sun, May 23, 2010 at 12:40 AM, David Mehler dave.meh...@gmail.comwrote: Hello, I've got a custom app that interacts with a database. I want to use something stronger than .htaccess to protect it and ssl is not available as this is a shared host. There will be several user's accessing this app and updating the database through it. What i was thinking was giving each a unique username, password, and ID string, which would be somehow used to compute a hash and if that would match access could be granted. That's just a guess on my part, i'd appreciate any suggestions. Thanks. Dave. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php If you really, really can't get to SSL, you could develop the client-side code to use a java applet as a proxy, and the applet could handle the encryption (I've only done that once and it wasn't worth the work in the long-run, I should have just switched hosts OR clients.) You could also pull off the same effect with a FLEX application, too. And, if you really, really wanted to, you could even develop an ajax application that encrypted the traffic before sending and decrypted any incoming traffic using a hash of a nonce provided by the server and the password of the user (the server-side PHP would perform the complimentary actions.) However, this would be quite a bit of work, and I'm hoping that you can talk someone into a hosting upgrade :) For reference, here's a javascript implementation of AES I've used in the past (there's a port of the corresponding PHP to use linked on the same page): http://www.movable-type.co.uk/scripts/aes.html But, again, I hope you can just switch to a host with SSL. Adam -- Nephtali: PHP web framework that functions beautifully http://nephtaliproject.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Remove blank lines from a file
At 1:02 PM -0400 5/22/10, Robert Cummings wrote: tedd wrote: If that is all (i.e., removing double linefeeds), then this will do it: $text_array = array(); $text_array = explode(\n\n, $input_text); $output_text = implode(\n,$text_array); Sorry tedd, this is broken. It doesn't solve problems with runs of greater than 2 newlines which is even in the example :) I would use the following instead which is also line break agnostic with final output in the style for your system: ?php $data = preg_replace( #[\r\n]+#, PHP_EOL, $input ); ? Cheers, Rob. Rob: It's not broken according to my given, which was If that is all (i.e., removing double linefeeds), then this will do it: My code does exactly what was stated. I did not catch there were more than two linefeeds in the OP's problem. Doing more was something I did not address. Also, the solution you provided works better this way: :-) $input = preg_replace( #[\r\n]+[[:space:]]+[\r\n]+#, \n, $input ); $input = preg_replace( #[\r\n]+#, PHP_EOL, $input ); $input = trim( $input ); 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] securing a custom app
On 05/23/2010 05:22 PM, David Mehler wrote: Hello everyone, Thanks. I'm looking in to the ssl, I would like to use it, and it does seem much less work than the alternative. Thanks. Dave. On 5/23/10, Adam Richardsonsimples...@gmail.com wrote: On Sun, May 23, 2010 at 12:40 AM, David Mehlerdave.meh...@gmail.comwrote: Hello, I've got a custom app that interacts with a database. I want to use something stronger than .htaccess to protect it and ssl is not available as this is a shared host. There will be several user's accessing this app and updating the database through it. What i was thinking was giving each a unique username, password, and ID string, which would be somehow used to compute a hash and if that would match access could be granted. That's just a guess on my part, i'd appreciate any suggestions. Thanks. Dave. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php If you really, really can't get to SSL, you could develop the client-side code to use a java applet as a proxy, and the applet could handle the encryption (I've only done that once and it wasn't worth the work in the long-run, I should have just switched hosts OR clients.) You could also pull off the same effect with a FLEX application, too. And, if you really, really wanted to, you could even develop an ajax application that encrypted the traffic before sending and decrypted any incoming traffic using a hash of a nonce provided by the server and the password of the user (the server-side PHP would perform the complimentary actions.) However, this would be quite a bit of work, and I'm hoping that you can talk someone into a hosting upgrade :) For reference, here's a javascript implementation of AES I've used in the past (there's a port of the corresponding PHP to use linked on the same page): http://www.movable-type.co.uk/scripts/aes.html But, again, I hope you can just switch to a host with SSL. Adam -- Nephtali: PHP web framework that functions beautifully http://nephtaliproject.com Ah obviously, because it is not done by PHP but managed by the server ! ;) -- Nilesh Govindarajan (निलेश गोविंदराजन) Twitter: nileshgr Facebook: nilesh.gr Website: www.itech7.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Multiple Login in a single PC should not be possible
A virtual machine is like a separate computer, but running in the same computer. It would easily thwart this. Cheers, Rob. Karl DeSaulniers wrote: What about creating a java or ajax proxy that verifies the system mixed with PHP login security and cookies? Maybe mix it with some SSL?? Karl On May 22, 2010, at 10:37 PM, Karl DeSaulniers wrote: I am going to ask my flash guru buddies. Let me see if I can find anything out. Karl On May 22, 2010, at 10:10 PM, Robert Cummings wrote: Robert Cummings wrote: Karl DeSaulniers wrote: Wow. I'm going to stay away from that one. I'm just trying to help this guy secure his learning API and that would be one way to insure that two browsers were not logged in on the same system. Especially if you weren't using a browser in the first place. Have you ever programed in flash? Yes. But I prefer open source all the way :) BTW, I'm still not sure how you expect flash to solve the problem. I can just run a virtual machine with another flash instance. Seems to me like your trading cauliflower for broccoli... they're both vegetables. Cheers, Rob. -- E-Mail Disclaimer: Information contained in this message and any attached documents is considered confidential and legally protected. This message is intended solely for the addressee(s). Disclosure, copying, and distribution are prohibited unless authorized. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Karl DeSaulniers Design Drumm http://designdrumm.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Karl DeSaulniers Design Drumm http://designdrumm.com -- E-Mail Disclaimer: Information contained in this message and any attached documents is considered confidential and legally protected. This message is intended solely for the addressee(s). Disclosure, copying, and distribution are prohibited unless authorized. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Multiple Login in a single PC should not be possible
See comment on virtual machine :) But even without a virtual machine, is this SharedObject saved in a browser determined location, or does the flash app get a say on where it wants to go. Is it shared between flash apps in same browser, or shared across all browsers on same machine. Cheers, Rob. Karl DeSaulniers wrote: Also, on the flash subject, I believe you can utilize the SharedObject class to achieve what they are wanting. I was told that you MUST remember to delete the SharedObject if the browser window is closed or crashes. Not sure on how this is done. Karl On May 23, 2010, at 3:59 AM, Karl DeSaulniers wrote: What about creating a java or ajax proxy that verifies the system mixed with PHP login security and cookies? Maybe mix it with some SSL?? Karl On May 22, 2010, at 10:37 PM, Karl DeSaulniers wrote: I am going to ask my flash guru buddies. Let me see if I can find anything out. Karl On May 22, 2010, at 10:10 PM, Robert Cummings wrote: Robert Cummings wrote: Karl DeSaulniers wrote: Wow. I'm going to stay away from that one. I'm just trying to help this guy secure his learning API and that would be one way to insure that two browsers were not logged in on the same system. Especially if you weren't using a browser in the first place. Have you ever programed in flash? Yes. But I prefer open source all the way :) BTW, I'm still not sure how you expect flash to solve the problem. I can just run a virtual machine with another flash instance. Seems to me like your trading cauliflower for broccoli... they're both vegetables. Cheers, Rob. -- E-Mail Disclaimer: Information contained in this message and any attached documents is considered confidential and legally protected. This message is intended solely for the addressee(s). Disclosure, copying, and distribution are prohibited unless authorized. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Karl DeSaulniers Design Drumm http://designdrumm.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Karl DeSaulniers Design Drumm http://designdrumm.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Karl DeSaulniers Design Drumm http://designdrumm.com -- E-Mail Disclaimer: Information contained in this message and any attached documents is considered confidential and legally protected. This message is intended solely for the addressee(s). Disclosure, copying, and distribution are prohibited unless authorized. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Remove blank lines from a file
tedd wrote: At 1:02 PM -0400 5/22/10, Robert Cummings wrote: tedd wrote: If that is all (i.e., removing double linefeeds), then this will do it: $text_array = array(); $text_array = explode(\n\n, $input_text); $output_text = implode(\n,$text_array); Sorry tedd, this is broken. It doesn't solve problems with runs of greater than 2 newlines which is even in the example :) I would use the following instead which is also line break agnostic with final output in the style for your system: ?php $data = preg_replace( #[\r\n]+#, PHP_EOL, $input ); ? Cheers, Rob. Rob: It's not broken according to my given, which was If that is all (i.e., removing double linefeeds), then this will do it: My code does exactly what was stated. Actually, his comment didn't say double line feeds... his comment said I want THIS to look like THAT. And THIS had a triple line feed and THAT completely normalized it to a single line feed. I realize you misunderstood the problem, but where I work, clients don't think a solution based on incorrect presumptions is a valid solution for a clearly defined problem :) I did not catch there were more than two linefeeds in the OP's problem. Doing more was something I did not address. Also, the solution you provided works better this way: :-) $input = preg_replace( #[\r\n]+[[:space:]]+[\r\n]+#, \n, $input ); $input = preg_replace( #[\r\n]+#, PHP_EOL, $input ); $input = trim( $input ); Doh, what's funny is I fixed it in my test script but had already pasted into my email and forgot to update that *lol*. Good catch! Cheers, Rob. -- E-Mail Disclaimer: Information contained in this message and any attached documents is considered confidential and legally protected. This message is intended solely for the addressee(s). Disclosure, copying, and distribution are prohibited unless authorized. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Multiple Login in a single PC should not be possible
Karl DeSaulniers wrote: can't be done I'm afraid, no matter how hard you look - there is *always* a way around it. only thing you can do is in certain situations ensure that whatever important 'act' is carried out is limited to a fixed person with some personally identifiable data; for instance requiring an address and passport / driving license number for airplane ticket deliver and so forth. To illustrate, before me now on my 'single' machine, I have the primary OS, and two more running in virtual box's; each one has several browsers; and to compound matters I'm hooked up to 2 different networks; and on one of those I can change IP whenever I want. Perhaps only deep packet inspection shared between the different ISPs I use and some kind of knowledge on their part between who in the household is using which machine to do what @ each certain time. Good luck though :) Nathan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Is there a good way to extract the embed/object content in HTML with/without closing tag?
Chian Hsieh wrote: Hi, I want to extract all contents started with embed and object with/without closing tags. My solution is using a regular expression to get it work, but there is some exception I could not handle out. The REGEXs I used are: // With closing tag if (preg_match_all(#((object|embed)[^]+.*?/\\2)#is, $str, $matchObjs)) { // blahblah // Without closing tag } else if (preg_match_all(#((?:object|embed)[^]+)#,$str,$matchObjs)){ // blahblah } But it might be failed if the $str are mixed with/without closing tags: $str ='divdivobject type=application/x-shockwave-flashparam name=zz value=xx/object/divdivembed src=http://sample.com; //div' In this situation, it will only get the object type=application/x-shockwave-flashparam name=zz value=xx/object but I want to get the two results which are object type=application/x-shockwave-flashparam name=zz value=xx/object embed src=http://sample.com; / So, is there a good way to use one REGEX to process this issue? If you're open to using methods other than regex; then one way to get pretty good results is to run the document through HTML Tidy, then parse it in to a DOM and query it using xpath/xquery - basically mimic the base way in which the browsers do it (and the way recommended by the HTML specs) Best, Nathan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Multiple Login in a single PC should not be possible
quick confirm: flash won't help you here (nor java, ajax, virtualisation, client side programs, ip filtering, browser detection) - it's not possible I'm afraid; best you can do is limit with personally identifiable information and trust that users won't be sharing an account which has sensitive data in it. I seem to have missed it; but why exactly don't you want a client 'logged in' multiple times (at the same time)? perhaps if you give us the root of the problem instead of how to do the solution you've chosen, we can be of more help :) Best, Nathan Robert Cummings wrote: See comment on virtual machine :) But even without a virtual machine, is this SharedObject saved in a browser determined location, or does the flash app get a say on where it wants to go. Is it shared between flash apps in same browser, or shared across all browsers on same machine. Karl DeSaulniers wrote: Also, on the flash subject, I believe you can utilize the SharedObject class to achieve what they are wanting. I was told that you MUST remember to delete the SharedObject if the browser window is closed or crashes. Not sure on how this is done. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Remove blank lines from a file
Robert Cummings wrote: tedd wrote: At 1:02 PM -0400 5/22/10, Robert Cummings wrote: tedd wrote: If that is all (i.e., removing double linefeeds), then this will do it: $text_array = array(); $text_array = explode(\n\n, $input_text); $output_text = implode(\n,$text_array); Sorry tedd, this is broken. It doesn't solve problems with runs of greater than 2 newlines which is even in the example :) I would use the following instead which is also line break agnostic with final output in the style for your system: ?php $data = preg_replace( #[\r\n]+#, PHP_EOL, $input ); ? Cheers, Rob. Rob: It's not broken according to my given, which was If that is all (i.e., removing double linefeeds), then this will do it: My code does exactly what was stated. Actually, his comment didn't say double line feeds... his comment said I want THIS to look like THAT. And THIS had a triple line feed and THAT completely normalized it to a single line feed. I realize you misunderstood the problem, but where I work, clients don't think a solution based on incorrect presumptions is a valid solution for a clearly defined problem :) I did not catch there were more than two linefeeds in the OP's problem. Doing more was something I did not address. Also, the solution you provided works better this way: :-) $input = preg_replace( #[\r\n]+[[:space:]]+[\r\n]+#, \n, $input ); $input = preg_replace( #[\r\n]+#, PHP_EOL, $input ); $input = trim( $input ); preg_replace( /(\s)\s+/im, '\\1', $input ); :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Remove blank lines from a file
Nathan Rixham wrote: Robert Cummings wrote: tedd wrote: At 1:02 PM -0400 5/22/10, Robert Cummings wrote: tedd wrote: If that is all (i.e., removing double linefeeds), then this will do it: $text_array = array(); $text_array = explode(\n\n, $input_text); $output_text = implode(\n,$text_array); Sorry tedd, this is broken. It doesn't solve problems with runs of greater than 2 newlines which is even in the example :) I would use the following instead which is also line break agnostic with final output in the style for your system: ?php $data = preg_replace( #[\r\n]+#, PHP_EOL, $input ); ? Cheers, Rob. Rob: It's not broken according to my given, which was If that is all (i.e., removing double linefeeds), then this will do it: My code does exactly what was stated. Actually, his comment didn't say double line feeds... his comment said I want THIS to look like THAT. And THIS had a triple line feed and THAT completely normalized it to a single line feed. I realize you misunderstood the problem, but where I work, clients don't think a solution based on incorrect presumptions is a valid solution for a clearly defined problem :) I did not catch there were more than two linefeeds in the OP's problem. Doing more was something I did not address. Also, the solution you provided works better this way: :-) $input = preg_replace( #[\r\n]+[[:space:]]+[\r\n]+#, \n, $input ); $input = preg_replace( #[\r\n]+#, PHP_EOL, $input ); $input = trim( $input ); preg_replace( /(\s)\s+/im, '\\1', $input ); :) ahh just read the rest of this thread.. icnase it gets a bit pedantic then here's a horizontal white space only one: preg_replace( /(\h)\h+/im, '\\1', $input ); and vertical only: preg_replace( /(\v)\v+/im, '\\1', $input ); (spot a pattern?) Best, Nathan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Remove blank lines from a file
Nathan Rixham wrote: Nathan Rixham wrote: Robert Cummings wrote: tedd wrote: At 1:02 PM -0400 5/22/10, Robert Cummings wrote: tedd wrote: If that is all (i.e., removing double linefeeds), then this will do it: $text_array = array(); $text_array = explode(\n\n, $input_text); $output_text = implode(\n,$text_array); Sorry tedd, this is broken. It doesn't solve problems with runs of greater than 2 newlines which is even in the example :) I would use the following instead which is also line break agnostic with final output in the style for your system: ?php $data = preg_replace( #[\r\n]+#, PHP_EOL, $input ); ? Cheers, Rob. Rob: It's not broken according to my given, which was If that is all (i.e., removing double linefeeds), then this will do it: My code does exactly what was stated. Actually, his comment didn't say double line feeds... his comment said I want THIS to look like THAT. And THIS had a triple line feed and THAT completely normalized it to a single line feed. I realize you misunderstood the problem, but where I work, clients don't think a solution based on incorrect presumptions is a valid solution for a clearly defined problem :) I did not catch there were more than two linefeeds in the OP's problem. Doing more was something I did not address. Also, the solution you provided works better this way: :-) $input = preg_replace( #[\r\n]+[[:space:]]+[\r\n]+#, \n, $input ); $input = preg_replace( #[\r\n]+#, PHP_EOL, $input ); $input = trim( $input ); preg_replace( /(\s)\s+/im, '\\1', $input ); :) ahh just read the rest of this thread.. icnase it gets a bit pedantic then here's a horizontal white space only one: preg_replace( /(\h)\h+/im, '\\1', $input ); and vertical only: preg_replace( /(\v)\v+/im, '\\1', $input ); (spot a pattern?) Hi Nathan, You may want to start testing your solutions. None have worked yet. Not even close :) Cheers, Rob. -- E-Mail Disclaimer: Information contained in this message and any attached documents is considered confidential and legally protected. This message is intended solely for the addressee(s). Disclosure, copying, and distribution are prohibited unless authorized. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Multiple Login in a single PC should not be possible
Hi Nathan, The problem is not mine to speak of necessarily. I was trying to help find a solution for another. But from what I understand, they have a online lesson that they dont want people to be able to log in as another user and get the answers to. Here is the their post. On May 14, 2010, at 2:18 AM, Jagdeep Singh wrote: Hi All! I am looking for a solution, I want a user to do a single Login only on a PC . E.g. If a User has logged on my website website.com in Internet explorer, then he cant login on same website in another browser like Firefox etc with same loginid or another. Can I trace MAC address of a single machine to solve this issue? Or is there a concept of GLOBAL COOKIE / Cross Browser Cookie which will work for all browsers in a single machine.. I hope You will help me out Regards Jagdeep Singh +91 9988009272 Karl DeSaulniers Design Drumm http://designdrumm.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Remove blank lines from a file
Robert Cummings wrote: Nathan Rixham wrote: Nathan Rixham wrote: Robert Cummings wrote: tedd wrote: At 1:02 PM -0400 5/22/10, Robert Cummings wrote: tedd wrote: If that is all (i.e., removing double linefeeds), then this will do it: $text_array = array(); $text_array = explode(\n\n, $input_text); $output_text = implode(\n,$text_array); Sorry tedd, this is broken. It doesn't solve problems with runs of greater than 2 newlines which is even in the example :) I would use the following instead which is also line break agnostic with final output in the style for your system: ?php $data = preg_replace( #[\r\n]+#, PHP_EOL, $input ); ? Cheers, Rob. Rob: It's not broken according to my given, which was If that is all (i.e., removing double linefeeds), then this will do it: My code does exactly what was stated. Actually, his comment didn't say double line feeds... his comment said I want THIS to look like THAT. And THIS had a triple line feed and THAT completely normalized it to a single line feed. I realize you misunderstood the problem, but where I work, clients don't think a solution based on incorrect presumptions is a valid solution for a clearly defined problem :) I did not catch there were more than two linefeeds in the OP's problem. Doing more was something I did not address. Also, the solution you provided works better this way: :-) $input = preg_replace( #[\r\n]+[[:space:]]+[\r\n]+#, \n, $input ); $input = preg_replace( #[\r\n]+#, PHP_EOL, $input ); $input = trim( $input ); preg_replace( /(\s)\s+/im, '\\1', $input ); :) ahh just read the rest of this thread.. icnase it gets a bit pedantic then here's a horizontal white space only one: preg_replace( /(\h)\h+/im, '\\1', $input ); and vertical only: preg_replace( /(\v)\v+/im, '\\1', $input ); (spot a pattern?) Hi Nathan, You may want to start testing your solutions. None have worked yet. Not even close :) filed under 'works for me' ?php $input = 'blah b asd as d asd a sd da asd d asd da'; echo preg_replace( /(\s)\s+/im, '\\1', $input ); on PHP/5.2.8 produces: blah b asd as d asd a sd da asd d asd da unless I'm completely missing the elephant in the room here! Best, Nathan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Multiple Login in a single PC should not be possible
Karl DeSaulniers wrote: Hi Nathan, The problem is not mine to speak of necessarily. I was trying to help find a solution for another. But from what I understand, they have a online lesson that they dont want people to be able to log in as another user and get the answers to. Here is the their post. On May 14, 2010, at 2:18 AM, Jagdeep Singh wrote: Hi All! I am looking for a solution, I want a user to do a single Login only on a PC . E.g. If a User has logged on my website website.com in Internet explorer, then he cant login on same website in another browser like Firefox etc with same loginid or another. Can I trace MAC address of a single machine to solve this issue? Or is there a concept of GLOBAL COOKIE / Cross Browser Cookie which will work for all browsers in a single machine.. I hope You will help me out cool; only effective way i can see is to produce a unique (one time) hash in response to every request, and submit that with the answer; that way it's unique to every interaction. And only allow the test to be taken by a specific login once (ie if they've started it, they can't start again) But doesn't effectively stop anything because they could have 2 user accounts, and all the previous matters. you can make it more difficult, can't prevent it. as far as I know anyway! Best, Nathan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Remove blank lines from a file
Nathan Rixham wrote: Robert Cummings wrote: Nathan Rixham wrote: Nathan Rixham wrote: Robert Cummings wrote: tedd wrote: At 1:02 PM -0400 5/22/10, Robert Cummings wrote: tedd wrote: If that is all (i.e., removing double linefeeds), then this will do it: $text_array = array(); $text_array = explode(\n\n, $input_text); $output_text = implode(\n,$text_array); Sorry tedd, this is broken. It doesn't solve problems with runs of greater than 2 newlines which is even in the example :) I would use the following instead which is also line break agnostic with final output in the style for your system: ?php $data = preg_replace( #[\r\n]+#, PHP_EOL, $input ); ? Cheers, Rob. Rob: It's not broken according to my given, which was If that is all (i.e., removing double linefeeds), then this will do it: My code does exactly what was stated. Actually, his comment didn't say double line feeds... his comment said I want THIS to look like THAT. And THIS had a triple line feed and THAT completely normalized it to a single line feed. I realize you misunderstood the problem, but where I work, clients don't think a solution based on incorrect presumptions is a valid solution for a clearly defined problem :) I did not catch there were more than two linefeeds in the OP's problem. Doing more was something I did not address. Also, the solution you provided works better this way: :-) $input = preg_replace( #[\r\n]+[[:space:]]+[\r\n]+#, \n, $input ); $input = preg_replace( #[\r\n]+#, PHP_EOL, $input ); $input = trim( $input ); preg_replace( /(\s)\s+/im, '\\1', $input ); :) ahh just read the rest of this thread.. icnase it gets a bit pedantic then here's a horizontal white space only one: preg_replace( /(\h)\h+/im, '\\1', $input ); and vertical only: preg_replace( /(\v)\v+/im, '\\1', $input ); (spot a pattern?) Hi Nathan, You may want to start testing your solutions. None have worked yet. Not even close :) filed under 'works for me' ?php $input = 'blah b asd as d asd a sd da asd d asd da'; echo preg_replace( /(\s)\s+/im, '\\1', $input ); on PHP/5.2.8 produces: blah b asd as d asd a sd da asd d asd da unless I'm completely missing the elephant in the room here! Doesn't appear to work on the following: $input = ' 1 2 3 4 5 6'; Additionally, your solution modifies lines that weren't asked to be modified :) I realize it potentially makes for a more succinct solution (if you ever get it to work properly in the general case) but it is not a valid solution for the requested functionality-- The OP did not ask for trimming of lines with content ;) Cheers, Rob. -- E-Mail Disclaimer: Information contained in this message and any attached documents is considered confidential and legally protected. This message is intended solely for the addressee(s). Disclosure, copying, and distribution are prohibited unless authorized. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Remove blank lines from a file
Robert Cummings wrote: Nathan Rixham wrote: Robert Cummings wrote: Nathan Rixham wrote: Nathan Rixham wrote: Robert Cummings wrote: tedd wrote: At 1:02 PM -0400 5/22/10, Robert Cummings wrote: tedd wrote: If that is all (i.e., removing double linefeeds), then this will do it: $text_array = array(); $text_array = explode(\n\n, $input_text); $output_text = implode(\n,$text_array); Sorry tedd, this is broken. It doesn't solve problems with runs of greater than 2 newlines which is even in the example :) I would use the following instead which is also line break agnostic with final output in the style for your system: ?php $data = preg_replace( #[\r\n]+#, PHP_EOL, $input ); ? Cheers, Rob. Rob: It's not broken according to my given, which was If that is all (i.e., removing double linefeeds), then this will do it: My code does exactly what was stated. Actually, his comment didn't say double line feeds... his comment said I want THIS to look like THAT. And THIS had a triple line feed and THAT completely normalized it to a single line feed. I realize you misunderstood the problem, but where I work, clients don't think a solution based on incorrect presumptions is a valid solution for a clearly defined problem :) I did not catch there were more than two linefeeds in the OP's problem. Doing more was something I did not address. Also, the solution you provided works better this way: :-) $input = preg_replace( #[\r\n]+[[:space:]]+[\r\n]+#, \n, $input ); $input = preg_replace( #[\r\n]+#, PHP_EOL, $input ); $input = trim( $input ); preg_replace( /(\s)\s+/im, '\\1', $input ); :) ahh just read the rest of this thread.. icnase it gets a bit pedantic then here's a horizontal white space only one: preg_replace( /(\h)\h+/im, '\\1', $input ); and vertical only: preg_replace( /(\v)\v+/im, '\\1', $input ); (spot a pattern?) Hi Nathan, You may want to start testing your solutions. None have worked yet. Not even close :) filed under 'works for me' ?php $input = 'blah b asd as d asd a sd da asd d asd da'; echo preg_replace( /(\s)\s+/im, '\\1', $input ); on PHP/5.2.8 produces: blah b asd as d asd a sd da asd d asd da unless I'm completely missing the elephant in the room here! Doesn't appear to work on the following: $input = ' 1 2 3 4 5 6'; Additionally, your solution modifies lines that weren't asked to be modified :) I realize it potentially makes for a more succinct solution (if you ever get it to work properly in the general case) but it is not a valid solution for the requested functionality-- The OP did not ask for trimming of lines with content ;) quote: So in the file it would look like (from the original file the user uploads that is) 1 2 3 4 5 6 but when the file is saved to the server it must look like 1 2 3 4 5 6 /quote the above produces what's required; and hence the vertical whitespace only solution included too /(\h)\h+/im what version are you on btw? not being an ass and actually am interested in where it doesn't work (as I use the code on some important sites in some apps that are open sourced) Best, Nathan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Remove blank lines from a file
Nathan Rixham wrote: Robert Cummings wrote: You may want to start testing your solutions. None have worked yet. Not even close :) filed under 'works for me' ?php $input = 'blah b asd as d asd a sd da asd d asd da'; echo preg_replace( /(\s)\s+/im, '\\1', $input ); on PHP/5.2.8 produces: blah b asd as d asd a sd da asd d asd da unless I'm completely missing the elephant in the room here! Doesn't appear to work on the following: $input = ' 1 2 3 4 5 6'; Additionally, your solution modifies lines that weren't asked to be modified :) I realize it potentially makes for a more succinct solution (if you ever get it to work properly in the general case) but it is not a valid solution for the requested functionality-- The OP did not ask for trimming of lines with content ;) quote: So in the file it would look like (from the original file the user uploads that is) 1 2 3 4 5 6 but when the file is saved to the server it must look like 1 2 3 4 5 6 /quote the above produces what's required; and hence the vertical whitespace only solution included too /(\h)\h+/im what version are you on btw? not being an ass and actually am interested in where it doesn't work (as I use the code on some important sites in some apps that are open sourced) I think I see an issue... either my client, your client, both, or the PHP list is trimming email lines. I have spaces at the end of some of the lines in my example. Let's see if a text file attachment works for this. FYI my command-line is currently running 5.2.11 Cheers, Rob -- E-Mail Disclaimer: Information contained in this message and any attached documents is considered confidential and legally protected. This message is intended solely for the addressee(s). Disclosure, copying, and distribution are prohibited unless authorized. 1 2 3 4 5 6 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Multiple Login in a single PC should not be possible
I was given a solution, or a work-around. You will have to use flash, but, you can set up a LocalConnection class that determines if the swf is being run on the same system and if it is boot one. You have the LocalConnection class send out a message to itself and if it answers itself, then there are two running. Otherwise only that one is running. Sort of hackish, but would probably do the trick. HTH Karl On May 23, 2010, at 3:35 PM, Karl DeSaulniers wrote: Hi Nathan, The problem is not mine to speak of necessarily. I was trying to help find a solution for another. But from what I understand, they have a online lesson that they dont want people to be able to log in as another user and get the answers to. Here is the their post. On May 14, 2010, at 2:18 AM, Jagdeep Singh wrote: Hi All! I am looking for a solution, I want a user to do a single Login only on a PC . E.g. If a User has logged on my website website.com in Internet explorer, then he cant login on same website in another browser like Firefox etc with same loginid or another. Can I trace MAC address of a single machine to solve this issue? Or is there a concept of GLOBAL COOKIE / Cross Browser Cookie which will work for all browsers in a single machine.. I hope You will help me out Regards Jagdeep Singh +91 9988009272 Karl DeSaulniers Design Drumm http://designdrumm.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Karl DeSaulniers Design Drumm http://designdrumm.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Multiple Login in a single PC should not be possible
You may still have trouble with virtual machines though. Karl On May 23, 2010, at 4:18 PM, Karl DeSaulniers wrote: I was given a solution, or a work-around. You will have to use flash, but, you can set up a LocalConnection class that determines if the swf is being run on the same system and if it is boot one. You have the LocalConnection class send out a message to itself and if it answers itself, then there are two running. Otherwise only that one is running. Sort of hackish, but would probably do the trick. HTH Karl On May 23, 2010, at 3:35 PM, Karl DeSaulniers wrote: Hi Nathan, The problem is not mine to speak of necessarily. I was trying to help find a solution for another. But from what I understand, they have a online lesson that they dont want people to be able to log in as another user and get the answers to. Here is the their post. On May 14, 2010, at 2:18 AM, Jagdeep Singh wrote: Hi All! I am looking for a solution, I want a user to do a single Login only on a PC . E.g. If a User has logged on my website website.com in Internet explorer, then he cant login on same website in another browser like Firefox etc with same loginid or another. Can I trace MAC address of a single machine to solve this issue? Or is there a concept of GLOBAL COOKIE / Cross Browser Cookie which will work for all browsers in a single machine.. I hope You will help me out Regards Jagdeep Singh +91 9988009272 Karl DeSaulniers Design Drumm http://designdrumm.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Karl DeSaulniers Design Drumm http://designdrumm.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Karl DeSaulniers Design Drumm http://designdrumm.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Remove blank lines from a file
Robert Cummings wrote: Nathan Rixham wrote: Robert Cummings wrote: You may want to start testing your solutions. None have worked yet. Not even close :) filed under 'works for me' ?php $input = 'blah b asd as d asd a sd da asd d asd da'; echo preg_replace( /(\s)\s+/im, '\\1', $input ); on PHP/5.2.8 produces: blah b asd as d asd a sd da asd d asd da unless I'm completely missing the elephant in the room here! Doesn't appear to work on the following: $input = ' 1 2 3 4 5 6'; Additionally, your solution modifies lines that weren't asked to be modified :) I realize it potentially makes for a more succinct solution (if you ever get it to work properly in the general case) but it is not a valid solution for the requested functionality-- The OP did not ask for trimming of lines with content ;) quote: So in the file it would look like (from the original file the user uploads that is) 1 2 3 4 5 6 but when the file is saved to the server it must look like 1 2 3 4 5 6 /quote the above produces what's required; and hence the vertical whitespace only solution included too /(\h)\h+/im what version are you on btw? not being an ass and actually am interested in where it doesn't work (as I use the code on some important sites in some apps that are open sourced) I think I see an issue... either my client, your client, both, or the PHP list is trimming email lines. I have spaces at the end of some of the lines in my example. Let's see if a text file attachment works for this. FYI my command-line is currently running 5.2.11 Yes it was client stripping out extra whitespace! thanks Rob, replicated your results: 1 2 3 4 5 6 and then 'fixed' to give what's needed: preg_replace( /(((\r|)\n)(\h*|))+/im, '\\1' , $input ); the above keeps line termination the same as in the source file; can you give it a quick check your side to ensure it works (if you don't mind)? modified one that 'cleans' the new lines: preg_replace( /((\r|)\n(\h*|))+/im, PHP_EOL , $input ); Best, Nathan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Remove blank lines from a file
Nathan Rixham wrote: Yes it was client stripping out extra whitespace! thanks Rob, replicated your results: 1 2 3 4 5 6 and then 'fixed' to give what's needed: preg_replace( /(((\r|)\n)(\h*|))+/im, '\\1' , $input ); the above keeps line termination the same as in the source file; can you give it a quick check your side to ensure it works (if you don't mind)? No, no, you missed my meaning... I don't care about line ending... I care about trailing whitespace on non-empty lines. modified one that 'cleans' the new lines: preg_replace( /((\r|)\n(\h*|))+/im, PHP_EOL , $input ); Yes, this is preferred with respect to line ending IMHO. But it still strips trailing whitesapce. Almost there... but you've also got that first blank line still hanging around which is supposed to be removed :D Cheers, Rob. -- E-Mail Disclaimer: Information contained in this message and any attached documents is considered confidential and legally protected. This message is intended solely for the addressee(s). Disclosure, copying, and distribution are prohibited unless authorized. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Remove blank lines from a file
Robert Cummings wrote: Nathan Rixham wrote: Yes it was client stripping out extra whitespace! thanks Rob, replicated your results: 1 2 3 4 5 6 and then 'fixed' to give what's needed: preg_replace( /(((\r|)\n)(\h*|))+/im, '\\1' , $input ); the above keeps line termination the same as in the source file; can you give it a quick check your side to ensure it works (if you don't mind)? No, no, you missed my meaning... I don't care about line ending... I care about trailing whitespace on non-empty lines. modified one that 'cleans' the new lines: preg_replace( /((\r|)\n(\h*|))+/im, PHP_EOL , $input ); Yes, this is preferred with respect to line ending IMHO. But it still strips trailing whitesapce. Almost there... but you've also got that first blank line still hanging around which is supposed to be removed :D lol ahh hell yeah; trim() it ;) I'm done for the night best, nathan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Multiple Login in a single PC should not be possible
I was also told that you can use Adobe Air to control this as well. Air only allows one copy per machine to run originally. Here is a link to set it to run multiple copies. You can use this to see how to set it up and figure a way to not let yours. If that is the route you take. http://www.colettas.org/?p=273 But here again, if they have a virtual machine... HTH, Karl On May 23, 2010, at 4:21 PM, Karl DeSaulniers wrote: You may still have trouble with virtual machines though. Karl On May 23, 2010, at 4:18 PM, Karl DeSaulniers wrote: I was given a solution, or a work-around. You will have to use flash, but, you can set up a LocalConnection class that determines if the swf is being run on the same system and if it is boot one. You have the LocalConnection class send out a message to itself and if it answers itself, then there are two running. Otherwise only that one is running. Sort of hackish, but would probably do the trick. HTH Karl On May 23, 2010, at 3:35 PM, Karl DeSaulniers wrote: Hi Nathan, The problem is not mine to speak of necessarily. I was trying to help find a solution for another. But from what I understand, they have a online lesson that they dont want people to be able to log in as another user and get the answers to. Here is the their post. On May 14, 2010, at 2:18 AM, Jagdeep Singh wrote: Hi All! I am looking for a solution, I want a user to do a single Login only on a PC . E.g. If a User has logged on my website website.com in Internet explorer, then he cant login on same website in another browser like Firefox etc with same loginid or another. Can I trace MAC address of a single machine to solve this issue? Or is there a concept of GLOBAL COOKIE / Cross Browser Cookie which will work for all browsers in a single machine.. I hope You will help me out Regards Jagdeep Singh +91 9988009272 Karl DeSaulniers Design Drumm http://designdrumm.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Karl DeSaulniers Design Drumm http://designdrumm.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Karl DeSaulniers Design Drumm http://designdrumm.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Karl DeSaulniers Design Drumm http://designdrumm.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Multiple Login in a single PC should not be possible
The consensus I have been getting is that there really is no way to block this type of activity, BUT you can make it difficult enough to deter most attempts. Karl On May 23, 2010, at 9:42 PM, Karl DeSaulniers wrote: I was also told that you can use Adobe Air to control this as well. Air only allows one copy per machine to run originally. Here is a link to set it to run multiple copies. You can use this to see how to set it up and figure a way to not let yours. If that is the route you take. http://www.colettas.org/?p=273 But here again, if they have a virtual machine... HTH, Karl On May 23, 2010, at 4:21 PM, Karl DeSaulniers wrote: You may still have trouble with virtual machines though. Karl On May 23, 2010, at 4:18 PM, Karl DeSaulniers wrote: I was given a solution, or a work-around. You will have to use flash, but, you can set up a LocalConnection class that determines if the swf is being run on the same system and if it is boot one. You have the LocalConnection class send out a message to itself and if it answers itself, then there are two running. Otherwise only that one is running. Sort of hackish, but would probably do the trick. HTH Karl On May 23, 2010, at 3:35 PM, Karl DeSaulniers wrote: Hi Nathan, The problem is not mine to speak of necessarily. I was trying to help find a solution for another. But from what I understand, they have a online lesson that they dont want people to be able to log in as another user and get the answers to. Here is the their post. On May 14, 2010, at 2:18 AM, Jagdeep Singh wrote: Hi All! I am looking for a solution, I want a user to do a single Login only on a PC . E.g. If a User has logged on my website website.com in Internet explorer, then he cant login on same website in another browser like Firefox etc with same loginid or another. Can I trace MAC address of a single machine to solve this issue? Or is there a concept of GLOBAL COOKIE / Cross Browser Cookie which will work for all browsers in a single machine.. I hope You will help me out Regards Jagdeep Singh +91 9988009272 Karl DeSaulniers Design Drumm http://designdrumm.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Karl DeSaulniers Design Drumm http://designdrumm.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Karl DeSaulniers Design Drumm http://designdrumm.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Karl DeSaulniers Design Drumm http://designdrumm.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Karl DeSaulniers Design Drumm http://designdrumm.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Remove blank lines from a file
Nathan Rixham wrote: Robert Cummings wrote: Nathan Rixham wrote: Yes it was client stripping out extra whitespace! thanks Rob, replicated your results: 1 2 3 4 5 6 and then 'fixed' to give what's needed: preg_replace( /(((\r|)\n)(\h*|))+/im, '\\1' , $input ); the above keeps line termination the same as in the source file; can you give it a quick check your side to ensure it works (if you don't mind)? No, no, you missed my meaning... I don't care about line ending... I care about trailing whitespace on non-empty lines. modified one that 'cleans' the new lines: preg_replace( /((\r|)\n(\h*|))+/im, PHP_EOL , $input ); Yes, this is preferred with respect to line ending IMHO. But it still strips trailing whitesapce. Almost there... but you've also got that first blank line still hanging around which is supposed to be removed :D lol ahh hell yeah; trim() it ;) I'm done for the night *rofl* Have a good night :D Cheers, Rob. -- E-Mail Disclaimer: Information contained in this message and any attached documents is considered confidential and legally protected. This message is intended solely for the addressee(s). Disclosure, copying, and distribution are prohibited unless authorized. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php