|
10 | 10 |
|
11 | 11 | validateCSRFToken($_POST['csrf_token']); |
12 | 12 |
|
13 | | - $client_id = intval($_POST['client_id']); |
14 | | - $name = sanitizeInput($_POST['name']); |
15 | | - $description = sanitizeInput($_POST['description']); |
16 | | - $type = sanitizeInput($_POST['type']); |
17 | | - $make = sanitizeInput($_POST['make']); |
18 | | - $model = sanitizeInput($_POST['model']); |
19 | | - $serial = sanitizeInput($_POST['serial']); |
20 | | - $os = sanitizeInput($_POST['os']); |
21 | | - $ip = sanitizeInput($_POST['ip']); |
22 | | - if($_POST['dhcp'] == 1){ |
23 | | - $ip = 'DHCP'; |
24 | | - } |
25 | | - $ipv6 = sanitizeInput($_POST['ipv6']); |
26 | | - $nat_ip = sanitizeInput($_POST['nat_ip']); |
27 | | - $mac = sanitizeInput($_POST['mac']); |
28 | | - $uri = sanitizeInput($_POST['uri']); |
29 | | - $uri_2 = sanitizeInput($_POST['uri_2']); |
30 | | - $status = sanitizeInput($_POST['status']); |
31 | | - $location = intval($_POST['location']); |
32 | | - $physical_location = sanitizeInput($_POST['physical_location']); |
33 | | - $vendor = intval($_POST['vendor']); |
34 | | - $contact = intval($_POST['contact']); |
35 | | - $network = intval($_POST['network']); |
36 | | - $purchase_date = sanitizeInput($_POST['purchase_date']); |
37 | | - if (empty($purchase_date)) { |
38 | | - $purchase_date = "NULL"; |
39 | | - } else { |
40 | | - $purchase_date = "'" . $purchase_date . "'"; |
41 | | - } |
42 | | - $warranty_expire = sanitizeInput($_POST['warranty_expire']); |
43 | | - if (empty($warranty_expire)) { |
44 | | - $warranty_expire = "NULL"; |
45 | | - } else { |
46 | | - $warranty_expire = "'" . $warranty_expire . "'"; |
47 | | - } |
48 | | - $install_date = sanitizeInput($_POST['install_date']); |
49 | | - if (empty($install_date)) { |
50 | | - $install_date = "NULL"; |
51 | | - } else { |
52 | | - $install_date = "'" . $install_date . "'"; |
53 | | - } |
54 | | - $notes = sanitizeInput($_POST['notes']); |
| 13 | + require_once 'asset_model.php'; |
55 | 14 |
|
56 | 15 | $alert_extended = ""; |
57 | 16 |
|
|
111 | 70 |
|
112 | 71 | validateCSRFToken($_POST['csrf_token']); |
113 | 72 |
|
| 73 | + require_once 'asset_model.php'; |
114 | 74 | $asset_id = intval($_POST['asset_id']); |
115 | | - $client_id = intval($_POST['client_id']); |
116 | | - $name = sanitizeInput($_POST['name']); |
117 | | - $description = sanitizeInput($_POST['description']); |
118 | | - $type = sanitizeInput($_POST['type']); |
119 | | - $make = sanitizeInput($_POST['make']); |
120 | | - $model = sanitizeInput($_POST['model']); |
121 | | - $serial = sanitizeInput($_POST['serial']); |
122 | | - $os = sanitizeInput($_POST['os']); |
123 | | - $ip = sanitizeInput($_POST['ip']); |
124 | | - if($_POST['dhcp'] == 1){ |
125 | | - $ip = 'DHCP'; |
126 | | - } |
127 | | - $ipv6 = sanitizeInput($_POST['ipv6']); |
128 | | - $nat_ip = sanitizeInput($_POST['nat_ip']); |
129 | | - $mac = sanitizeInput($_POST['mac']); |
130 | | - $uri = sanitizeInput($_POST['uri']); |
131 | | - $uri_2 = sanitizeInput($_POST['uri_2']); |
132 | | - $status = sanitizeInput($_POST['status']); |
133 | | - $location = intval($_POST['location']); |
134 | | - $physical_location = sanitizeInput($_POST['physical_location']); |
135 | | - $vendor = intval($_POST['vendor']); |
136 | | - $contact = intval($_POST['contact']); |
137 | | - $network = intval($_POST['network']); |
138 | | - $purchase_date = sanitizeInput($_POST['purchase_date']); |
139 | | - if (empty($purchase_date)) { |
140 | | - $purchase_date = "NULL"; |
141 | | - } else { |
142 | | - $purchase_date = "'" . $purchase_date . "'"; |
143 | | - } |
144 | | - $warranty_expire = sanitizeInput($_POST['warranty_expire']); |
145 | | - if (empty($warranty_expire)) { |
146 | | - $warranty_expire = "NULL"; |
147 | | - } else { |
148 | | - $warranty_expire = "'" . $warranty_expire . "'"; |
149 | | - } |
150 | | - $install_date = sanitizeInput($_POST['install_date']); |
151 | | - if (empty($install_date)) { |
152 | | - $install_date = "NULL"; |
153 | | - } else { |
154 | | - $install_date = "'" . $install_date . "'"; |
155 | | - } |
156 | | - $notes = sanitizeInput($_POST['notes']); |
157 | 75 |
|
158 | 76 | // Get Existing Photo |
159 | 77 | $sql = mysqli_query($mysqli,"SELECT asset_photo FROM assets WHERE asset_id = $asset_id"); |
|
734 | 652 |
|
735 | 653 | validateCSRFToken($_POST['csrf_token']); |
736 | 654 |
|
| 655 | + // Interface info |
| 656 | + $interface_id = intval($_POST['interface_id']); |
737 | 657 | $asset_id = intval($_POST['asset_id']); |
| 658 | + require_once 'asset_interface_model.php'; |
738 | 659 |
|
739 | 660 | // Get Asset Name and Client ID for logging and alert message |
740 | 661 | $sql = mysqli_query($mysqli,"SELECT asset_name, asset_client_id FROM assets WHERE asset_id = $asset_id"); |
741 | 662 | $row = mysqli_fetch_array($sql); |
742 | 663 | $asset_name = sanitizeInput($row['asset_name']); |
743 | 664 | $client_id = intval($row['asset_client_id']); |
744 | 665 |
|
745 | | - $name = sanitizeInput($_POST['name']); |
746 | | - $mac = sanitizeInput($_POST['mac']); |
747 | | - $ip = sanitizeInput($_POST['ip']); |
748 | | - if($_POST['dhcp'] == 1){ |
749 | | - $ip = 'DHCP'; |
750 | | - } |
751 | | - $ipv6 = sanitizeInput($_POST['ipv6']); |
752 | | - $port = sanitizeInput($_POST['port']); |
753 | | - $network = intval($_POST['network']); |
754 | | - $notes = sanitizeInput($_POST['notes']); |
755 | | - |
756 | 666 | mysqli_query($mysqli,"INSERT INTO asset_interfaces SET interface_name = '$name', interface_mac = '$mac', interface_ip = '$ip', interface_ipv6 = '$ipv6', interface_port = '$port', interface_notes = '$notes', interface_network_id = $network, interface_asset_id = $asset_id"); |
757 | 667 |
|
758 | 668 | $interface_id = mysqli_insert_id($mysqli); |
|
772 | 682 |
|
773 | 683 | validateCSRFToken($_POST['csrf_token']); |
774 | 684 |
|
| 685 | + // Interface info |
775 | 686 | $interface_id = intval($_POST['interface_id']); |
| 687 | + require_once 'asset_interface_model.php'; |
776 | 688 |
|
777 | 689 | // Get Asset Name and Client ID for logging and alert message |
778 | 690 | $sql = mysqli_query($mysqli,"SELECT asset_name, asset_client_id, asset_id FROM asset_interfaces LEFT JOIN assets ON asset_id = interface_asset_id WHERE interface_id = $interface_id"); |
|
781 | 693 | $asset_name = sanitizeInput($row['asset_name']); |
782 | 694 | $client_id = intval($row['asset_client_id']); |
783 | 695 |
|
784 | | - $name = sanitizeInput($_POST['name']); |
785 | | - $mac = sanitizeInput($_POST['mac']); |
786 | | - $ip = sanitizeInput($_POST['ip']); |
787 | | - if($_POST['dhcp'] == 1){ |
788 | | - $ip = 'DHCP'; |
789 | | - } |
790 | | - $ipv6 = sanitizeInput($_POST['ipv6']); |
791 | | - $port = sanitizeInput($_POST['port']); |
792 | | - $network = intval($_POST['network']); |
793 | | - $notes = sanitizeInput($_POST['notes']); |
794 | | - |
795 | 696 | mysqli_query($mysqli,"UPDATE asset_interfaces SET interface_name = '$name', interface_mac = '$mac', interface_ip = '$ip', interface_ipv6 = '$ipv6', interface_port = '$port', interface_notes = '$notes', interface_network_id = $network WHERE interface_id = $interface_id"); |
796 | 697 |
|
797 | 698 | //Logging |
|
0 commit comments