Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
64 changes: 64 additions & 0 deletions madona_revazashvili/Week1/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<?php
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$nameValid = true;
$lastnameValid = true;
if (!preg_match("/^[a-zA-z]*$/", $_POST['name'])) {
$nameValid = false;
}
if (!preg_match("/^[a-zA-z]*$/", $_POST['lastname'])) {
$lastnameValid = false;
}
if (empty($_POST["name"]) || !$nameValid) {
$name_error = "Please enter a valid name";
} else {
$name = $_POST['name'];
}
if (empty($_POST["lastname"]) || !$lastnameValid) {
$lastname_error = "Please enter a valid lastname";
} else {
$lastname = $_POST['lastname'];
}
if (empty($_FILES['picture'])) {
$photo_error = "Please upload picture";
} else {
$fileTempName = $_FILES['picture']['tmp_name'];
$fileUpExt = explode(".", $_FILES['picture']['name']);
$fileExt = strtolower(end($fileUpExt));
$fileName = uniqid('', true) . "." . $fileExt;
$fileDestiation = './Data/' . $fileName;
move_uploaded_file($fileTempName, $fileDestiation);
}
}
?>
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="./reset.css">
<link rel="stylesheet" href="./style.css">
<title>Document</title>
</head>

<body>
<form action="./index.php" method="POST" enctype="multipart/form-data">
<label for="name">Your First Name</label>
<input type="text" placeholder="Enter your first name" id="name" name="name">
<span><?php if (isset($name_error)) echo $name_error ?> </span>
<label for="lastname">Your Last Name</label>
<input type="text" placeholder="Enter your last name" id="lastname" name="lastname">
<span><?php if (isset($lastname_error)) echo $lastname_error ?> </span>
<label for="picture" class="picture">Upload Your Profile Picture</label>
<span><?php if (isset($picture_error)) echo $picture_error ?></span>
<input type="file" name="picture" id="picture">
<button type="submit">Submit</button>
</form>
</body>
<?php if (isset($name) && isset($lastname) && isset($fileDestiation)) {
echo "<div><h1>$name $lastname</h1><img src=$fileDestiation alt=''></div>";
} ?>
</body>

</html>
139 changes: 139 additions & 0 deletions madona_revazashvili/Week1/reset.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
html,
body,
div,
span,
applet,
object,
iframe,
h1,
h2,
h3,
h4,
h5,
h6,
p,
blockquote,
pre,
a,
abbr,
acronym,
address,
big,
cite,
code,
del,
dfn,
em,
img,
ins,
kbd,
q,
s,
samp,
small,
strike,
strong,
sub,
sup,
tt,
var,
b,
u,
i,
center,
dl,
dt,
dd,
ol,
ul,
li,
fieldset,
form,
label,
legend,
table,
caption,
tbody,
tfoot,
thead,
tr,
th,
td,
article,
aside,
canvas,
details,
embed,
figure,
figcaption,
footer,
header,
hgroup,
menu,
nav,
output,
ruby,
section,
summary,
time,
mark,
audio,
video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}

/* HTML5 display-role reset for older browsers */
article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
menu,
nav,
section {
display: block;
}

body {
line-height: 1;
}

ol,
ul {
list-style: none;
}

blockquote,
q {
quotes: none;
}

blockquote:before,
blockquote:after,
q:before,
q:after {
content: '';
content: none;
}

table {
border-collapse: collapse;
border-spacing: 0;
}

a {
text-decoration: none;
color: #000000;
}

* {
box-sizing: border-box;
}
54 changes: 54 additions & 0 deletions madona_revazashvili/Week1/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
body {
width: 100%;
display: flex;
justify-content: center;
align-items: center;
background-color: rgb(63, 101, 101);
}

form {
background-color: rgb(145, 161, 52);
border-radius: 5px;
padding: 40px;
}

input {
display: block;
}

input {
width: 100%;
height: 35px;
border-radius: 5px;
border: none;
font-size: 1vw;
color: black;
font-weight: bold;
font-style: italic;
margin: 15px auto 0px auto;
}

label {
font-size: 1.3vw;
color: rgb(77, 71, 71);
font-weight: bold;
text-align: center;
}

button {
width: 10vw;
height: 40px;
background-color: rgb(141, 87, 87);
font-size: 1.5vw;
display: flex;
justify-content: center;
align-items: center;
border-radius: 5px;
color: black;
margin: 30px auto 0px auto;
cursor: pointer;
}
button:hover {
background-color: black;
color: white;
}