Commit 7f53639a by sopham

Initial commit

parents
<?php
include_once "dbconnection_data.php";
$link = new mysqli($server, $user, $password, $database);
if ($link -> connect_error) die("Connection to DB failed: ". $link ->connect_error);
$query = "INSERT INTO toDoList(task) VALUES ('".$_POST["add-task"]."')";
if (mysqli_query($link, $query)) {
echo "Successfully added. ";
}
else {
echo "Error: " . $query . "<br>" . mysqli_error($link);
}
$link -> close();
?>
<?php
$server = "anysql.itcollege.ee";
$user = "team4";
$password = "rw_353MIl_e";
$database = "WT_4";
?>
var i = 0;
//add new row to list after submitting
function addRow(){
if (document.getElementById('addTask').value!=''){
i++;
var title = document.getElementById('addTask').value;
var node = document.createElement('div');
node.innerHTML = '<input id="option' + i + '" type="checkbox" class="hidden" name="checkbox"><label for="option' + i + '" class="check--label"><span class="check--label-box"></span><span class="check--label-text">'+ title +'</span>';
document.getElementById('doList').appendChild(node);
}
}
//clear input after submitting
function onFormSubmit(){
document.getElementById('addTask').value='';
}
//delete all tasks
function deleteAll() {
var e = document.getElementById("doList");
while (e.firstChild) {
e.removeChild(e.firstChild);
}
}
//delete completed tasks
function deleteComplete() {
var boxes = document.getElementsByClassName('hidden');
var texts = document.getElementsByClassName('check--label');
for(let i = 0; i<boxes.length; i++){
box = boxes[i];
txt = texts[i];
if(box.checked){
box.parentNode.removeChild(box);
txt.parentNode.removeChild(txt);
}
}
}
//scrolling
window.onscroll = function() {myFunction()};
function myFunction() {
var winScroll = document.body.scrollTop || document.documentElement.scrollTop;
var height = document.documentElement.scrollHeight - document.documentElement.clientHeight;
var scrolled = (winScroll / height) * 100;
document.getElementById("myBar").style.width = scrolled + "%";
}
//display image
function readURL(input) {
if (input.files && input.files[0]) {
var reader = new FileReader();
reader.onload = function(e) {
$('#imagePreview').css('background-image', 'url('+e.target.result +')');
$('#imagePreview').hide();
$('#imagePreview').fadeIn(650);
}
reader.readAsDataURL(input.files[0]);
}
}
$("#imageUpload").change(function() {
readURL(this);
});
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="style.css">
<link href="https://fonts.googleapis.com/css?family=Roboto+Slab" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="function.js" type="text/javascript"></script>
</head>
<body>
<div id="wrapper">
<div class="row">
<div class="side" id="side">
<div class="list-card">
<div class="avatar-upload">
<div class="avatar-edit">
<input type="file" accept="image/gif, image/jpeg, image/png" id="imageUpload" onchange="readURL(this);">
<label for="imageUpload"></label>
</div>
<div class="avatar-preview">
<div id="imagePreview" style="background-image: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/20625/avatar-bg.png);"></div>
</div>
</div>
</div>
<div class="task-card">
<div class="extra-content" id="extraContent">
<a href="javascript:window.print()"><i class="glyphicon glyphicon-print"></i> Print List</a>
<a onclick="deleteComplete();"><i class="fa fa-trash w3-large"></i> Completed Tasks</a>
<a onclick="deleteAll();"><i class="fa fa-trash w3-large"></i> Delete All</a>
</div><br>
<form action="" method="POST" id="action">
<input type="submit" class="logout-button" name="logout"value="Logout">
</form>
</div>
</div>
<div class="main">
<div class="card">
<form action="dbconnection.php" method="POST" id="addAction">
<input type="text" id="addTask" onkeypress="return event.keyCode != 13" id="add-task" name="add-task" placeholder="Add tasks..." autocomplete="off">
<input type="submit" class="add-button" id="add" name="add-button" value="Add">
<!--<input type="button" class="add-button" id="add" onclick="addRow(); onFormSubmit();" onkeypress="return searchKeyPress(event);" name="add-button" value="Add">-->
</form>
<form class="task-board card" class="list" id="form">
<div class="list-item" id="doList">
<div class="progress-container">
<div class="progress-bar" id="myBar"></div>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
<script>
//enter to add to list
var input = document.getElementById("addTask");
input.addEventListener("keyup", function(event) {
if (event.keyCode === 13) {
event.preventDefault();
document.getElementById("add").click();
}
});
</script>
</body>
</html>
<?php
if(isset($_POST['logout'])) {
session_name($user);
session_destroy();
header('Location: login_page.php');
exit;
}
if(isset($_POST['add-button'])){
$addTask = $_POST['add-task'];
$file = fopen("taskList.txt","a+") or die("Unable to open file");
$s = $addTask."\r\n";
fputs($file,$s) or die("Unable to open save");
fclose($file);
header('Location: index.php');
}
?>
<?php
error_reporting(0);
$user = $_POST['username'];
$pass = $_POST['password'];
//login
if(isset($_POST['submit'])){
if($user=="admin" && $pass=="admin"){
header('Location:index.php');
session_name($user);
session_start();
}
else{
echo "Wrong Username or/and Password";
}
}
//logout
if(isset($_POST['logout'])) {
session_name($user);
session_start();
session_unset();
session_destroy();
session_write_close();
setcookie(session_name(), '', 0,'/');
session_regenerate_id(true);
header('Location: login_page.php');
exit();
}
//write to list
if(isset($_POST['add-button'])){
$addTask = $_POST['add-task'];
$file = fopen("taskList.txt","a+") or die("Unable to open file");
$s = $addTask."\r\n";
fputs($file,$s) or die("Unable to open save");
fclose($file);
header('Location: index.php');
}
?>
\ No newline at end of file
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="login_style.css">
</head>
<body>
<div class="row">
<div class="column">
<div class="card">
<form name="input" action="login_check.php" method="POST">
<label for="username">Username</label>
<input type="text" id="username" name="username" pattern="[a-zA-Z][a-zA-Z0-9-_\.]{1,20}" required>
<br>
<label for="password">Password&nbsp</label>
<input type="password" id="password" name="password" autocomplete="off" required>
<br>
<input type="submit" name="submit" value="Login">
</form>
</div>
</div>
</div>
</body>
</html>
@charset "UTF-8";
#wrapper{
max-width: 1350px;
min-width: 1350px;
}
.card {
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
padding: 50px 50px 70px 50px;
text-align: center;
background-color: #9370DB;
border-radius: 6px;
width: 350px;
margin: auto;
margin-top: 15%;
color: white;
font-size: 25px;
font-family: 'Roboto Slab', serif;
}
input[type=text], [type=password] {
position: inherit;
padding: 10px 0px 10px 10px;
margin: 8px;
display: inline-block;
border: 1px solid #ccc;
border-radius: 6px;
box-sizing: border-box;
color: black;
font-size: 20px;
font-family: 'Roboto Slab', serif;
vertical-align: middle;
width: 50%;
}
input[type=submit] {
font-family: 'Roboto Slab', serif;
font-size: 15px;
font-weight: bold;
background-color: white;
color: black;
padding: 10px 20px;
margin: 7px 35px 0px 0px;
border-radius: 6px;
border: 1px solid #ccc;
cursor: pointer;
float: right;
letter-spacing: 1px;
}
input[type=submit]:hover {
background-color: rgb(182, 171, 189);
color: white;
border-radius: 6px;
}
\ No newline at end of file
body {
visibility: hidden;
}
.check--label-text {
visibility: visible;
font-size: 500%;
}
@charset "UTF-8";
* {
box-sizing: border-box;
font-family: 'Roboto Slab', serif;
font-size: 20px;
}
@media print{
#form {
overflow-y:hidden;
}
#side {
display: none; }
#action{
display: none;
}
#addAction{
display: none;
}
#buttonExtra{
display: none;
}
#extraContent{
display: none;
}
#dropContent{
display: none;
}
#doList {
display: block;
position: absolute;
top: 10px;
left: 20px;
}
}
@media screen and (max-width: 600px) {
body {float: none;}
}
.row {
margin: 0 -5px;
display: flex;
}
.card {
width: 100%;
height: 100%;
min-height: 940px;
box-shadow: 0 4px 8px 0 rgba(0,0,0, 0.2);
padding: 30px;
text-align: center;
background-color: #f1f1f1;
margin: 10px 10px 10px 10px;
}
.list-card {
width: 90%;
height: 20%;
box-shadow: 0 4px 8px 0 rgba(0,0,0, 0.2);
padding: 12px;
text-align: center;
font-family: 'Roboto Slab', serif;
background-color: #f1f1f1;
text-align: center;
margin: 10px 10px 10px 10px;
}
.task-card {
cursor: pointer;
width: 90%;
height: 80%;
box-shadow: 0 4px 8px 0 rgba(0,0,0, 0.2);
padding: 30px;
margin: 10px 10px 10px 10px;
text-align: center;
background-color: #f1f1f1;
}
.side {
width: 205;
padding: 0px 5px 0px 30px;
}
.extra-content {
font-family: 'Roboto Slab', serif;
width: 100%;
border-radius: 6px;
}
.extra-content a {
color: black;
padding: 15px 16px;
display: block;
border-radius: 6px;
}
.extra-content a:hover {
color: white;
background-color:#b198e6b9;
}
.logout-button {
background-color: #9370DB;
font-family: 'Roboto Slab', serif;
width: 100%;
padding: 10px;
border-radius: 6px;
border: none;
transition: all 0.5s;
cursor: pointer;
display: inline-block;
color: white;
}
.logout-button:hover{
background: red;
}
input[type=text] {
width: 70%;
box-sizing: border-box;
border: 2px solid #9370DB;
border-radius: 6px;
background-color: white;
padding: 12px 0 12px 40px;
float:left;
margin-left: 90px;
margin-top: 60px;
}
.add-button {
background-color:rgb(83, 68, 170);
font-family: 'Roboto Slab', serif;
width: 10%;
color: white;
padding: 14px;
border-radius: 6px;
border: none;
transition: all 0.5s;
cursor: pointer;
float: left;
margin-top: 60px;
margin-left: 5px;
}
.add-button:hover{
background-color: #9370DB;
color: white;
}
.task-board {
border: 6px;
margin-top: 160px;
margin-left: 90px;
height: 80%;
width: 80%;
background-color: white;
border-radius: 15px;
overflow-y: scroll;
min-width: 200px;
height: 200px;
}
.checkmark {
position: absolute;
top: 9px;
left: 15px;
height: 25px;
width: 25px;
border-radius: 50%;
background-color: #eee;
}
.hidden {
position: absolute;
appearance: none;
}
.main {
width: 80%;
}
.side {
width: 20%;
}
.list {
display: flex;
}
.check--label {
display: flex;
justify-content: flex-start;
flex-direction: row;
flex-wrap: nowrap;
align-items: center;
margin-top: 15px;
height: 40px;
}
.check--label-box {
display: flex;
align-self: center;
position: relative;
height: 25px;
width: 25px;
margin: 0 20px;
border: 2px solid rgb(83, 68, 170);
cursor: pointer;
border-radius: 50%;
}
.check--label-text {
position: relative;
display: flex;
cursor: pointer;
align-self: center;
padding: 20px;
font-size: 22px;
border-left: 1px solid #ecf0f1;
}
.check--label-text:after {
content: '';
display: block;
width: 0%;
height: 2px;
background-color: #000;
position: absolute;
top: 50%;
left: 7.5%;
transform: translateY(-50%);
transition: width 100ms ease-in-out;
}
.hidden:checked + .check--label {
background-color: #fff;
}
.hidden:checked + .check--label .check--label-box {
background-color: rgb(83, 68, 170);
}
.hidden:checked + .check--label .check--label-box:after {
content: '';
display: block;
position: absolute;
top: 3px;
left: 7px;
width: 7px;
height: 12px;
border: solid white;
border-width: 0 3px 3px 0;
transform: rotate(45deg);
}
.hidden:checked + .check--label .check--label-text:after {
width: 85%;
}
.avatar-upload {
position: relative;
max-width: 205px;
margin: 50px auto;
}
.avatar-edit {
position: absolute;
right: 12px;
z-index: 1;
top: -20px;
}
.avatar-upload .avatar-edit input {
display: none;
}
.avatar-upload input + label {
display: inline-block;
width: 34px;
height: 34px;
margin-bottom: 0;
border-radius: 100%;
background: #FFFFFF;
border: 1px solid transparent;
box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.12);
cursor: pointer;
font-weight: normal;
transition: all .2s ease-in-out;
}
.avatar-upload input + label:hover {
background: #f1f1f1;
border-color: #d6d6d6;
}
.avatar-upload input + label:after {
content: "\f040";
font-family: 'FontAwesome';
color: #757575;
position: absolute;
top: 2px;
left: 0px;
right: 0px;
text-align: center;
margin: auto;
}
.avatar-preview {
width: 190px;
height: 190px;
position: relative;
top: -35px;
border-radius: 100%;
border: 6px solid #F8F8F8;
box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.1);
}
.avatar-preview > div {
width: 100%;
height: 100%;
border-radius: 50%;
background-size: cover;
background-repeat: no-repeat;
background-position: center;
}
.progress-container {
position: relative;
width: 100%;
height: 8px;
background: #ccc;
}
#myBar {
position: absolute;
height: 8px;
background: red;
width: 0%;
}
var i = 0;
//add new row to list after submitting
function addRow(){
if (document.getElementById('addTask').value!=''){
i++;
var title = document.getElementById('addTask').value;
var node = document.createElement('div');
node.setAttribute("id", "n" + i);
node.innerHTML = '<input id="option' + i + '" type="checkbox" class="hidden" name="checkbox"><label for="option' + i + '" class="check--label"><span class="check--label-box"></span><span class="check--label-text">'+ title +'</span>';
document.getElementById('doList').appendChild(node);
}
}
//clear input after submitting
function onFormSubmit(){
document.getElementById('addTask').value='';
}
//delete all tasks
function deleteAll() {
let x;
for (x = 1; x <= i; x++) {
let e = document.getElementById("n" + x);
e.parentNode.removeChild(e);
}
}
//delete completed tasks
function deleteComplete() {
var boxes = document.getElementsByClassName('hidden');
var texts = document.getElementsByClassName('check--label');
for(let i = 0; i<boxes.length; i++){
box = boxes[i];
txt = texts[i];
if(box.checked){
box.parentNode.removeChild(box);
txt.parentNode.removeChild(txt);
}
}
}
\ No newline at end of file
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="style.css">
<link href="https://fonts.googleapis.com/css?family=Roboto+Slab" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="function.js" type="text/javascript"></script>
</head>
<body>
<div id="wrapper">
<div class="row">
<div class="side" id="side">
<div class="list-card">
<div class="avatar-upload">
<div class="avatar-edit">
<input type="file" accept="image/gif, image/jpeg, image/png" id="imageUpload" onchange="readURL(this);">
<label for="imageUpload"></label>
</div>
<div class="avatar-preview">
<div id="imagePreview" style="background-image: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/20625/avatar-bg.png);"></div>
</div>
</div>
</div>
<div class="task-card">
<div class="extra-content" id="extraContent">
<a href="javascript:window.print()"><i class="glyphicon glyphicon-print"></i> Print List</a>
<a onclick="deleteComplete();"><i class="fa fa-trash w3-large"></i> Completed Tasks</a>
<a onclick="deleteAll();"><i class="fa fa-trash w3-large"></i> Delete All</a>
</div><br>
<form action="index_php.php" method="POST" id="action">
<input type="submit" class="logout-button" name="logout"value="Logout">
</form>
</div>
</div>
<div class="main">
<div class="card">
<form action="" method="POST" id="addAction">
<input type="text" id="addTask" onkeypress="return event.keyCode != 13" name="add-task" placeholder="Add tasks..." autocomplete="off">
<input type="button" class="add-button" id="add" onclick="addRow(); onFormSubmit();" onkeypress="return searchKeyPress(event);" name="add-button" value="Add">
</form>
<form class="task-board card" class="list" id="form">
<div class="list-item" id="doList">
<div class="progress-container">
<div class="progress-bar" id="myBar"></div>
</div>
<input id="option" type="checkbox" name="checkbox" class="hidden">
<label for="option" class="check--label">
<span class="check--label-box"></span>
<span class="check--label-text">One</span>
</label>
</div>
</form>
</div>
</div>
</div>
</div>
<script>
//enter to add to list
var input = document.getElementById("addTask");
input.addEventListener("keyup", function(event) {
if (event.keyCode === 13) {
event.preventDefault();
document.getElementById("add").click();
}
});
//scrolling
window.onscroll = function() {myFunction()};
function myFunction() {
var winScroll = document.body.scrollTop || document.documentElement.scrollTop;
var height = document.documentElement.scrollHeight - document.documentElement.clientHeight;
var scrolled = (winScroll / height) * 100;
document.getElementById("myBar").style.width = scrolled + "%";
}
</script>
</body>
</html>
<?php
if(isset($_POST['logout'])) {
session_destroy();
header('Location: login_page.php');
exit;
}
if(isset($_POST['add-button'])){
$addTask = $_POST['add-task'];
$file = fopen("taskList.txt","a+") or die("Unable to open file");
$s = $addTask."\r\n";
fputs($file,$s) or die("Unable to open save");
fclose($file);
header('Location: index.php');
}
?>
\ No newline at end of file
<?php
session_start();
error_reporting(0);
$user = $_POST['username'];
$pass = $_POST['password'];
if(isset($_POST['submit'])){
if($user=="admin" && $pass==admin){
header('Location:index.php');
}
else{
echo "Wrong Username or/and Password";
}
}
?>
\ No newline at end of file
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="login_style.css">
</head>
<body>
<div id="wrapper">
<div class="row">
<div class="column">
<div class="card">
<form name="input" action="login_check.php" method="POST">
<label for="username">Username</label>
<input type="text" id="username" name="username" pattern="[a-zA-Z][a-zA-Z0-9-_\.]{1,20}" required><br>
<label for="password">Password</label>
<input type="password" id="password" name="password" autocomplete="off" required><br>
<input type="submit" name="submit" value="Login">
</form>
</div>
</div>
</div>
</div>
</body>
</html>
\ No newline at end of file
@charset "UTF-8";
#wrapper{
max-width: 1350px;
min-width: 1350px;
}
.card {
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
padding: 50px 50px 70px 50px;
text-align: center;
background-color: #9370DB;
border-radius: 6px;
width: 350px;
margin: auto;
margin-top: 15%;
color: white;
font-size: 25px;
font-family: 'Roboto Slab', serif;
}
input[type=text], [type=password] {
position: inherit;
padding: 10px 0px 10px 10px;
margin: 8px;
display: inline-block;
border: 1px solid #ccc;
border-radius: 6px;
box-sizing: border-box;
color: black;
font-size: 20px;
font-family: 'Roboto Slab', serif;
vertical-align: middle;
width: 50%;
}
input[type=submit] {
font-family: 'Roboto Slab', serif;
font-size: 15px;
font-weight: bold;
background-color: white;
color: black;
padding: 10px 20px;
margin: 7px 35px 0px 0px;
border-radius: 6px;
border: 1px solid #ccc;
cursor: pointer;
float: right;
letter-spacing: 1px;
}
input[type=submit]:hover {
background-color: rgb(182, 171, 189);
color: white;
border-radius: 6px;
}
\ No newline at end of file
@charset "UTF-8";
* {
box-sizing: border-box;
font-family: 'Roboto Slab', serif;
font-size: 20px;
}
@media print{
#form {
overflow-y:hidden;
}
#side {
display: none; }
#action{
display: none;
}
#addAction{
display: none;
}
#buttonExtra{
display: none;
}
#extraContent{
display: none;
}
#dropContent{
display: none;
}
#doList {
display: block;
position: absolute;
top: 10px;
left: 20px;
}
}
@media screen and (max-width: 600px) {
body {float: none;}
}
.row {
margin: 0 -5px;
display: flex;
}
.card {
width: 1005px;
height: 100%;
min-height: 940px;
box-shadow: 0 4px 8px 0 rgba(0,0,0, 0.2);
padding: 30px;
text-align: center;
background-color: #f1f1f1;
margin: 10px 10px 10px 10px;
}
.list-card {
height: 20%;
box-shadow: 0 4px 8px 0 rgba(0,0,0, 0.2);
padding: 12px;
text-align: center;
font-family: 'Roboto Slab', serif;
background-color: #f1f1f1;
text-align: center;
margin: 10px 10px 10px 10px;
}
.task-card {
cursor: pointer;
height: 80%;
box-shadow: 0 4px 8px 0 rgba(0,0,0, 0.2);
padding: 30px;
margin: 10px 10px 10px 10px;
text-align: center;
background-color: #f1f1f1;
}
.side {
padding: 0px 5px 0px 30px;
}
.extra-content {
font-family: 'Roboto Slab', serif;
width: 100%;
border-radius: 6px;
}
.extra-content a {
color: black;
padding: 15px 16px;
display: block;
border-radius: 6px;
}
.extra-content a:hover {
color: white;
background-color:#b198e6b9;
}
.logout-button {
background-color: #9370DB;
font-family: 'Roboto Slab', serif;
width: 100%;
padding: 10px;
border-radius: 6px;
border: none;
transition: all 0.5s;
cursor: pointer;
display: inline-block;
color: white;
}
.logout-button:hover{
background: red;
}
input[type=text] {
width: 70%;
box-sizing: border-box;
border: 2px solid #9370DB;
border-radius: 6px;
background-color: white;
padding: 12px 0 12px 40px;
float:left;
margin-left: 90px;
margin-top: 60px;
}
.add-button {
background-color:rgb(83, 68, 170);
font-family: 'Roboto Slab', serif;
width: 10%;
color: white;
padding: 14px;
border-radius: 6px;
border: none;
transition: all 0.5s;
cursor: pointer;
float: left;
margin-top: 60px;
margin-left: 5px;
}
.add-button:hover{
background-color: #9370DB;
color: white;
}
.task-board {
border: 6px;
margin-top: 160px;
margin-left: 90px;
height: 80%;
width: 80%;
background-color: white;
border-radius: 15px;
overflow-y: scroll;
min-width: 200px;
height: 200px;
}
.checkmark {
position: absolute;
top: 9px;
left: 15px;
height: 25px;
width: 25px;
border-radius: 50%;
background-color: #eee;
}
.hidden {
position: absolute;
appearance: none;
}
.list {
display: flex;
}
.check--label {
display: flex;
justify-content: flex-start;
flex-direction: row;
flex-wrap: nowrap;
align-items: center;
margin-top: 15px;
height: 40px;
}
.check--label-box {
display: flex;
align-self: center;
position: relative;
height: 25px;
width: 25px;
margin: 0 20px;
border: 2px solid rgb(83, 68, 170);
cursor: pointer;
border-radius: 50%;
}
.check--label-text {
position: relative;
display: flex;
cursor: pointer;
align-self: center;
padding: 20px;
font-size: 22px;
border-left: 1px solid #ecf0f1;
}
.check--label-text:after {
content: '';
display: block;
width: 0%;
height: 2px;
background-color: #000;
position: absolute;
top: 50%;
left: 7.5%;
transform: translateY(-50%);
transition: width 100ms ease-in-out;
}
.hidden:checked + .check--label {
background-color: #fff;
}
.hidden:checked + .check--label .check--label-box {
background-color: rgb(83, 68, 170);
}
.hidden:checked + .check--label .check--label-box:after {
content: '';
display: block;
position: absolute;
top: 3px;
left: 7px;
width: 7px;
height: 12px;
border: solid white;
border-width: 0 3px 3px 0;
transform: rotate(45deg);
}
.hidden:checked + .check--label .check--label-text:after {
width: 85%;
}
.avatar-upload {
position: relative;
max-width: 205px;
margin: 50px auto;
}
.avatar-edit {
position: absolute;
right: 12px;
z-index: 1;
top: -20px;
}
.avatar-upload .avatar-edit input {
display: none;
}
.avatar-upload input + label {
display: inline-block;
width: 34px;
height: 34px;
margin-bottom: 0;
border-radius: 100%;
background: #FFFFFF;
border: 1px solid transparent;
box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.12);
cursor: pointer;
font-weight: normal;
transition: all .2s ease-in-out;
}
.avatar-upload input + label:hover {
background: #f1f1f1;
border-color: #d6d6d6;
}
.avatar-upload input + label:after {
content: "\f040";
font-family: 'FontAwesome';
color: #757575;
position: absolute;
top: 2px;
left: 0px;
right: 0px;
text-align: center;
margin: auto;
}
.avatar-preview {
width: 190px;
height: 190px;
position: relative;
top: -35px;
border-radius: 100%;
border: 6px solid #F8F8F8;
box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.1);
}
.avatar-preview > div {
width: 100%;
height: 100%;
border-radius: 50%;
background-size: cover;
background-repeat: no-repeat;
background-position: center;
}
.progress-container {
position: relative;
width: 100%;
height: 8px;
background: #ccc;
}
#myBar {
position: absolute;
height: 8px;
background: red;
width: 0%;
}
\ No newline at end of file
function readURL(input) {
if (input.files && input.files[0]) {
var reader = new FileReader();
reader.onload = function(e) {
$('#imagePreview').css('background-image', 'url('+e.target.result +')');
$('#imagePreview').hide();
$('#imagePreview').fadeIn(650);
}
reader.readAsDataURL(input.files[0]);
}
}
$("#imageUpload").change(function() {
readURL(this);
});
<?php
$uploads_dir = "/var/www/html/to-do-list/uploads/";
$target_file = $uploads_dir . basename($_FILES["fileToUpload"]["name"]);
$uploadOk = 1;
$imageFileType = strtolower(pathinfo($target_file, PATHINO_EXTENSION));
if (isset($_POST["submit"])) {
// check if image file is an actual image
$check = getimagesize($_FILES["fileToUpload"]["tmp_name"]);
if ($check == false) {
echo "File is not an image";
$uploadOk = 0;
}
// check file size
if ($_FILES["fileToUpload"]["size"] > 500000) {
echo "File is too large";
$uploadOk = 0;
}
// allow certain file format
if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif") {
echo "Only JPG, JPEG, PNG & GIF files are allowed";
$uploadOk = 0;
}
if ($uploadOk == 0) {
if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) {
echo "your file is uploaded successfully yayyy";
}
}
}
?>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment