I am trying to developing a ecommerce website. But My problem is in product purchase confirmation page.It show this type of message: (Notice: A session had already been started - ignoring session_start() in C:\xampp\htdocs\online shop\dataAccessLayer\dalSession.php on line 6) I need to some suggestion how can I solve this issue. Here is my code.
This is my dalSession.php page:
<?php
class Session
{
public static function Start(){
session_start(); //line 6
}
public static function Set($key , $value){
$_SESSION[$key] = $value;
}
public static function Get($key){
if (isset($_SESSION[$key])) {
return $_SESSION[$key];
}
else{
return false;
}
}
public static function Stop(){
session_destroy();
header("Location:user/login.php");
}
public static function StopA(){
session_destroy();
header("Location:../user/login.php");
}
public static function StopB(){
session_destroy();
header("Location:login.php");
}
public static function Check()
{
self::Start();
//echo $this->user_id;;
if (self::Get("Mlogin")==false)
{
self::Stop();
header("Location:login.php");
}
}
public static function CheckA(){
self::Start();
if (self::Get("Alogin")==false) {
self::StopA();
header("Location:../user/login.php");
}
}
public static function CheckAll()
{
if (self::Get("Mlogin")==false && self::Get("Alogin")==false)
{
return false;
}
else
{
return true;
}
}
public static function CheckUserLogin()
{self::Start();
if (self::Get("Mlogin")==false)
{
return false;
}
else
{
return true;
}
}
public static function Auto(){
self::Start();
if(self::Get("Mlogin")==false){
echo "<a style=\"color:white;\" href='user/login.php'>Login</a>";
} else {
echo "<a style=\"color:red;\" href='?action=logout'>Logout</a>";
if(isset($_GET['action']) && ($_GET['action']== "logout")){
self::Stop();
}
}
}
public static function AutoA(){
self::Start();
if(self::Get("Mlogin")==false){
echo "<a style=\"color:white;\" href='login.php'>Login</a>";
} else {
echo "<a style=\"color:red;\" href='?action=logout'>Logout</a>";
if(isset($_GET['action']) && ($_GET['action']== "logout")){
self::StopB();
}
}
}
}
?>
This is My confirm.php code:
<?php
require_once("/../dataAccessLayer/dalSession.php");
require_once("/../dataAccessLayer/dalLogin.php");
session::check();
?>
<?php
if(isset($_GET['action']) && ($_GET['action']== "logout")){
Session::Stop();
}
?>
<!doctype html>
<html lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<title>Success Notification Boxes</title>
<link rel="stylesheet" type="text/css" media="all" href="style.css">
<script type="text/javascript" src="https://ajax.googleapis.com /ajax/libs/jquery/1.9.1/jquery.min.js"></script>
</head>
<body>
<div id="w">
<div id="content">
<!-- Icons source http://dribbble.com/shots/913555-Flat-Web-Elements -->
<div class="notify successbox">
<h1>Success!</h1>
<span class="alerticon"><img src="" alt="checkmark" /></span>
<p>Thanks For Your Purchase.</p>
<p>Your Purchase Will Deliver Within 72 Hours.</p>
<p>Any Question? Please Call: <b>+8801721557233</b></p>
<p></p>
</div>
<h1><a class="navbar-brand" href="../index.php">Home</a></h1>
</div><!-- @end #content -->
</div><!-- @end #w -->
</body>
</html>