• PHP riddle

    From Spectre@21:3/101 to Anyone on Thu Sep 3 11:01:00 2020
    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 Thu Sep 3 14:59:06 2020
    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 Fri Sep 4 03:09:00 2020
    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 Fri Sep 4 20:37:00 2020
    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)