Post by gila » Wed Sep 23, 2009 10:15 pm

hi, i'm tryng to protect the whole access to the opencart folder with a password, i put this code into index.php in the first row and it works the first time you access but then if you click any link of the page it sys that you're not logged, why?

here's the code i use

Code: Select all

if(!isset($_SESSION['login_ute'])) {
echo "no0";
   if(isset($_POST['pass']) && isset($_POST['user'])){
      if($_POST['pass']=="test" && $_POST['pass']=="test")
                 {
               $_SESSION['login_ute'] = true;
               }else{
                  echo "no1";
                  exit;
               }
      }else{
         echo "no2";
         exit;

New member

Posts

Joined
Fri Jan 25, 2008 4:33 am

Post by kdmp » Thu Sep 24, 2009 10:48 am

One coding error, not sure if you copied all of the code, but you didn't close the if first if statement.
if(!isset($_SESSION['login_ute'])) {
Try this:

Code: Select all

if(!isset($_SESSION['login_ute'])) {
   echo "no0";
   if(isset($_POST['pass']) && isset($_POST['user'])) {
      if($_POST['pass']=="test" && $_POST['pass']=="test") {
         $_SESSION['login_ute'] = true;
      } else {
          echo "no1";
          exit;
      }
   }else{
      echo "no2";
      exit;
}

Kevin Davidson
Purolator Shipping Module
Canpar Shipping Module
VQMod - Paypal Transaction ID to Payment Details


Active Member

Posts

Joined
Thu Jun 04, 2009 10:40 am
Location - Ontario, Canada

Post by Qphoria » Thu Sep 24, 2009 11:07 am

You should really look into how the admin uses the "preaction" system. You can use the same preaction on the front end

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am
Who is online

Users browsing this forum: No registered users and 13 guests