mirror of
https://github.com/Schrolli91/BOSWatch.git
synced 2026-04-04 14:07:25 +00:00
Enabling basic functionality
- removed deprecated functions (mysql) - adding function: select view at login - adapting queries to database structure - some minor stuff
This commit is contained in:
parent
1a9e2a34d1
commit
c02cd74586
7 changed files with 203 additions and 60 deletions
57
exampleAddOns/alarmMonitorWeb/do_eintragen.php
Normal file
57
exampleAddOns/alarmMonitorWeb/do_eintragen.php
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
|
||||
<?php
|
||||
session_start();
|
||||
?>
|
||||
|
||||
<?php
|
||||
if(($_SESSION["username"])!="admin")
|
||||
{
|
||||
echo "Sie sind nicht berechtigt fuer diesen Bereich";
|
||||
exit;
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
|
||||
|
||||
<?php
|
||||
@require_once("config.php");
|
||||
$verbindung = mysqli_connect($dbhost, $dbuser , $dbpassword, $database)
|
||||
or die("Verbindung zur Datenbank konnte nicht hergestellt werden");
|
||||
|
||||
$username = $_POST["username"];
|
||||
$passwort = $_POST["passwort"];
|
||||
$passwort2 = $_POST["passwort2"];
|
||||
|
||||
if($passwort != $passwort2 OR $username == "" OR $passwort == "")
|
||||
{
|
||||
echo "Eingabefehler. Bitte alle Felder korekt ausfüllen. <a href=\"eintragen.html\">Zurück</a>";
|
||||
exit;
|
||||
}
|
||||
$passwort = md5($passwort);
|
||||
|
||||
$result = mysqli_query($verbindung, "SELECT id FROM login WHERE username LIKE '$username'");
|
||||
$menge = mysqli_num_rows($result);
|
||||
|
||||
if($menge == 0)
|
||||
{
|
||||
$eintrag = "INSERT INTO login (username, passwort) VALUES ('$username', '$passwort')";
|
||||
$eintragen = mysqli_query($verbindung, $eintrag);
|
||||
|
||||
if($eintragen == true)
|
||||
{
|
||||
echo "Benutzername <b>$username</b> wurde erstellt. <a href=\"index.php\">Login</a>";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "Fehler beim Speichern des Benutzernames. <a href=\"eintragen.html\">Zurück</a>";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
echo "Benutzername schon vorhanden. <a href=\"eintragen.html\">Zurück</a>";
|
||||
}
|
||||
?>
|
||||
Loading…
Add table
Add a link
Reference in a new issue