Adds some various php files
This commit is contained in:
parent
e73edafc99
commit
f04ad028ae
9 changed files with 112 additions and 0 deletions
23
lib/Settings.dart
Normal file
23
lib/Settings.dart
Normal file
|
@ -0,0 +1,23 @@
|
|||
import 'package:libac_flutter/nbt/impl/CompoundTag.dart';
|
||||
|
||||
class Settings {
|
||||
static Settings? _inst = null;
|
||||
Settings._() {}
|
||||
|
||||
factory Settings() {
|
||||
if (Settings._inst != null)
|
||||
return Settings._inst!;
|
||||
else {
|
||||
Settings._inst = Settings._();
|
||||
return Settings._inst!;
|
||||
}
|
||||
}
|
||||
|
||||
static void Load(CompoundTag tag) {}
|
||||
|
||||
static CompoundTag save() {
|
||||
CompoundTag tag = CompoundTag();
|
||||
|
||||
return tag;
|
||||
}
|
||||
}
|
|
@ -16,6 +16,14 @@ class OpenSimPageState extends State<OpenSimPage> {
|
|||
backgroundColor: Constants.TITLEBAR_COLOR,
|
||||
title: Text("Zontreck.com - OpenSim Manager"),
|
||||
),
|
||||
body: Padding(
|
||||
padding: EdgeInsets.all(8),
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
import FlutterMacOS
|
||||
import Foundation
|
||||
|
||||
import shared_preferences_foundation
|
||||
|
||||
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
||||
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
|
||||
}
|
||||
|
|
32
php/Common.php
Normal file
32
php/Common.php
Normal file
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
if(defined("COMMON")) return;
|
||||
define("COMMON", 1);
|
||||
|
||||
function get_DB() {
|
||||
return mysqli_connect(DB_HOST, DB_USERNAME, DB_PASSWORD, DB_NAME);
|
||||
|
||||
|
||||
}
|
||||
|
||||
function getJsonizedInput() {
|
||||
$js = file_get_contents("php://input");
|
||||
return json_decode($js,true);
|
||||
}
|
||||
|
||||
|
||||
function rewrite_DB_conf($host, $user, $pass, $db)
|
||||
{
|
||||
$ptl = "<\?php\n"
|
||||
. "define(\"DB_HOST\", \"$host\");\n"
|
||||
. "define(\"DB_USER\", \"$user\");\n"
|
||||
. "define(\"DB_PASS\", \"$pass\");\n"
|
||||
. "define(\"DB_NAME\", \"$db\");\n"
|
||||
. "\?>";
|
||||
|
||||
file_put_contents("Database.php", $ptl);
|
||||
}
|
||||
|
||||
require("Database.php");
|
||||
|
||||
session_start();
|
||||
?>
|
8
php/Database.php
Normal file
8
php/Database.php
Normal file
|
@ -0,0 +1,8 @@
|
|||
<?php
|
||||
|
||||
define("DB_HOST", "localhost");
|
||||
define("DB_USER", "root");
|
||||
define("DB_PASS", "changeme");
|
||||
define("DB_NAME", "changeme");
|
||||
|
||||
?>
|
16
php/Login.php
Normal file
16
php/Login.php
Normal file
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
|
||||
if(!defined("COMMON"))
|
||||
require("Common.php");
|
||||
|
||||
$js = getJsonizedInput();
|
||||
|
||||
// Read login parameters
|
||||
$username = $js["username"];
|
||||
$password = $js["password"];
|
||||
|
||||
// Password is hashed
|
||||
// Compare against hash in database + : md5(salt)
|
||||
$DB = get_DB();
|
||||
|
||||
?>
|
4
php/README.md
Normal file
4
php/README.md
Normal file
|
@ -0,0 +1,4 @@
|
|||
About
|
||||
======
|
||||
|
||||
These files get copied to the API subdomain by default. This setup is intended to permit for multiple hosts.
|
17
php/SetupCheck.php
Normal file
17
php/SetupCheck.php
Normal file
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
|
||||
if(DB_NAME == "changeme" && DB_PASS == "changeme") {
|
||||
$ret = array (
|
||||
"done" => false
|
||||
);
|
||||
header("X-Zontreck-Setup-Completed", "FALSE");
|
||||
die(json_encode($ret));
|
||||
}else {
|
||||
$ret = array (
|
||||
"done" => true
|
||||
);
|
||||
header("X-Zontreck-Setup-Completed", "TRUE");
|
||||
die(json_encode($ret));
|
||||
}
|
||||
|
||||
?>
|
|
@ -38,6 +38,8 @@ dependencies:
|
|||
libac_flutter:
|
||||
hosted: https://git.zontreck.com/api/packages/AriasCreations/pub/
|
||||
version: 1.0.1
|
||||
dio: ^5.4.3+1
|
||||
shared_preferences: ^2.2.3
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
|
|
Loading…
Reference in a new issue