public static function getStartables() { if (is_null(self::$startables) || !is_array(self::$startables)) { self::$startables = array(); QueryBuilder::create(SQL::getConnection())->withQuery("SELECT id, display_name, folder_name, executable FROM websites")->build()->forEachResult(function ($row) { self::$startables[] = new Startables($row['id'], $row['display_name'], $row['folder_name'], $row['executable']); }); if (count(self::$startables) == 0) { throw new Exception("lol"); } } return self::$startables; }
<?php include_once "SQL.php"; if (!isset($_GET['username'], $_GET['token'])) { header('Location: index.php'); exit; } $myUsername = $_GET['username']; $mailToken = $_GET['token']; $action = "reset_password.php?token={$mailToken}&username={$myUsername}"; if (isset($_POST['newPassword'], $_POST['confirmPassword'])) { if ($_POST['newPassword'] !== $_POST['confirmPassword']) { header("Location: {$action}"); exit; } $sql = SQL::getConnection(); $saltedPassword = $myUsername . strlen($myUsername) . $_POST['newPassword']; $hashedPassword = hash("sha512", $saltedPassword); $sql->query("UPDATE accounts SET password = '******', token = NULL WHERE token = '{$mailToken}' AND username = '******'"); if ($sql->affected_rows == 1) { echo 'Password successfully reset!'; } else { echo 'Invalid token.'; } } ?> <style type="text/css"> .shit { width: 300px; text-align: center; background-color: #CCC;
<?php ini_set('display_errors', 'On'); spl_autoload_register(function ($className) { // Normal PHP path $path = $_SERVER['DOCUMENT_ROOT'] . "/php/" . $className . ".php"; if (file_exists($path)) { /** @noinspection PhpIncludeInspection */ include_once $path; } }); if (!Security::hasPermission()) { echo ":("; die; } SQL::getConnection();
if ($webId == "-1") { // Update all foreach (Website::getAllWebsites() as $site) { echoSite($site); } } else { // Update single site QueryBuilder::create(SQL::getConnection())->withQuery("SELECT display_name, folder_name FROM websites WHERE id = ?")->withParam($webId, QueryBuilder::PARAM_TYPE_INT)->build()->forEachResult(function ($row) { $site = new Website(0, $row['display_name'], $row['folder_name']); echoSite($site); }); } } else { function echoStart(Startables $starter) { echo $starter->getName() . ":\r\n"; echo $starter->start() . "\r\n"; } $webId = $_GET['start-id']; /*if ($webId == "-1") { // Update all foreach (Website::getAllWebsites() as $site) { echoSite($site); } } else {*/ // Update single site QueryBuilder::create(SQL::getConnection())->withQuery("SELECT display_name, folder_name, executable FROM websites WHERE id = ?")->withParam($webId, QueryBuilder::PARAM_TYPE_INT)->build()->forEachResult(function ($row) { $starter = new Startables(0, $row['display_name'], $row['folder_name']); echoStart($starter); }); }