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
62 changes: 62 additions & 0 deletions vako_janikashvili/first/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<!DOCTYPE html>
<html>
<head>
<title>My name valid</title>
</head>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
<link rel="stylesheet" href="style.css">
<body>
<div class="container-fluid">
<h1>Registration form</h1>
</div>

<div class="container">

<form action="/index.php" method="POST" enctype="multipart/form-data">
<input type="text" name="fname" placeholder="First Name" required> <br>
<input type="text" name="lname" placeholder="Last Name" required><br><br>
<input type="file" name="uploadfile"><br>
<input id="submit" type="submit" name="submit" value="save">
</form>
</div>



<?php



$alpha = "/^[a-zA-z]+$/";
$fname = $_POST['fname'];

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

input-ების წამოღება დიდი ალბათობით if(isset($_POST['submit'])-ამდე ერორს მოგცემს

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

გამარჯობა,
ვცადე და ერორს არ მაძლევს, რამე ერორის კოდი დავამატე ჯობს?

Copy link

@HenryDarts HenryDarts May 25, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

იდეაში პოსტის შემოწმების გარეშე, წესით დასაბმითებამდე ყოველთვის ცარიელ მონაცემს მოგცემს, შეგიძლია თუ სურვილი გექნება ეს ნაწილიც if(isset($_POST['submit'])) ამის ქვეშ შეიტანო, ეგ მოგცემს რომ input ფილდიდან ველიუს მხოლოდ დასაბმითების მერე წამოიღებ

$lname = $_POST['lname'];
$error = "Incorrect name";
$success = $fname . ' ' . $lname;



if(isset($_POST['submit'])) {
if(preg_match($alpha, $fname) && preg_match($alpha, $lname)) {
$new_dir = "uploads/";
$new_file = $new_dir.basename($_FILES["uploadfile"]["name"]);
$imageFileType = pathinfo($new_file,PATHINFO_EXTENSION);
move_uploaded_file($_FILES["uploadfile"]["tmp_name"], $new_file);

echo '<img src="'.$new_file.'" />';

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

სალამიი, კითხვა მაქვს, php-ით html ელემენტის გამოტანის მაგივრად, უკეთესი ხო არ იქნებოდა, პირიქით გაკეთება html-ის ელემენტში php variable-ის გამოტანა

echo "<br>";
echo "I'm " . $success. " from BitCamp";
}else{
echo $error;
}
}




?>




</body>
</html>
45 changes: 45 additions & 0 deletions vako_janikashvili/first/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
body {
background-color: rgb(83, 116, 216);
margin-top: 30px;
text-align: center;
font-size: 30px;
font-style: bold;
font-family: 'Times New Roman', Times, serif;

}

.container {
width: 300px;
margin-bottom: 10px;
border: 1px solid #000000;
padding: 10px;
background-color: rgb(173, 185, 223);
box-shadow: 5px 5px;
font-size: 17px;


}

form {
text-align: center;

}


#submit {
background-color: #48a11f;
}

.container input {
width: 250px;
border: none;
border-radius: 50px;
padding: 5px 10px;
margin-bottom: 15px;
}

img {
border-radius: 30%;
width: 250px;
margin: 5px;
}
105 changes: 105 additions & 0 deletions vako_janikashvili/second/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
<?php /* resourcess */

$name = $_POST['name'];
$type = "";
$alpha = "/^[a-zA-z]+$/";

//if ($_SERVER['REQUEST_METHOD'] === 'POST'){
/* $name = $_POST['name'];
$type = $_POST['repos' || 'followers']; */

$headers = [
"User-Agent: vaaakoo",
"Authorization:"
];
$resource = curl_init($url);
curl_setopt($resource, CURLOPT_HTTPHEADER, $headers);
curl_setopt($resource, CURLOPT_RETURNTRANSFER, true);
//}

?>
<!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">
<title>php browse</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="/style.css">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.3.1/dist/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<title>HomeWork-2</title>
</head>
<body>
<div class="container p-5 my-5 bg-dark text-white">
<center><h2>Lets Try : )) </h2><center></center>
<form action="/index.php" method="POST">
<label for="username" >Search people:</label>
<input type="text" id="name" name="name" placeholder="Enter User Name" required>
<input class="submit" type="submit" name="submit" value="Submit"><br>
<input type="radio" id="repos" name="repository" value="repository">
<label class="click" for="repos">repository</label>
<input type="radio" id="followers" name="followers" value="followers">
<label class="click" for="followers">followers</label><br>
</form>
</div>
<hr>
<!-- repository php -->
<div class="container p-3 mb-2 border bg-success">
<?php if(isset($_POST['submit'])){
if(preg_match($alpha, $name)){
if(isset($_POST['repository'])){


curl_setopt($resource, CURLOPT_URL, "https://api.github.com/users/"."$name"."/repos?page=1&per_page=10");

$name = $_POST['name'];
$response = curl_exec($resource);
curl_close($resource);

$data = json_decode($response, true);

foreach ($data as $repository) {
echo "<pre>";
//var_dump($repository["login"]);
var_dump($repository["owner"]);
//var_dump($repository["html_url"]);
echo "</pre>";
"<br>";
}
}
}
}
?>
<!-- Followers php -->
<div class="content p-3 mb-2 bg-secondary">

<?php if(isset($_POST['submit'])){
if(preg_match($alpha, $name)){
if(isset($_POST['followers'])){

curl_setopt($resource, CURLOPT_URL, "https://api.github.com/users/"."$name"."/followers");
$name = $_POST['name'];

$response = curl_exec($resource);
curl_close($resource);

$data = json_decode($response, true);

foreach ($data as $repository) {
echo $repository["login"], "<br>",
"<img id='img' src='".$repository["avatar_url"]."'>", "<br>",
"<a href='".$repository["html_url"]."' target='_blank'>visit to ".$repository["login"]."</a>","<br>",
"<br>";
}
}
}
}

?>
</div>
</div>

</body>
</html>
42 changes: 42 additions & 0 deletions vako_janikashvili/second/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
body{
padding: 20px;
}

.container{
padding: 30px;
margin: auto;
}
h2 {
color: rgb(255, 0, 0);
font-weight: bold;
margin-bottom: 15px;
}
form {
text-align: center;
color: rgb(255, 0, 0);
}
.submit {
background-color: green;
}

#img {
width: 350px;
border-radius: 20px;
transition: 0.5s;
}

#img:hover {
opacity: 60%;
}

.content {
text-align: center;
color: rgb(255, 0, 0);
font-size: 30px;

}

.container a {
color:blue;
font-family: sans-serif;
}