here to go back."); end_frame(); stdfoot(); die(); } $delid = intval($_GET['delid'] ?? 0); if($delid > 0) { echo("Are you sure you would like to delete this Location?( Yes! / No )"); end_frame(); stdfoot(); die(); } $edited = intval($_GET['edited'] ?? 0); if($edited == 1) { $id = intval($_GET['id'] ?? 0); $name = $_GET['name']; $flagpic = $_GET['flagpic']; $location_main = $_GET['location_main']; $location_sub = $_GET['location_sub']; $start_ip = $_GET['start_ip']; $end_ip = $_GET['end_ip']; $theory_upspeed = $_GET['theory_upspeed']; $practical_upspeed = $_GET['practical_upspeed']; $theory_downspeed = $_GET['theory_downspeed']; $practical_downspeed = $_GET['practical_downspeed']; if(validip_format($start_ip) && validip_format($end_ip)) { if(ip2long($end_ip) > ip2long($start_ip)) { $query = "UPDATE locations SET name = " . sqlesc($name) .",flagpic = " . sqlesc($flagpic) . ",location_main = " . sqlesc($location_main). ",location_sub= " . sqlesc($location_sub) . ",start_ip = " . sqlesc($start_ip) . ",end_ip = " . sqlesc($end_ip) . ",theory_upspeed = " . sqlesc($theory_upspeed) . ",practical_upspeed = " . sqlesc($practical_upspeed) . ",theory_downspeed = " . sqlesc($theory_downspeed) . ",practical_downspeed = " . sqlesc($practical_downspeed). " WHERE id=".sqlesc($id); $sql = sql_query($query) or sqlerr(__FILE__, __LINE__); if($sql) { stdmsg("Success!","Location has been edited, click here to go back"); stdfoot(); die(); } } else echo("
The end IP address should be larger than the start one, or equal for single IP check!
"); } else echo("Invalid IP Address Format !!!
"); } $editid = $_GET['editid'] ?? 0; if($editid > 0) { $query = "SELECT * FROM locations WHERE id=" . sqlesc($editid); $sql = sql_query($query); $row = mysql_fetch_array($sql); $name = $row['name']; $flagpic = $row['flagpic']; $location_main = $row['location_main']; $location_sub = $row['location_sub']; $start_ip = $row['start_ip']; $end_ip = $row['end_ip']; $theory_upspeed = $row['theory_upspeed']; $practical_upspeed = $row['practical_upspeed']; $theory_downspeed = $row['theory_downspeed']; $practical_downspeed = $row['practical_downspeed']; echo(""); end_frame(); stdfoot(); die(); } $add = $_GET['add'] ?? ''; $success = false; if($add == 'true') { $name = $_GET['name']; $flagpic = $_GET['flagpic']; $location_main = $_GET['location_main']; $location_sub = $_GET['location_sub']; $start_ip = $_GET['start_ip']; $end_ip = $_GET['end_ip']; $theory_upspeed = $_GET['theory_upspeed']; $practical_upspeed = $_GET['practical_upspeed']; $theory_downspeed = $_GET['theory_downspeed']; $practical_downspeed = $_GET['practical_downspeed']; if(validip_format($start_ip) && validip_format($end_ip)) { if(ip2long($end_ip) > ip2long($start_ip)) { $query = "INSERT INTO locations (name, flagpic, location_main, location_sub, start_ip, end_ip, theory_upspeed, practical_upspeed, theory_downspeed, practical_downspeed) VALUES (" . sqlesc($name) ."," . sqlesc($flagpic) . "," . sqlesc($location_main). "," . sqlesc($location_sub) . "," . sqlesc($start_ip) . "," . sqlesc($end_ip) . "," . sqlesc($theory_upspeed) . "," . sqlesc($practical_upspeed) . "," . sqlesc($theory_downspeed) . "," . sqlesc($practical_downspeed) . ")"; $sql = sql_query($query) or sqlerr(__FILE__, __LINE__); if($sql) { $success = true; } else { $success = false; } } else echo("The end IP address should be larger than the start one, or equal for single IP check!
"); } else echo("Invalid IP Address Format !!!
"); } echo(""); $range_start_ip = $_GET['range_start_ip'] ?? ''; $range_end_ip = $_GET['range_end_ip'] ?? ''; echo(""); ///////////////////// E X I S T I N G C A T E G O R I E S \\\\\\\\\\\\\\\\\\\\\\\\\\\\ print("Conforming Locations:
"); } else echo("The end IP address should be larger than the start one, or equal for single IP check!
"); } else echo("Invalid IP Address Format !!!
"); } else { echo("" . ($success == true ? "(Updated!)" : "") . "Existing Locations:
"); } echo("| ID | Name | Pic | Start IP | End IP | T.U | P.U | T.D | P.D | Edit | Delete | "); $res = sql_query("SELECT COUNT(*) FROM locations ".$wherea); $row = mysql_fetch_array($res); $count = $row[0]; $perpage = 50; list($pagertop, $pagerbottom, $limit) = pager($perpage, $count, "location.php?"); $query = "SELECT * FROM locations " . $wherea ." ORDER BY name ASC, start_ip ASC ".$limit; $sql = sql_query($query); $maxlen_sub_location = 40; while ($row = mysql_fetch_array($sql)) { $id = $row['id']; $name = $row['name']; $flagpic = $row['flagpic']; $location_main = $row['location_main']; $location_sub = $row['location_sub']; $start_ip = $row['start_ip']; $end_ip = $row['end_ip']; $theory_upspeed = $row['theory_upspeed']; $practical_upspeed = $row['practical_upspeed']; $theory_downspeed = $row['theory_downspeed']; $practical_downspeed = $row['practical_downspeed']; $count_location_sub=strlen($location_sub); if($count_location_sub > $maxlen_sub_location) $location_sub=substr($location_sub, 0, $maxlen_sub_location) . ".."; echo("||
| $id | " . "$name | " . "" . ($flagpic != "" ? " | " .
"$location_main | " . "$location_sub | " . "" . $start_ip . " | " . "" . $end_ip . " | " . "$theory_upspeed | " . "$practical_upspeed | " . "$theory_downspeed | " . "$practical_downspeed | " . "Edit | ". "Remove | " . "