MMCT TEAM
Server IP : 162.214.80.37  /  Your IP : 216.73.216.83
Web Server : Apache
System : Linux sh013.webhostingservices.com 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64
User : imyrqtmy ( 2189)
PHP Version : 8.2.18
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0755) :  /home2/imyrqtmy/public_html/destinytrafficsolutions/admin/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home2/imyrqtmy/public_html/destinytrafficsolutions/admin/add_ser.php
<?php

include("inc/config.php");

if (isset($_POST['add_ser'])) {
    $ser_name = mysqli_real_escape_string($conn, $_POST['ser_name']);

 

    $query = "INSERT INTO sers (ser_name) VALUES ('$ser_name')";
    
    if (mysqli_query($conn, $query)) {
        echo "<script>
                alert('Service Added Successfully!');
                window.location.href = 'view-ser.php';
              </script>";
        exit();
    } else {
        echo "<script>
                alert('Error: " . mysqli_error($conn) . "');
                window.history.back();
              </script>";
    }
}




if (isset($_POST['update_ser'])) {
    $id = $_POST['id'];
    $ser_name = $_POST['ser_name'];
 

  

    // Update the project information in the database
    $query = "UPDATE sers 
              SET ser_name='$ser_name'
              WHERE id='$id'";

    $query_run = mysqli_query($conn, $query);

    if ($query_run) {
        $_SESSION['status'] = "Service Updated Successfully";
        header('Location: view-ser.php');
    } else {
        $_SESSION['status'] = "Service Not Updated Successfully";
        header('Location: view-ser.php');
    }
}



// delete

if (isset($_POST['delete_sers'])) {

    $id = $_POST['delete_id'];
    
    $query = "DELETE FROM `sers` WHERE id = '$id'";
    $query_run = mysqli_query($conn, $query);

    if ($query_run) {
        $_SESSION['status'] = "Deleted Successfully";
        header('Location: view-ser.php');
    } else {
        $_SESSION['status'] = "Not Deleted Successfully";
        header('Location: view-ser.php');
    }
}

?>

MMCT - 2023