Answer the question
In order to leave comments, you need to log in
How to change the avatar on the site?
Hello everyone! Need help! Can you point my finger at which site I can find the code? I'm just a newbie in this area and I want to change the avatar in my profile.
<?php
session_start();
if (!$_SESSION['user']) {
header('Location: index.php');
# code...
}
?>
<title>Профиль | PortaleModeSA</title>
<link rel="stylesheet" type="text/css" href="css/bootstrap.css">
<link rel="stylesheet" href="https://bootstraptema.ru/plugins/2015/bootstrap3/bootstrap.min.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" />
<script src="https://bootstraptema.ru/plugins/jquery/jquery-1.11.3.min.js"></script>
<script src="https://bootstraptema.ru/plugins/2015/b-v3-3-6/bootstrap.min.js"></script>
<style>
body{background:url(https://bootstraptema.ru/images/bg/bg-1.png)}
#main {
background-color: #f2f2f2;
padding: 20px;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
-ms-border-radius: 4px;
-o-border-radius: 4px;
border-radius: 4px;
border-bottom: 4px solid #ddd;
}
#real-estates-detail #author img {
-webkit-border-radius: 100%;
-moz-border-radius: 100%;
-ms-border-radius: 100%;
-o-border-radius: 100%;
border-radius: 100%;
border: 5px solid #ecf0f1;
margin-bottom: 10px;
}
#real-estates-detail .sosmed-author i.fa {
width: 30px;
height: 30px;
border: 2px solid #bdc3c7;
color: #bdc3c7;
padding-top: 6px;
margin-top: 10px;
}
.panel-default .panel-heading {
background-color: #fff;
}
#real-estates-detail .slides li img {
height: 450px;
}
.rectangle {
width: 200px;
height: 100px;
background: grey;
}
</style>
<div class="d-flex flex-column flex-md-row align-items-center p-3 px-md-4 mb-3 bg-white border-bottom shadow-sm">
<h5 class="my-0 mr-md-auto font-weight-normal"><a href="index.php">PortaleModeSA</a></h5>
<nav class="my-2 my-md-0 mr-md-3">
</nav>
<a class="btn btn-outline-primary" href="logout.php">Выход</a>
</div>
</div>
</div>
<div class="container">
<div id="main">
<div class="row" id="real-estates-detail">
<div class="col-lg-4 col-md-4 col-xs-12">
<div class="panel panel-default">
<div class="panel-heading">
<header class="panel-title">
<div class="text-center">
<strong style="color: grey;"><?= $_SESSION['user']['role'] ?></strong>
</div>
</header>
</div>
<div class="panel-body">
<div class="text-center" id="author">
<img style="width: 200px; height: 200px;" src="<?= $_SESSION['user']['avatar'] ?>">
<h3><?= $_SESSION['user']['name'] ?></h3>
<p>Всемогущий</p>
<p class="sosmed-author">
</p>
</div>
</div>
</div>
</div>
<div class="col-lg-8 col-md-8 col-xs-12">
<div class="panel">
<div class="panel-body">
<ul id="myTab" class="nav nav-pills">
<button class="btn btn-lg btn-primary btn-block" style="width:250px;height:40px" type="submit" name="do_signup"><a style="color: white;" href="editprofile.php">Настройки</a></button>
</ul>
<div id="myTabContent" class="tab-content">
<hr>
<div class="tab-pane fade active in" id="detail">
<h4>Профиль</h4>
<table class="table table-th-block">
<tbody>
<tr><td class="active">ID:</td><td><?= $_SESSION['user']['id'] ?></td></tr>
<tr><td class="active">Email:</td><td><?= $_SESSION['user']['email'] ?></td></tr>
<tr><td class="active">Зарегистрирован:</td><td><?= $_SESSION['user']['date'] ?>0</td></tr>
<tr><td class="active">Страна:</td><td>Россия</td></tr>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div><!-- /.main -->
</div><!-- /.container -->
Answer the question
In order to leave comments, you need to log in
1. Read how to create forms for .
2. Write a function in PHP (with access by URL, as it fits into the action of the form), which will receive a file and save it .
3. The resulting address (where the picture is saved) is written to the database. Search in a search engine for something in the spirit of " How to write to the database php "
4. Immediately look in the direction of security at least at the level of allowed file extensions.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question