From 628c97aaf508bbd615ef3a500f22fcdd1ca00f4d Mon Sep 17 00:00:00 2001 From: AlisaLinUwU Date: Sun, 26 Jan 2025 11:49:02 +0500 Subject: Initialize --- Qarz daftarcha.iml | 8 ++++ add_user.php | 50 ++++++++++++++++++++++ connect_database.php | 14 ++++++ delete_user.php | 15 +++++++ get_users.php | 40 ++++++++++++++++++ index.php | 117 +++++++++++++++++++++++++++++++++++++++++++++++++++ paid.php | 50 ++++++++++++++++++++++ 7 files changed, 294 insertions(+) create mode 100644 Qarz daftarcha.iml create mode 100644 add_user.php create mode 100644 connect_database.php create mode 100644 delete_user.php create mode 100644 get_users.php create mode 100644 index.php create mode 100644 paid.php diff --git a/Qarz daftarcha.iml b/Qarz daftarcha.iml new file mode 100644 index 0000000..80cc739 --- /dev/null +++ b/Qarz daftarcha.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/add_user.php b/add_user.php new file mode 100644 index 0000000..652de82 --- /dev/null +++ b/add_user.php @@ -0,0 +1,50 @@ + + + + Qarz daftarcha + + + + + + + + + +
+

Qoshish

+
+
+ + + + + + +
+ +
+
+ +query($sql); + + if ($result === TRUE) { + header("Location: index.php"); + } else { + echo "Error: " . $sql . "
" . $conn->error; + } +} + +?> + + + diff --git a/connect_database.php b/connect_database.php new file mode 100644 index 0000000..978e6ed --- /dev/null +++ b/connect_database.php @@ -0,0 +1,14 @@ +connect_error) { + die("Connection failed: " . $conn->connect_error); +} + +?> diff --git a/delete_user.php b/delete_user.php new file mode 100644 index 0000000..d6623f2 --- /dev/null +++ b/delete_user.php @@ -0,0 +1,15 @@ +query($sql); + +if ($result === TRUE) { + header("Location: index.php"); +} else { + echo "Error: " . $sql . "
" . $conn->error; +} + diff --git a/get_users.php b/get_users.php new file mode 100644 index 0000000..32d2801 --- /dev/null +++ b/get_users.php @@ -0,0 +1,40 @@ +query($sql); + +$users; +$min_user; +$max_user; + +$sum_duty = 0; +$min_duty = 99999999999; +$max_duty = 0; + +for ($i = 0, $j = 0; $i < $result->field_count; $i++) { + while ($row = $result->fetch_assoc()) { + $users[$j] = $row; + $sum_duty += $row["miqdor"]; + + if ($row["miqdor"] < $min_duty) { + $min_user = $row; + $min_duty = $row["miqdor"]; + } + if ($row["miqdor"] > $max_duty) { + $max_user = $row; + $max_duty = $row["miqdor"]; + } + $j++; + } +} + +?> diff --git a/index.php b/index.php new file mode 100644 index 0000000..1177956 --- /dev/null +++ b/index.php @@ -0,0 +1,117 @@ + + + + Qarz daftarcha + + + + + + + + + +
+

Qarz daftarcha

+
+ +
+
+
+ +
+ +
+
+
+ + Qoshish + +

Qarzdorlar:

+ + + + + + + + + + + + + + + + + + + + + +
IsmTelefon nomerVaqtQarzHarakatlar
+ so'mOchirishToladi
+ +

Statistika

+ +
+ + + diff --git a/paid.php b/paid.php new file mode 100644 index 0000000..ec7e89a --- /dev/null +++ b/paid.php @@ -0,0 +1,50 @@ + + + + Qarz daftarcha + + + + + + + + + +
+

Toladi

+
+
+ + +
+ +
+
+ +query("SELECT miqdor FROM qarzdorlar WHERE id = $id"); +$existing_money = $existing_money->fetch_assoc()["miqdor"]; + +if (array_key_exists("miqdor", $_POST) && $existing_money >= $_POST["miqdor"]) { + $miqdor = (int) $existing_money - $_POST["miqdor"]; + $sql = "UPDATE qarzdorlar SET miqdor = $miqdor WHERE id = $id"; + $result = $conn->query($sql); + + if ($result === TRUE) { + header("Location: index.php"); + } else { + echo "Error: " . $sql . "
" . $conn->error; + } +} elseif (array_key_exists("miqdor", $_POST) && $existing_money <= $_POST["miqdor"]) { + header("Location: index.php"); +} + +?> + + + -- cgit v1.2.3