Jump to content

Login Re-direct Error!!!


rawky1976

Recommended Posts

Hello

 

This restrict access script was automatically created by Dreamweaver, for some reason it always re-directs to loginFailure.php???

 

<?php require_once('Connections/connKnowledgeBase.php'); ?>

<?php

if (!isset($_SESSION)) {

  session_start();

}

$MM_authorizedUsers = "";

$MM_donotCheckaccess = "true";

 

// *** Restrict Access To Page: Grant or deny access to this page

function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) {

  // For security, start by assuming the visitor is NOT authorized.

  $isValid = False;

 

  // When a visitor has logged into this site, the Session variable MM_Username set equal to their username.

  // Therefore, we know that a user is NOT logged in if that Session variable is blank.

  if (!empty($UserName)) {

    // Besides being logged in, you may restrict access to only certain users based on an ID established when they login.

    // Parse the strings into arrays.

    $arrUsers = Explode(",", $strUsers);

    $arrGroups = Explode(",", $strGroups);

    if (in_array($UserName, $arrUsers)) {

      $isValid = true;

    }

    // Or, you may restrict access to only certain users based on their username.

    if (in_array($UserGroup, $arrGroups)) {

      $isValid = true;

    }

    if (($strUsers == "") && true) {

      $isValid = true;

    }

  }

  return $isValid;

}

 

$MM_restrictGoTo = "loginFailure.php";

if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) { 

  $MM_qsChar = "?";

  $MM_referrer = $_SERVER['PHP_SELF'];

  if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";

  if (isset($QUERY_STRING) && strlen($QUERY_STRING) > 0)

  $MM_referrer .= "?" . $QUERY_STRING;

  $MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);

  header("Location: ". $MM_restrictGoTo);

  exit;

}

?>

Link to comment
https://forums.phpfreaks.com/topic/38213-login-re-direct-error/
Share on other sites

Dreamweaver isn't good for PHP. Now that that's out of the way...

 

It checks the username against blank lists in the call to isAuthorized(), or so I think that's what's happening. I can't really tell though, since Dreamweaver's code is pretty ugly, and it's not in a code block.

Link to comment
https://forums.phpfreaks.com/topic/38213-login-re-direct-error/#findComment-182989
Share on other sites

You set up your site and choose a code model, PHP is right there man!!!

 

I re-created an upload script with help from this site and it was half the size of DW, so I know it isn't great! But it's all I got whilst I learn!!!

 

Do you need code for any other pages to help me???

 

Thanks, Mark

Link to comment
https://forums.phpfreaks.com/topic/38213-login-re-direct-error/#findComment-182995
Share on other sites

But it's all I got whilst I learn!!!

 

There are a ton of free and better options here for PHP work. Interface work can still be done in Dreamweaver, but don't do PHP work with it.

 

Anyway, I suggest you look into some online tutorials for login/membership systems. In all honesty, Dreamweaver's code sucks horribly. You have to update that page every time you want to add a new member, which is a horrible waste of time, not to mention the code in itself is quite a bit messy.

 

Also, refer to my previous post for a potential solution to the problem of Dreamweaver's code.

Link to comment
https://forums.phpfreaks.com/topic/38213-login-re-direct-error/#findComment-183001
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.