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
71 changes: 71 additions & 0 deletions Shota_pirtskhalava/display.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<?php
$name = $lastname = "";

$nameErr = $lastnameErr = $errorFile = "";


if($_SERVER["REQUEST_METHOD"] == "POST") {

if(empty($_POST["firstname"])){
$nameErr = "required";
}
else{
$name = $_POST["firstname"];

if(!preg_match("/^[a-zA-Z-' ]*$/", $name)){
$nameErr ="only letters";
}
}


if(empty($_POST["lastname"])){
$lastnameErr = "required";
}
else{
$lastname = $_POST["lastname"];

if(!preg_match("/^[a-zA-Z-' ]*$/", $name)){
$lastnameErr ="only letters";
}
}


if(isset($_FILES['profileimage'])){
$target_dir = getcwd() . "/uploads/";
$porfile_image = basename($_FILES["profileimage"]["name"]);
$allowed_ext = array("jpg" => "image/jpg",
"jpeg" => "image/jpeg",
"gif" => "image/gif",
"png" => "image/png");
$profile_image_url = NULL;
$ext = pathinfo($porfile_image, PATHINFO_EXTENSION);
if (!array_key_exists($ext, $allowed_ext)) {
$errorFile="please use JPG PNG JPEG GIF PNG";
}
if(in_array($_FILES["profileimage"]["type"], $allowed_ext)) {
if(!file_exists($target_dir)) {
mkdir($target_dir);
}
if(move_uploaded_file($_FILES["profileimage"]["tmp_name"], $target_dir . $porfile_image) ){
$profile_image_url = $target_dir.$porfile_image;
}
}
}

}










?>





63 changes: 63 additions & 0 deletions Shota_pirtskhalava/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<!DOCTYPE html>

<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<link rel="stylesheet" href="./style.css" type="text/css">
<body>
<?php
include "display.php";
?>
<?php if(empty($_POST) || !empty($nameErr) || !empty($lastnameErr) ||!empty($errorFile)): ?>


<form action="" method="post" enctype="multipart/form-data">
<input type="text" name="firstname" class="feedback-input" placeholder="First Name" >
<span><?= $nameErr ?></span>
<br>

<input type="text" name="lastname" class="feedback-input" placeholder="Last Name">
<span><?= $lastnameErr ?></span>
<br>
<form action="upload.php" enctype="multipart/form-data" method="post">
<input type="file" name="profileimage" class="feedback-input">
<span><?= $errorFile ?></span>
<button type="submit" name="submit">submit

</button>







</form>







<?php
else:
?>


<div>
<img src="<?php print "uploads/" . $porfile_image; ?>">
<ul class="list">
<li class= "list"><?= $name ?></li>
<li class="list"><?= $lastname ?></li>

</ul>
</div>

<?php endif; ?>



</body>
</html>
59 changes: 59 additions & 0 deletions Shota_pirtskhalava/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
body { background:rgb(30,30,40); }
form { max-width:420px; margin:50px auto; }

.feedback-input {
color:MediumTurquoise;
font-weight:500;
font-size: 18px;
border-radius: 5px;
line-height: 22px;
background-color: transparent;
border:2px solid aquamarine;
padding: 13px;
margin-bottom: 15px;
width:100%;
box-sizing: border-box;
outline:0;
}

[type="submit"] {

width: 100%;
background: yellow;
border-radius:5px;
border:0;
color:black;
font-size:24px;
padding-top:10px;
padding-bottom:10px;
margin-top:-4px;
font-weight:700;
}
[type="submit"]:hover { background:#218161;
}

.list {
list-style-type: none;
font-family: Arial;
color: rgb(209, 8, 8);
text-align: center;
font-size:xx-large;




}




img {
width: 500px;;
display: block;
margin-left: auto;
margin-right: auto;
height: 10%;
border-radius: 10px;


}
Binary file added Shota_pirtskhalava/uploads/Paolo.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.