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
| <form action="vote.php" method="post"> | |
| Did you enjoy this page?<br> | |
| <input type="radio" name="liked" value="yes" checked> Yes <br> | |
| <input type="radio" name="liked" value="no"> No <br> | |
| <input type="submit" value="Submit"> | |
| </form> |
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
| <html> | |
| <?php | |
| echo "<h1>Thank you for voting!</h1>" | |
| ?> | |
| </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
| <?php | |
| echo "You voted " . $_POST["liked"] . "!"; | |
| ?> |
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
| <html> | |
| <h1> Super Duper PHP Calculator </h1> | |
| <form action="calculate.php" method="post"> | |
| <input type="text" name="first_number"> | |
| <select name="operation"> | |
| <option value="sum"> + </option> | |
| <option value="sub"> - </option> | |
| <option value="mult"> * </option> | |
| <option value="div"> / </option> | |
| </select> |
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
| <html> | |
| <h1> Super Duper PHP Calculator </h1> | |
| <?php | |
| if ($_POST["operation"] == "sum") { | |
| $res = $_POST["first_number"] + $_POST["second_number"]; | |
| } elseif ($_POST["operation"] == "sub") { | |
| $res = $_POST["first_number"] - $_POST["second_number"]; | |
| } elseif ($_POST["operation"] == "mult") { | |
| $res = $_POST["first_number"] * $_POST["second_number"]; | |
| } else { |
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
| <html> | |
| <h1> Telling your IP </h1> | |
| <?php | |
| echo "Your IP is " . $_SERVER['REMOTE_ADDR']; | |
| ?> | |
| </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
| <html> | |
| <!-- SAME OLD CRAP --> | |
| <?php | |
| $servername = "localhost"; | |
| $username = "root"; | |
| $password = "my_root_password"; | |
| $dbname = "herschel"; |
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
| <html> | |
| <!-- SAME OLD CRAP --> | |
| <?php | |
| $servername = "localhost"; | |
| $username = "gabriel"; | |
| $password = "my_secret_password"; | |
| $dbname = "herschel"; |
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
| <html> | |
| <!-- SAME OLD CRAP --> | |
| <?php | |
| $servername = "localhost"; | |
| $username = "gabriel"; | |
| $password = "my_secret_password"; | |
| $dbname = "herschel"; |
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
| <?php | |
| // Insert data to database | |
| if ($_POST["liked"] === "yes") { | |
| $vote = TRUE; | |
| } else { | |
| $vote = FALSE; | |
| } | |
| $insert = "INSERT INTO vote (id, liked) VALUES ('" . $_SERVER['REMOTE_ADDR'] . "', " . $vote . ")"; |