serican Posted February 15, 2017 Share Posted February 15, 2017 Notice: Undefined index: location in /storage/h5/444/813444/public_html/index.php on line 6 PHP 5.4 server im getting this error above... script is as below:- pls help anyone? <?php $GLOBALS['key'] = "thisisapasswordkeytoprotectmarketingplan"; $GLOBALS['expiry'] = 5*60; // in seconds if ($_GET['location'] == 'viewMarketingPlan' && strlen($_GET['key']) > 0 && $_GET['view'] == 'true') { $key = $GLOBALS['key']; $data = trim($_GET['key']); $data = base64_decode(strtr($data, '-_,', '+/=')); $decoded = rtrim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, md5($key), $data, MCRYPT_MODE_CBC, md5(md5($key))), "\0"); $decoded = explode("|SEAN|", $decoded); list($code, $race, $country, $expiry) = $decoded; if ($expiry >= (time()+$GLOBALS['expiry'])) exit; if ($country == "IN") { $file = "mp-india"; } else if ($race == "M") { $file = "mp-malaysia-ms"; } else { $file = "mp-malaysia-en"; } $filepath = "../../marketing-plans/{$file}.pdf"; header('Content-type: application/pdf'); //header('Content-Disposition: attachment; filename="Tasly-Marketing-Plan.pdf"'); @readfile(realpath($filepath)); exit; } require_once 'functions.php'; session_start(); if (isset($_SESSION['user'])) { if ($_SESSION['status'] == 'Active') { // force auto logout if inacrive for more than 1 hour if (strlen($_SESSION['lastActive']) > 0 && ($_SESSION['lastActive']+(1*60*60)) <= time()) { header("Location: logout.php"); } $_SESSION['lastActive'] = time(); $location=$_GET['location']; if (empty($location)) $location='index'; changelocation($location); } else { //the status session variable isn't registered and not equal to active, send them back to the inactive page. /* $host = $_SERVER["HTTP_HOST"]; ` $uri = rtrim(dirname($_SERVER["PHP_SELF"]), "{\\}"); $extra = "inactiveDist.php"; */ header("Location: inactiveDist.php"); } } else { //the session variable isn't registered, send them back to the login page /* $host = $_SERVER["HTTP_HOST"]; $uri = rtrim(dirname($_SERVER["PHP_SELF"]), "{\\}"); $extra = "login.php"; */ header("Location: login.php"); } function changelocation($location) { $user=$_SESSION["user"]; $post=$_SESSION["post"]; $name=$_SESSION["name"]; require_once "dbconnect.php"; include ('header.php'); echo '<table cols="3" border="0" cellpadding="10" cellspacing="0" align="center" width="100%">'; echo '<tr>'; echo '<td width="20%" bgcolor="" valign="top" rowspan="4">'; include('navbar.php'); echo '</td>'; echo '<td bgcolor="" valign="top">'; $locations = array('viewInfo', 'changePass', 'netListing', 'detailNetListing', 'PGS', 'monthPGS', 'downDetail', 'histBonusSum', 'bonusSum', 'periodInq', 'networkbns', 'Inquiry2', 'Inquiry', 'periodActlines', 'periodActlines2', 'ActDownlines', 'ActDownlines2', 'estTotalSales', 'newPromo', 'newProducts', 'productPricing', 'Greenair', 'Pillow', 'viewMarketingPlan'); if (in_array($location, $locations)) { // marketPlan2-13 //substr($location,0,10) == 'marketPlan' && substr($location,10,strlen($location)) >= 2 && substr($location,10,strlen($location)) <= 13) { require_once "{$location}.php"; } else if (in_array($location, array('index', 'importantNotice'))) { require_once "main.php"; } echo '</td></tr></table>'; include ('footer.php'); } Quote Link to comment Share on other sites More sharing options...
Jacques1 Posted February 15, 2017 Share Posted February 15, 2017 Well, you're obviously trying to access the script without a location parameter in the URL, and the script cannot handle that. You have much bigger issues, though. PHP 5.4 is long dead and doesn't even receive security updates. And the self-made encryption scheme in your code is horribly broken. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.