Re: [PHP] Re: Download speed limit
- Original Message - From: "Tijnema !" <[EMAIL PROTECTED]> To: "Jonathan" <[EMAIL PROTECTED]> Cc: Sent: Friday, May 18, 2007 12:07 PM Subject: Re: [PHP] Re: Download speed limit On 5/18/07, Jonathan <[EMAIL PROTECTED]> wrote: Rangel Reale wrote: > Hello! > > For my application I need to limit the speed that my application sends > data, in my case a binary file. > > I need to send the speed as a parameter, like: > > sendfile.php?speed=2 > > Would send the file at 20kb/s (forgetting about real byte counts for > this example). > > To send the file, I am doing: > > $fp=fopen($this->contentfile,"rb"); > while(!feof($fp)){ > print(fread($fp,1024*8)); > flush(); > ob_flush(); > } > fclose($fp); > > If after ob_flush I do a sleep(), I can limit the speed, but I would > like to limit at the speed of the parameter. > > Is there a way to do this? > > Thanks, > Rangel > Will this mean i can set my ?speed= Excellent! Yeah, that's nice, you limit it, but a little bit smart guy can set it to whatever he/she wants :) Tijnema Hehehe yes, but as I said in a later message, only my application will be accessing this page (hopefully), and the problem is not on the sending server (which has lots of bandwidth) but on the receiving client, where my downloading is killing all its small bandwidth. -- 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.467 / Virus Database: 269.7.0/803 - Release Date: 13/5/2007 12:17 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Download speed limit
Yes, I tried, this works, but I would like to control the send speed more, preferably via URL, as this programs will only be accessed by my desktop application, and I have full control of them. But, if there is no other way, this will be the way! - Original Message - From: "Greg Donald" <[EMAIL PROTECTED]> To: Sent: Thursday, May 17, 2007 6:55 PM Subject: Re: [PHP] Download speed limit On 5/17/07, Rangel Reale <[EMAIL PROTECTED]> wrote: Hmm that apache module isn't quite what I need, it just accepts or refuse connections based on bandwidth usage, it does not throttle the connection. Have you tried something like this? http://destiney.com/ -- 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.467 / Virus Database: 269.7.0/803 - Release Date: 13/5/2007 12:17 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Download speed limit
Hmm that apache module isn't quite what I need, it just accepts or refuse connections based on bandwidth usage, it does not throttle the connection. - Original Message - From: "Rangel Reale" <[EMAIL PROTECTED]> To: "Ovidiu Rosoiu" <[EMAIL PROTECTED]> Cc: Sent: Thursday, May 17, 2007 6:10 PM Subject: Re: [PHP] Download speed limit Yes, it seems to be bad thing, but this limit is because the big files are non-critical, but I can't let them hammer the customer's connection, using all the bandwidth. The internet connection is slow (500kbps ADSL), and they have the critical applications running on it. It is no problem my download taking 5 hours, event if the connection is broken I can continue the download after. I will look at the link you posted, thanks! But if there is a php solution for this, that would be better for my application. - Original Message - From: "Ovidiu Rosoiu" <[EMAIL PROTECTED]> To: "Rangel Reale" <[EMAIL PROTECTED]> Cc: Sent: Friday, May 18, 2007 2:34 PM Subject: Re: [PHP] Download speed limit limiting speed by using sleep in your script is a very bad idea. for a 350 MB file, with a 20 KB/s limit the script would take aprox. 5 hours. you can see how this is totally wrong. even skyrocketing the timeout, it's not a good solution. Use a web server mod for dynamic bandwidth limiting. See http://www.topology.org/src/bwshare/README.html, maybe it will help you. Rangel Reale wrote: Between 90 and 350 MB. - Original Message - From: "Jim Lucas" <[EMAIL PROTECTED]> To: "Rangel Reale" <[EMAIL PROTECTED]> Cc: Sent: Wednesday, May 16, 2007 6:41 PM Subject: Re: [PHP] Download speed limit Rangel Reale wrote: Hello! For my application I need to limit the speed that my application sends data, in my case a binary file. I need to send the speed as a parameter, like: sendfile.php?speed=2 Would send the file at 20kb/s (forgetting about real byte counts for this example). To send the file, I am doing: $fp=fopen($this->contentfile,"rb"); while(!feof($fp)){ print(fread($fp,1024*8)); flush(); ob_flush(); } fclose($fp); If after ob_flush I do a sleep(), I can limit the speed, but I would like to limit at the speed of the parameter. Is there a way to do this? Thanks, Rangel on average, how big are the files that you will be sending? -- Jim Lucas "Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them." Unknown -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.467 / Virus Database: 269.7.0/803 - Release Date: 13/5/2007 12:17 -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.467 / Virus Database: 269.7.0/803 - Release Date: 13/5/2007 12:17 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Download speed limit
Yes, it seems to be bad thing, but this limit is because the big files are non-critical, but I can't let them hammer the customer's connection, using all the bandwidth. The internet connection is slow (500kbps ADSL), and they have the critical applications running on it. It is no problem my download taking 5 hours, event if the connection is broken I can continue the download after. I will look at the link you posted, thanks! But if there is a php solution for this, that would be better for my application. - Original Message - From: "Ovidiu Rosoiu" <[EMAIL PROTECTED]> To: "Rangel Reale" <[EMAIL PROTECTED]> Cc: Sent: Friday, May 18, 2007 2:34 PM Subject: Re: [PHP] Download speed limit limiting speed by using sleep in your script is a very bad idea. for a 350 MB file, with a 20 KB/s limit the script would take aprox. 5 hours. you can see how this is totally wrong. even skyrocketing the timeout, it's not a good solution. Use a web server mod for dynamic bandwidth limiting. See http://www.topology.org/src/bwshare/README.html, maybe it will help you. Rangel Reale wrote: Between 90 and 350 MB. - Original Message ----- From: "Jim Lucas" <[EMAIL PROTECTED]> To: "Rangel Reale" <[EMAIL PROTECTED]> Cc: Sent: Wednesday, May 16, 2007 6:41 PM Subject: Re: [PHP] Download speed limit Rangel Reale wrote: Hello! For my application I need to limit the speed that my application sends data, in my case a binary file. I need to send the speed as a parameter, like: sendfile.php?speed=2 Would send the file at 20kb/s (forgetting about real byte counts for this example). To send the file, I am doing: $fp=fopen($this->contentfile,"rb"); while(!feof($fp)){ print(fread($fp,1024*8)); flush(); ob_flush(); } fclose($fp); If after ob_flush I do a sleep(), I can limit the speed, but I would like to limit at the speed of the parameter. Is there a way to do this? Thanks, Rangel on average, how big are the files that you will be sending? -- Jim Lucas "Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them." Unknown -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.467 / Virus Database: 269.7.0/803 - Release Date: 13/5/2007 12:17 -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.467 / Virus Database: 269.7.0/803 - Release Date: 13/5/2007 12:17 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Download speed limit
Between 90 and 350 MB. - Original Message - From: "Jim Lucas" <[EMAIL PROTECTED]> To: "Rangel Reale" <[EMAIL PROTECTED]> Cc: Sent: Wednesday, May 16, 2007 6:41 PM Subject: Re: [PHP] Download speed limit Rangel Reale wrote: Hello! For my application I need to limit the speed that my application sends data, in my case a binary file. I need to send the speed as a parameter, like: sendfile.php?speed=2 Would send the file at 20kb/s (forgetting about real byte counts for this example). To send the file, I am doing: $fp=fopen($this->contentfile,"rb"); while(!feof($fp)){ print(fread($fp,1024*8)); flush(); ob_flush(); } fclose($fp); If after ob_flush I do a sleep(), I can limit the speed, but I would like to limit at the speed of the parameter. Is there a way to do this? Thanks, Rangel on average, how big are the files that you will be sending? -- Jim Lucas "Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them." Unknown -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.467 / Virus Database: 269.7.0/803 - Release Date: 13/5/2007 12:17 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Download speed limit
Hello! For my application I need to limit the speed that my application sends data, in my case a binary file. I need to send the speed as a parameter, like: sendfile.php?speed=2 Would send the file at 20kb/s (forgetting about real byte counts for this example). To send the file, I am doing: $fp=fopen($this->contentfile,"rb"); while(!feof($fp)){ print(fread($fp,1024*8)); flush(); ob_flush(); } fclose($fp); If after ob_flush I do a sleep(), I can limit the speed, but I would like to limit at the speed of the parameter. Is there a way to do this? Thanks, Rangel
Re: [PHP] What is the best way to protect the PHP page thatreturns the AJAX data?
That was only an example, the question is, how do I protect possibly sensitive data sent by AJAX, so one user can't access other user's data? Is the anwser just "don't do this with AJAX"? - Original Message - From: "Robert Cummings" <[EMAIL PROTECTED]> To: "Rangel Reale" <[EMAIL PROTECTED]> Cc: Sent: Friday, May 11, 2007 10:13 AM Subject: Re: [PHP] What is the best way to protect the PHP page thatreturns the AJAX data? On Fri, 2007-05-11 at 09:01 -0300, Rangel Reale wrote: I would also like to know how people are dealing with this, how to you make sure people don't steal your data, sometimes it can be something simple like state names, but sometimes it can be your entire user/email database, who knows? State names and your entire user list are two different issues. State names are almost certainly shown completely due to the need for state selector lists. But I can't see any reason why you would have your entire user list available. Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- Internal Virus Database is out-of-date. Checked by AVG Free Edition. Version: 7.5.467 / Virus Database: 269.6.1/776 - Release Date: 25/4/2007 12:19 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What is the best way to protect the PHP page that returns the AJAX data?
I would also like to know how people are dealing with this, how to you make sure people don't steal your data, sometimes it can be something simple like state names, but sometimes it can be your entire user/email database, who knows? And OF COURSE he is not passing a query on the url, a dumb user like this wouldn't know how to enter a mailing list :P Thanks, Rangel - Original Message - From: "Daevid Vincent" <[EMAIL PROTECTED]> To: Sent: Friday, May 11, 2007 12:18 AM Subject: [PHP] What is the best way to protect the PHP page that returns the AJAX data? Like most sites, someone needs to join up to use mine. I'm using a wee-bit-o-AJAX to pull some results from a database and display them dynamically. For the AJAX to work, it has to hit a script that's accessible from the htdocs tree right? Effectively it's just a (JavaScript initiated) GET URL request correct? For example, index.html calls http://example.com/gimmedata.php?query=foo That in turn returns a JS formatted array which is eval() in JS and rendered on the page. (over simplified I know) My question is, how do you protect gimmedata.php since it's sitting out there sans normal web headers and stuff? Can it include session_start() and do all that wonderful checking to make sure the user is logged in before just happily doling out my precious data? What is the proper, secure, sanctioned and AJAX/PHP blessed way to do this? I could set up a test environment and hack up something I'm sure -- and probably will if I get too impatient, but nobody seems to address this issue in any examples, they just do it as if information is *gasp* free. I'm a PHP guru, but I am also an AJAX novice. From what I gather, the return is really in XML transport format and all the magic of converting to/from XML is transparent to me. I worry that putting other headers or whatever may "corrupt" that? -- 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.467 / Virus Database: 269.6.4/790 - Release Date: 5/5/2007 10:34 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Ajax?
JavaScript (and AJAX) took the fun out of programming. Before AJAX, programming for web was easy and fast. Now its the oposite. - Original Message - From: "jekillen" <[EMAIL PROTECTED]> To: "Emil Edeholt" <[EMAIL PROTECTED]> Cc: "PHP List" Sent: Wednesday, May 09, 2007 10:03 PM Subject: Re: [PHP] Ajax? On May 9, 2007, at 8:04 AM, Emil Edeholt wrote: Hi! What do you guys use to develop ajax applications and do you have any good articles on the subject? I've just about finished an ajaxish site but it wasn't fun. A lot of nesting javascript inside php calls, having to write the logic both in javascript and php and so on. The source looks ugly and was time consuming to debug. Thanks! Anything involving javascript development has several built in debugging facilities 1: Alert dialogs: You may find it a chore to learn how to use them effectively. But the current content of any variable can be displayed with an alert dialog. You have to pay attention to how strings are concatenated; with +, The actual variable name cannot be quoted. 2: Browser error reporting, in Netscape species, javascript console. Take a hint, all source code text should be formated for Unix/Linux ( line feed line endings) If you do scripting on a Classic Mac OS <= OS9, the line endings are carriage; and Windows uses both carriage return and line feed. return. You will drive your self crazy cussing the console because it will not refer to lines containing syntax errors, but some disrelated lines. 3. View source window in browser to see exactly what the browser is getting on page load. 4. Forms: I have coded special forms just for the sake of development and debug of javascript apps. All globals are visible through out the script, WITH THE EXCEPTION OF SOME THAT ARE DEFINED IN SOURCED JS FILES; Opening a javascript window is in a function does not seem to register if the function is in a sourced file. 5. Patience, patience, patience, some masochism, Several large available paper back text books. No one will describe all you might need to know about issues like rollovers, DHTML, etc, Imagination and ingenuity, or the will to search and sift through others source code until you find what you are looking for, and then making it work for you. That's it, I have some suggestion that there are systems available for javascript but I have done without long enough to have my methods and approaches. One more thing, php and javascript work very well together. I have even written a function to display php variable values as javascript alert dialogs. It will not function as break points for php like it does with javascript, but at least you do not have to decipher php error smeared all over the screen. And Ajax, even though I have not cracked that particular aspect of javascript as yet, looks very worthwhile. Jeff K -- 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.467 / Virus Database: 269.6.4/790 - Release Date: 5/5/2007 10:34 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP 6: Mysql with iso-8859-1 chars outputting utf-8: "Could not convert binary string to Unicode string"
You are right, I really don't know Unicode very much! :P What I was trying to understand was, because unicode.runtime_encoding = iso-8859-1, I tought that all internal operations were done in this encoding, and only when outputting (unicode.output_encoding = utf-8) data would be converted to utf-8. So to me, I did a mysql query with latin1, data comes to my variables as iso-8859-1, I use them, and only when I echo'ed them, they would become utf-8, from a iso-8859-1-to-utf-8-like function. The strange thing to me, is the mysql_fetch_assoc function give this error even before I accessed the field values, as I understanded from the above explanation. Did I understood it wrong? Thanks, Rangel - Original Message - From: "Richard Lynch" <[EMAIL PROTECTED]> To: "Rangel Reale" <[EMAIL PROTECTED]> Cc: Sent: Wednesday, May 02, 2007 6:53 PM Subject: Re: [PHP] PHP 6: Mysql with iso-8859-1 chars outputting utf-8: "Could not convert binary string to Unicode string" This is a question from a guy who does NOT really do Unicode very well... If everything else in your entire system is iso-8859-1 (aka Latin1) why are you making your output be utf-8? Seems to me that that is where the conversion is probably taking place... On Sun, April 29, 2007 11:07 am, Rangel Reale wrote: Hello! I have a MySQL database where all tables are in the latin1 character set, with accented (Portuguese) characters. In my php.ini I have ; Unicode settings ; unicode.semantics = on unicode.runtime_encoding = iso-8859-1 unicode.script_encoding = iso-8859-1 unicode.output_encoding = utf-8 unicode.from_error_mode = U_INVALID_SUBSTITUTE unicode.from_error_subst_char = 3f unicode.fallback_encoding = iso-8859-1 because all my files and data in mysql server are in iso-8859-1. When connecting to mysql I issue: mysql_query('set names latin1', $this->mysql_link); but when I do query in any record that have accented characters I get this warning (using mysql_fetch_assoc): -- Could not convert binary string to Unicode string (converter UTF-8 failed on bytes (0xE7) at offset 9) -- for all accented characters in all fields. If I changed the set names query to: mysql_query('set names utf8', $this->mysql_link); it works, but I would like to keep compatibility with PHP 5, and for my application it requires set names to be latin1. Also, my databases are not created with the "utf8" option. As I understood PHP 6's unicode support, all string characters (including mysql result values) are converted from unicode.runtime_encoding to unicode (utf-16), but looks like it is trying to convert from ASCII, which does not have all the accented characters. Am I assuming right? How to make mysql_fetch_assoc assume field values are in iso-8859-1 instead of ASCII? Thanks, Rangel Reale -- 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? -- Internal Virus Database is out-of-date. Checked by AVG Free Edition. Version: 7.5.463 / Virus Database: 269.6.1/776 - Release Date: 25/4/2007 12:19 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP 6: Mysql with iso-8859-1 chars outputting utf-8: "Could not convert binary string to Unicode string"
Hello! I have a MySQL database where all tables are in the latin1 character set, with accented (Portuguese) characters. In my php.ini I have ; Unicode settings ; unicode.semantics = on unicode.runtime_encoding = iso-8859-1 unicode.script_encoding = iso-8859-1 unicode.output_encoding = utf-8 unicode.from_error_mode = U_INVALID_SUBSTITUTE unicode.from_error_subst_char = 3f unicode.fallback_encoding = iso-8859-1 because all my files and data in mysql server are in iso-8859-1. When connecting to mysql I issue: mysql_query('set names latin1', $this->mysql_link); but when I do query in any record that have accented characters I get this warning (using mysql_fetch_assoc): -- Could not convert binary string to Unicode string (converter UTF-8 failed on bytes (0xE7) at offset 9) -- for all accented characters in all fields. If I changed the set names query to: mysql_query('set names utf8', $this->mysql_link); it works, but I would like to keep compatibility with PHP 5, and for my application it requires set names to be latin1. Also, my databases are not created with the "utf8" option. As I understood PHP 6's unicode support, all string characters (including mysql result values) are converted from unicode.runtime_encoding to unicode (utf-16), but looks like it is trying to convert from ASCII, which does not have all the accented characters. Am I assuming right? How to make mysql_fetch_assoc assume field values are in iso-8859-1 instead of ASCII? Thanks, Rangel Reale