<?php

require 'admin-login.php';

$id = $_GET['id'];
$type = $_GET['type'];

$query = mysqli_query($link, "SELECT * FROM user WHERE email = '$id' ");
$user = mysqli_fetch_array($query);

$u_email = $user['email'];
$u_id = $user['id'];

if($type == "on"){
    mysqli_query($link, "UPDATE user SET upgrade = 'upgrade' WHERE email = '$id' ");

header("Location: user-details.php?id=$u_id");
}elseif($type == "off"){
    mysqli_query($link, "UPDATE user SET upgrade = 'no-upgrade' WHERE email = '$id' ");

header("Location: user-details.php?id=$u_id");
}



?>