-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
129 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,106 +1,18 @@ | ||
<?php | ||
session_start(); | ||
include_once "functions.php"; | ||
if (is_not_logged_in()){ | ||
redirect_to('page_login.php'); | ||
exit(); | ||
} | ||
// если нет id перенаправляем на страницу пользователей | ||
if (!isset($_GET['id'])){ | ||
include_once 'functions.php'; | ||
|
||
if (!(isset($_POST['id']) && isset($_FILES['img']))){ | ||
set_flash_message('danger', 'Ошибка запроса, повторите попытку'); | ||
redirect_to('users.php'); | ||
exit(); | ||
} | ||
|
||
|
||
|
||
?> | ||
|
||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>Document</title> | ||
<meta name="description" content="Chartist.html"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no, user-scalable=no, minimal-ui"> | ||
<link id="vendorsbundle" rel="stylesheet" media="screen, print" href="css/vendors.bundle.css"> | ||
<link id="appbundle" rel="stylesheet" media="screen, print" href="css/app.bundle.css"> | ||
<link id="myskin" rel="stylesheet" media="screen, print" href="css/skins/skin-master.css"> | ||
<link rel="stylesheet" media="screen, print" href="css/fa-solid.css"> | ||
<link rel="stylesheet" media="screen, print" href="css/fa-brands.css"> | ||
</head> | ||
<body> | ||
<?php include 'nav_component.php'?> | ||
<main id="js-page-content" role="main" class="page-content mt-3"> | ||
<div class="subheader"> | ||
<h1 class="subheader-title"> | ||
<i class='subheader-icon fal fa-image'></i> Загрузить аватар | ||
</h1> | ||
|
||
</div> | ||
<form action="media.php" method="post" enctype="multipart/form-data"> | ||
<div class="row"> | ||
<div class="col-xl-6"> | ||
<div id="panel-1" class="panel"> | ||
<div class="panel-container"> | ||
<div class="panel-hdr"> | ||
<h2>Текущий аватар</h2> | ||
</div> | ||
<div class="panel-content"> | ||
<div class="form-group"> | ||
<img src="<?= isset($edit_user['img']) ? $edit_user['img'] : ""?>" alt="" class="img-responsive" width="200"> | ||
</div> | ||
|
||
<div class="form-group"> | ||
<label class="form-label" for="example-fileinput">Выберите аватар</label> | ||
<input type="file" id="example-fileinput" class="form-control-file"> | ||
<input type="hidden" name="id" | ||
value="<?= isset($edit_user['id']) ? $edit_user['id'] : "" ?>"> | ||
</div> | ||
|
||
|
||
<div class="col-md-12 mt-3 d-flex flex-row-reverse"> | ||
<button class="btn btn-warning">Загрузить</button> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</form> | ||
</main> | ||
|
||
<script src="js/vendors.bundle.js"></script> | ||
<script src="js/app.bundle.js"></script> | ||
<script> | ||
|
||
$(document).ready(function() | ||
{ | ||
|
||
$('input[type=radio][name=contactview]').change(function() | ||
{ | ||
if (this.value == 'grid') | ||
{ | ||
$('#js-contacts .card').removeClassPrefix('mb-').addClass('mb-g'); | ||
$('#js-contacts .col-xl-12').removeClassPrefix('col-xl-').addClass('col-xl-4'); | ||
$('#js-contacts .js-expand-btn').addClass('d-none'); | ||
$('#js-contacts .card-body + .card-body').addClass('show'); | ||
|
||
} | ||
else if (this.value == 'table') | ||
{ | ||
$('#js-contacts .card').removeClassPrefix('mb-').addClass('mb-1'); | ||
$('#js-contacts .col-xl-4').removeClassPrefix('col-xl-').addClass('col-xl-12'); | ||
$('#js-contacts .js-expand-btn').removeClass('d-none'); | ||
$('#js-contacts .card-body + .card-body').removeClass('show'); | ||
} | ||
|
||
}); | ||
|
||
//initialize filter | ||
initApp.listFilter($('#js-contacts'), $('#js-filter-contacts')); | ||
}); | ||
|
||
</script> | ||
</body> | ||
</html> | ||
$uploaded_img = upload_avatar($_POST['id'], $_FILES['img']); | ||
if ($uploaded_img){ | ||
set_flash_message('success', 'Данные успешно обновлены'); | ||
redirect_to('page_profile.php?id='.$_POST['id']); | ||
exit(); | ||
} | ||
set_flash_message('danger', 'Ошибка запроса, повторите попытку'); | ||
redirect_to('page_profile.php?id=' . $_POST['id']); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
<?php | ||
session_start(); | ||
include_once "functions.php"; | ||
if (is_not_logged_in()){ | ||
redirect_to('page_login.php'); | ||
exit(); | ||
} | ||
// если нет id перенаправляем на страницу пользователей | ||
if (!isset($_GET['id'])){ | ||
redirect_to('users.php'); | ||
exit(); | ||
} | ||
$edit_user = get_user_by_id($_GET['id']); | ||
$image_path = empty($edit_user['img'])?"img/demo/avatars/avatar-f.png":$edit_user['img']; | ||
|
||
?> | ||
|
||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>Document</title> | ||
<meta name="description" content="Chartist.html"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no, user-scalable=no, minimal-ui"> | ||
<link id="vendorsbundle" rel="stylesheet" media="screen, print" href="css/vendors.bundle.css"> | ||
<link id="appbundle" rel="stylesheet" media="screen, print" href="css/app.bundle.css"> | ||
<link id="myskin" rel="stylesheet" media="screen, print" href="css/skins/skin-master.css"> | ||
<link rel="stylesheet" media="screen, print" href="css/fa-solid.css"> | ||
<link rel="stylesheet" media="screen, print" href="css/fa-brands.css"> | ||
</head> | ||
<body> | ||
<?php include 'nav_component.php'?> | ||
<main id="js-page-content" role="main" class="page-content mt-3"> | ||
<div class="subheader"> | ||
<h1 class="subheader-title"> | ||
<i class='subheader-icon fal fa-image'></i> Загрузить аватар | ||
</h1> | ||
|
||
</div> | ||
<form action="media.php" method="post" enctype="multipart/form-data"> | ||
<div class="row"> | ||
<div class="col-xl-6"> | ||
<div id="panel-1" class="panel"> | ||
<div class="panel-container"> | ||
<div class="panel-hdr"> | ||
<h2>Текущий аватар</h2> | ||
</div> | ||
<div class="panel-content"> | ||
<div class="form-group"> | ||
<img src="<?= $image_path ?>" alt="" class="img-responsive" width="200"> | ||
</div> | ||
|
||
<div class="form-group"> | ||
<label class="form-label" for="example-fileinput">Выберите аватар</label> | ||
<input type="file" id="example-fileinput" class="form-control-file" name="img"> | ||
<input type="hidden" name="id" | ||
value="<?= isset($edit_user['id']) ? $edit_user['id'] : "" ?>"> | ||
</div> | ||
|
||
|
||
<div class="col-md-12 mt-3 d-flex flex-row-reverse"> | ||
<button class="btn btn-warning" type="submit">Загрузить</button> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</form> | ||
</main> | ||
|
||
<script src="js/vendors.bundle.js"></script> | ||
<script src="js/app.bundle.js"></script> | ||
<script> | ||
|
||
$(document).ready(function() | ||
{ | ||
|
||
$('input[type=radio][name=contactview]').change(function() | ||
{ | ||
if (this.value == 'grid') | ||
{ | ||
$('#js-contacts .card').removeClassPrefix('mb-').addClass('mb-g'); | ||
$('#js-contacts .col-xl-12').removeClassPrefix('col-xl-').addClass('col-xl-4'); | ||
$('#js-contacts .js-expand-btn').addClass('d-none'); | ||
$('#js-contacts .card-body + .card-body').addClass('show'); | ||
|
||
} | ||
else if (this.value == 'table') | ||
{ | ||
$('#js-contacts .card').removeClassPrefix('mb-').addClass('mb-1'); | ||
$('#js-contacts .col-xl-4').removeClassPrefix('col-xl-').addClass('col-xl-12'); | ||
$('#js-contacts .js-expand-btn').removeClass('d-none'); | ||
$('#js-contacts .card-body + .card-body').removeClass('show'); | ||
} | ||
|
||
}); | ||
|
||
//initialize filter | ||
initApp.listFilter($('#js-contacts'), $('#js-filter-contacts')); | ||
}); | ||
|
||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters