-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathchange-photo.php
52 lines (52 loc) · 1.79 KB
/
change-photo.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
session_start();
if (!isset($_SESSION["loggedin"]) || $_SESSION["loggedin"] !== true) {
header("location: login.php?redirect_link=change-photo.php");
exit;
}
require "config/config.php";
$new_photo_err = "";
if (!empty($_GET['new_photo_err'])) {
$new_photo_err = $_GET['new_photo_err'];
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height">
<title>Change Profile Photo</title>
<link rel="shortcut icon" href="logos/logo.png" type="image/x-icon">
<link rel="stylesheet" href="css/change-photo.css?v=<?php echo time(); ?>">
<script src="jquery/jquery.js"></script>
<script>
$(document).ready(function() {
$('#image').change(function() {
var i = $(this).prev('label').clone();
var file = $('#image')[0].files[0].name;
if (file.length > 25) file = file.substring(0, 25) + "...";
$(this).prev('label').text(file);
});
});
</script>
</head>
<body>
<?php require_once("header.php"); ?>
<div style="margin: 20px;">
<h1>Change Profile Photo</h1>
<form method="POST" action="actions.php?action=change_photo" enctype="multipart/form-data">
<div>
<label for="image" class="custom-file-upload">
Click here to add a profile picture
</label>
<input id="image" name="image" type="file" style="display:none;">
<br>
<span class="user-error"><?php echo $new_photo_err; ?></span>
</div>
<br>
<button type="submit" class="user-button">Change photo</button>
</form>
</div>
</body>
</html>