adding first code
This commit is contained in:
29
apache-conf/000-default.conf
Normal file
29
apache-conf/000-default.conf
Normal file
@@ -0,0 +1,29 @@
|
||||
<VirtualHost *:80>
|
||||
# The ServerName directive sets the request scheme, hostname and port that
|
||||
# the server uses to identify itself. This is used when creating
|
||||
# redirection URLs. In the context of virtual hosts, the ServerName
|
||||
# specifies what hostname must appear in the request's Host: header to
|
||||
# match this virtual host. For the default virtual host (this file) this
|
||||
# value is not decisive as it is used as a last resort host regardless.
|
||||
# However, you must set it for any further virtual host explicitly.
|
||||
#ServerName www.example.com
|
||||
|
||||
ServerAdmin webmaster@localhost
|
||||
DocumentRoot /var/www/html
|
||||
|
||||
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
|
||||
# error, crit, alert, emerg.
|
||||
# It is also possible to configure the loglevel for particular
|
||||
# modules, e.g.
|
||||
#LogLevel info ssl:warn
|
||||
|
||||
ErrorLog ${APACHE_LOG_DIR}/error.log
|
||||
CustomLog ${APACHE_LOG_DIR}/access.log combined
|
||||
|
||||
# For most configuration files from conf-available/, which are
|
||||
# enabled or disabled at a global level, it is possible to
|
||||
# include a line for only one particular virtual host. For example the
|
||||
# following line enables the CGI configuration for this host only
|
||||
# after it has been globally disabled with "a2disconf".
|
||||
#Include conf-available/serve-cgi-bin.conf
|
||||
</VirtualHost>
|
||||
3
install.md
Normal file
3
install.md
Normal file
@@ -0,0 +1,3 @@
|
||||
1) git clone
|
||||
2) install docker
|
||||
3) docker volume create --name=sys0-db
|
||||
3
install.sh
Executable file
3
install.sh
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
chmod 777 sys0-code/log
|
||||
docker volume create sys0-db
|
||||
1975
php-conf/php.ini
Normal file
1975
php-conf/php.ini
Normal file
File diff suppressed because it is too large
Load Diff
16
srv_dockerfile
Normal file
16
srv_dockerfile
Normal file
@@ -0,0 +1,16 @@
|
||||
# Extend the official PHP image
|
||||
FROM php:apache
|
||||
|
||||
# Install the mysqli extension
|
||||
RUN docker-php-ext-install mysqli
|
||||
#RUN a2enmod ssl
|
||||
RUN service apache2 restart
|
||||
#COPY ./cyberhex-code /var/www/html
|
||||
#RUN mkdir -p /var/www/html/install/
|
||||
#RUN mkdir -p /var/www/html/database_srv
|
||||
#RUN mkdir -p /var/www/html/export
|
||||
#RUN mkdir -p /var/www/html/import
|
||||
#RUN chown -R www-data:www-data /var/www/html/export/
|
||||
#RUN chown -R www-data:www-data /var/www/html/import/
|
||||
#RUN chown -R www-data:www-data /var/www/html/install/
|
||||
#RUN chown -R www-data:www-data /var/www/html/database_srv/
|
||||
25
sys0-code/api/free_printer.php
Normal file
25
sys0-code/api/free_printer.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
include "../config/config.php"
|
||||
$apikey=htmlspecialchars($_GET["apikey"]);
|
||||
$apikey_fromdb="";
|
||||
$sql="select apikey from api where id=1";
|
||||
$stmt = mysqli_prepare($link, $sql);
|
||||
mysqli_stmt_execute($stmt);
|
||||
mysqli_stmt_store_result($stmt);
|
||||
mysqli_stmt_bind_result($stmt, $apikey_fromdb);
|
||||
mysqli_stmt_fetch($stmt);
|
||||
if($apikey!=$apikey_fromdb)
|
||||
{
|
||||
echo("wrong apikey");
|
||||
exit;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
$id=htmlspecialchars($_GET["id"]);
|
||||
$sql="update printer set free=1,printing=0,cancel=0 ,used_by_userid=0 where id=$id";
|
||||
$stmt = mysqli_prepare($link, $sql);
|
||||
mysqli_stmt_execute($stmt);
|
||||
}
|
||||
|
||||
?>
|
||||
45
sys0-code/api/printer_settings.php
Normal file
45
sys0-code/api/printer_settings.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
session_start();
|
||||
|
||||
if(!isset($_SESSION["loggedin"]) || $_SESSION["loggedin"] !== true || $_SESSION["role"][9]!=="1"){
|
||||
header("location: login.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
include "../config/config.php";
|
||||
|
||||
if($_GET['action']=="update_rotation")
|
||||
{
|
||||
$printer_id=htmlspecialchars($_GET['id']);
|
||||
$rotation=htmlspecialchars($_GET["value"]);
|
||||
$sql="update printer set rotation=$rotation where id=$printer_id";
|
||||
$stmt = mysqli_prepare($link, $sql);
|
||||
mysqli_stmt_execute($stmt);
|
||||
}
|
||||
|
||||
if($_GET["action"]=="update_color")
|
||||
{
|
||||
$printer_id=htmlspecialchars($_GET['id']);
|
||||
$color=htmlspecialchars($_GET["value"]);
|
||||
$sql="update printer set color='$color' where id=$printer_id";
|
||||
$stmt = mysqli_prepare($link, $sql);
|
||||
mysqli_stmt_execute($stmt);
|
||||
}
|
||||
|
||||
if($_GET["action"]=="update_filament")
|
||||
{
|
||||
$id=htmlspecialchars($_GET['id']);
|
||||
$color=htmlspecialchars($_GET["value"]);
|
||||
$sql="update filament set name='$color' where internal_id=$id";
|
||||
$stmt = mysqli_prepare($link, $sql);
|
||||
mysqli_stmt_execute($stmt);
|
||||
}
|
||||
if($_GET["action"]=="delete_filament")
|
||||
{
|
||||
$id=htmlspecialchars($_GET['id']);
|
||||
$color=htmlspecialchars($_GET["value"]);
|
||||
$sql="delete from filament where internal_id=$id";
|
||||
$stmt = mysqli_prepare($link, $sql);
|
||||
mysqli_stmt_execute($stmt);
|
||||
}
|
||||
?>
|
||||
92
sys0-code/api/update_color.php
Normal file
92
sys0-code/api/update_color.php
Normal file
@@ -0,0 +1,92 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<?php
|
||||
|
||||
include "../config/config.php";
|
||||
|
||||
?>
|
||||
|
||||
|
||||
<script src="/assets/js/load_page.js"></script>
|
||||
<script>
|
||||
function load_user()
|
||||
{
|
||||
$(document).ready(function(){
|
||||
$('#content').load("/assets/php/user_page.php");
|
||||
});
|
||||
}
|
||||
</script>
|
||||
<?php
|
||||
|
||||
echo "<script type='text/javascript' >load_user()</script>";
|
||||
|
||||
|
||||
?>
|
||||
<?php
|
||||
$color=$_SESSION["color"];
|
||||
include "../assets/components.php";
|
||||
if(isset($_POST["printer"])){
|
||||
$color=htmlspecialchars($_GET["color"]);
|
||||
$id=htmlspecialchars($_POST["printer"]);
|
||||
$sql="update printer set color='$color' where id=$id;";
|
||||
//echo($sql);
|
||||
$stmt = mysqli_prepare($link, $sql);
|
||||
mysqli_stmt_execute($stmt);
|
||||
|
||||
}
|
||||
?>
|
||||
<div id="content"></div>
|
||||
|
||||
<head>
|
||||
<title>Filamentfarbe Aktualisieren</title>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<div class="container mt-5" style="min-height: 95vh;">
|
||||
<div class="row justify-content-center">
|
||||
<div style="width: 100hh">
|
||||
<h1>Filamentfarbe Aktualisieren</h1>
|
||||
<form class="mt-5" enctype="multipart/form-data" method="POST" action="">
|
||||
<input type="text" value="<?php echo($_GET["color"]); ?>" name="color" disabled><br><br>
|
||||
<select class="form-control selector" name="printer" required>
|
||||
<?php
|
||||
//get number of printers
|
||||
$num_of_printers=0;
|
||||
$sql="select count(*) from printer;";
|
||||
$stmt = mysqli_prepare($link, $sql);
|
||||
mysqli_stmt_execute($stmt);
|
||||
mysqli_stmt_store_result($stmt);
|
||||
mysqli_stmt_bind_result($stmt, $num_of_printers);
|
||||
mysqli_stmt_fetch($stmt);
|
||||
//echo("test1:".$num_of_printers);
|
||||
$last_id=0;
|
||||
$printers_av=0;
|
||||
while($num_of_printers!=0)
|
||||
{
|
||||
$id=0;
|
||||
$sql="Select id from printer where id>$last_id order by id";
|
||||
//echo $sql;
|
||||
$color="";
|
||||
$stmt = mysqli_prepare($link, $sql);
|
||||
mysqli_stmt_execute($stmt);
|
||||
mysqli_stmt_store_result($stmt);
|
||||
mysqli_stmt_bind_result($stmt, $id);
|
||||
mysqli_stmt_fetch($stmt);
|
||||
if($id!=0 && $id!=$last_id)
|
||||
{
|
||||
echo("<option printer='$id' value='$id'>Printer $id</option>");
|
||||
}
|
||||
$last_id=$id;
|
||||
$num_of_printers--;
|
||||
}
|
||||
?>
|
||||
</select><br><br>
|
||||
<input type="submit" class="btn btn-dark mb-5" value="Farbe aktualisieren" id="button">
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="footer"></div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
30
sys0-code/api/update_url.php
Normal file
30
sys0-code/api/update_url.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
include "../config/config.php";
|
||||
$apikey=htmlspecialchars($_GET["apikey"]);
|
||||
$apikey_fromdb="";
|
||||
$octoapikey=htmlspecialchars($_GET["octoapikey"]);
|
||||
$sql="select apikey from api where id=1";
|
||||
$stmt = mysqli_prepare($link, $sql);
|
||||
mysqli_stmt_execute($stmt);
|
||||
mysqli_stmt_store_result($stmt);
|
||||
mysqli_stmt_bind_result($stmt, $apikey_fromdb);
|
||||
mysqli_stmt_fetch($stmt);
|
||||
//echo('got from db:');
|
||||
//echo($apikey_fromdb);
|
||||
if($apikey!=$apikey_fromdb)
|
||||
{
|
||||
echo("wrong apikey");
|
||||
exit;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
$url=htmlspecialchars($_GET["url"]);
|
||||
$id=htmlspecialchars($_GET["id"]);
|
||||
$sql="insert into printer (id, printer_url,printing,free,used_by_userid,system_status,apikey) values ($id,'$url',0,1,0,0,'$octoapikey') on duplicate key update printer_url='$url', apikey='$octoapikey'";
|
||||
echo($sql);
|
||||
$stmt = mysqli_prepare($link, $sql);
|
||||
mysqli_stmt_execute($stmt);
|
||||
}
|
||||
|
||||
?>
|
||||
10
sys0-code/assets/components.php
Normal file
10
sys0-code/assets/components.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
echo('<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0/dist/css/bootstrap.min.css" rel="stylesheet" >
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.9.2/dist/umd/popper.min.js" ></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/js/bootstrap.min.js" integrity="sha384-Atwg2Pkwv9vp0ygtn1JAojH0nYbwNJLPhwyoVbhoPwBhjQPR5VtM2+xf0Uwh9KtT" crossorigin="anonymous"></script>
|
||||
<script src="https://kit.fontawesome.com/8ab5a73cf2.js" crossorigin="anonymous"></script>
|
||||
');
|
||||
?>
|
||||
17
sys0-code/config/config.php
Normal file
17
sys0-code/config/config.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
define('DB_SERVER', 'localhost');
|
||||
define('DB_USERNAME', 'root');
|
||||
define('DB_PASSWORD', '1234');
|
||||
define('DB_NAME', 'system0');
|
||||
$api="bot6975511033:AAGGswiwKYwCVbehpGE3hz_tLc9xuSAoBVg"; //the telegram api key for jakach notification system
|
||||
$SENDGRID_API_KEY="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"; //our new api key, for the new mail address
|
||||
$sendgrid_email="print@ksw3d.ch"; //our new email
|
||||
$chat_id="6587711215"; //chat id of the admin => janis steiner
|
||||
/* Attempt to connect to MySQL database */
|
||||
$link = mysqli_connect(DB_SERVER, DB_USERNAME, DB_PASSWORD, DB_NAME);
|
||||
|
||||
// Check connection
|
||||
if($link === false){
|
||||
die("ERROR: Could not connect. " . mysqli_connect_error());
|
||||
}
|
||||
?>
|
||||
5
sys0-code/index.php
Normal file
5
sys0-code/index.php
Normal file
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
phpinfo();
|
||||
//header('LOCATION:/system0/html/php/login/v3/login.php');
|
||||
//echo("<br><br><center>Due to some security concerns we are running scans on our entire network.<br>The jakach sites have been disabled temporarly. please come back later;<br></center>");
|
||||
?>
|
||||
Reference in New Issue
Block a user