profile pictures implemented & poc for active user feautre
This commit is contained in:
parent
13ceba1e23
commit
5d2dd2a6d5
@ -12,4 +12,21 @@ if($_SESSION['activated'] == 0) {
|
||||
die ("Not activated yet");
|
||||
}
|
||||
echo "heres the fun world";
|
||||
?>
|
||||
?>
|
||||
<br /> <br />
|
||||
<div class="jumbotron jumbotron-fluid">
|
||||
<div class="container">
|
||||
<?php
|
||||
echo "Hi ".$_SESSION['username']."!";
|
||||
if(isset($_GET['notimplemented'])) {
|
||||
echo '<div class="alert alert-danger" role="alert">Feature not yet implemented!</div>';
|
||||
}
|
||||
?>
|
||||
<br /><br />
|
||||
<a href="changeprofilepicture.php"><button class="btn btn-primary">Change Profile Picture</button>
|
||||
<br /><br />
|
||||
<a href="?notimplemented=1"><button class="btn btn-primary disabled">Change Description</button></a>
|
||||
<br /> <br /><br />
|
||||
<a href="start.php"><button class="btn btn-info">Back</button></a>
|
||||
</div>
|
||||
</div>
|
68
changeprofilepicture.php
Normal file
68
changeprofilepicture.php
Normal file
@ -0,0 +1,68 @@
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Activated Area</title>
|
||||
<link rel="stylesheet" href="ressources/css/bootstrap.min.css" crossorigin="anonymous">
|
||||
</head>
|
||||
<body>
|
||||
<script src="ressources/js/bootstrap.min.js"></script>
|
||||
<?php
|
||||
session_start();
|
||||
include 'db.inc.php';
|
||||
if($_SESSION['activated'] == 0) {
|
||||
die ("Not activated yet");
|
||||
}
|
||||
echo "heres the fun world";
|
||||
?>
|
||||
<?php
|
||||
|
||||
//regex to parse file extensions here:
|
||||
|
||||
//function to insert url into table here:
|
||||
if(isset($_GET['new'])) {
|
||||
$imageurl = $_POST['imageurl'];
|
||||
$userid = $_SESSION['userid'];
|
||||
|
||||
if($imageurl == "https://web.td00.de/woddle.gif") {
|
||||
echo "<br> returning to default picture";
|
||||
$statement = $pdo->prepare("UPDATE users SET profilepicture = :imageurl WHERE id = :userid");
|
||||
$result = $statement->execute(array('imageurl' => $imageurl, 'userid'=> $userid ));
|
||||
|
||||
if($result) {
|
||||
die('<br>Changed Profile Picture. Going to <a href="update.php?page=profile.php">profile</a> now.<meta http-equiv="refresh" content="1; URL=update.php?page=profile.php">');
|
||||
}
|
||||
}
|
||||
else {
|
||||
$statement = $pdo->prepare("UPDATE users SET profilepicture = :imageurl WHERE id = :userid");
|
||||
$result = $statement->execute(array('imageurl' => $imageurl, 'userid'=> $userid ));
|
||||
|
||||
if($result) {
|
||||
die('<br>Changed Profile Picture. Going to <a href="update.php?page=profile.php">profile</a> now.<meta http-equiv="refresh" content="1; URL=update.php?page=profile.php">');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
<br /> <br />
|
||||
<div class="jumbotron jumbotron-fluid">
|
||||
<div class="container">
|
||||
<i>Right now you need to upload the picture somewhere and input the URL here.</i><br />
|
||||
<b>Please be aware that only the following filetypes will work!</b>
|
||||
<li>jpg</li>
|
||||
<li>gif</li>
|
||||
<li>png</li>
|
||||
<br /><br /><br />
|
||||
<script src="ressources/js/bootstrap.min.js"></script>
|
||||
|
||||
<form action="?new=1&userid=<?php echo htmlentities($userid); ?>&code=<?php echo htmlentities($code); ?>" method="post">
|
||||
<div class="form-group">
|
||||
<label for="imageurl">URL to new image</label>
|
||||
<input type="url" pattern="https://.*" id="imageurl" class="form-control" name="imageurl"><br><br>
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn btn-primary">Submit new Image</button>
|
||||
</form>
|
||||
<br /> <br /><br />
|
||||
<a href="activatedarea.php"><button class="btn btn-info">Back</button></a>
|
||||
</div>
|
||||
</div>
|
@ -12,7 +12,7 @@ $usergn = $_SESSION['givenName'];
|
||||
$userln = $_SESSION['lastName'];
|
||||
$activated = $_SESSION['activated'];
|
||||
$isadmin = $_SESSION['isadmin'];
|
||||
$profilepicture = "https://web.td00.de/woddle.gif";
|
||||
$profilepicture = $_SESSION['profilepicture'];
|
||||
?>
|
||||
<html>
|
||||
<head>
|
||||
|
Loading…
x
Reference in New Issue
Block a user