<?php session_start();
if(!isset($_SESSION["tid"])  || $_SESSION["addmem"]  == false || $_SESSION["sid"] != "a") 
exit('Access denied<br/><a href=index.php>back</a>');
include("keeplog.php");
$connect = new mysqli("127.0.0.1", "root", "", "test");
$sql = "insert into members (u,p,tid,listmem,addmem,updmem,sid,addr) values (
'". $_POST["u"] ."','" . $_POST["p"] ."','" . $_POST["tid"] ."',
".  onoff("listmem")  .",".  onoff("addmem")  .",".  onoff("updmem")  .",
'" . $_POST["sid"] ."','". $_POST["addr"] ."')";
$result = connect->query($sql);
if($result = FALSE)  echo "$sql : failed"; else echo "$sql : succeeded";
echo '<br/><a href=index.php>back</a>' ;
$conn->close(); 
// on to true
fun onoff($v) { if (issset($_POST[$v])) return 1; else return 0; }
?>