<?php
include_once("include/db_connection.php");
session_start();
if($_SESSION["adminloggedIn"] == FALSE){
header("Location:admin_login.php");
exit;
}
include_once("config_admin.php");
checkLoggedIn("yes");?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>
<?php
$EventAssociate = $_GET['EventAssociate'];
$NumberOfEventsSelected = sizeof($_POST);
echo $NumberOfEventsSelected;
print_r($_POST);
// $i=0;
$n=$_POST[dgvfvbfvgbfbgvfbghpv];
$sqlQuery = "SELECT * FROM events ";
$result = MYSQL_QUERY($sqlQuery);
$numberOfRows = MYSQL_NUM_ROWS($result);
$i = 0;
while($i<($numberOfRows))
{
if($_POST[$i]!=$n){
//$EventName = MYSQL_RESULT($result,$i,"EventName");
$sqlQuery1="UPDATE events SET EventAssociate='$EventAssociate' WHERE EventName = '$_POST[$i]'";
//$sqlQuery1="INSERT INTO events(`EventAssociate` = '$EventAssociate' WHERE EventName = '$_POST[$i]'";
$result1 = MYSQL_QUERY($sqlQuery1);
$query3 = "SELECT * FROM rights WHERE UserName='$EventAssociate' and EventName = '$_POST[$i]' ";
$result=mysql_query($query3)
or die(" checkPass fatal error: ".mysql_error());
// Check exactly one row is found:
if(mysql_num_rows($result)==0) {
$query2 = "INSERT INTO rights(`UserName`, `EventName`) VALUES ('$EventAssociate', '$_POST[$i]')";
$result2 = MYSQL_QUERY($query2);
}
}
$i++;
}
?>
<script type="text/javascript">
<!--
window.location = "assignCell.php?EventAssociate=<?php echo $EventAssociate ;?>"
//-->
</script>
//}
</body>
</html>