Updated profile
This commit is contained in:
parent
8f9489407d
commit
999858f79a
24 changed files with 671 additions and 300 deletions
|
@ -87,7 +87,9 @@ body{
|
|||
.article-other-info .test:hover + .tooltiptext,
|
||||
.article-extra-option-icon:hover + .tooltiptext,
|
||||
.company-date:hover .tooltiptext,
|
||||
.outter-container:hover .tooltiptext{
|
||||
.outter-container:hover .tooltiptext,
|
||||
.plus-icon-container:hover .tooltiptext,
|
||||
.trash-icon-container:hover .tooltiptext{
|
||||
visibility: visible;
|
||||
opacity: 1;
|
||||
font-size: 0.7em;
|
||||
|
@ -115,6 +117,9 @@ body{
|
|||
.tooltiptextTop150 {
|
||||
top: 150%;
|
||||
}
|
||||
.tooltiptextTop130 {
|
||||
top: 130%;
|
||||
}
|
||||
.tooltiptextTop120 {
|
||||
top: 120%;
|
||||
}
|
||||
|
|
|
@ -658,18 +658,99 @@ body {
|
|||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
.admin-panel section {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr 1fr 1fr 60px;
|
||||
padding: 0.5rem;
|
||||
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
table-layout: fixed;
|
||||
margin-top: 1rem;
|
||||
}
|
||||
.admin-panel section div {
|
||||
padding: 20px;
|
||||
|
||||
table caption {
|
||||
font-size: 1.5rem;
|
||||
margin: .5rem 0 .75rem;
|
||||
}
|
||||
|
||||
table tr {
|
||||
background-color: var(--bg);
|
||||
border: 1px solid var(--border-medium);
|
||||
padding: .35rem;
|
||||
}
|
||||
table th,
|
||||
table td {
|
||||
padding: 1rem;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
table th {
|
||||
font-size: .85rem;
|
||||
letter-spacing: .1rem;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
@media screen and (max-width: 600px) {
|
||||
table {
|
||||
border: 0;
|
||||
}
|
||||
|
||||
table caption {
|
||||
font-size: 1.3em;
|
||||
}
|
||||
|
||||
table thead {
|
||||
border: none;
|
||||
clip: rect(0 0 0 0);
|
||||
height: 1px;
|
||||
margin: -1px;
|
||||
overflow: hidden;
|
||||
padding: 0;
|
||||
position: absolute;
|
||||
width: 1px;
|
||||
}
|
||||
|
||||
table tr {
|
||||
display: block;
|
||||
margin-bottom: .625em;
|
||||
}
|
||||
|
||||
table td {
|
||||
display: block;
|
||||
font-size: 0.8rem;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
table td::before {
|
||||
content: attr(data-label);
|
||||
float: left;
|
||||
font-weight: bold;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
table td:last-child {
|
||||
border-bottom: 0;
|
||||
}
|
||||
}
|
||||
.plus-icon-container,
|
||||
.trash-icon-container {
|
||||
min-height: 2rem;
|
||||
width: 2rem;
|
||||
margin: auto;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border-radius: 50%;
|
||||
transition: all ease-in-out .12s;
|
||||
cursor: pointer;
|
||||
position: relative;
|
||||
}
|
||||
.admin-panel i {
|
||||
color: green;
|
||||
.plus-icon-container i { color: var(--green-light); }
|
||||
.plus-icon-container:hover { background-color: var(--hover-light); }
|
||||
.trash-icon-container i {
|
||||
color: var(--font-dark);
|
||||
transition: all ease-in-out .22s;
|
||||
}
|
||||
.trash-icon-container:hover i { color: var(--red-medium);}
|
||||
|
||||
|
||||
/* Change */
|
||||
|
|
|
@ -691,6 +691,12 @@ body{
|
|||
grid-template-columns: repeat(12,minmax(0, 1fr));
|
||||
grid-gap: 1rem 2rem;
|
||||
}
|
||||
.main-content-section.headlines .main-content-container {
|
||||
grid-template-columns: minmax(0,1fr) minmax(0,1fr) minmax(0,1fr) minmax(0,1fr) minmax(0,1fr) minmax(0,1fr) minmax(0,1fr) minmax(0,1fr) minmax(0,1fr) 220px;
|
||||
}
|
||||
.main-content-section.headlines .main-content-container .article-container { grid-column: 1/9; }
|
||||
.main-content-section.headlines .main-content-container .main-side-content-container { grid-column: 9/13 ; }
|
||||
|
||||
.article-container { grid-column: 1/9; }
|
||||
#main-side-content-container { grid-column: 9/13; }
|
||||
article.aside { border: none; }
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%,-50%) scale(0.9);
|
||||
/* transition: all ease-in-out .1s; */
|
||||
border: 1px solid var(--hover-medium);
|
||||
border-radius: 5px;
|
||||
background-color: var(--bg);
|
||||
|
@ -16,10 +15,12 @@
|
|||
z-index: 1000;
|
||||
visibility: visible;
|
||||
transform: translate(-50%,-50%) scale(1);
|
||||
min-width: 340px;
|
||||
min-width: 320px;
|
||||
max-width: 370px;
|
||||
height: auto;
|
||||
}
|
||||
.main-img-container .container {
|
||||
margin-top: 0.75rem;
|
||||
margin-bottom: 0.75rem;
|
||||
display: flex;
|
||||
}
|
||||
|
@ -28,7 +29,7 @@
|
|||
.color-img.active { margin-top: 1rem; }
|
||||
|
||||
.main-img-container section {
|
||||
margin-top: 1rem;
|
||||
margin: 1rem 0 2rem 0;
|
||||
padding: 0 5px;
|
||||
}
|
||||
.main-img-container.active section:nth-of-type(2) { margin-top: 0; }
|
||||
|
@ -129,5 +130,43 @@
|
|||
.insert-photo-container + section { margin-top: 0; }
|
||||
.main-insert-photo-container .footer {
|
||||
height: 3rem;
|
||||
margin: auto;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
}
|
||||
.main-insert-photo-container .footer div:first-of-type {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-self: flex-start;
|
||||
flex-grow: 1;
|
||||
}
|
||||
.main-insert-photo-container .footer div:first-of-type span {
|
||||
color: var(--font-dark);
|
||||
font-size: 0.8rem;
|
||||
}
|
||||
.main-insert-photo-container .footer .button {
|
||||
display: flex;
|
||||
padding: 2px 5px;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 50%;
|
||||
background-color: var(--bg);
|
||||
border: 1px solid var(--border-light);
|
||||
border-radius: 3px;
|
||||
cursor: pointer;
|
||||
transition: all ease-in-out .15s;
|
||||
color: var(--font-dark);
|
||||
}
|
||||
.main-insert-photo-container .footer .button:hover { background-color: var(--hover-light); }
|
||||
|
||||
.color-container {
|
||||
min-height: 4rem;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.color-container .box-container {
|
||||
display: inline-flex;
|
||||
padding: 0.5rem 0.5rem;
|
||||
/* margin: auto 1rem 1rem auto; */
|
||||
}
|
||||
.color-container div:last-of-type { margin-right: 0;}
|
||||
|
|
BIN
Images/5f7b8d76df9d60.00481097.png
Normal file
BIN
Images/5f7b8d76df9d60.00481097.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 47 KiB |
|
@ -3,6 +3,7 @@ const sideBarResAccount = document.querySelector('.side-bar-responsive')
|
|||
const sideBarAccount = document.getElementById('side-bar-account')
|
||||
|
||||
window.onload = () => {
|
||||
generateColors()
|
||||
if(window.location.pathname.includes('changeName')) change.name()
|
||||
else if(window.location.pathname.includes('changeCountry')) change.country()
|
||||
else if(window.location.pathname.includes('changePassword')) change.password()
|
||||
|
@ -26,11 +27,13 @@ function responsive() {
|
|||
sideBarResAccount.classList.add('disable')
|
||||
}
|
||||
}
|
||||
if(mainImgContainer)
|
||||
if(mainImgContainer.classList.contains('disable')) mainImgContainer.classList.remove('disable')
|
||||
|
||||
|
||||
async function logout(string) {
|
||||
await fetch(`../include/logout.inc.php`)
|
||||
openLinks(filePath.headlines + string);
|
||||
openLinks('/'+filePath.headlines+string);
|
||||
}
|
||||
|
||||
function openLinks(string) { window.location.replace(websiteURL + string) }
|
||||
|
@ -181,7 +184,7 @@ const check = {
|
|||
body: createFormData('name', array)
|
||||
})
|
||||
const data = await res.text()
|
||||
if(data === 'success') openLinks('account/personal.php')
|
||||
if(data === 'success') openLinks('/account/personal.php')
|
||||
},
|
||||
gender : async() => {
|
||||
if(!document.querySelector('.gender-container .active')) {
|
||||
|
@ -194,7 +197,7 @@ const check = {
|
|||
body: createFormData('gender', array)
|
||||
})
|
||||
const data = await res.text()
|
||||
if(data === 'success') openLinks('account/personal.php')
|
||||
if(data === 'success') openLinks('/account/personal.php')
|
||||
},
|
||||
country : async() => {
|
||||
if(!document.querySelector('.country-container .active')) {
|
||||
|
@ -207,7 +210,7 @@ const check = {
|
|||
body: createFormData('country', array)
|
||||
})
|
||||
const data = await res.text()
|
||||
if(data === 'success') openLinks('account/personal.php')
|
||||
if(data === 'success') openLinks('/account/personal.php')
|
||||
|
||||
},
|
||||
psw : async() => {
|
||||
|
@ -227,7 +230,7 @@ const check = {
|
|||
})
|
||||
const data = await res.text()
|
||||
console.log(data)
|
||||
if(data === 'success') openLinks('account/personal.php')
|
||||
if(data === 'success') openLinks('/account/personal.php')
|
||||
else error.passwordOldAfter()
|
||||
}
|
||||
}
|
||||
|
@ -361,3 +364,74 @@ function managePasswordVisibility(element) {
|
|||
else if(element.parentElement.firstElementChild.lastElementChild === pswOldInput) pswOldInput.type = 'password'
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function addAdmin(element) {
|
||||
element.parentElement.firstElementChild.classList.add('disable')
|
||||
element.parentElement.lastElementChild.classList.remove('disable')
|
||||
admin('addAdmin', element.parentElement.parentElement.children[1].innerHTML.trim())
|
||||
}
|
||||
|
||||
function removeAdmin(element) {
|
||||
element.parentElement.firstElementChild.classList.remove('disable')
|
||||
element.parentElement.lastElementChild.classList.add('disable')
|
||||
admin('removeAdmin', element.parentElement.parentElement.children[1].innerHTML.trim())
|
||||
}
|
||||
|
||||
async function admin(action, email) {
|
||||
|
||||
const res = await fetch('../include/update.inc.php', {
|
||||
method: "POST",
|
||||
body: createFormData(action, email)
|
||||
})
|
||||
const data = await res.text()
|
||||
console.log(data)
|
||||
}
|
||||
|
||||
let imageUploadActive = false
|
||||
let currentImageUploadLocation
|
||||
async function submitProfileImageUploadForm() {
|
||||
|
||||
if(document.getElementById('file-upload').value) {
|
||||
|
||||
let photo = document.getElementById("file-upload").files[0]
|
||||
let formData = new FormData()
|
||||
|
||||
formData.append('file', photo)
|
||||
|
||||
const response = await fetch('../include/uploadFile.inc.php', {
|
||||
method: "POST",
|
||||
body: formData
|
||||
})
|
||||
const text = await response.text()
|
||||
if(text === 'too big') errorSpanUploadImage.innerHTML = `${icon} Max file size is 1MB`
|
||||
else if(text === 'error') errorSpanUploadImage.innerHTML = `${icon} There have been some sort of an error`
|
||||
else if(text === 'extension not allowed') errorSpanUploadImage.innerHTML = `${icon} Only jpeg, jpg, png are allowed`
|
||||
else {
|
||||
imageUploadActive = true
|
||||
errorSpanUploadImage.classList.remove('red-color')
|
||||
errorSpanUploadImage.classList.add('light-green-color')
|
||||
errorSpanUploadImage.innerHTML = 'Image has been successfully added'
|
||||
|
||||
currentImageUploadLocation = text.split(' ')[1]
|
||||
|
||||
array = JSON.stringify(['0', currentImageUploadLocation])
|
||||
const res = await fetch('../include/update.inc.php', {
|
||||
method: "POST",
|
||||
body: createFormData('imageUpload', array)
|
||||
})
|
||||
const data = await res.text()
|
||||
console.log(data)
|
||||
}
|
||||
document.getElementById('file-upload').value = ''
|
||||
|
||||
} else imageNameLabel.innerHTML = 'No file selected'
|
||||
|
||||
}
|
||||
function fileChange() {
|
||||
console.log(document.querySelector('.insert-photo-container .footer'))
|
||||
document.querySelector('.insert-photo-container .footer .footer').classList.remove('disable')
|
||||
let a = document.getElementById('file-upload').value.split(`fakepath`).pop().replace(/\\/g, '')
|
||||
a = a.substring(0, 20)+'...'
|
||||
imageNameLabel.innerHTML = a
|
||||
}
|
||||
|
|
23
JS/main.js
23
JS/main.js
|
@ -4,16 +4,16 @@ let weatherArrayTommorow
|
|||
let weatherArray2Days
|
||||
|
||||
const weather = {
|
||||
async getweather() {
|
||||
city = changeDiacritics(userLocationInformationValue[3])
|
||||
const key = php.info('weather')
|
||||
getweather : async function () {
|
||||
city = removeDiacritics(userLocationInformationValue[3])
|
||||
const key = await php.info('weather')
|
||||
const response = await fetch(`https://cors-anywhere.herokuapp.com/https://api.weatherapi.com/v1/forecast.json?key=${key}&q=${city}&days=7`)
|
||||
const data = await response.json()
|
||||
weatherArrayToday = data.forecast.forecastday[0]
|
||||
weatherArrayTommorow = data.forecast.forecastday[1]
|
||||
weatherArray2Days = data.forecast.forecastday[2]
|
||||
},
|
||||
updateWeather() {
|
||||
updateWeather : function () {
|
||||
let header = document.querySelectorAll('.weather-main-header')[0]
|
||||
header.children[0].src = weatherArrayToday.day.condition.icon
|
||||
header.children[1].innerHTML = userLocationInformationValue[3]
|
||||
|
@ -23,8 +23,10 @@ const weather = {
|
|||
let tommorowNumber = weatherDate.getDay()
|
||||
let dayAfterTomorrow = weatherDate.getDay()
|
||||
|
||||
if(tommorowNumber == 6) tommorowNumber = tommorowNumber - 7
|
||||
if(dayAfterTomorrow == 5 || dayAfterTomorrow == 6) dayAfterTomorrow = dayAfterTomorrow - 7
|
||||
if (tommorowNumber == 6)
|
||||
tommorowNumber = tommorowNumber - 7
|
||||
if (dayAfterTomorrow == 5 || dayAfterTomorrow == 6)
|
||||
dayAfterTomorrow = dayAfterTomorrow - 7
|
||||
|
||||
let dayAcronymTommorow = daysAcronyms[tommorowNumber + 1]
|
||||
let dayAcronymIn2Days = daysAcronyms[dayAfterTomorrow + 2]
|
||||
|
@ -273,9 +275,9 @@ window.onload = async () => {
|
|||
// Close all open windows
|
||||
hideExtraSearchOptions()
|
||||
hideSuggestWords()
|
||||
generateColors()
|
||||
|
||||
if(window.location.hash === '#login') manageLoginOptions()
|
||||
|
||||
document.querySelectorAll('input').forEach(input => { input.autocomplete = 'off' })
|
||||
|
||||
error.window()
|
||||
|
@ -388,10 +390,11 @@ function fahrenheitToKelvin(number) { return (number - 32) * 5/9 + 273 }
|
|||
|
||||
/* HEADLINES */
|
||||
async function headlines() {
|
||||
// await weather.getWeather()
|
||||
// weather.updateWeather()
|
||||
|
||||
pathLocation = ''
|
||||
await user.location()
|
||||
await weather.getweather()
|
||||
weather.updateWeather()
|
||||
|
||||
sidebarCategorySelect(document.querySelector('.fa-newspaper').parentElement.parentElement)
|
||||
|
||||
historyPushState(window.location.origin + window.location.pathname, '', `?cou=${getCountryAcronym(selectedCountry.innerHTML.trim())}`,`&bg=${backgroundColor}`)
|
||||
|
|
16
JS/show.js
16
JS/show.js
|
@ -143,7 +143,7 @@ function manageExtraProfileOptions() {
|
|||
}
|
||||
}
|
||||
|
||||
function openLinks(string) { window.location.replace(websiteURL + string) }
|
||||
function openLinks(string) { window.location.replace(websiteURL +'/'+ string) }
|
||||
const insertContainer = document.getElementById('insert-photo-container')
|
||||
function showProfileImg() {
|
||||
if(mainImgContainer.classList.contains('active')) {
|
||||
|
@ -164,3 +164,17 @@ function manageInsertContainer() {
|
|||
else insertContainer.classList.add('active')
|
||||
}
|
||||
function openFolder() { document.getElementById('file-upload').click() }
|
||||
|
||||
function generateColors () {
|
||||
let parent = document.querySelector('.color-container')
|
||||
if(!parent) return
|
||||
for(let i = 0; i < colors.length; i++) {
|
||||
let divP = document.createElement('div')
|
||||
divP.classList.add('box-container')
|
||||
let div = document.createElement('div')
|
||||
div.classList.add('img','medium')
|
||||
div.style.backgroundColor = colors[i]
|
||||
divP.appendChild(div)
|
||||
parent.appendChild(divP)
|
||||
}
|
||||
}
|
|
@ -8,7 +8,7 @@
|
|||
const colors = ['rgb(211, 47, 47)','rgb(123, 31, 162)','rgb(81, 45, 168)','rgb(48, 63, 159)','rgb(25, 118, 210)','rgb(2, 136, 209)','rgb(0, 151, 167)','rgb(0, 121, 107)','rgb(56, 142, 60)','rgb(104, 159, 56)','rgb(175, 180, 43)','rgb(251, 192, 45)','rgb(255, 160, 0)','rgb(245, 124, 0)','rgb(230, 74, 25)','rgb(93, 64, 55)','rgb(97, 97, 97)']
|
||||
const days = ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday']
|
||||
const daysAcronyms = ['Sun','Mon','Tue','Wed','Thu','Fri','Sat']
|
||||
const websiteURL = 'http://localhost:8080/News-website/'
|
||||
const websiteURL = 'http://localhost:8080/News-website'
|
||||
// const websiteURL = 'https://news.niktopler.com'
|
||||
|
||||
const topStoriesURL = '&t=topstories&'
|
||||
|
@ -66,12 +66,15 @@
|
|||
const showCountriesLink = document.getElementById('show-countries-button')
|
||||
let sclSpan
|
||||
let sclStrong
|
||||
const mainImgContainer = document.getElementById('main-img-container')
|
||||
const mainImgContainer = document.querySelector('#main-img-container.main-img-container')
|
||||
if(showCountriesLink !== null) {
|
||||
sclSpan = showCountriesLink.firstElementChild.firstElementChild
|
||||
sclStrong = showCountriesLink.firstElementChild.lastElementChild
|
||||
}
|
||||
|
||||
const imageNameLabel = document.getElementById('image-name-label')
|
||||
const errorSpanUploadImage = document.getElementById('error-span-upload-image')
|
||||
|
||||
const main = document.getElementById('main')
|
||||
const overlay = document.getElementById('overlay')
|
||||
const navigationBarProfileImageDiv = document.getElementById('outter-container')
|
||||
|
|
|
@ -3,28 +3,31 @@
|
|||
<div class="side-bar-container" id="side-bar-container">
|
||||
<div>
|
||||
<div class="side-bar-content" id="side-bar-content">
|
||||
<div class="sidebar-category <?php if(strpos($_SERVER['REQUEST_URI'], 'home')) echo 'active'; ?>" onclick="openLinks('account/home.php')">
|
||||
<div class="sidebar-category <?php if(strpos($_SERVER['REQUEST_URI'], 'home')) echo 'active'; ?>" onclick="openLinks('/account/home.php')">
|
||||
<div class="icon"><i class="fas fa-user-circle fa-lg"></i></div>
|
||||
<div><a href="#">Home</a></div>
|
||||
</div>
|
||||
<div class="sidebar-category <?php if(strpos($_SERVER['REQUEST_URI'], 'personal')) echo 'active'; ?>" onclick="openLinks('account/personal.php')">
|
||||
<div class="sidebar-category <?php if(strpos($_SERVER['REQUEST_URI'], 'personal')) echo 'active'; ?>" onclick="openLinks('/account/personal.php')">
|
||||
<div class="icon"><i class="far fa-id-card-alt fa-lg"></i></div>
|
||||
<div><a href="#">Personal Information</a></div>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
if($_SESSION['admin'] != 'no')
|
||||
echo '<div class="sidebar-category <?php if(strpos($_SERVER[\'REQUEST_URI\'], \'admin\')) echo \'active\'; ?>" onclick="openLinks(\'account/admin.php\')">
|
||||
$admin = '';
|
||||
$trending = '';
|
||||
if(strpos($_SERVER['REQUEST_URI'], 'admin')) $admin = 'active';
|
||||
if(strpos($_SERVER['REQUEST_URI'], 'trending')) $trending = 'active';
|
||||
|
||||
echo '<div class="sidebar-category '.$admin.'" onclick="openLinks(\'/account/admin.php\')">
|
||||
<div class="icon"><i class="fas fa-users-crown fa-lg"></i></div>
|
||||
<div><a href="#" class="side-menu-categories">Admin</a></div>
|
||||
</div>
|
||||
<div class="sidebar-category <?php if(strpos($_SERVER[\'REQUEST_URI\'], \'trending\')) echo \'active\'; ?>" onclick="openLinks(\'account/trending.php\')">
|
||||
<div class="sidebar-category '.$trending.'" onclick="openLinks(\'/account/trending.php\')">
|
||||
<div class="icon"><i class="far fa-chart-line fa-lg"></i></div>
|
||||
<div><a href="#" class="side-menu-categories">Trending Section</a></div>
|
||||
</div>';
|
||||
|
||||
?>
|
||||
<div class="sidebar-category <?php if(strpos($_SERVER['REQUEST_URI'], 'settings')) echo 'active'; ?>" onclick="openLinks('account/settings.php')">
|
||||
<div class="sidebar-category <?php if(strpos($_SERVER['REQUEST_URI'], 'settings')) echo 'active'; ?>" onclick="openLinks('/account/settings.php')">
|
||||
<div class="icon"><i class="fas fa-user-cog fa-lg"></i></div>
|
||||
<div><a href="#" class="side-menu-categories">Settings</a></div>
|
||||
</div>
|
||||
|
@ -36,13 +39,13 @@
|
|||
<div class="side-bar-responsive disable">
|
||||
<div class="slide">
|
||||
<ul class="res-container">
|
||||
<li class="content-container" onclick="openLinks('account/home.php')">
|
||||
<li class="content-container" onclick="openLinks('/account/home.php')">
|
||||
<div>
|
||||
<div class="<?php if(strpos($_SERVER['REQUEST_URI'], 'home')) echo 'active'; ?>"></div>
|
||||
<span class="<?php if(strpos($_SERVER['REQUEST_URI'], 'home')) echo 'active'; ?>">Home</span>
|
||||
</div>
|
||||
</li>
|
||||
<li class="content-container" onclick="openLinks('account/personal.php')">
|
||||
<li class="content-container" onclick="openLinks('/account/personal.php')">
|
||||
<div>
|
||||
<div class="<?php if(strpos($_SERVER['REQUEST_URI'], 'personal')) echo 'active'; ?>"></div>
|
||||
<span class="<?php if(strpos($_SERVER['REQUEST_URI'], 'personal')) echo 'active'; ?>">Personal Info</span>
|
||||
|
@ -51,22 +54,27 @@
|
|||
<?php
|
||||
|
||||
if($_SESSION['admin'] != 'no')
|
||||
echo ' <li class="content-container" onclick="openLinks(\'account/admin.php\')">
|
||||
$admin = '';
|
||||
$trending = '';
|
||||
if(strpos($_SERVER['REQUEST_URI'], 'admin')) $admin = 'active';
|
||||
if(strpos($_SERVER['REQUEST_URI'], 'trending')) $trending = 'active';
|
||||
|
||||
echo ' <li class="content-container" onclick="openLinks(\'/account/admin.php\')">
|
||||
<div>
|
||||
<div class="<?php if(strpos($_SERVER[\'REQUEST_URI\'], \'admin\')) echo \'active\'; ?>"></div>
|
||||
<span class="<?php if(strpos($_SERVER[\'REQUEST_URI\'], \'admin\')) echo \'active\'; ?>">Admin</span>
|
||||
<div class="'.$admin.'"></div>
|
||||
<span class="'.$admin.'">Admin</span>
|
||||
</div>
|
||||
</li>
|
||||
<li class="content-container" onclick="openLinks(\'account/trending.php\')">
|
||||
<li class="content-container" onclick="openLinks(\'/account/trending.php\')">
|
||||
<div>
|
||||
<div class="<?php if(strpos($_SERVER[\'REQUEST_URI\'], \'trending\')) echo \'active\'; ?>"></div>
|
||||
<span class="<?php if(strpos($_SERVER[\'REQUEST_URI\'], \'trending\')) echo \'active\'; ?>">Trending</span>
|
||||
<div class="'.$trending.'"></div>
|
||||
<span class="'.$trending.'">Trending</span>
|
||||
</div>
|
||||
</li>';
|
||||
|
||||
?>
|
||||
|
||||
<li class="content-container" onclick="openLinks('account/settings.php')">
|
||||
<li class="content-container" onclick="openLinks('/account/settings.php')">
|
||||
<div>
|
||||
<div class="<?php if(strpos($_SERVER['REQUEST_URI'], 'settings')) echo 'active'; ?>"></div>
|
||||
<span class="<?php if(strpos($_SERVER['REQUEST_URI'], 'settings')) echo 'active'; ?>">Settings</span>
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
if($_SESSION['admin'] == 'no') header("location:../headlines.php");
|
||||
?>
|
||||
|
||||
<body>
|
||||
<body>
|
||||
|
||||
<nav class="account">
|
||||
<div class="left">
|
||||
|
@ -36,96 +36,99 @@
|
|||
Manage user privileges
|
||||
</p>
|
||||
</div>
|
||||
<article class="admin-panel">
|
||||
<section>
|
||||
<div class="ca"><span>Name</span></div>
|
||||
<div class="ca"><span>Email</span></div>
|
||||
<div class="ca"><span>Country</span></div>
|
||||
<div class="ca"><span>Name</span></div>
|
||||
<div class="ca"></div>
|
||||
</section>
|
||||
<section>
|
||||
<div class="ca">Nik Topler</div>
|
||||
<div class="ca">nik.topler21@gmail.com</div>
|
||||
<div class="ca">Slovenia</div>
|
||||
<div class="ca">Admin</div>
|
||||
<div class="ca"><div class="icon"><i class="far fa-plus fa-lg"></i></div></i></div>
|
||||
</section>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Name</th>
|
||||
<th scope="col">Email</th>
|
||||
<th scope="col">Country</th>
|
||||
<th scope="col">Status</th>
|
||||
<th scope="col"> </th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
|
||||
<section>
|
||||
<div class="ca">Nik Topler</div>
|
||||
<div class="ca">nik.topler21@gmail.com</div>
|
||||
<div class="ca">Slovenia</div>
|
||||
<div class="ca">Admin</div>
|
||||
<div class="ca"><div class="icon"><i class="far fa-plus fa-lg"></i></div></i></div>
|
||||
</section>
|
||||
include_once '../include/db.inc.php';
|
||||
|
||||
<section>
|
||||
<div class="ca">Nik Topler</div>
|
||||
<div class="ca">nik.topler21@gmail.com</div>
|
||||
<div class="ca">Slovenia</div>
|
||||
<div class="ca">Admin</div>
|
||||
<div class="ca"><div class="icon"><i class="far fa-plus fa-lg"></i></div></i></div>
|
||||
</section>
|
||||
class generateUsers extends Dbh {
|
||||
|
||||
<section>
|
||||
<div class="ca">Nik Topler</div>
|
||||
<div class="ca">nik.topler21@gmail.com</div>
|
||||
<div class="ca">Slovenia</div>
|
||||
<div class="ca">Admin</div>
|
||||
<div class="ca"><div class="icon"><i class="far fa-plus fa-lg"></i></div></i></div>
|
||||
</section>
|
||||
<section>
|
||||
<div class="ca">Nik Topler</div>
|
||||
<div class="ca">nik.topler21@gmail.com</div>
|
||||
<div class="ca">Slovenia</div>
|
||||
<div class="ca">Admin</div>
|
||||
<div class="ca"><div class="icon"><i class="far fa-plus fa-lg"></i></div></i></div>
|
||||
</section>
|
||||
<section>
|
||||
<div class="ca">Nik Topler</div>
|
||||
<div class="ca">nik.topler21@gmail.com</div>
|
||||
<div class="ca">Slovenia</div>
|
||||
<div class="ca">Admin</div>
|
||||
<div class="ca"><div class="icon"><i class="far fa-plus fa-lg"></i></div></i></div>
|
||||
</section>
|
||||
<section>
|
||||
<div class="ca">Nik Topler</div>
|
||||
<div class="ca">nik.topler21@gmail.com</div>
|
||||
<div class="ca">Slovenia</div>
|
||||
<div class="ca">Admin</div>
|
||||
<div class="ca"><div class="icon"><i class="far fa-plus fa-lg"></i></div></i></div>
|
||||
</section>
|
||||
<section>
|
||||
<div class="ca">Nik Topler</div>
|
||||
<div class="ca">nik.topler21@gmail.com</div>
|
||||
<div class="ca">Slovenia</div>
|
||||
<div class="ca">Admin</div>
|
||||
<div class="ca"><div class="icon"><i class="far fa-plus fa-lg"></i></div></i></div>
|
||||
</section>
|
||||
<section>
|
||||
<div class="ca">Nik Topler</div>
|
||||
<div class="ca">nik.topler21@gmail.com</div>
|
||||
<div class="ca">Slovenia</div>
|
||||
<div class="ca">Admin</div>
|
||||
<div class="ca"><div class="icon"><i class="far fa-plus fa-lg"></i></div></i></div>
|
||||
</section>
|
||||
<section>
|
||||
<div class="ca">Nik Topler</div>
|
||||
<div class="ca">nik.topler21@gmail.com</div>
|
||||
<div class="ca">Slovenia</div>
|
||||
<div class="ca">Admin</div>
|
||||
<div class="ca"><div class="icon"><i class="far fa-plus fa-lg"></i></div></i></div>
|
||||
</section>
|
||||
<section>
|
||||
<div class="ca">Nik Topler</div>
|
||||
<div class="ca">nik.topler21@gmail.com</div>
|
||||
<div class="ca">Slovenia</div>
|
||||
<div class="ca">Admin</div>
|
||||
<div class="ca"><div class="icon"><i class="far fa-plus fa-lg"></i></div></i></div>
|
||||
</section>
|
||||
public function generate() {
|
||||
$sql = "SELECT * FROM users";
|
||||
$stmt = $this->connect()->prepare($sql);
|
||||
$stmt->execute();
|
||||
$row = $stmt->fetch();
|
||||
while($row = $stmt->fetch()) {
|
||||
|
||||
</article>
|
||||
if($_SESSION['email'] != $row['email']) {
|
||||
echo '<tr>';
|
||||
echo '<td>';
|
||||
$name = 'No name set';
|
||||
if(isset($row['name'])) $name = $row['name'];
|
||||
if(isset($row['surname'])) $name = $name.' '.$row['surname'];
|
||||
echo $name;
|
||||
echo '</td>';
|
||||
echo '<td>';
|
||||
echo $row['email'];
|
||||
echo '</td>';
|
||||
echo '<td>';
|
||||
echo $this->getCountryNameWithID($row['country_id']);
|
||||
echo '</td>';
|
||||
echo '<td>';
|
||||
if($this->checkIfIsUserAdmin($row['id']) == 'yes' ) $admin = 'admin';
|
||||
else $admin = 'user';
|
||||
echo $admin;
|
||||
echo '</td>';
|
||||
echo '<td>';
|
||||
if($admin == 'admin') {
|
||||
$add = 'disable';
|
||||
$remove = '';
|
||||
} else {
|
||||
$remove = 'disable';
|
||||
$add = '';
|
||||
}
|
||||
echo '<div class="plus-icon-container '.$add.'" onclick="addAdmin(this)">
|
||||
<div>
|
||||
<i class="far fa-plus"></i>
|
||||
</div>
|
||||
<span class="tooltiptext tooltiptextTop130">Add</span>
|
||||
|
||||
</div>
|
||||
<div class="trash-icon-container '.$remove.'" onclick="removeAdmin(this)">
|
||||
<i class="fas fa-trash-alt"></i>
|
||||
<span class="tooltiptext tooltiptextTop130">Remove</span>
|
||||
</div>';
|
||||
echo '</td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public function getCountryNameWithID($id) {
|
||||
$sql = "SELECT * FROM countries WHERE id = ?";
|
||||
$stmt = $this->connect()->prepare($sql);
|
||||
$stmt->execute([$id]);
|
||||
$row = $stmt->fetch();
|
||||
return $row['name'];
|
||||
}
|
||||
public function checkIfIsUserAdmin($id) {
|
||||
$sql = "SELECT * FROM admins WHERE user_id = ?";
|
||||
$stmt = $this->connect()->prepare($sql);
|
||||
$stmt->execute([$id]);
|
||||
$row = $stmt->fetch();
|
||||
if($row) return 'yes';
|
||||
else return 'no';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$generateObj = new generateUsers();
|
||||
$generateObj->generate();
|
||||
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
|
@ -133,5 +136,6 @@
|
|||
|
||||
</main>
|
||||
|
||||
</body>
|
||||
</body>
|
||||
|
||||
</html>
|
|
@ -24,8 +24,11 @@
|
|||
<section class="header">
|
||||
<div class="img-container">
|
||||
<?php
|
||||
$path = '../';
|
||||
if(strpos($_SERVER['REQUEST_URI'], 'search') || strpos($_SERVER['REQUEST_URI'], 'headlines')) $path = '';
|
||||
|
||||
if($_SESSION['profile_choice'] == 0)
|
||||
echo ('<div class="img xxl" onclick="changeProfileImg()" ><img src="'.$_SESSION['profile_img'].'" class="imga"></div>');
|
||||
echo ('<div class="img xxl" onclick="changeProfileImg()" ><img src="'.$path.$_SESSION['profile_img'].'" class="imga"></div>');
|
||||
else if($_SESSION['profile_choice'] == 1)
|
||||
echo ('<div class="img xxl" onclick="changeProfileImg()" style="background-color: '.$_SESSION['profile_color'].';">
|
||||
<div class="letter">
|
||||
|
@ -68,7 +71,7 @@
|
|||
<strong>Note: </strong>Some personal information can change the way website works.
|
||||
</p>
|
||||
</div>
|
||||
<div class="button" onclick="openLinks('account/personal.php')">
|
||||
<div class="button" onclick="openLinks('/account/personal.php')">
|
||||
<a href="#">Manage your Personal Information</a>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -79,7 +82,7 @@
|
|||
Customize your account based on your prefrences.
|
||||
</p>
|
||||
</div>
|
||||
<div class="button" onclick="openLinks('account/settings.php')">
|
||||
<div class="button" onclick="openLinks('/account/settings.php')">
|
||||
<a href="#">Open Settings</a>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -96,7 +99,7 @@
|
|||
<strong>Note: </strong> this page is only for website moderators.
|
||||
</p>
|
||||
</div>
|
||||
<div class="button" onclick="openLinks(\'account/admin.php\')">
|
||||
<div class="button" onclick="openLinks(\'/account/admin.php\')">
|
||||
<a href="#">Manage Admins</a>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -107,7 +110,7 @@
|
|||
Select news articles, that are going to be featured in the trending section.
|
||||
</p>
|
||||
</div>
|
||||
<div class="button" onclick="openLinks(\'account/trending.php\')">
|
||||
<div class="button" onclick="openLinks(\'/account/trending.php\')">
|
||||
<a href="#">Edit Trending section</a>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
<?php include 'add-ons/head.php' ?>
|
||||
|
||||
<body>
|
||||
<?php include '../add-ons/profileImg.php' ?>
|
||||
<nav class="account">
|
||||
<div class="left">
|
||||
<div class="container">
|
||||
|
@ -16,6 +15,7 @@
|
|||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<main>
|
||||
<?php include 'add-ons/side-bar.php' ?>
|
||||
|
||||
|
@ -44,7 +44,7 @@
|
|||
<div class="image">
|
||||
<?php
|
||||
if($_SESSION['profile_choice'] == 0)
|
||||
echo ('<div class="img medium" ><img src="'.$_SESSION['profile_img'].'" class="imga"></div>');
|
||||
echo ('<div class="img medium" ><img src="../'.$_SESSION['profile_img'].'" class="imga"></div>');
|
||||
else if($_SESSION['profile_choice'] == 1)
|
||||
echo ('<div class="img medium" style="background-color: '.$_SESSION['profile_color'].';">
|
||||
<div class="letter">
|
||||
|
@ -60,7 +60,7 @@
|
|||
?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="info" onclick="openLinks('account/changeName.php')">
|
||||
<div class="info" onclick="openLinks('/account/changeName.php')">
|
||||
<div class="line"></div>
|
||||
<div class="title">
|
||||
<h3>Name</h3>
|
||||
|
@ -79,7 +79,7 @@
|
|||
<i class="far fa-angle-right fa-lg"></i>
|
||||
</div>
|
||||
</div>
|
||||
<div class="info" onclick="openLinks('account/changeGender.php')">
|
||||
<div class="info" onclick="openLinks('/account/changeGender.php')">
|
||||
<div class="line"></div>
|
||||
<div class="title">
|
||||
<h3>Gender</h3>
|
||||
|
@ -96,7 +96,7 @@
|
|||
<i class="far fa-angle-right fa-lg"></i>
|
||||
</div>
|
||||
</div>
|
||||
<div class="info" onclick="openLinks('account/changeCountry.php?cou=<?php if(isset($_SESSION['country'])) echo $_SESSION['country'][1]?>')">
|
||||
<div class="info" onclick="openLinks('/account/changeCountry.php?cou=<?php if(isset($_SESSION['country'])) echo $_SESSION['country'][1]?>')">
|
||||
<div class="line"></div>
|
||||
<div class="title">
|
||||
<h3>Country</h3>
|
||||
|
@ -113,7 +113,7 @@
|
|||
<i class="far fa-angle-right fa-lg"></i>
|
||||
</div>
|
||||
</div>
|
||||
<div class="info psw" onclick="openLinks('account/changePassword.php')">
|
||||
<div class="info psw" onclick="openLinks('/account/changePassword.php')">
|
||||
<div class="line"></div>
|
||||
<div class="title">
|
||||
<h3>Password</h3>
|
||||
|
@ -164,6 +164,8 @@
|
|||
|
||||
</div>
|
||||
</main>
|
||||
<?php include '../add-ons/profileImg.php' ?>
|
||||
|
||||
<div class="fixed" id="overlay"></div>
|
||||
</body>
|
||||
</html>
|
|
@ -4,11 +4,15 @@
|
|||
<div class="outter-container border-radius-50 pointer <?php if(!isset($_SESSION['id'])) echo 'disable'?>" id="outter-container">
|
||||
<div>
|
||||
<?php
|
||||
$path = '../';
|
||||
if(strpos($_SERVER['REQUEST_URI'], 'search') || strpos($_SERVER['REQUEST_URI'], 'headlines')) $path = '';
|
||||
|
||||
|
||||
if(!strpos($_SERVER['REQUEST_URI'], 'change')) $str = 'onclick="manageExtraProfileOptions()"';
|
||||
else $str = '';
|
||||
|
||||
if($_SESSION['profile_choice'] == 0)
|
||||
echo ('<div class="img small" '.$str.'><img src="'.$_SESSION['profile_img'].'" class="imga"></div>');
|
||||
echo ('<div class="img small" '.$str.'><img src="'.$path.$_SESSION['profile_img'].'" class="imga"></div>');
|
||||
else if($_SESSION['profile_choice'] == 1)
|
||||
echo ('<div class="img small" '.$str.' style="background-color: '.$_SESSION['profile_color'].';">
|
||||
<div class="letter">
|
||||
|
@ -47,20 +51,23 @@
|
|||
<div class="img-middle">
|
||||
<div>
|
||||
<?php
|
||||
$path = '../';
|
||||
if(strpos($_SERVER['REQUEST_URI'], 'search') || strpos($_SERVER['REQUEST_URI'], 'headlines')) $path = '';
|
||||
|
||||
if($_SESSION['profile_choice'] == 0)
|
||||
echo ('<div class="img big" onclick="openLinks(\'account/home.php\')" ><img src="'.$_SESSION['profile_img'].'" class="imga"></div>');
|
||||
echo ('<div class="img big" onclick="openLinks(\'/account/home.php\')" ><img src="'.$path.$_SESSION['profile_img'].'" class="imga"></div>');
|
||||
else if($_SESSION['profile_choice'] == 1)
|
||||
echo ('<div class="img big" onclick="openLinks(\'account/home.php\')" style="background-color: '.$_SESSION['profile_color'].';">
|
||||
echo ('<div class="img big" onclick="openLinks(\'/account/home.php\')" style="background-color: '.$_SESSION['profile_color'].';">
|
||||
<div class="letter">
|
||||
<span>'.$_SESSION['letter'].'</span>
|
||||
</div>
|
||||
</div>');
|
||||
else if($_SESSION['profile_choice'] == 2)
|
||||
echo ('<div class="img big" onclick="openLinks(\'account/home.php\')"><img src="'.$_SESSION['google_profile_img'].'" class="imga"></div>');
|
||||
echo ('<div class="img big" onclick="openLinks(\'/account/home.php\')"><img src="'.$_SESSION['google_profile_img'].'" class="imga"></div>');
|
||||
else if($_SESSION['profile_choice'] == 3)
|
||||
echo ('<div class="img big" onclick="openLinks(\'account/home.php\')"><img src="'.$_SESSION['facebook_profile_img'].'" class="imga"></div>');
|
||||
echo ('<div class="img big" onclick="openLinks(\'/account/home.php\')"><img src="'.$_SESSION['facebook_profile_img'].'" class="imga"></div>');
|
||||
else if($_SESSION['profile_choice'] == 4)
|
||||
echo ('<div class="img big" onclick="openLinks(\'account/home.php\')"><img src="'.$_SESSION['github_profile_img'].'" class="imga"></div>');
|
||||
echo ('<div class="img big" onclick="openLinks(\'/account/home.php\')"><img src="'.$_SESSION['github_profile_img'].'" class="imga"></div>');
|
||||
?>
|
||||
</div>
|
||||
<div class="camera-container" onclick="showProfileImg()">
|
||||
|
@ -80,13 +87,13 @@
|
|||
<?php
|
||||
|
||||
if(strpos($_SERVER['REQUEST_URI'], 'account'))
|
||||
echo '<div class="container" onclick="openLinks(\'headlines.php\')">
|
||||
echo '<div class="container" onclick="openLinks(\'/headlines.php\')">
|
||||
<span>
|
||||
Browse latest news articles
|
||||
</span>
|
||||
</div>';
|
||||
else
|
||||
echo '<div class="container" onclick="openLinks(\'account/home.php\')">
|
||||
echo '<div class="container" onclick="openLinks(\'/account/home.php\')">
|
||||
<span>
|
||||
Manage your account
|
||||
</span>
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<div class="menu-burger-icon">
|
||||
</div>
|
||||
</figure>
|
||||
<a href="#" onclick="openLinks('headlines.php')" class="logo">Fews</a>
|
||||
<a href="#" onclick="openLinks('/headlines.php')" class="logo">Fews</a>
|
||||
</div>
|
||||
|
||||
<div class="nav-search flex align-center justify-center relative" id="navigation-bar-middle">
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
<div class="main-img-container" id="main-img-container">
|
||||
|
||||
<div class="main-img-container disable" id="main-img-container">
|
||||
<header>
|
||||
<h1>Change Profile Image</h1>
|
||||
</header>
|
||||
|
@ -20,23 +19,26 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<section class="insert-photo-container" id="insert-photo-container" onclick="openFolder()">
|
||||
<section class="insert-photo-container" id="insert-photo-container">
|
||||
<div class="main-insert-photo-container">
|
||||
<div class="img-text">
|
||||
<p>Click on grey area and add image</p>
|
||||
</div>
|
||||
<div class="select-img">
|
||||
<div><span class="error-span-upload-image red-color" id="error-span-upload-image"></span></div>
|
||||
|
||||
<div class="select-img" onclick="openFolder()">
|
||||
<div class="icon">
|
||||
<i class="fab fa-dropbox"></i>
|
||||
</div>
|
||||
</div>
|
||||
<div class="footer">
|
||||
<div class="file-name">
|
||||
<span></span>
|
||||
</div>
|
||||
<div class="button">
|
||||
<div>
|
||||
Upload
|
||||
<form action="include/uploadFile.inc.php" method="post" enctype="multipart/form-data" id="uploadProfileImageForm">
|
||||
<input type="file" hidden="hidden" id="file-upload" name="file" onChange='fileChange()'>
|
||||
</form>
|
||||
<div class="footer disable">
|
||||
<div class="name"><span class="image-name-label" id="image-name-label">Ime</span></div>
|
||||
<div class="button" onclick="submitProfileImageUploadForm()">
|
||||
Submit
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -45,7 +47,9 @@
|
|||
</section>
|
||||
<section class="color-img">
|
||||
<div class="img-text">
|
||||
<p>Select image from your computer or type in a link</p>
|
||||
<p>Select a color you like</p>
|
||||
</div>
|
||||
<div class="color-container">
|
||||
</div>
|
||||
</section>
|
||||
<div class="x" onclick="showProfileImg()" >
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
<link rel="stylesheet" href="CSS/*.css">
|
||||
<link rel="stylesheet" href="CSS/index.css">
|
||||
<link rel="stylesheet" href="CSS/responsive.css">
|
||||
<link rel="shortcut icon" href="">
|
||||
|
||||
<script src="JS/variables.js" defer></script>
|
||||
<script src="JS/responsive.js" defer></script>
|
||||
|
@ -32,36 +33,28 @@
|
|||
|
||||
<?php include 'add-ons/side-bar.php' ?>
|
||||
|
||||
<section class="main-content-section grid" id="main-content-section">
|
||||
<!-- <header id="main-content-header" class="header-main-content search">
|
||||
<h1 class="search">Slovenia</h1>
|
||||
<section>
|
||||
<div>
|
||||
<figure class="circle" onclick="saveSearchWord(this)">
|
||||
<i class="fal fa-bookmark"></i>
|
||||
</figure>
|
||||
<figure class="rectangle" onclick="followSearchWord(this)">
|
||||
<i class="fa fa-star"></i> Follow
|
||||
</figure>
|
||||
</div>
|
||||
</section>
|
||||
</header> -->
|
||||
|
||||
<!-- <figure id="main-content-container">
|
||||
<header id="main-content-header" class="section-main-header header-main-content">
|
||||
<h1>Headlines</h1>
|
||||
<a href="#" class="blue-link flex" onclick="showCategoryNews()">Categories</a>
|
||||
</header>
|
||||
<article class="coronavirus-article grid article-other" id="coronavirus-article">
|
||||
<a href="#" class="blue-link" id="coronavirus-article-a">
|
||||
COVID-19 information:
|
||||
<span> See the lates coverage of coronavirus</span>
|
||||
</a>
|
||||
<i class="fas fa-chevron-right corona-arrow pointer"></i>
|
||||
<section class="main-content-section single headlines" id="main-content-section">
|
||||
<div class="main-content-container">
|
||||
<div class="article-container">
|
||||
|
||||
<article class="news">
|
||||
|
||||
<div>
|
||||
<h3>Hello World!</h3>
|
||||
<div>
|
||||
|
||||
</div>
|
||||
<div class="subtitle">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</article>
|
||||
|
||||
</figure> -->
|
||||
<!-- <aside id="main-side-content-container">
|
||||
</div>
|
||||
|
||||
<aside id="main-side-content-container">
|
||||
<article class="weather-article grid relative">
|
||||
<header class="weather-main-header grid">
|
||||
<img src="" alt="" class="flex align-center justify-center">
|
||||
|
@ -116,9 +109,31 @@
|
|||
</section>
|
||||
</footer>
|
||||
</article>
|
||||
</aside> -->
|
||||
</aside>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- <section class="main-content-section grid" id="main-content-section">
|
||||
<header id="main-content-header" class="header-main-content search">
|
||||
<h1 class="search">Headlines</h1>
|
||||
</header> -->
|
||||
|
||||
<!-- <figure id="main-content-container">
|
||||
<header id="main-content-header" class="section-main-header header-main-content">
|
||||
<h1>Headlines</h1>
|
||||
<a href="#" class="blue-link flex" onclick="showCategoryNews()">Categories</a>
|
||||
</header>
|
||||
<article class="coronavirus-article grid article-other" id="coronavirus-article">
|
||||
<a href="#" class="blue-link" id="coronavirus-article-a">
|
||||
COVID-19 information:
|
||||
<span> See the lates coverage of coronavirus</span>
|
||||
</a>
|
||||
<i class="fas fa-chevron-right corona-arrow pointer"></i>
|
||||
</article>
|
||||
|
||||
</figure> -->
|
||||
|
||||
|
||||
</main>
|
||||
|
||||
<?php include 'add-ons/navigation-bar.php' ?>
|
||||
|
|
|
@ -15,3 +15,20 @@
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
// class Dbh {
|
||||
// private $host = '';
|
||||
// private $dbName = 'niktople_Fews';
|
||||
// private $user = 'niktople_nik';
|
||||
// private $pwd = 'niktopler2002';
|
||||
// private $charset = 'utf8mb4';
|
||||
|
||||
// protected function connect() {
|
||||
// $dsn = 'mysql:host=' .$this->host. ';dbname=' .$this->dbName. ';charset=' .$this->charset ;
|
||||
// $pdo = new PDO($dsn, $this->user, $this->pwd);
|
||||
// $pdo->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC);
|
||||
// return $pdo;
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
<?php session_start();
|
||||
|
||||
echo $_SERVER['REQUEST_URI'];
|
||||
|
||||
if(isset($_SESSION['user_id'])) {
|
||||
|
||||
}
|
|
@ -98,6 +98,54 @@ class update extends Dbh {
|
|||
} else return 'wrong password';
|
||||
}
|
||||
|
||||
public function addAdmin($email) {
|
||||
if($this->checkIfUserExists($email) == 0) die;
|
||||
$sql = "INSERT INTO admins(user_id) VALUES((SELECT id FROM users WHERE email = ?))";
|
||||
$stmt = $this->connect()->prepare($sql);
|
||||
$stmt->execute([$email]);
|
||||
echo 'success';
|
||||
}
|
||||
|
||||
public function checkIfUserExists($email) {
|
||||
$sql = "SELECT * FROM users WHERE email = ?";
|
||||
$stmt = $this->connect()->prepare($sql);
|
||||
$stmt->execute([$email]);
|
||||
$row = $stmt->fetch();
|
||||
if($row) return 1;
|
||||
else return 0;
|
||||
}
|
||||
|
||||
public function removeAdmin($email) {
|
||||
if($this->checkIfUserExists($email) == 0) die;
|
||||
$sql = "DELETE FROM admins WHERE user_id = (SELECT id FROM users WHERE email = ?)";
|
||||
$stmt = $this->connect()->prepare($sql);
|
||||
$stmt->execute([$email]);
|
||||
echo 'success';
|
||||
}
|
||||
|
||||
public function imageUpload($info) {
|
||||
if($info[0] == '0') {
|
||||
$name = "profile_img";
|
||||
$num = 0;
|
||||
}
|
||||
$this->checkForImage();
|
||||
$sql = "UPDATE users SET profile_choice = ? WHERE email = ?";
|
||||
$stmt = $this->connect()->prepare($sql);
|
||||
$stmt->execute([$num, $_SESSION['email']]);
|
||||
|
||||
$sql = "UPDATE users SET ".$name." = ? WHERE email = ?";
|
||||
$stmt = $this->connect()->prepare($sql);
|
||||
$stmt->execute([$info[1], $_SESSION['email']]);
|
||||
$this->setSessionVariables($_SESSION['email']);
|
||||
echo 'success';
|
||||
}
|
||||
public function checkForImage() {
|
||||
$sql = 'SELECT * FROM users WHERE email = ?';
|
||||
$stmt = $this->connect()->prepare($sql);
|
||||
$stmt->execute([$_SESSION['email']]);
|
||||
$row = $stmt->fetch();
|
||||
if($row['profile_select'] == 0 && $row['profile_img'] != null) unlink('../'.$row['profile_img']);
|
||||
}
|
||||
}
|
||||
|
||||
$updateObj = new Update();
|
||||
|
@ -108,3 +156,7 @@ else if(isset($_POST['gender'])) $updateObj->gender(json_decode($_POST['gender']
|
|||
else if(isset($_POST['country'])) $updateObj->country(json_decode($_POST['country']));
|
||||
else if(isset($_POST['newPsw'])) $updateObj->newPsw(json_decode($_POST['newPsw']));
|
||||
else if(isset($_POST['oldPsw'])) $updateObj->oldPsw(json_decode($_POST['oldPsw']));
|
||||
else if(isset($_POST['addAdmin'])) $updateObj->addAdmin($_POST['addAdmin']);
|
||||
else if(isset($_POST['removeAdmin'])) $updateObj->removeAdmin($_POST['removeAdmin']);
|
||||
else if(isset($_POST['imageUpload'])) $updateObj->imageUpload(json_decode($_POST['imageUpload']));
|
||||
|
||||
|
|
38
include/uploadFile.inc.php
Normal file
38
include/uploadFile.inc.php
Normal file
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
|
||||
if($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$file = $_FILES['file'];
|
||||
|
||||
$fileName = $_FILES['file']['name'];
|
||||
$fileTmpName = $_FILES['file']['tmp_name'];
|
||||
$fileSize = $_FILES['file']['size'];
|
||||
$fileError = $_FILES['file']['error'];
|
||||
$fileType = $_FILES['file']['type'];
|
||||
|
||||
$fileExt = explode('.', $fileName);
|
||||
$fileActuallExt = strtolower(end($fileExt));
|
||||
|
||||
$allow = ['jpeg','jpg','png'];
|
||||
|
||||
if(in_array($fileActuallExt,$allow)){
|
||||
|
||||
if($fileError === 0){
|
||||
|
||||
if($fileSize <= 1000000){
|
||||
|
||||
$fileNewName = uniqid('',true).'.'.$fileActuallExt;
|
||||
$fileDestination = 'Images/'.$fileNewName;
|
||||
move_uploaded_file($fileTmpName,'../Images/'.$fileNewName);
|
||||
|
||||
$array = [$fileNewName, $fileDestination];
|
||||
|
||||
echo $array[0].' '.$array[1];
|
||||
|
||||
} else echo 'too big';
|
||||
|
||||
} else echo 'error';
|
||||
|
||||
} else echo 'extension not allowed';
|
||||
|
||||
} else header('location: ../index.php');
|
||||
|
|
@ -11,6 +11,7 @@
|
|||
<link rel="stylesheet" href="CSS/*.css">
|
||||
<link rel="stylesheet" href="CSS/index.css">
|
||||
<link rel="stylesheet" href="CSS/responsive.css">
|
||||
<link rel="shortcut icon" href="">
|
||||
|
||||
<script src="JS/variables.js" defer></script>
|
||||
<script src="JS/responsive.js" defer></script>
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
<link rel="stylesheet" href="CSS/*.css">
|
||||
<link rel="stylesheet" href="CSS/signin.css">
|
||||
<link rel="stylesheet" href="CSS/responsive.css">
|
||||
<link rel="shortcut icon" href="">
|
||||
|
||||
<script src="JS/responsive.js" defer></script>
|
||||
<script src="JS/signIn/signin.js" defer></script>
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
<link rel="stylesheet" href="CSS/*.css">
|
||||
<link rel="stylesheet" href="CSS/signup.css">
|
||||
<link rel="stylesheet" href="CSS/responsive.css">
|
||||
<link rel="shortcut icon" href="">
|
||||
|
||||
<script src="JS/responsive.js" defer></script>
|
||||
<script src="JS/signIn/signup.js" defer></script>
|
||||
|
|
Loading…
Reference in a new issue