session_start();
global $scode;
$linkID = mysql_connect("localhost", "root", "zangtang");
mysql_select_db("SciPark");
function findexts ($filename)
{
$filename = strtolower($filename) ;
$exts = split("[/\\.]", $filename) ;
$n = count($exts)-1;
$exts = $exts[$n];
return $exts;
}
//------------------------------------------------------------------------------------------------------------------------------------
// VERIFY FORM FUNCTION
//---------------------------------------------------------------------------------------------------------------------------------------
function VerifyForm(&$values, &$errors)
{
// if (htmlentities($values['BranchName']) == "Select") $errors['BranchName'] = "Branch Name Required";
// if (htmlentities($values['SubCatName']) == "Select") $errors['SubCatName'] = "Theme/Topic Required";
// if(htmlentities($values['SubCatName']) == "00")
// {
// if(strlen($values['SubCatOther'])== 0) $errors['SubCatOther'] = "Theme/Topic Required";
//}
/* $CatOther = htmlentities($values['SubCatOther']);
$query1 = "SELECT * FROM `ExhbtCountMaster` where SubCatName='$CatOther'"; echo $query1;
$result1 = mysql_db_query("SciPark", $query1) or die ("could not query" . mysql_error());
$tung1=mysql_affected_rows();
if($tung1 != 0) $errors['SubCatOther'] = "The entered Sub-Category already listed in the drop down menu of Theme";
*/
if(strlen($values['ExhbtEName'])== 0) $errors['ExhbtEName'] = "Exhibit Name Required";
if(strlen($values['ExhbtEPrincipal'])== 0) $errors['ExhbtEPrincipal'] = "Exhibit Principal Required";
if(strlen($values['ExhbtEDescription'])== 0) $errors['ExhbtEDescription'] = "Exhibit Description Required";
// if(strlen($values['ExhbtMName'])== 0) $errors['ExhbtMName'] = "Exhibit Name Required";
// if(strlen($values['ExhbtMPrincipal'])== 0) $errors['ExhbtMPrincipal'] = "Exhibit Principal Required";
// if(strlen($values['ExhbtMDescription'])== 0) $errors['ExhbtMDescription'] = "Exhibit Description Required";
// if(strlen($values['ExhbtScientist'])== 0) $errors['ExhbtScientist'] = "Inventor/Researcher's Name Required";
if(strlen($values['ExhbtCount'])== 0 || !is_Numeric($values['ExhbtCount'])) $errors['ExhbtCount'] = "Numeric value in Exhibit Count Required";
if(strlen($values['ExhbtWCount'])== 0 || !is_Numeric($values['ExhbtWCount'])) $errors['ExhbtWCount'] = "Numeric value in Exhibit Working Count Required";
if (htmlentities($values['Vendor_Name']) == "Select") $errors['Vendor_Name'] = "Vendor Name Required";
if(htmlentities($values['Vendor_Name']) == "V001")
{
if(strlen($values['VendorArtist'])== 0) $errors['VendorArtist'] = "Artist Name Required";
}
if(strlen($values['ExhbtPopularity'])== 0) $errors['ExhbtPopularity'] = "Exhibit Popularity Required";
if(strlen($values['WebVisible'])== 0) $errors['WebVisible'] = "Web Visibility Yes/No Required";
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
print_r($errors);
return (count($errors) == 0);
}
//---------------------------------------------------------------------------------------------------------------------------------------
// DISPLAY FORM FUNCTION
//---------------------------------------------------------------------------------------------------------------------------------------
function outputOptionList($names, $selected)
{
foreach ($names as $key => $value) { ?>
}}
function DisplayForm($values, $errors)
{
// $chars = "abcdefghijkmnopqrstuvwxyz023456789"; $i=0;
$d=date(d);
$m=date(F);
$n=date(n);
$y=date(Y);
//print_r($optionListYear);
?>
SCIENCE PARK UNIVERSITY OF PUNE
}
//---------------------------------------------------------------------------------------------------------------------------------------
$login = $_SESSION['AdminLogin'] ;
$linkID = mysql_connect("localhost", "webuser", "zangtang");
mysql_select_db("SciPark");
$query0 = "SELECT * FROM AdminLogin WHERE `AdminLogin`='$login'";
$result0 = mysql_db_query("SciPark", $query0) or die ("could not query" . mysql_error());
$tung0=mysql_affected_rows();
$i=0; $j=0;
if(isset($_SESSION['AdminLogin']))
{
if($tung0)
{
if($_SERVER['REQUEST_METHOD'] == "POST")
{
$formValues = $_POST;
$formErrors = array();
$_SESSION["Vendor_Name"] = $_POST["Vendor_Name"];
$_SESSION["H_Vendor_Name"] = $_POST["H_Vendor_Name"];
$_SESSION["Vendor_Name"] = $_POST["Vendor_Name"];
$_SESSION["H_Vendor_Name"] = $_POST["H_Vendor_Name"];
$_SESSION["ExhbtEName"] = addslashes($_POST["ExhbtEName"]);
$_SESSION["ExhbtMName"] = $_POST["ExhbtMName"];
$_SESSION["ExhbtEPrincipal"] = addslashes($_POST["ExhbtEPrincipal"]);
$_SESSION["ExhbtMPrincipal"] = $_POST["ExhbtMPrincipal"];
$_SESSION["ExhbtEDescription"] = addslashes($_POST["ExhbtEDescription"]);
$_SESSION["ExhbtMDescription"] = $_POST["ExhbtMDescription"];
$_SESSION["ExhbtScientist"] = addslashes($_POST["ExhbtScientist"]);
$_SESSION["ExhbtCount"] = $_POST["ExhbtCount"];
$_SESSION["ExhbtWCount"] = $_POST["ExhbtWCount"];
$_SESSION["ExtraInfo"] = $_POST["ExtraInfo"];
$_SESSION["Vendor_Name"] = $_POST["Vendor_Name"];
$_SESSION["VendorArtist"] = $_POST["VendorArtist"];
$_SESSION["ExhbtPopularity"] = $_POST["ExhbtPopularity"];
$_SESSION["WebVisible"] = $_POST["WebVisible"];
if(isset($_POST["UpdateExhbt"]))
{
$_SESSION["Vendor_Name"] = $_POST["Vendor_Name"];
$_SESSION["H_Vendor_Name"] = $_POST["H_Vendor_Name"];
$_SESSION["Vendor_Name"] = $_POST["Vendor_Name"];
$_SESSION["H_Vendor_Name"] = $_POST["H_Vendor_Name"];
$_SESSION["ExhbtEName"] = addslashes($_POST["ExhbtEName"]);
$_SESSION["ExhbtMName"] = $_POST["ExhbtMName"];
$_SESSION["ExhbtEPrincipal"] = addslashes($_POST["ExhbtEPrincipal"]);
$_SESSION["ExhbtMPrincipal"] = $_POST["ExhbtMPrincipal"];
$_SESSION["ExhbtEDescription"] = addslashes($_POST["ExhbtEDescription"]);
$_SESSION["ExhbtMDescription"] = $_POST["ExhbtMDescription"];
$_SESSION["ExhbtScientist"] = addslashes($_POST["ExhbtScientist"]);
$_SESSION["ExhbtCount"] = $_POST["ExhbtCount"];
$_SESSION["ExhbtWCount"] = $_POST["ExhbtWCount"];
$_SESSION["ExtraInfo"] = $_POST["ExtraInfo"];
$_SESSION["Vendor_Name"] = $_POST["Vendor_Name"];
$_SESSION["VendorArtist"] = $_POST["VendorArtist"];
$_SESSION["ExhbtPopularity"] = $_POST["ExhbtPopularity"];
$_SESSION["WebVisible"] = $_POST["WebVisible"];
if(!VerifyForm($formValues, $formErrors))
DisplayForm($formValues, $formErrors);
else
{
$formValues = $_POST;
$formErrors = array();
$_SESSION["Vendor_Name"] = $_POST["Vendor_Name"];
$_SESSION["H_Vendor_Name"] = $_POST["H_Vendor_Name"];
$_SESSION["ExhbtEName"] = addslashes($_POST["ExhbtEName"]); $ExhbtEName = addslashes($_POST["ExhbtEName"]);
$_SESSION["ExhbtMName"] = $_POST["ExhbtMName"]; $ExhbtMName = $_POST["ExhbtMName"];
$_SESSION["ExhbtEPrincipal"] = addslashes($_POST["ExhbtEPrincipal"]); $ExhbtEPrincipal = addslashes($_POST["ExhbtEPrincipal"]);
$_SESSION["ExhbtMPrincipal"] = $_POST["ExhbtMPrincipal"]; $ExhbtMPrincipal = $_POST["ExhbtMPrincipal"];
$_SESSION["ExhbtEDescription"] = addslashes($_POST["ExhbtEDescription"]); $ExhbtEDescription = addslashes($_POST["ExhbtEDescription"]);
$_SESSION["ExhbtMDescription"] = $_POST["ExhbtMDescription"]; $ExhbtMDescription = $_POST["ExhbtMDescription"];
$_SESSION["ExhbtScientist"] = addslashes($_POST["ExhbtScientist"]); $ExhbtScientist = addslashes($_POST["ExhbtScientist"]);
$_SESSION["ExhbtCount"] = $_POST["ExhbtCount"]; $ExhbtCount = $_POST["ExhbtCount"];
$_SESSION["ExhbtWCount"] = $_POST["ExhbtWCount"]; $ExhbtWCount = $_POST["ExhbtWCount"];
$_SESSION["ExtraInfo"] = $_POST["ExtraInfo"]; $ExtraInfo = $_POST["ExtraInfo"];
$_SESSION["Vendor_Name"] = $_POST["Vendor_Name"]; $Vendor_Name = $_POST["Vendor_Name"];
$_SESSION["VendorArtist"] = $_POST["VendorArtist"]; $VendorArtist = $_POST["VendorArtist"];
$_SESSION["ExhbtPopularity"] = $_POST["ExhbtPopularity"]; $ExhbtPopularity = $_POST["ExhbtPopularity"];
$_SESSION["WebVisible"] = $_POST["WebVisible"]; $WebVisible = $_POST["WebVisible"];
$ExhbtCode = $_SESSION["ExhbtCode"];
$ExhbtNWCount = $ExhbtCount-$ExhbtWCount;
if (isset($ExhbtEName) && isset($ExhbtEDescription) && isset($ExhbtCount) && isset($WebVisible))
{
//print_r($_POST);
$Fdate = date("Y-m-d");
$Tag = "0";
$query5 = "UPDATE ExhbtMaster SET `ExhbtName` = '$ExhbtEName',
`ExhbtPrincipal` = '$ExhbtEPrincipal',
`Exhbt_Scientist`= '$ExhbtScientist',
`ExhbtDescr` = '$ExhbtEDescription',
`ExhbtNameMarathi` = '$ExhbtMName',
`ExhbtPrincipalMarathi`= '$ExhbtMPrincipal',
`ExhbtDescMarathi` = '$ExhbtMDescription',
`ExhbtCount` = '$ExhbtCount',
`ExhbtWCount` = '$ExhbtWCount',
`ExhbtNWCount`= $ExhbtNWCount,
`ExhbtRemark` = '$ExtraInfo',
`Vendor_ID` = '$Vendor_Name',
`VendorArtist` = '$VendorArtist',
`ExhbtPopularity` ='$ExhbtPopularity',
`WebShow` = '$WebVisible'
where `ExhbtId` = '$ExhbtCode'"; echo $query5 ;
$result5 = mysql_db_query("SciPark", $query5) or die ("could not connect to database".mysql_error());
$tung5=mysql_affected_rows();
echo "Record Updated" ;
header("Location: ExhbtUpdated.php?ExbtCode=$ExhbtCode");
}
else echo "Error found!!! Please fill the form correctly";
} //else close
}
else
{ $_SESSION["Vendor_Name"] = $_POST["Vendor_Name"];
$formValues = $_POST; $formErrors = array();
DisplayForm($formValues, $formErrors);
} //echo $_POST["a_addr1"]; }//} ////////
}
else
{
DisplayForm(null, null); //echo "here1"; //
}
}
}
else
{
header( 'Location: Access_Denied.html' ) ;
}
?>