4
1
Fork 0

Design Update

This commit is contained in:
MaKe_Univ3rs 2017-04-06 19:03:45 +02:00
parent 8bbc669c86
commit e4f89e7c89
4 changed files with 49 additions and 35 deletions

View file

@ -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>';
}
?>

View file

@ -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);

View file

@ -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: /');
?>

View file

@ -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;
}