Skip to content
Permalink
Browse files

Added force installation

  • Loading branch information...
Maxelweb committed May 5, 2018
1 parent 55d3680 commit a2e0a483634a2d040dd21ff0cecf0532a4224e0a
Showing with 34 additions and 26 deletions.
  1. +30 −25 controllers/installation.ctrl.php
  2. +4 −1 views/installation.view.php
@@ -18,6 +18,7 @@
$pass = $_POST['pass'];
$path = $_POST['path'];
$finstall = $_POST['finstall'];
$ercon = (int)$_POST['ercon'];
$essh = (int)$_POST['essh'];
@@ -39,34 +40,38 @@
echo "Starting configuration, please wait...<br>";
if($ercon)
{
$query = new SampRcon($ips, $port, $rcon);
if(!$query->connect())
die(No("Connection error. Retry.",1));
if(count($query->getCommandList()) <= 1) // if invalid, returns one element with error message
exit(No("RCON password - The RCON is invalid, please insert a valid RCON to continue. Make sure there's no <code>rcon 0</code> in your <code>server.cfg</code>. Otherwise, change it to <code>rcon 1</code> to enable remote rcon commands."));
else
Ok("RCON password - Accepted.<br>");
}
if($essh)
if($finstall)
No("[FORCE INSTALLATION] RCON and SSH controls have been skipped!<br>");
else
{
$ssh = new Net_SSH2($ips);
if (!$ssh->login($user, $pass))
exit(No('SSH access - Login incorrect. Please, retry.'));
else
{
if(trim($ssh->exec('find '.$path.'samp03svr')) != $path."samp03svr")
exit(No("SSH access - Login correct, but <u>invalid server path</u>. The path should contains the <code>samp03svr</code> execution file as well as the basic SA-MP files and folders."));
else
Ok('SSH access - Done. <br>');
}
if($ercon)
{
$query = new SampRcon($ips, $port, $rcon);
if(!$query->connect())
die(No("Connection error. Retry.",1));
if(count($query->getCommandList()) <= 1) // if invalid, returns one element with error message
exit(No("RCON password - The RCON is invalid, please insert a valid RCON to continue. Make sure there's no <code>rcon 0</code> in your <code>server.cfg</code>. Otherwise, change it to <code>rcon 1</code> to enable remote rcon commands."));
else
Ok("RCON password - Accepted.<br>");
}
if($essh)
{
$ssh = new Net_SSH2($ips);
if (!$ssh->login($user, $pass))
exit(No('SSH access - Login incorrect. Please, retry.'));
else
{
if(trim($ssh->exec('find '.$path.'samp03svr')) != $path."samp03svr")
exit(No("SSH access - Login correct, but <u>invalid server path</u>. The path should contains the <code>samp03svr</code> execution file as well as the basic SA-MP files and folders."));
else
Ok('SSH access - Done. <br>');
}
}
}
$rcon = str_replace('"', '\"', $rcon);
$pass = str_replace('"', '\"', $pass);
@@ -150,7 +155,7 @@
$lock = fopen("installed.lock", "x");
if($lock) Ok("Configuration completed! Wait..");
else die($errorPermissions);
sleep(1);
sleep(3);
location("install.php");
}
else
@@ -18,7 +18,7 @@

<form action='?a=do-magic-things' method='post' class="form-control">

<h3 class="pt-4 pb-2"><i class="fa fa-thumbtack"></i> Main configuration <span class="badge badge-danger small">REQUIRED</span></h3>
<h3 class="pt-4 pb-2"><i class="fa fa-thumbtack"></i> Main configuration <span class="badge badge-success small">REQUIRED</span></h3>
<input type='password' class='form-control' required placeholder='Choose a password' name='srcp'>
<p class="text-muted small mt-2 mb-4">Choose a Password to access the SRC. <b><code>Letters, numbers, dashes and underscores only; [4-32] characters length.</code></b></p>
<input type='text' value="<?=$ips;?>" class='form-control' required placeholder='Server IP Address (without port)' name='ips'>
@@ -41,6 +41,9 @@
<input type='password' class='form-control' placeholder='SSH Password' name='pass' id="sshPass" disabled /><br>
<input type='text' class='form-control' value="<?=$path;?>" placeholder='SSH Path/to/sa-mp/server' name='path' id="sshPath" disabled />
<p class="text-muted small my-2"><b>Warning</b>, the folder MUST end with <code>/</code>. For example: <code>samp03/</code></p>
<hr>
<input type='checkbox' name='finstall' class="custom-checkbox" id="forceInstall" value="1"> Force installation <span class="badge badge-danger">Not Recommended</span>
<p class="text-muted small my-2">Use this option to bypass SSH and RCON controls. If credentials are wrong, some features won't work. </p>
<br>
<button class='btn btn-primary' type='submit'>Submit the form <span class="fa fa-sign-in-alt"></span></button>
</form>

0 comments on commit a2e0a48

Please sign in to comment.
You can’t perform that action at this time.