We help IT Professionals succeed at work.

Problems redirecting to index page after logining

Robert Thomas
on
274 Views
Last Modified: 2010-04-25
I have created an login field were it is suppose to redirect users to either back to the home page or a registration page. The site is currently a subdomain on a yahoo site used for testing.  The problem is that when it redirects after the initail login it always point to the folder on the server instead of the actual subdomain address. For instance the main location is www.prism.dragteck.com, so when i login it should go to either the www.prism.dragteck.com address or www.prism.dragteck.com/index.php.  unfortuantly no matter what it always goes to http://www.prism.dragteck.com/prismV2/index.php. Pointing to the folder were it is stored on the sever.  I have everything I could to fix it.  On the test server on my local computer it works fine. Im wondering if it has something to do with yahoo's setup and if so what can I do to fix it.
Comment
Watch Question

Joe WuDeveloper | Solutions Architect | CTO
CERTIFIED EXPERT

Commented:
how are you redirecting after a successful login?
Something like this would have worked (provided you are in directory http://www.prism.dragteck.com/prismV2/):

header("Location: ../index.php");

Let me know how you get on.
Robert ThomasProgram Analyst / Web Developer

Author

Commented:
Im using the sever behaviors built into dreamweavers for the login function.  The directory folder location is actually dragteck.com/prismV2.  But I have it set up as a subdirectory on yahoo.  
Robert ThomasProgram Analyst / Web Developer

Author

Commented:
It looks like the main problem is coming from the form submit button.  It is the only thing that is pointing to the directory.
Robert ThomasProgram Analyst / Web Developer

Author

Commented:
Im not exactly sure how to fix this, since dreamweaver created the code.
Joe WuDeveloper | Solutions Architect | CTO
CERTIFIED EXPERT

Commented:
Are you able to post the code?
Robert ThomasProgram Analyst / Web Developer

Author

Commented:
not realy cause its a dreamweaver generated code and its not all in one place. I was wondering if there something maybe in the settings that i might need to change to fix this or if there are any special instructions for dealing with yahoo subdirecories
Joe WuDeveloper | Solutions Architect | CTO
CERTIFIED EXPERT

Commented:
no i dont' think so, I have not ever had to use dm's generated code since I wrote my own login codes, however i think there is something in the code which references to the directory instead of the root. If you look through the code you should be able to find it?
Robert ThomasProgram Analyst / Web Developer

Author

Commented:
I think this is the entire code but I don't see anything calling to that specific directory:

<?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['username'])) {
  $loginUsername=$_POST['username'];
  $password=$_POST['password'];
  $MM_fldUserAuthorization = "level";
  $MM_redirectLoginSuccess = "index.php";
  $MM_redirectLoginFailed = "registration.php";
  $MM_redirecttoReferrer = true;
  mysql_select_db($database_prism, $prism);
        
  $LoginRS__query=sprintf("SELECT user, password, level FROM user WHERE user='%s' AND password='%s'",
  get_magic_quotes_gpc() ? $loginUsername : addslashes($loginUsername), get_magic_quotes_gpc() ? $password : addslashes($password));
   
  $LoginRS = mysql_query($LoginRS__query, $prism) or die(mysql_error());
  $loginFoundUser = mysql_num_rows($LoginRS);
  if ($loginFoundUser) {
   
    $loginStrGroup  = mysql_result($LoginRS,0,'level');
   
    //declare two session variables and assign them
    $_SESSION['MM_Username'] = $loginUsername;
    $_SESSION['MM_UserGroup'] = $loginStrGroup;           

    if (isset($_SESSION['PrevUrl']) && true) {
      $MM_redirectLoginSuccess = $_SESSION['PrevUrl'];      
    }
    header("Location: " . $MM_redirectLoginSuccess );
  }
  else {
    header("Location: ". $MM_redirectLoginFailed );
  }
}
?>
>>$_SESSION['PrevUrl'] = $_GET['accesscheck'];

where is $_GET['accesscheck'] coming from? check its value.
Developer | Solutions Architect | CTO
CERTIFIED EXPERT
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.