include "login.php";
include "conn.inc";
if ($_SESSION["userId"]){
if ($_SESSION["userLevel"] == 0) {
// BEGIN ADD
if ($_GET["add"]){
// extract Vars
extract ($_POST);
// add current entry into wd_cspin table
$addSpin = "insert into wd_cspin (cs_date,cs_from,cs_to,cs_subject,cs_listdate,cs_text,cs_response) values ('$cs_date','$cs_from','$cs_to','$cs_subject','$cs_listdate','$cs_text','$cs_response')";
$addResult = mysql_query($addSpin) or die ("Error ". mysql_errno()." in adding data to table: ". mysql_error());
//create success message
$message = "Counter-SPIN for $cs_date successfully added";
//clear vars
$cs_date = "";
$cs_from = "";
$cs_to = "";
$cs_subject = "";
$cs_listdate = "";
$cs_text = "";
$cs_response = "";
}
//END ADD
// BEGIN DELETE
if ($_GET["del"]) {
$delID = $_GET["del"];
$delDate = $_GET["date"];
$sql = "delete from wd_cspin where cs_id = $delID";
$delRes = mysql_query($sql) or die ("Counter SPIN Report Delete Error ".mysql_errno().": ".mysql_error());
$message = "Counter-SPIN Report for $delDate successfully deleted.";
}
// END DELETE
// BEGIN QUERY
if ($_GET["query"]) {
$updID = $_GET["query"];
$sql = "select * from wd_cspin where cs_id = $updID LIMIT 1";
$updRes = mysql_query($sql) or die ("mem error: ".mysql_error());
$urow = mysql_fetch_array($updRes);
extract ($urow);
}
// END QUERY
// BEGIN UPDATE
if ($_GET["update"]){
// extract Vars
extract ($_POST);
// update current record in wd_cspin table
$upSpin = "update wd_cspin set cs_date='$cs_date', cs_from='$cs_from', cs_to='$cs_to', cs_subject='$cs_subject', cs_listdate='$cs_listdate', cs_text='$cs_text', cs_response='$cs_response' where cs_id = $cs_id LIMIT 1";
$upResult = mysql_query($upSpin) or die ("Error in updating Counter-SPIN Record for ". $cs_date.": ".mysql_errno() ." ". mysql_error());
$message = "Counter-SPIN Record for ".$cs_date." successfully updated.";
//clear vars
$cs_date = "";
$cs_from = "";
$cs_to = "";
$cs_subject = "";
$cs_listdate = "";
$cs_text = "";
$cs_response = "";
}
// END UPDATE
?>
War Dogs Motorcycle Club - Counter-SPIN Report Add-View-Change
}else{
include "notauth.php";
}
}?>