[help] Execute LUA via PHP?

This is what I got going on, I believe it is quite complicated.
I am using @Slluxx 's Webmanager v2 script.

I am currently trying to figure out if there is a way I can use his existing ban/kick commands, and instead of having them use the default clientkick and ban commands, can I implement es_admin2s commands on there. Website and Server are both being hosted on the same VPS. Any ideas? Has anyone done this before, executing .lua scripts from .php? Is it possible?

you could just make a custom rcon command, which bans a player the way es_admin does. eg write the steamid in the same file or so. and then you just into the sourcecode of my site and change “tempbanclient” to your rcon command.

thats the thing, es_admin2 rcon ban command is nonexistant, or at least broken. I can only ban players in my game via GUI menu.

Then you make one…

Alright, thanks gentlemen.

its also not hard to make a ban plugin yourself.
you just need a list with steamids and check every player joining.

As of now, I’m likely going to use

document.getElementById("modal_steam_fivem").value = identifiers_org;

and have it post to bans.txt within the es_admin2

1 Like

You can use this cool class for rcon protocol.

https://pastebin.com/2kXSKhZE

here’s what my php looks like for my AJAX POST. You’ll have to code the form yourself :slight_smile:

<?php
$server = array("0","Dev Server","ph.dedi.host.org","30120","rconpassword");
require("rcon/q3query.class.php");
$q3 = new q3query($server['2'], $server['3'], $s);
if (!$s) {
	die ("Rcon connection failed.");
}
$q3->setRconpassword($server['4']);
if(isset($_POST['action'])){
	$action = $_POST['action'];
	if ($action == 'restart') {
		if (isset($_POST['resource'])){
			$resource = $_POST['resource'];
			$q3->rcon("restart $resource");
			die();
		}
	}  elseif ($action == 'kick') {
		$q3->rcon("clientkick $user_id $kickmessage");
		die();
	} elseif ($action == 'msg') {
		if (isset($_POST['target'])) {
			$target = $_POST['target'];
			if(isset($_POST['msg'])){
				$msg = $_POST['msg'];
				$q3->rcon("term $target $msg");
				die();
			}
		}
	}
}
?>

You’ll notice I also have custom RCON commands - which I’ve simply added to the default RCON resource.

Rightousness, Thanks!