download.php

  1. 10 years ago

    Attempting to play and download voicemails now that I have fop2 running on the right machine.

    I can see a list of the vm's when I click on the envelope icons for an extension. At that point I get a screen that show Play and download icons, but neither do anything. I've read enough to recognize the issue as a likely php session issue, and when I invoke download.php directly from the browser, i get "no way".
    But, before that, I'm seeing

    [Thu Jul 24 14:49:06 2014] [error] [client 96.56.230.76] PHP Notice: Undefined offset: 1 in /var/www/html/fop2/download.php on line 116

    in my http error log, which corresponds to this line:

    list ($getid,$filename2) = preg_split("/!/",$_REQUEST['file'],2);

    Assuming that I've passed the following URL:
    ...../fop2/download.php?file=/var/spool/asterisk/default/102/INBOX/msg0000.WAV

    I'm seeing the entire $_REQUEST['file'] in $getid, and $filename2 is what is undefined. I've been searching far and wide for what the pattern "/!/" represents, the closest thing I've come to is a negative lookahead.

    So I wrote a little test program:
    $lines = file("test.out");
    $foo = array( "","" );

    foreach ($lines as $a) {
    echo "$a\n";
    $foo = preg_split("/!/",$a,2);
    echo "$foo[0] ... $foo[1] ..\n";
    }
    echo "done\n";

    And fed it these filenames:

    /var/foo/bar/test
    foo/bar/test/gooey/
    /var/www/html/fop2/foo.bar

    and it produced the same result:

    /var/foo/bar/test

    PHP Notice: Undefined index: 1 in /home/agiletel/test.php on line 8
    /var/foo/bar/test
    ... ..
    foo/bar/test/gooey/

    PHP Notice: Undefined index: 1 in /home/agiletel/test.php on line 8
    foo/bar/test/gooey/
    ... ..
    /var/www/html/fop2/foo.bar

    PHP Notice: Undefined index: 1 in /home/agiletel/test.php on line 8
    /var/www/html/fop2/foo.bar

    done

    I'm running php 5.1.6, and there doesn't seem to be any dependence on a particular version of PHP here.

    Any thoughts ? I need to get past this so I can get back to grappling with the session issue, which I think is unrelated (and not likely to be solved by this either)

    Ron

  2. admin

    25 Jul 2014 Administrator

    The download does not work unless you pass a fop2 key before the filename (as a security measure). The exclamation sign is the separator. The fop2 key is set via php sessions, so your problem could be very well related to them.

or Sign Up to reply!