ccrevcypsys Posted August 31, 2007 Share Posted August 31, 2007 I get this error Warning: Cannot modify header information - headers already sent by (output started at /home/streamru/public_html/language/en/lang.inc.php:6001) in /home/streamru/public_html/includes/content/login.inc.php on line 76 and heres the code it says is wrong header("Location: ".str_replace("amp;","",treatGet(base64_decode($_GET['redir'])))); It wont let me log in to the web site can somone please help me Quote Link to comment https://forums.phpfreaks.com/topic/67494-solved-login-problem/ Share on other sites More sharing options...
pocobueno1388 Posted August 31, 2007 Share Posted August 31, 2007 The header function has to be called before any output to the browser. If you post your code to that script, we can help you place it in the correct spot. Quote Link to comment https://forums.phpfreaks.com/topic/67494-solved-login-problem/#findComment-338859 Share on other sites More sharing options...
ccrevcypsys Posted August 31, 2007 Author Share Posted August 31, 2007 here is the login php code $_GET['act'] = treatGet($_GET['act']); if($_GET['act']=="login" && isset($_POST['username']) && isset($_POST['password'])){ $_POST['username'] = treatGet($_POST['username']); $_POST['password'] = treatGet($_POST['password']); $query = "SELECT customer_id FROM ".$glob['dbprefix']."CubeCart_customer WHERE email=".$db->mySQLSafe($_POST['username'])." AND password = ".$db->mySQLSafe(md5($_POST['password']))." AND type>0"; $customer = $db->select($query); if($customer==FALSE) { if($db->blocker($_POST['username'],$ini['bfattempts'],$ini['bftime'],FALSE,"f")==TRUE) { $blocked = TRUE; } } elseif($customer[0]['customer_id']>0) { if($db->blocker($_POST['username'],$ini['bfattempts'],$ini['bftime'],TRUE,"f")==TRUE) { $blocked = TRUE; } else { $customerData["customer_id"] = $customer[0]['customer_id']; $update = $db->update($glob['dbprefix']."CubeCart_sessions", $customerData,"sessId=".$db->mySQLSafe($_SESSION['ccUser'])); $_POST['remember'] = treatGet($_POST['remember']); if($_POST['remember']==1){ setcookie("ccRemember","1",time()+$config['sqlSessionExpiry'], $GLOBALS['rootRel']); } // redirect // "login","reg","unsubscribe","forgotPass" if(isset($_GET['redir']) && !empty($_GET['redir']) && !eregi("logout|login|forgotPass|changePass",base64_decode($_GET['redir']))){ header("Location: ".str_replace("amp;","",treatGet(base64_decode($_GET['redir'])))); exit; } else { header("Location: ".$GLOBALS['rootRel']."index.php"); exit; } } } elseif(eregi("step1",base64_decode($_GET['redir']))) { header("Location: ".$GLOBALS['rootRel']."cart.php?act=step1"); exit; } } Now heres the session.php page if(($config['offLine']==1 && isset($_SESSION['ccAdmin']) && $config['offLineAllowAdmin']==0) || ($config['offLine']==1 && !isset($_SESSION['ccAdmin']))) { header("Location: offLine.php"); exit; } $sessData["location"] = $db->mySQLSafe(currentPage()); $lkParsed = "PC9ib2R5Pg==PC9odG1sPg=="; if( !isset($_SESSION['ccUser']) && (isset($_COOKIE['ccUser']) || isset($_GET['ccUser'])) ){ if(isset($_COOKIE['ccUser'])){ $_COOKIE['ccUser'] = treatGet($_COOKIE['ccUser']); $sessId = base64_decode($_COOKIE['ccUser']); } elseif(isset($_GET['ccUser'])){ $_GET['ccUser'] = treatGet($_GET['ccUser']); $sessId = $_GET['ccUser']; } // see if session is still in db $query = "SELECT sessId FROM ".$glob['dbprefix']."CubeCart_sessions WHERE sessId=".$db->mySQLSafe($sessId); $results = $db->select($query); if($results == TRUE){ $sessData["timeLast"] = $db->mySQLSafe(time()); if(!isset($_COOKIE['ccRemember'])) { $sessData["customer_id"] = 0; } $update = $db->update($glob['dbprefix']."CubeCart_sessions", $sessData,"sessId=".$db->mySQLSafe($results[0]['sessId'])); $_SESSION['ccUser'] = $results[0]['sessId']; // set cookie to extend expire time meaning if the visitor visits regularly they stay logged in setcookie("ccUser", base64_encode($sessId),time()+$config['sqlSessionExpiry'], $sessionDomain); } } if(!isset($_SESSION['ccUser']) && $results == FALSE) { $sessId = makeSessId(); $_SESSION['ccUser'] = $sessId; // insert sessionId into db $sessData["sessId"] = $db->mySQLSafe($_SESSION['ccUser']); $timeNow = $db->mySQLSafe(time()); $sessData["timeStart"] = $timeNow; $sessData["timeLast"] = $timeNow; $sessData["customer_id"] = 0; $insert = $db->insert($glob['dbprefix']."CubeCart_sessions", $sessData); // set cookie setcookie("ccUser", base64_encode($sessId),time()+$config['sqlSessionExpiry'], $sessionDomain); // delete sessions older than time set in config file $expiredSessTime = time() - $config['sqlSessionExpiry']; $delete = $db->delete($glob['dbprefix']."CubeCart_sessions", "timeLast<".$expiredSessTime); } else { $sessData["timeLast"] = $db->mySQLSafe(time()); $update = $db->update($glob['dbprefix']."CubeCart_sessions", $sessData,"sessId=".$db->mySQLSafe($_SESSION['ccUser'])); } $uniKey = "PGRpdiBjbGFzcz0ndHh0Q29weXJpZ2h0Jz5Qb3dlcmVkIGJ5IDxhIGhyZWY9J2h0dHA6Ly93d3cuY3ViZWNhcnQuY29tJyBjbGFzcz0ndHh0Q29weXJpZ2h0JyB0YXJnZXQ9J19ibGFuayc+Q3ViZUNhcnQ8L2E+JnRyYWRlOzxiciAvPkNvcHlyaWdodCA8YSBocmVmPSdodHRwOi8vd3d3LmRldmVsbGlvbi5jb20nIGNsYXNzPSd0eHRDb3B5cmlnaHQnIHRhcmdldD0nX2JsYW5rJz5EZXZlbGxpb24gTGltaXRlZDwvYT4gMjAwNi4gQWxsIHJpZ2h0cyByZXNlcnZlZC48L2Rpdj48L2JvZHk+"; $uniKey2 = "TG9jYXRpb246IGh0dHA6Ly93d3cuY3ViZWNhcnQuY29tL3NpdGUvcHVyY2hhc2Uv"; // get userdata $query = "SELECT * FROM ".$glob['dbprefix']."CubeCart_sessions LEFT JOIN ".$glob['dbprefix']."CubeCart_customer ON ".$glob['dbprefix']."CubeCart_sessions.customer_id = ".$glob['dbprefix']."CubeCart_customer.customer_id WHERE sessId = ".$db->mySQLSafe($_SESSION['ccUser']); $ccUserData = $db->select($query); // We have a session issue :-/ (e.g. session but no matching DB value) if($ccUserData==FALSE) { // reset session and reload current page unset($_SESSION['ccUser'],$_COOKIE['ccUser'],$_COOKIE['ccRemember']); header("Location: ".str_replace("&","&",currentPage())); exit; } Quote Link to comment https://forums.phpfreaks.com/topic/67494-solved-login-problem/#findComment-338860 Share on other sites More sharing options...
ccrevcypsys Posted August 31, 2007 Author Share Posted August 31, 2007 are those the pages you can help me with? Quote Link to comment https://forums.phpfreaks.com/topic/67494-solved-login-problem/#findComment-338922 Share on other sites More sharing options...
pocobueno1388 Posted August 31, 2007 Share Posted August 31, 2007 Are those the entire files? You had to have included another page somewhere in the script with the include() or require_once() function. Quote Link to comment https://forums.phpfreaks.com/topic/67494-solved-login-problem/#findComment-338943 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.