AECC database project.
1<?php
2function validate_input($data) {
3 include("db.php");
4 $data = trim($data);
5 $data = stripslashes($data);
6 $data = htmlspecialchars($data);
7 $data = mysqli_real_escape_string($db, $data);
8 return $data;
9}
10
11function err_msg($err_code) {
12 $msg = "What are you doing bruh ";
13 while ($err_code != 0) {
14 $err_code -= 1;
15 $msg = $msg . "?";
16 }
17 return $msg;
18}
19
20function input_submit() {
21 return '<input type="submit" value="Submit" />';
22}
23
24function input_radio_many($strs, $name, $label_str) {
25 $out = "";
26 $out = $out . '<label for="' . $name . '">' . $label_str . '</label>';
27 $out = $out . '<br />';
28 foreach ($strs as $str) {
29 $out = $out . '<input name="' . $name . '" type="radio" id="' . $str . '" value="' . $str . '">';
30 $out = $out . '<label for="' . $str . '">';
31 $out = $out . $str;
32 $out = $out . '</label>';
33 $out = $out . '</input>';
34 $out = $out . '<br />';
35 }
36
37 return $out;
38}
39
40function input_any($label, $label_str, $type) {
41 $out = "";
42 $out = $out . '<label for="' . $label . '">' . $label_str . '</label>';
43 $out = $out . '<br />';
44 $out = $out . '<input type="' . $type . '" id="' . $label . '" name="' . $label . '" />';
45 $out = $out . '<br />';
46 return $out;
47}
48
49function input_any_value($label, $label_str, $value, $type) {
50 $out = "";
51 $out = $out . '<label for="' . $label . '">' . $label_str . '</label>';
52 $out = $out . '<br />';
53 $out = $out . '<input type="' . $type . '" id="' . $label . '" name="' . $label . '" value="' . $value . '" />';
54 $out = $out . '<br />';
55 return $out;
56}
57
58function da_append($left, $right) {
59 return $left . $right;
60}
61
62function t($tag, $content) {
63 return "<" . $tag . ">" . $content . "</" . $tag . ">";
64}
65
66function ti($tag, $inside, $content) {
67 return "<" . $tag . " " . $inside . ">" . $content . "</" . $tag . ">";
68}
69
70function get($arr, $e) {
71 return isset($arr[$e]) ? validate_input($arr[$e]) : "";
72}
73?>