Design Update
This commit is contained in:
parent
8bbc669c86
commit
e4f89e7c89
4 changed files with 49 additions and 35 deletions
64
index.php
64
index.php
|
@ -4,28 +4,7 @@
|
|||
</head>
|
||||
|
||||
<?php
|
||||
|
||||
session_start();
|
||||
if (!isset($_SESSION['id'])){
|
||||
echo '<h1>Nicht eingeloggt!</h1>';
|
||||
echo '<div class="form">' .
|
||||
'<form action="/login.php" method="post">' .
|
||||
'<input type="text" placeholder="Username" name="user">' .
|
||||
'<input type="password" placeholder="Password" name="pw">' .
|
||||
'<input type="submit" value="Login">' .
|
||||
'</form>' .
|
||||
'</div>';
|
||||
return;
|
||||
}
|
||||
|
||||
if (isset($_SESSION['id'])){
|
||||
echo '<h1>Hier klicken zum Ausloggen!</h1>';
|
||||
echo '<div class="form2">' .
|
||||
'<form action="/logout.php" method="post">' .
|
||||
'<input type="submit" value="Logout">' .
|
||||
'</form>' .
|
||||
'</div>';
|
||||
}
|
||||
|
||||
$cockDatabase = "dulow";
|
||||
$host = "localhost";
|
||||
|
@ -89,8 +68,41 @@ $number++;
|
|||
?>
|
||||
</table><br>
|
||||
|
||||
<form action="/insert.php" method="post">
|
||||
Text:<input type="text" name="author"><br>
|
||||
URL:<input type="text" name="url"><br>
|
||||
<input type="submit" value="Hinzufügen">
|
||||
</form>
|
||||
|
||||
|
||||
<?php
|
||||
if (!isset ($_SESSION['id'])){
|
||||
// echo '<h1>Nicht eingeloggt!</h1>';
|
||||
echo '<div class="loginform">' .
|
||||
'<form action="/login.php" method="post">' .
|
||||
'<input type="text" placeholder="Username" name="user">' .
|
||||
'<input type="password" placeholder="Password" name="pw">' .
|
||||
'<input type="submit" value="Login">' .
|
||||
'</form>' .
|
||||
'</div>';
|
||||
if (isset ($_SESSION['status'])){
|
||||
echo $_SESSION['status'];
|
||||
}
|
||||
return;
|
||||
}
|
||||
?>
|
||||
|
||||
<?php
|
||||
echo '<div class="loginform">' .
|
||||
'<form action="/insert.php" method="post">' .
|
||||
'<input type="text" placeholder="Link" name="url"><br>' .
|
||||
'<input type="submit" value="Hinzufügen">' .
|
||||
'</form>' .
|
||||
'</div>';
|
||||
?>
|
||||
|
||||
<?php
|
||||
if (isset($_SESSION['id'])){
|
||||
// echo '<h1>Hier klicken zum Ausloggen!</h1>';
|
||||
echo '<div class="loginform">' .
|
||||
'<form action="/logout.php" method="post">' .
|
||||
'<input type="submit" value="Logout">' .
|
||||
'</form>' .
|
||||
'</div>';
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -10,15 +10,13 @@ if ($conn->connect_error){
|
|||
}
|
||||
|
||||
var_dump($_POST['url']);
|
||||
var_dump($_POST['author']);
|
||||
if($_POST['url'] == '' && $_POST['author'] == ''){
|
||||
if($_POST['url'] == ''){
|
||||
header('Location: /');
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
$url = $_POST['url'];
|
||||
$author = $_POST['author'];
|
||||
$author = $_SESSION['user'];
|
||||
|
||||
$sql = "INSERT INTO cheaterliste (url, author) VALUES('".$url."', '".$author."')";
|
||||
$conn->query($sql);
|
||||
|
|
|
@ -15,6 +15,10 @@
|
|||
|
||||
if ($result->num_rows == 1) {
|
||||
$_SESSION['id'] = $result->fetch_array()['id'];
|
||||
unset ($_SESSION['status']);
|
||||
$_SESSION['user'] = $_POST['user'];
|
||||
} else {
|
||||
$_SESSION['status'] = '<h1>Benutzername oder Kennwort ist falsch</h1>';
|
||||
}
|
||||
header('Location: /');
|
||||
?>
|
||||
|
|
10
style.css
10
style.css
|
@ -50,15 +50,15 @@ table.center {
|
|||
margin-top: 200px;
|
||||
}
|
||||
|
||||
.form {
|
||||
max-width: 360px;
|
||||
margin: 0 auto;
|
||||
.loginform {
|
||||
max-width: 340px;
|
||||
margin-left: auto;
|
||||
padding: 30px;
|
||||
padding-bottom: 0px;
|
||||
background: rgba(18,18,18, 0.3);
|
||||
border: 2px solid #DDDDDD;
|
||||
}
|
||||
.form input {
|
||||
.loginform input {
|
||||
width: 100%;
|
||||
margin: 0 0 15px;
|
||||
box-sizing: border-box;
|
||||
|
@ -68,6 +68,6 @@ table.center {
|
|||
color: #000000;
|
||||
background-color: white;
|
||||
}
|
||||
.form button:hover,.form button:active,.form button:focus {
|
||||
.loginform button:hover,.loginform button:active,.loginform button:focus {
|
||||
background: #43A047;
|
||||
}
|
||||
|
|
Reference in a new issue