Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Websites programming problem?

  1. May 10, 2007 #1
    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. jcsd
  3. May 10, 2007 #2

    -Job-

    User Avatar
    Science Advisor

    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
  4. May 10, 2007 #3
    Do you know meebo,it can let the user chat with msn,yahoo or other IM in their webpage,how can it do that ?
     
  5. May 11, 2007 #4
    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
  6. May 11, 2007 #5

    -Job-

    User Avatar
    Science Advisor

    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.
     
  7. May 11, 2007 #6
    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 .
     
  8. May 11, 2007 #7

    -Job-

    User Avatar
    Science Advisor

    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.
     
  9. May 12, 2007 #8
    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
     
  10. May 12, 2007 #9
    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 , how can i hide it and show only something such as www.something.com/download.php 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.
     
  11. May 13, 2007 #10

    -Job-

    User Avatar
    Science Advisor

    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
  12. May 13, 2007 #11
    what type of content-type header ? can you give me an example ?
     
  13. May 13, 2007 #12

    -Job-

    User Avatar
    Science Advisor

    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
  14. May 14, 2007 #13
    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 ?
     
  15. May 14, 2007 #14
    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.
     
  16. May 15, 2007 #15

    -Job-

    User Avatar
    Science Advisor

    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.
     
  17. May 15, 2007 #16
    how about disabled the resume download function ?
     
  18. May 15, 2007 #17

    -Job-

    User Avatar
    Science Advisor

    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.
     
  19. May 16, 2007 #18
    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 ?
     
  20. May 16, 2007 #19

    -Job-

    User Avatar
    Science Advisor

    You need to start using http://www.php.net. Here's some code for writing a file out in chunks (from http://us2.php.net/readfile):
    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 about the sleep function http://http://us2.php.net/manual/en/function.sleep.php.

    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
     
  21. May 21, 2007 #20
    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
    header('Content-type: application/pdf');
    header('Content-Disposition: attachment; filename="downloaded.zip"');
    readfile_chunked('test.zip');
    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;

    }

    ?>
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?