-
Notifications
You must be signed in to change notification settings - Fork 72
Vako Janikashvili - Week 1 - home work #77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
vaaakoo
wants to merge
2
commits into
bitoid:master
Choose a base branch
from
vaaakoo:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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']; | ||
| $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.'" />'; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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'])-ამდე ერორს მოგცემს
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
გამარჯობა,
ვცადე და ერორს არ მაძლევს, რამე ერორის კოდი დავამატე ჯობს?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
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 ფილდიდან ველიუს მხოლოდ დასაბმითების მერე წამოიღებ