<?php include_once 'database.php'; if (isset($_POST['add_services'])) { if (isset($_POST['servicename']) && isset($_POST['servicetype']) && isset($_POST['details'])) { addservice($_POST); header("Location:index.php?page=services"); } } $type = getallservicesType(); ?> <html> <head><title>PH directory - Add Services</title></head> <body> <h2>Add Service</h2> <form method="post" class="form-horizontal"> <div class="form-group"> <label id="form-label">Service Name</label> <input type="text" name="servicename" id="servicename" placeholder="Service Name" class="form-control" required> <label id="form-label">Service Type</label> <select name="servicetype" id="servicetype" class="form-control" required> <?php foreach ($type as $t) { ?> <option><?php echo $t['serviceTypeName']; ?> </option> <?php
<?php include "functionapi.php"; if ($_SESSION['user_class'] == null) { die("place relogin<a href ='login.php'>login page</a>"); } $domainname = mysql_escape_string($_POST['domainname']); switch ($_REQUEST['active']) { case "new_service": if ($_POST['conf_name'] == null || $domainname == null || $_POST['serverip'] == null) { header("location: addserivces.php?new_service_error=true"); break; } if (addservice($domainname, $_POST['serverip'], $_SESSION['user_id'], $_POST['conf_name'])) { header('Location: services.php'); } else { header("location: addserivces.php?new_service_error=true"); } break; case "modif_service": $res = $dbconnect->query("update services set domain_name='" . $domainname . "', serverip='" . $_POST['serverip'] . "', status=1 where id=" . $_POST['serviceid']); is_error($res); header('Location: services.php'); break; case "del_service": $res = $dbconnect->query("delete from services where id=" . $_GET['serviceid']); is_error($res); $res = $dbconnect->query("delete from upstreams where service_id=" . $_GET['serviceid']); is_error($res); $res = $dbconnect->query("delete from locations where service_id=" . $_GET['serviceid']); is_error($res);