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
Binary file added .DS_Store
Binary file not shown.
Binary file added irakli_pankvelashvili/.DS_Store
Binary file not shown.
57 changes: 57 additions & 0 deletions irakli_pankvelashvili/Challenge 1/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<!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>Chellange1</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-gH2yIJqKdNHPEq0n4Mqa/HGKIhSkIHeL5AyhkYV8i59U5AR6csBvApHHNl/vI1Bx" crossorigin="anonymous">
<link rel="stylesheet" type="text/css" href="style.css">

</head>
<body>
<form action="index.php" method="POST" enctype='multipart/form-data'>
<div class="mb-3">
<label for="fn" class="form-label">Firstname</label>
<input type="text" class="form-control" name="firstname" placeholder="Enter your firstname" required>
</div>
<div class="mb-3">
<label for="ln" class="form-label">Lastname</label>
<input type="text" class="form-control" name="lastname" placeholder="Enter your firstname" required>
</div>
<div class="mb-3">
<label for="formFile" class="form-label">Please Upload Profile Picture</label>
<input type="file" class="form-control"name="image" aria-label="file example" required>
</div>
<div class="mb-3">
<input class="btn btn-primary" type="submit" name="submit" value="Submit">
</div>
</form>
<?php



$alpha = "/^[A-Z]+$/";

if(isset($_POST['submit'])){
$image_name = $_FILES['image']['name'];
$image_type = $_FILES['image']['type'];
$image_size = $_FILES['image']['size'];
$image_tmp_name = $_FILES['image']['tmp_name'];
$first=$_POST['firstname'];
$last=$_POST['lastname'];


if(preg_match ($alpha, $first) && (preg_match ($alpha, $last)) && move_uploaded_file($image_tmp_name,"./photos/$image_name") ){
echo "<p>$first<br>$last<br> <img src='photos/$image_name' width='200' height='200'></p>";
}else{
echo "<h3><br>ERROR:Firstname And Lastname Should Contain Only Alphabet [A-Z] <h3>";
}


}

?>

</body>
</html>
Binary file not shown.
30 changes: 30 additions & 0 deletions irakli_pankvelashvili/Challenge 1/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
.mb-3{
width: 500px;
margin: 0 auto;

}

p{
text-align: center;
size: 16px;
font-weight: bold;
color: rgb(19, 19, 105);
}


h3{
text-align: center;
color: red;
font-weight: bold;
}

.btn{
transition: 1s;
}

.btn:hover{
background-color: white;
color: blue;
width: 100px;
}

69 changes: 69 additions & 0 deletions irakli_pankvelashvili/Challenge 2/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<?php require "resource.php" ?>

<!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 href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-gH2yIJqKdNHPEq0n4Mqa/HGKIhSkIHeL5AyhkYV8i59U5AR6csBvApHHNl/vI1Bx" crossorigin="anonymous">
<title>Challenge 2</title>
<link rel="stylesheet" type="text/css" href="./style.css">
</head>
<body>

<form action="index.php" method="POST">
<div class="input-group has-validation">
<span class="input-group-text">Git</span>
<div class="form-floating is-invalid">
<input type="search" name="username" class="form-control is-invalid" placeholder="Username" required >
<label for="username">Username</label>

</div>
</div>
<div class="form-floating">
<select class="form-select" name="select" require>
<option value="Repos">Repos</option>
<option value="Followers">Followers</option>
<option value="Both">Both</option>
</select><br>
<label for="select">Choose One</label>
</div>
<button class="btn btn-outline-secondary" type="submit" name="submit">S e a r c h</button>

</form>

<?php if($info == 'Repos' || $info == 'Both'): ?>
<ul>
<?php foreach($user_repos as $i => $repo): ?>
<li>

<img src="<?= $repo->owner->avatar_url?>" style="width: 60px">
<?= $repo->name?>
<a href="<?= $repo->html_url?>">
</a>

</li>

<?php endforeach ?>
</ul>
<?php endif; ?>

<?php if($info == 'Followers' || $info == 'Both'): ?>
<ul>
<?php foreach($user_followers as $k => $follower): ?>
<li>
<img src="<?= $follower->avatar_url ?>" style="width:60px;">
<?= $follower->login ?>
<a href="<?= $follower->html_url ?>" >
</a>

</li>

<?php endforeach ?>
</ul>
<?php endif; ?>


</body>
</html>
36 changes: 36 additions & 0 deletions irakli_pankvelashvili/Challenge 2/resource.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php
if(isset($_POST['submit'])){
$info=$_POST['select'];
$user_name=$_POST['username'];
$followers_url="https://api.github.com/users/$user_name/followers?per_page=100&page=1";
$repos_url="https://api.github.com/users/$user_name/repos?per_page=100&page=1";




function curl ($url)
{
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch,CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_USERAGENT, 'Test');
$result=curl_exec($ch);
return $json=json_decode($result);

}

if($info == "Followers"){
$user_followers=curl($followers_url);
}else if($info == "Repos"){
$user_repos=curl($repos_url);
}else{
$user_followers=curl($followers_url);
$user_repos=curl($repos_url);
};
}


?>


15 changes: 15 additions & 0 deletions irakli_pankvelashvili/Challenge 2/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@


.btn{
width: 300px;
background-color: rgb(10, 10, 150);
color: white;
border-radius: 50px;
transition: 1s;
margin-left: 40%;
}

.btn:hover{
background-color: white;
color: blue;
}