Skip to main content
December 20, 2014
Question

dreamweaver login redirect not working

  • December 20, 2014
  • 1 reply
  • 643 views

My website was working fine but there some problems with hosting. they informed to change my database username and password. after I changed my username and password I can not log in to my site to insert data. When i click sign in the browser loads the same login page again. Surprisingly everything works fine locally but I can not login on my live website. Hope some one help me

<?php

// *** Validate request to login to this site.

if (!isset($_SESSION)) {

  session_start();

}

$loginFormAction = $_SERVER['PHP_SELF'];

if (isset($_GET['accesscheck'])) {

  $_SESSION['PrevUrl'] = $_GET['accesscheck'];

}

if (isset($_POST['User_Name'])) {

  $loginUsername=$_POST['User_Name'];

  $password=$_POST['User_Pass'];

  $MM_fldUserAuthorization = "";

  $MM_redirectLoginSuccess = "post-list.php";

  $MM_redirectLoginFailed = "../index.php";

  $MM_redirecttoReferrer = false;

  mysql_select_db($database_afghanistan, $afghanistan);

 

  $LoginRS__query=sprintf("SELECT User_Name, User_Pass FROM users WHERE User_Name=%s AND User_Pass=%s",

    GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text"));

  

  $LoginRS = mysql_query($LoginRS__query, $afghanistan) or die(mysql_error());

  $loginFoundUser = mysql_num_rows($LoginRS);

  if ($loginFoundUser) {

     $loginStrGroup = "";

   

    if (PHP_VERSION >= 5.1) {session_regenerate_id(true);} else {session_regenerate_id();}

    //declare two session variables and assign them

    $_SESSION['MM_Username'] = $loginUsername;

    $_SESSION['MM_UserGroup'] = $loginStrGroup;         

    if (isset($_SESSION['PrevUrl']) && false) {

      $MM_redirectLoginSuccess = $_SESSION['PrevUrl'];   

    }

    header("Location: " . $MM_redirectLoginSuccess );

  }

  else {

    header("Location: ". $MM_redirectLoginFailed );

  }

}

?>

This topic is closed to new replies. Start a new post to keep the conversation going.

1 reply

Participating Frequently
December 22, 2014

So you changed your credentials in your remote database? Did you also update the credentials in your CONNECTIONS file?