This repository has been archived by the owner on May 25, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 4a417d3
Showing
66 changed files
with
27,546 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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,73 @@ | ||
# Created by .ignore support plugin (hsz.mobi) | ||
### JetBrains template | ||
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm | ||
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 | ||
|
||
# User-specific stuff | ||
.idea/**/workspace.xml | ||
.idea/**/tasks.xml | ||
.idea/**/usage.statistics.xml | ||
.idea/**/dictionaries | ||
.idea/**/shelf | ||
|
||
# Generated files | ||
.idea/**/contentModel.xml | ||
|
||
# Sensitive or high-churn files | ||
.idea/**/dataSources/ | ||
.idea/**/dataSources.ids | ||
.idea/**/dataSources.local.xml | ||
.idea/**/sqlDataSources.xml | ||
.idea/**/dynamic.xml | ||
.idea/**/uiDesigner.xml | ||
.idea/**/dbnavigator.xml | ||
|
||
# Gradle | ||
.idea/**/gradle.xml | ||
.idea/**/libraries | ||
|
||
# Gradle and Maven with auto-import | ||
# When using Gradle or Maven with auto-import, you should exclude module files, | ||
# since they will be recreated, and may cause churn. Uncomment if using | ||
# auto-import. | ||
# .idea/artifacts | ||
# .idea/compiler.xml | ||
# .idea/modules.xml | ||
# .idea/*.iml | ||
# .idea/modules | ||
# *.iml | ||
# *.ipr | ||
|
||
# CMake | ||
cmake-build-*/ | ||
|
||
# Mongo Explorer plugin | ||
.idea/**/mongoSettings.xml | ||
|
||
# File-based project format | ||
*.iws | ||
|
||
# IntelliJ | ||
out/ | ||
|
||
# mpeltonen/sbt-idea plugin | ||
.idea_modules/ | ||
|
||
# JIRA plugin | ||
atlassian-ide-plugin.xml | ||
|
||
# Cursive Clojure plugin | ||
.idea/replstate.xml | ||
|
||
# Crashlytics plugin (for Android Studio and IntelliJ) | ||
com_crashlytics_export_strings.xml | ||
crashlytics.properties | ||
crashlytics-build.properties | ||
fabric.properties | ||
|
||
# Editor-based Rest Client | ||
.idea/httpRequests | ||
|
||
# Android studio 3.1+ serialized cache file | ||
.idea/caches/build_file_checksums.ser | ||
|
This file contains 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,21 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2019-2020 Marco Aceti | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains 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,3 @@ | ||
# ITIS volume 2 | ||
|
||
Puoi trovare altro nella vecchia repository: [MarcoBuster/ITIS](https://github.com/MarcoBuster/ITIS) |
This file contains 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,14 @@ | ||
<?php | ||
|
||
function generate_options($name) { | ||
echo "<select name='$name'>"; | ||
foreach (range(0, 15) as $i) { | ||
$h = strtoupper(dechex($i)); | ||
echo "<option name='$h'>$h</option>"; | ||
} | ||
echo "</select>"; | ||
} | ||
|
||
function generate_hex_color() { | ||
return "#" . $_GET['r1'] . $_GET['r2'] . $_GET['g1'] . $_GET['g2'] . $_GET['b1'] . $_GET['b2']; | ||
} |
This file contains 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,47 @@ | ||
<?php | ||
|
||
include_once "functions.php"; | ||
|
||
?> | ||
|
||
<!DOCTYPE html> | ||
<html lang="it"> | ||
<head> | ||
<title>Coloriamo le parole!</title> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> | ||
<link rel="stylesheet" href="/static/css/bootstrap.min.css"> | ||
</head> | ||
<body> | ||
<div class="container mt-4"> | ||
<form method="get" action="index.php"> | ||
<label for="r">Rosso</label> | ||
<?php generate_options("r1"); ?> | ||
<?php generate_options("r2"); ?> | ||
<br /> | ||
<label for="g">Verde</label> | ||
<?php generate_options("g1"); ?> | ||
<?php generate_options("g2"); ?> | ||
<br /> | ||
<label for="b">Blu</label> | ||
<?php generate_options("b1"); ?> | ||
<?php generate_options("b2"); ?> | ||
<br /> | ||
<label for="word">Parola da colorare</label> | ||
<input id="word" name="word"> <br /> | ||
<button type="submit">Coloriamo!</button> | ||
<br /> <br /> | ||
</form> | ||
|
||
<span id="result"> | ||
<?php | ||
if (array_key_exists("word", $_GET) && strlen($_GET['word']) > 0) { | ||
$color = generate_hex_color(); | ||
$word = $_GET['word']; | ||
echo "<span style=\"color: $color\">$word</span> (<code>$color</code>)"; | ||
} | ||
?> | ||
</span> | ||
</div> | ||
</body> | ||
</html> |
This file contains 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,44 @@ | ||
<?php | ||
|
||
function getRows() { | ||
$conn = mysqli_connect("mysql", "root", "ROOT", "polizza"); | ||
|
||
$sql_res = mysqli_query($conn, "SELECT * FROM polizza.polizza"); | ||
$rows = []; | ||
while ($row = mysqli_fetch_assoc($sql_res)) | ||
$rows[] = $row; | ||
return $rows; | ||
} | ||
|
||
function printTable($rows) { | ||
echo "<table class='table'>"; | ||
echo "<tr>"; | ||
echo "<th></th>"; | ||
echo "<th>ID</th>"; | ||
echo "<th>Nome</th>"; | ||
echo "<th>Prezzo</th>"; | ||
echo "<th>Note contrattuali</th>"; | ||
echo "</tr>"; | ||
foreach ($rows as $row) { | ||
$id = $row["id"]; | ||
echo "<tr>"; | ||
echo "<td><input type='checkbox' name='delete_$id' value='$id'></td>"; | ||
echo "<td>" . $id . "</td>"; | ||
echo "<td>" . $row["nomePolizza"] . "</td>"; | ||
echo "<td>" . $row["prezzo"] . "</td>"; | ||
echo "<td>" . $row["noteContrattuali"] . "</td>"; | ||
echo "</tr>"; | ||
} | ||
echo "</tr>"; | ||
echo "</table>"; | ||
} | ||
|
||
function deleteRows($ids) { | ||
$conn = mysqli_connect("mysql", "root", "ROOT", "polizza"); | ||
foreach ($ids as $id) { | ||
$res = mysqli_query($conn, "DELETE FROM polizza.polizza WHERE id=$id"); | ||
if ($res === false) | ||
return $res; | ||
} | ||
return count($ids); | ||
} |
This file contains 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,4 @@ | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> | ||
<link rel="stylesheet" href="/static/css/bootstrap.min.css"> | ||
<link rel="stylesheet" href="/static/css/dark.css"> |
This file contains 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 @@ | ||
<?php include "functions.php"; ?> | ||
|
||
<!DOCTYPE html> | ||
<html lang="it"> | ||
<head> | ||
<title>Elimina tupla - checkbox button</title> | ||
<?php include "head.php"; ?> | ||
</head> | ||
<body> | ||
<div class="container py-3"> | ||
<h1>Elimina tupla - <span class="text-muted">checkbox button edition</span></h1> | ||
|
||
<?php | ||
if (!isset($_POST)) | ||
return; | ||
|
||
$ids = []; | ||
foreach ($_POST as $key => $value) { | ||
if (strlen($key) < 8) | ||
continue; | ||
if (substr($key, 0, 7) !== "delete_") | ||
continue; | ||
$ids[] = substr($key, 7, 1); | ||
} | ||
|
||
if (count($ids) > 0) { | ||
$res = deleteRows($ids); | ||
if ($res === false) | ||
echo "<div class='alert alert-danger'>Errore durante l'eliminazione degli elementi</div>"; | ||
else { | ||
$letter = $res > 1 ? 'i' : 'o'; | ||
echo "<div class='alert alert-success'>$res element$letter eliminat$letter</div>"; | ||
} | ||
} | ||
?> | ||
|
||
<form method="post" action="index.php"> | ||
<?php printTable(getRows()) ?> | ||
<button type="submit" class="btn btn-primary">Distruggi tuple</button> | ||
</form> | ||
</div> | ||
</body> |
This file contains 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,39 @@ | ||
<?php | ||
|
||
function getRows() { | ||
$conn = mysqli_connect("mysql", "root", "ROOT", "polizza"); | ||
|
||
$sql_res = mysqli_query($conn, "SELECT * FROM polizza.polizza"); | ||
$rows = []; | ||
while ($row = mysqli_fetch_assoc($sql_res)) | ||
$rows[] = $row; | ||
return $rows; | ||
} | ||
|
||
function printTable($rows) { | ||
echo "<table class='table'>"; | ||
echo "<tr>"; | ||
echo "<th></th>"; | ||
echo "<th>ID</th>"; | ||
echo "<th>Nome</th>"; | ||
echo "<th>Prezzo</th>"; | ||
echo "<th>Note contrattuali</th>"; | ||
echo "</tr>"; | ||
foreach ($rows as $row) { | ||
$id = $row["id"]; | ||
echo "<tr>"; | ||
echo "<td><input type='radio' name='delete' value='$id'></td>"; | ||
echo "<td>" . $id . "</td>"; | ||
echo "<td>" . $row["nomePolizza"] . "</td>"; | ||
echo "<td>" . $row["prezzo"] . "</td>"; | ||
echo "<td>" . $row["noteContrattuali"] . "</td>"; | ||
echo "</tr>"; | ||
} | ||
echo "</tr>"; | ||
echo "</table>"; | ||
} | ||
|
||
function deleteRow($id) { | ||
$conn = mysqli_connect("mysql", "root", "ROOT", "polizza"); | ||
return mysqli_query($conn, "DELETE FROM polizza.polizza WHERE id=$id"); | ||
} |
This file contains 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,4 @@ | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> | ||
<link rel="stylesheet" href="/static/css/bootstrap.min.css"> | ||
<link rel="stylesheet" href="/static/css/dark.css"> |
This file contains 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,34 @@ | ||
<?php include "functions.php"; ?> | ||
|
||
<!DOCTYPE html> | ||
<html lang="it"> | ||
<head> | ||
<title>Elimina tupla - radio button</title> | ||
<?php include "head.php"; ?> | ||
</head> | ||
<body> | ||
<div class="container py-3"> | ||
<h1>Elimina tupla - <span class="text-muted">radio button edition</span></h1> | ||
|
||
<?php | ||
if (isset($_POST) && array_key_exists("delete", $_POST)) { | ||
$id = $_POST["delete"]; | ||
if ($id === "none") | ||
echo "<div class='alert alert-danger'>Non hai selezionato nessun elemento da eliminare</div>"; | ||
else { | ||
$res = deleteRow($id); | ||
if ($res === false) | ||
echo "<div class='alert alert-danger'>Errore durante l'eliminazione dell'elemento</div>"; | ||
else | ||
echo "<div class='alert alert-success'>Elemento con ID=$id eliminato</div>"; | ||
} | ||
} | ||
?> | ||
|
||
<form method="post" action="index.php"> | ||
<input type="radio" name="delete" value="none" style="display: none;" checked> | ||
<?php printTable(getRows()) ?> | ||
<button type="submit" class="btn btn-primary">Distruggi tupla</button> | ||
</form> | ||
</div> | ||
</body> |
This file contains 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,10 @@ | ||
<?php | ||
|
||
function var_type($v) { | ||
return gettype($v); | ||
} | ||
|
||
echo var_type(5) . "<br />"; | ||
echo var_type('c') . "<br />"; | ||
echo var_type("ciao") . "<br />"; | ||
echo var_type(["11", 2, '3']) . "<br />"; |
This file contains 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,10 @@ | ||
<?php | ||
|
||
function date_diffence(int $a, int $b) : int { | ||
return floor(($a - $b) / 60 / 60 / 24); | ||
} | ||
|
||
$now = time(); | ||
$my_birthday = 1004205600; | ||
|
||
echo date_diffence($now, $my_birthday) . " giorni"; |
Oops, something went wrong.