<?php

session_start();

if(!isset($error)){    $error = '';     }

if(!isset($_POST['password'])) {  $_POST['password'] = '';  }

if(isset($_POST['submit_pass']) && $_POST['pass']){

    $pass = $_POST['pass'];

    $_SESSION['password'] =  $pass;


    if( $pass == "BTS3DaysInn"){        

        $_SESSION['d_link'] = 'link_one';

    } else {

        $_SESSION['d_link'] = 'no_access';

        $error = "Incorrect Password";

    }

}

?>

<!DOCTYPE html>

<html lang="en">

<meta charset="UTF-8">

<title>Better Than Solar EBook</title>

<meta name="viewport" content="width=device-width,initial-scale=1">

<link rel="stylesheet" href="../assets/css/bootstrap.min.css" >

<link rel="stylesheet" href="../assets/css/custom.css" >

<style>

</style>

<script src="../assets/js/bootstrap.min.js"></script>



<body>



<div class="container">

<h1 align="center">EBook Downloads</h1>

        <!-- <h3 align="center">The First 72 Hours Ebook </h3> -->



    <?php

    if( isset($_SESSION['password']) &&  $_SESSION['d_link'] != 'no_access' ) { 

        if ($_SESSION['d_link'] == 'link_one'){

            $pdf_file_1 = "BetterThanSolarManuscript-5.62x8.62(V3J).pdf";
            $pdf_file_2 = "3DaysIn.pdf";

        }

    ?>

      

      

    <div class="row d-flex justify-content-center">

        <div class="card mb-12" style="max-width: 70%; margin:20px;">

            <div class="row no-gutters text-center" style="padding:30px;">

                <div class="col-sm-6">

                <img src="download_1.png" class="card-img" alt="" style="width:50%;">

                </div>

                <div class="col-sm-6">

                <div class="card-body">

                    <h5 class="card-title">Better Than Solar EBook</h5>

                    <img src="../assets/images/download.png" width="60" alt="<?php pathinfo($pdf_file_1, PATHINFO_FILENAME); ?>">

                     <p><a href="download.php?file=<?php echo urlencode($pdf_file_1); ?>">Download</a></p>

                </div>

                </div>

            </div>



        </div>

    </div>

    <div class="row d-flex justify-content-center">

        <div class="card mb-12" style="max-width: 70%; margin:20px;">

            <div class="row no-gutters text-center" style="padding:30px;">

                <div class="col-sm-6">

                <img src="download_2.png" class="card-img" alt="" style="width:50%;">

                </div>

                <div class="col-sm-6">

                <div class="card-body">

                    <h5 class="card-title">3 Days In EBook</h5>

                    <img src="../assets/images/download.png" width="60" alt="<?php pathinfo($pdf_file_2, PATHINFO_FILENAME); ?>">

                     <p><a href="download.php?file=<?php echo urlencode($pdf_file_2); ?>">Download</a></p>

                </div>

                </div>

            </div>



        </div>

    </div>



   

<?php

    } else {

    ?>

 <form method="post" action="<?php $_SERVER["PHP_SELF"]; ?> " id="login_form">

    <div class="row d-flex align-items-center justify-content-center h-100">

      

      <div class="col-md-12 col-lg-6 col-xl-6" style="margin-top:50px;">

        <h5> Please Enter Password to Download Bonus Guides</h5>

     

          <div class="form-outline mb-4">

            <input type="password" name="pass" class="form-control form-control-lg" required />

            <label class="form-label">Password</label>

          </div>

          <button type="submit" name="submit_pass" class="btn btn-primary btn-lg btn-block">Enter</button>



          <p><font style="color:red;"><?php echo $error; ?></font></p>

      </div>

    </div>



</form>



<?php } ?>

  

</div>





</body>

</html>