Current Path : G:/PleskVhosts/mpcdp.in/cmamp.mpcdp.in/CP/ |
Windows NT SG2NWVPWEB022 10.0 build 17763 (Windows Server 2016) i586 |
Current File : G:/PleskVhosts/mpcdp.in/cmamp.mpcdp.in/CP/CPMasterDownload-Exec.php |
<?php if (isset($_POST['BtnAdd'])) { $mStart = $_GET['start']; $mDownloadID = $_GET['DownloadID']; header("location: CPMasterDownload.php?start=$mStart&DownloadID=$mDownloadID&mMode=Add"); } else if (isset($_POST['BtnModify'])) { $mStart = $_GET['start']; $mDownloadID = $_GET['DownloadID']; header("location: CPMasterDownload.php?start=$mStart&DownloadID=$mDownloadID&mMode=Modify"); } else if (isset($_POST['BtnSave'])) { require_once('CPConfig.php'); if (isset($_GET['mMode'])) { $mMode = $_GET['mMode']; } else { $mMode = ''; } $mStart = $_GET['start']; $mDownloadID = $_GET['DownloadID']; $link = mysql_connect($hostname, $username, $password) ; $db= mysql_select_db($dbname); $DownloadName = addslashes(str_replace("'", "'", $_POST['TxtDownloadName'])); $DownloadDescription = addslashes(str_replace("'", "'", $_POST['TxtDownloadDescription'])); $DownloadRemarks = addslashes(str_replace("'", "'", $_POST['TxtDownloadRemarks'])); if ($DownloadName == '') { session_start(); $_SESSION['mDownloadName'] = str_replace("'", "'", $_POST['TxtDownloadName']); $_SESSION['mDownloadDescription'] = str_replace("'", "'", $_POST['TxtDownloadDescription']); $_SESSION['mDownloadRemarks'] = str_replace("'", "'", $_POST['TxtDownloadRemarks']); header("location: CPMasterDownload.php?start=$mStart&DownloadID=$mDownloadID&mMode=$mMode&mError=Invalid Document..."); exit; } if ($mMode == 'Add') { $DocumentPath = 'Download/'; $DocumentName = basename($_FILES['DocumentPath']['name']); $DocumentFile = $DocumentPath . $DocumentName; move_uploaded_file($_FILES['DocumentPath']['tmp_name'], $DocumentFile); $qry = "INSERT INTO masterdownload(DownloadName, DownloadDescription, DownloadRemarks, DocumentPath, DocumentName) VALUES('$DownloadName', '$DownloadDescription', '$DownloadRemarks', '$DocumentPath', '$DocumentName')"; } else if ($mMode == 'Modify') { $DocumentPath = 'Download/'; $DocumentName = basename($_FILES['DocumentPath']['name']); $DocumentFile = $DocumentPath . $DocumentName; move_uploaded_file($_FILES['DocumentPath']['tmp_name'], $DocumentFile); $qry = "UPDATE masterdownload SET DownloadName='$DownloadName', DownloadDescription='$DownloadDescription', DownloadRemarks='$DownloadRemarks'"; if ($DocumentName != '') { $qry = $qry . ", DocumentName='$DocumentName'"; } $qry = $qry . " WHERE DownloadID=$mDownloadID"; } $result = @mysql_query($qry); if($result) { header("location: CPMasterDownload.php?start=$mStart&DownloadID=$mDownloadID&mMode=Save"); } else { die("Query failed"); } } else if (isset($_POST['BtnCancel'])) { $mStart = $_GET['start']; $mDownloadID = $_GET['DownloadID']; header("location: CPMasterDownload.php?start=$mStart&DownloadID=$mDownloadID&mMode=Cancel"); } else if (isset($_POST['BtnDelete'])) { require_once('CPConfig.php'); $mStart = $_GET['start']; $mDownloadID = $_GET['DownloadID']; $link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD); $db = mysql_select_db(DB_DATABASE); $qry = "DELETE FROM masterdownload WHERE DownloadID = '$mDownloadID'"; $result = @mysql_query($qry); if($result) { header("location: CPMasterDownload.php?start=$mStart&mMode=Delete"); } } ?>