Part 1 Code (Copy and paste into one text file). Name your text file as "indexNew"
<?php
session_start(); //start a session
error_reporting(E_ALL); //E_ALL ^ E_NOTICE
ini_set('display_errors','1'); //Initialize custom debugging function
?>
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Device Manager</title>
<!-- Call JQuery -->
<script src="http://www.acmeous.com/tutorials/demo/acmeousCollapsibleLists/acmeousCollapsibleLists.js"
type="text/javascript"></script>
<!-- Setup Event Listener -->
<script type="text/javascript"><!--
if (window.addEventListener) {
window.addEventListener("load", function(){makeCollapsible(document.getElementById('addDevice'), 0);}, false);
} else if (window.attachEvent) {
window.attachEvent("onload", function(){makeCollapsible(document.getElementById('addDevice'), 1);});
} else {
window.onload = function(){makeCollapsible(document.getElementById('addDevice'), 1);};
}
-->
</script>
</head>
<body>
<?php
print "<font size='6'>DEVICE INVENTORY (Android): MOBILE TEAM</font><br>";
$textfile = 'mtand.txt';
$data = ''; //defining variable before use
if (file_exists($textfile) && is_readable($textfile))
{
$file = file($textfile);
foreach ($file as $line)
{
//separate each element and store in temp array.
$tmp = explode(":", $line);
//assign each element to array.
$data[] = array('name' => $tmp[0], 'mdn' => $tmp[1], 'carrier' => $tmp[2], 'meid' => $tmp[3], 'version' => $tmp[4], 'date' => $tmp[5], 'notes' => $tmp[6], 'voice' => $tmp[7]);
}
}
echo "<table cellspacing='0' cellpadding='14'>";
if ($data!=""){
echo "<tr><th style='background:#6699FF'>Device Name</th><th style='background:#6699FF'>MDN</th><th style='background:#6699FF'>Carrier</th><th style='background:#6699FF'>MEID/IMEI</th><th style='background:#6699FF'>OS Version</th><th style='background:#6699FF'>Received Date</th><th style='background:#6699FF'>Notes</th><th style='background:#6699FF'>Voice</th></tr>";
foreach ($data as $key => $row)
{
$name[$key]= $row['name'];
$mdn[$key]= $row['mdn'];
$carrier[$key]= $row['carrier'];
$meid[$key]= $row['meid'];
$version[$key]= $row['version'];
$date[$key]= $row['date'];
$notes[$key]= $row['notes'];
$voice[$key]= $row['voice'];
echo "<tr><td>{$name[$key]}</td><td>{$mdn[$key]}</td><td>{$carrier[$key]}</td><td>{$meid[$key]}</td><td>{$version[$key]}</td><td>{$date[$key]}</td><td>{$notes[$key]}</td><td>{$voice[$key]}</td></tr>";
}
}
echo "</table>";
$return = "indexNew2.htm";
$delete = @$_GET['delete'];
$textFile = file("mtand.txt");
$lines = count($textFile);
if($delete != "" && $delete >! $lines || $delete === '0') {
$textFile[$delete] = "";
$fileUpdate = fopen("mtand.txt", "wb");
for($a=0; $a<$lines; $a++) {
fwrite($fileUpdate, $textFile[$a]);
}
fclose($fileUpdate);
header("location:$return");
exit;
}
foreach($textFile as $key => $val) {
$line ="<a href =?delete=$key>[ DELETE ]</a><br/>";
}
echo $line;
?>
<?php
print "<font size='6'>DEVICE INVENTORY (iOS): MOBILE TEAM</font><br>";
$textfile = 'mtios.txt';
$data = ''; //defining variable before use
if (file_exists($textfile) && is_readable($textfile))
{
$file = file($textfile);
foreach ($file as $line)
{
//separate each element and store in temp array.
$tmp = explode(":", $line);
//assign each element to array.
$data[] = array('name' => $tmp[0], 'mdn' => $tmp[1], 'carrier' => $tmp[2], 'meid' => $tmp[3], 'version' => $tmp[4], 'date' => $tmp[5], 'notes' => $tmp[6], 'voice' => $tmp[7]);
}
}
echo "<table cellspacing='0' cellpadding='14'>";
if ($data!=""){
echo "<tr><th style='background:#6699FF'>Device Name</th><th style='background:#6699FF'>MDN</th><th style='background:#6699FF'>Carrier</th><th style='background:#6699FF'>MEID/IMEI</th><th style='background:#6699FF'>OS Version</th><th style='background:#6699FF'>Received Date</th><th style='background:#6699FF'>Notes</th><th style='background:#6699FF'>Voice</th></tr>";
foreach ($data as $key => $row)
{
$name[$key]= $row['name'];
$mdn[$key]= $row['mdn'];
$carrier[$key]= $row['carrier'];
$meid[$key]= $row['meid'];
$version[$key]= $row['version'];
$date[$key]= $row['date'];
$notes[$key]= $row['notes'];
$voice[$key]= $row['voice'];
echo "<tr><td>{$name[$key]}</td><td>{$mdn[$key]}</td><td>{$carrier[$key]}</td><td>{$meid[$key]}</td><td>{$version[$key]}</td><td>{$date[$key]}</td><td>{$notes[$key]}</td><td>{$voice[$key]}</td></tr>";
}
}
echo "</table>";
?>
<?php
print "<font size='6'>DEVICE INVENTORY (MISC): MOBILE TEAM</font><br>";
$textfile = 'mtmisc.txt';
$data = ''; //defining variable before use
if (file_exists($textfile) && is_readable($textfile))
{
$file = file($textfile);
foreach ($file as $line)
{
//separate each element and store in temp array.
$tmp = explode(":", $line);
//assign each element to array.
$data[] = array('name' => $tmp[0], 'mdn' => $tmp[1], 'carrier' => $tmp[2], 'meid' => $tmp[3], 'version' => $tmp[4], 'date' => $tmp[5], 'notes' => $tmp[6], 'voice' => $tmp[7]);
}
}
echo "<table cellspacing='0' cellpadding='14'>";
if ($data!=""){
echo "<tr><th style='background:#6699FF'>Device Name</th><th style='background:#6699FF'>MDN</th><th style='background:#6699FF'>Carrier</th><th style='background:#6699FF'>MEID/IMEI</th><th style='background:#6699FF'>OS Version</th><th style='background:#6699FF'>Received Date</th><th style='background:#6699FF'>Notes</th><th style='background:#6699FF'>Voice</th></tr>";
foreach ($data as $key => $row)
{
$name[$key]= $row['name'];
$mdn[$key]= $row['mdn'];
$carrier[$key]= $row['carrier'];
$meid[$key]= $row['meid'];
$version[$key]= $row['version'];
$date[$key]= $row['date'];
$notes[$key]= $row['notes'];
$voice[$key]= $row['voice'];
echo "<tr><td>{$name[$key]}</td><td>{$mdn[$key]}</td><td>{$carrier[$key]}</td><td>{$meid[$key]}</td><td>{$version[$key]}</td><td>{$date[$key]}</td><td>{$notes[$key]}</td><td>{$voice[$key]}</td></tr>";
}
}
echo "</table>";
?>
<?php
print "<font size='6'>DEVICE INVENTORY (Android): BIZ DEV</font><br>";
$textfile = 'bdand.txt';
$data = ''; //defining variable before use
if (file_exists($textfile) && is_readable($textfile))
{
$file = file($textfile);
foreach ($file as $line)
{
//separate each element and store in temp array.
$tmp = explode(":", $line);
//assign each element to array.
$data[] = array('name' => $tmp[0], 'mdn' => $tmp[1], 'carrier' => $tmp[2], 'meid' => $tmp[3], 'version' => $tmp[4], 'date' => $tmp[5], 'notes' => $tmp[6], 'voice' => $tmp[7]);
}
}
echo "<table cellspacing='0' cellpadding='14'>";
if ($data!=""){
echo "<tr><th style='background:#A6A6A6'>Device Name</th><th style='background:#A6A6A6'>MDN</th><th style='background:#A6A6A6'>Carrier</th><th style='background:#A6A6A6'>MEID/IMEI</th><th style='background:#A6A6A6'>OS Version</th><th style='background:#A6A6A6'>Received Date</th><th style='background:#A6A6A6'>Notes</th><th style='background:#A6A6A6'>Voice</th></tr>";
foreach ($data as $key => $row)
{
$name[$key]= $row['name'];
$mdn[$key]= $row['mdn'];
$carrier[$key]= $row['carrier'];
$meid[$key]= $row['meid'];
$version[$key]= $row['version'];
$date[$key]= $row['date'];
$notes[$key]= $row['notes'];
$voice[$key]= $row['voice'];
echo "<tr><td>{$name[$key]}</td><td>{$mdn[$key]}</td><td>{$carrier[$key]}</td><td>{$meid[$key]}</td><td>{$version[$key]}</td><td>{$date[$key]}</td><td>{$notes[$key]}</td><td>{$voice[$key]}</td></tr>";
}
}
echo "</table>";
?>
<?php
print "<font size='6'>DEVICE INVENTORY (iOS): BIZ DEV</font><br>";
$textfile = 'bdios.txt';
$data = ''; //defining variable before use
if (file_exists($textfile) && is_readable($textfile))
{
$file = file($textfile);
foreach ($file as $line)
{
//separate each element and store in temp array.
$tmp = explode(":", $line);
//assign each element to array.
$data[] = array('name' => $tmp[0], 'mdn' => $tmp[1], 'carrier' => $tmp[2], 'meid' => $tmp[3], 'version' => $tmp[4], 'date' => $tmp[5], 'notes' => $tmp[6], 'voice' => $tmp[7]);
}
}
echo "<table cellspacing='0' cellpadding='14'>";
if ($data!=""){
echo "<tr><th style='background:#A6A6A6'>Device Name</th><th style='background:#A6A6A6'>MDN</th><th style='background:#A6A6A6'>Carrier</th><th style='background:#A6A6A6'>MEID/IMEI</th><th style='background:#A6A6A6'>OS Version</th><th style='background:#A6A6A6'>Received Date</th><th style='background:#A6A6A6'>Notes</th><th style='background:#A6A6A6'>Voice</th></tr>";
foreach ($data as $key => $row)
{
$name[$key]= $row['name'];
$mdn[$key]= $row['mdn'];
$carrier[$key]= $row['carrier'];
$meid[$key]= $row['meid'];
$version[$key]= $row['version'];
$date[$key]= $row['date'];
$notes[$key]= $row['notes'];
$voice[$key]= $row['voice'];
echo "<tr><td>{$name[$key]}</td><td>{$mdn[$key]}</td><td>{$carrier[$key]}</td><td>{$meid[$key]}</td><td>{$version[$key]}</td><td>{$date[$key]}</td><td>{$notes[$key]}</td><td>{$voice[$key]}</td></tr>";
}
}
echo "</table>";
?>
<?php
print "<font size='6'>DEVICE INVENTORY (MISC): BIZ DEV</font><br>";
$textfile = 'bdmisc.txt';
$data = ''; //defining variable before use
if (file_exists($textfile) && is_readable($textfile))
{
$file = file($textfile);
foreach ($file as $line)
{
//separate each element and store in temp array.
$tmp = explode(":", $line);
//assign each element to array.
$data[] = array('name' => $tmp[0], 'mdn' => $tmp[1], 'carrier' => $tmp[2], 'meid' => $tmp[3], 'version' => $tmp[4], 'date' => $tmp[5], 'notes' => $tmp[6], 'voice' => $tmp[7]);
}
}
echo "<table cellspacing='0' cellpadding='14'>";
if ($data!=""){
echo "<tr><th style='background:#A6A6A6'>Device Name</th><th style='background:#A6A6A6'>MDN</th><th style='background:#A6A6A6'>Carrier</th><th style='background:#A6A6A6'>MEID/IMEI</th><th style='background:#A6A6A6'>OS Version</th><th style='background:#A6A6A6'>Received Date</th><th style='background:#A6A6A6'>Notes</th><th style='background:#A6A6A6'>Voice</th></tr>";
foreach ($data as $key => $row)
{
$name[$key]= $row['name'];
$mdn[$key]= $row['mdn'];
$carrier[$key]= $row['carrier'];
$meid[$key]= $row['meid'];
$version[$key]= $row['version'];
$date[$key]= $row['date'];
$notes[$key]= $row['notes'];
$voice[$key]= $row['voice'];
echo "<tr><td>{$name[$key]}</td><td>{$mdn[$key]}</td><td>{$carrier[$key]}</td><td>{$meid[$key]}</td><td>{$version[$key]}</td><td>{$date[$key]}</td><td>{$notes[$key]}</td><td>{$voice[$key]}</td></tr>";
}
}
echo "</table>";
?>
Pay close attention to (WARNING: Don't recopy this part) $return = "indexNew2.htm";
$delete = @$_GET['delete'];
$textFile = file("mtand.txt");
$lines = count($textFile);
if($delete != "" && $delete >! $lines || $delete === '0') {
$textFile[$delete] = "";
$fileUpdate = fopen("mtand.txt", "wb");
for($a=0; $a<$lines; $a++) {
fwrite($fileUpdate, $textFile[$a]);
}
fclose($fileUpdate);
header("location:$return");
exit;
That is where my mistake is, I know.