telephone / LookingGlass

A user-friendly PHP Looking Glass
MIT License
1.25k stars 345 forks source link

Fatal error: Uncaught Error: Function name must be a string in /ajax.php:44 #44

Open Smir opened 7 years ago

Smir commented 7 years ago

Just installed and can't ping, traceroute or anything to do with that area. `Fatal error: Uncaught Error: Function name must be a string in /ajax.php:44 Stack trace:

0 {main}

thrown in /ajax.php on line 44 Line 44 of ajax.php reads; $output = $lg->$_GET'cmd';`

Regards

Volodya1234 commented 7 years ago

I will do this string for case:

    switch ($_GET['cmd']) {
        case "host":
            $output = $lg->host($_GET['host']);
            break;
        case "mtr":
            $output = $lg->mtr($_GET['host']);
            break;
        case "mtr6":
            $output = $lg->mtr6($_GET['host']);
            break;
        case "ping":
            $output = $lg->ping($_GET['host']);
            break;
        case "ping6":
            $output = $lg->ping6($_GET['host']);
            break;
        case "traceroute":
            $output = $lg->traceroute($_GET['host']);
            break;              
        case "traceroute6":
            $output = $lg->traceroute6($_GET['host']);
            break;
    }
Smir commented 7 years ago

Whats this for??

Volodya1234 commented 7 years ago

Not all people are programmers and sometimes come to the github to find a solution to the problem and nothing more. I wrote a simple solution to this problem.

Smir commented 7 years ago

I have no idea what you posted?

do you mean overwrite line44 with what you posted?

Volodya1234 commented 7 years ago

Yes. It is necessary to rewrite this function in line44 to the code that I wrote above.

Pulseeey commented 7 years ago

I just rewrote it to this, PHP 7 likes it now. $output = $lg->{$_GET['cmd']}$_GET['host']);

InsaneSplash commented 7 years ago

$output = $lg->{$_GET['cmd']}($_GET['host']);

There is a missing ( in @Volodya1234 's code

yavg commented 3 years ago

after i change $output = $lg->$_GET'cmd'; to $output = $lg->{$_GET['cmd']}($_GET['host']); my lg is work now.