<?php
session_start();
if($_SESSION['dbName']==""){
header("location:../index.php");
}

include("config.inc.php");
$connection = mysql_connect($config['dbServer'],$config['dbUser'],$config['dbPass']) or die("Could not connect to DB");
mysql_select_db($_SESSION['dbName'],$connection) or die("Could not find DB");

$tableName = $_POST['tableName'];
$mode = $_POST['mode'];
$userName = $_POST['userName'];

if($mode == 'Add'){
$query = "Insert into ". $config['dbName_log'].".loginstk (user_account, projectDt_id) value ('".$userName."', '".$tableName."')";
$result=mysql_query($query,$connection) or die(mysql_error());

}

if($mode == 'Remove'){
$query = "Delete from ". $config['dbName_log'].".loginstk where user_account = '".$userName."' AND projectDt_id  = ".$tableName;
$result=mysql_query($query,$connection) or die(mysql_error());

}
//echo $tableName;
//echo $userAccount;
echo $query;
?>