# Websites programming problem?

Tags:
1. May 10, 2007

### ngkamsengpeter

I want to place a video conferencing script on my webpage so that my member can use it but i don't know how to program it . Can anyone teach me ? Can i program it in php ?

2. May 10, 2007

### -Job-

Video conferencing? You'll definitely need either flash or java, and you'd need to program a server or use something like the Adobe Media Server.

You definitely can't do it with PHP alone and it's not something someone would be able to teach in a couple of posts. However, your best bet is to use Flash because it has a good Camera support. The flash plugin will acquire the video data and send it to a server of yours, which broadcasts that information to other users. The Adobe Media Server supports this.

Last edited: May 10, 2007
3. May 10, 2007

### ngkamsengpeter

Do you know meebo,it can let the user chat with msn,yahoo or other IM　in their webpage,how can it do that ?

4. May 11, 2007

### raolduke

I am guessing that it logs in to each respective messenger's network and combines them into one interface .. Then again I have no idea because I've never used or even heard of "meebo". Are you using some sort of php-powered CMS for this project?

Last edited: May 11, 2007
5. May 11, 2007

### -Job-

Do you mean something like MeeboMe http://www.meebome.com/ ?
These are third party plugins so you'd just drop them on your site following the manufacturer's directions.

6. May 11, 2007

### ngkamsengpeter

I just want to learn to create my one , anyone can help ?And do anybody now how to make a textarea become a editor instance just like tinymce . I want to make my own one , don't want to use tinymce, so any tutorial on it . Please help .

7. May 11, 2007

### -Job-

I can't help you unless go do some research first and come back with some more specific questions. For Video Conferencing look into Flash. For doing something akin to TinyMCE Javascript is sufficient, but you need to have a fairly good understanding of it.

8. May 12, 2007

### ngkamsengpeter

I know a javascript and know how to do it for some of the function at the tinymce but just don't understand why a table or picture can be shown at the textarea ?How can it do that

9. May 12, 2007

### ngkamsengpeter

Another questions , how can i hide the exact link of a files from my members when they download files.
For example, the files is at www.something.com/something.zip[/url] , how can i hide it and show only something such as [url]www.something.com/download.php [Broken] when my member download that files?
Is it possible to limit the download or upload speed of my member when they download files from my websites using php.

Last edited by a moderator: Apr 22, 2017 at 5:33 PM
10. May 13, 2007

### -Job-

TinyMCE doesn't use a TextArea control. It probably uses a div which is manipulated to emulate a textarea, i.e. a div which captures keystrokes and updates its innerHTML attribute and uses an animation for the cursor.

As far as your download.php question you accomplish that by having the download.php script receive a variable, such as a file ID in the querystring, for instance: /download.php?fid=5.
The script then obtains the file (or file location) using the ID (i.e. by querying a database) and writes out the contents of the file setting the Content-Type header to the appropriate type and the Content-Disposition to "attachment; fileName=myFile.zip" for example.

For limiting download speed you may write out the file more slowly (flushing the contents to the client periodicaly). I can't think of a way to limit upload speed without using a Java applet. You might delay the processing of the upload at the server, but as far as controlling how fast the file is uploaded i can only think of a way to do it by using Java.

Last edited: May 13, 2007
11. May 13, 2007

### ngkamsengpeter

what type of content-type header ? can you give me an example ?

12. May 13, 2007

### -Job-

For example:
Code (Text):

asf: ContentType = "video/x-ms-asf"
avi: ContentType = "video/avi"
doc: ContentType = "application/msword"
zip: ContentType = "application/zip"
xls: ContentType = "application/vnd.ms-excel"
gif: ContentType = "image/gif"
jpg: ContentType = "image/jpeg"
jpeg: ContentType = "image/jpeg"
wav: ContentType = "audio/wav"
mp3: ContentType = "audio/mpeg3"
mpg: ContentType = "video/mpeg"
mpeg: ContentType = "video/mpeg"
rtf: ContentType = "application/rtf"
htm: ContentType = "text/html"
html: ContentType = "text/html"
asp: ContentType = "text/asp"

Last edited: May 13, 2007
13. May 14, 2007

### ngkamsengpeter

for the limit download speed, how to write out the file more slowly (flushing the contents to the client periodicaly),can you give a some of the sample code ?

14. May 14, 2007

### ngkamsengpeter

I know some download manager can let the user resume download .How can i disable this resume download for my sites.
And about the tinymce, a div ,ok now i understand most of it but i still don't understand some functions such as undo,redo and also how to highlight the word and format it.

15. May 15, 2007

### -Job-

You can use the Javascript to get the highlighted text. Once you click the bold button for example it can replace the highlighted text in the div with <b>highlighted text here</b>, which makes the highlighted text bold. For undoing and redoing you can keep a list of changes that are made to the text.

16. May 15, 2007

### ngkamsengpeter

17. May 15, 2007

### -Job-

When you write a file to the client, if you include the header Accept-Ranges: bytes then resume download is supported.
If you don't want to support resuming you can set it to Accept-Ranges: none.

18. May 16, 2007

### ngkamsengpeter

Can you give me some code on how to write the file to client and limit the download speed, i don't very understand it .
I am facing another problem when using ajax , i use innerHTML=responseText to update the element html code when it receive responseText using ajax . The resposeText contain the html code and also the javascript tag but the javascrip tag doesn't work on this method. It seems like the javascript doesn't exist at all.How can i do to fix this problem ?

19. May 16, 2007

### -Job-

You need to start using "http://www.php.net" [Broken]):
PHP:

<?php
function readfile_chunked($filename,$retbytes=true) {
$chunksize = 1*(1024*1024); // how many bytes per chunk$buffer = '';
$cnt =0; //$handle = fopen($filename, 'rb');$handle = fopen($filename, 'rb'); if ($handle === false) {
return false;
}
while (!feof($handle)) {$buffer = fread($handle,$chunksize);
echo $buffer; if ($retbytes) {
$cnt += strlen($buffer);
}
}
$status = fclose($handle);
if ($retbytes &&$status) {
return $cnt; // return num. bytes delivered like readfile() does. } return$status;

}
?>

After writing a chunk you can have the code sleep for x seconds, see www.php.net[/url] about the sleep function [URL="http://http://us2.php.net/manual/en/function.sleep.php"]http://http://us2.php.net/manual/en/function.sleep.php [Broken].

Also, any <script> in the html you pass to an object's innerHTML property will be ignored. To overcome this limitation whenever needed i extract the javascript code in between the <script></script> tags and call eval(extractedScriptHere). The best/easiest way to extract the code is by using Regular Expressions "http://docs.sun.com/source/816-6408-10/regexp.htm" [Broken]

Last edited by a moderator: Apr 22, 2017 at 5:37 PM
20. May 21, 2007

### ngkamsengpeter

This is my code but it don't work , it just run for once only doesn't loop.
for instance,i set the chunksize to 1 MB and the file i download is also 1 MB and then finish but the actual file size is 14 MB.This is the case when i use firefox.
When i use IE 6 , it doesn't download at all.
I see on the official php manual , it code also something like that but just use the default readfile functions .
So, What is the problem ? Is it my code wrong somewhere ?

<?php
function readfile_chunked($filename,$retbytes=true) {
$chunksize = 2*(100*100); // how many bytes per chunk$buffer = '';
$cnt =0; //$handle = fopen($filename, 'rb');$handle = fopen($filename, 'rb'); if ($handle == false) {
return false;
}
while (!feof($handle)) {$buffer = fread($handle,$chunksize);
echo $buffer; if ($retbytes) {
$cnt += strlen($buffer);
}
}
$status = fclose($handle);
if ($retbytes &&$status) {
return $cnt; // return num. bytes delivered like readfile() does. } return$status;

}

?>