• PHP riddle

    From Spectre@21:3/101 to Anyone on Thursday, September 03, 2020 07:01:00
    Can anyone tell me what the fortescue is wrong with this? From the command line it appears to work just fine. Yeah all the table guff is incomplete but the links, and or the "video" seems to look ok if you run with or without any parameters.

    But she's half dead inside apache. It's not finding any of the commandline parameters just stuck in no parameter loop.

    Ta, Spec

    <?php

    $argc = count($argv);
    if($argc > 2 or $argc <2){
    $directory = "./";
    $phpfiles = glob($directory . "*.mp4");

    foreach($phpfiles as $phpfile){
    $file = basename($phpfile);
    echo "<tr><td colspan=2><center>";
    echo '<a href="test.php?'.$file.'">'.$file.'</a>';
    }

    } else {

    echo "<video controls width=320>";
    echo "<source src=\".basename($argv[1])\".mp4\"> type=\"video/mp4\">";
    echo "</video>";

    $phpfiles = glob("*.mp4");
    foreach($phpfiles as $phpfile){
    $file = basename($phpfile);
    echo "<tr><td colspan=2><center>";
    echo '<a href="test.php?'.$file.'">'.$file.'</a>';
    }
    }




    *** THE READER V4.50 [freeware]
    --- SuperBBS v1.17-3 (Eval)
    * Origin: Scrawled in haste at The Lower Planes (21:3/101)
  • From alterego@21:2/116 to Spectre on Thursday, September 03, 2020 10:59:06
    Re: PHP riddle
    By: Spectre to Anyone on Thu Sep 03 2020 07:01 am

    Howdy,

    Can anyone tell me what the fortescue is wrong with this? From the command line it appears to work just fine. Yeah all the table guff is incomplete but the links, and or the "video" seems to look ok if you run with or without any parameters.

    But she's half dead inside apache. It's not finding any of the commandline parameters just stuck in no parameter loop.

    $argc = count($argv);
    if($argc > 2 or $argc <2){

    Apache doesnt received arguments - as it invokes the script with web based enviroment variables:

    https://www.php.net/manual/en/reserved.variables.argv.php

    You probably need one of the other variables: https://www.php.net/manual/en/reserved.variables.php

    ...лоеп

    ... Nothing is true. Everything is permitted.
    --- SBBSecho 3.11-Linux
    * Origin: I'm playing with ANSI+videotex - wanna play too? (21:2/116)
  • From Spectre@21:3/101 to alterego on Thursday, September 03, 2020 23:09:00
    Apache doesnt received arguments - as it invokes the script with web
    based enviroment variables: https://www.php.net/manual/en/reserved.variables.argv.php
    You probably need one of the other variables: https://www.php.net/manual/en/reserved.variables.php

    Makes sense, I have a vague recollection of using a $GET or something similar, but for the life of me I can't recall what I used it in or how to. Thinking harder just now it might have been in the Pineapple search script... I'll have to go and have a peek at it.

    Spec


    --- SuperBBS v1.17-3 (Eval)
    * Origin: (21:3/101)
  • From Spectre@21:3/101 to alterego on Friday, September 04, 2020 16:37:00
    Apache doesnt received arguments - as it invokes the script with web based enviroment variables:

    Well you were right, and it is $_GET that holds the parameters.. in some weird assembly. I have a rough version of said script in place and functional. But it is butt ugly, and not doing any input checking, so it could get ugly, but for today its enough. :)

    Spec


    *** THE READER V4.50 [freeware]
    --- SuperBBS v1.17-3 (Eval)
    * Origin: Scrawled in haste at The Lower Planes (21:3/101)