Robert Thomas
asked on
Problems redirecting to index page after logining
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.
ASKER
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.
ASKER
It looks like the main problem is coming from the form submit button. It is the only thing that is pointing to the directory.
ASKER
Im not exactly sure how to fix this, since dreamweaver created the code.
Are you able to post the code?
ASKER
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
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?
ASKER
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['use rname'];
$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("S ELECT 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__quer y, $prism) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);
if ($loginFoundUser) {
$loginStrGroup = mysql_result($LoginRS,0,'l evel');
//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 );
}
}
?>
<?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['use
$password=$_POST['password
$MM_fldUserAuthorization = "level";
$MM_redirectLoginSuccess = "index.php";
$MM_redirectLoginFailed = "registration.php";
$MM_redirecttoReferrer = true;
mysql_select_db($database_
$LoginRS__query=sprintf("S
get_magic_quotes_gpc() ? $loginUsername : addslashes($loginUsername)
$LoginRS = mysql_query($LoginRS__quer
$loginFoundUser = mysql_num_rows($LoginRS);
if ($loginFoundUser) {
$loginStrGroup = mysql_result($LoginRS,0,'l
//declare two session variables and assign them
$_SESSION['MM_Username'] = $loginUsername;
$_SESSION['MM_UserGroup'] = $loginStrGroup;
if (isset($_SESSION['PrevUrl'
$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.
where is $_GET['accesscheck'] coming from? check its value.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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.