New to PHP... HELP
Posted: Fri Oct 26, 2007 12:58 pm
feyd | Please use
The part that is not working would be the very last IF statement. On the site that is currently active this page redirects to: http://www.mysite.com/admin/home.php
on my server the page redirects to: http://www.mysite.com/admin/index.php?a ... 2Fhome.php
Can anyone help me out on resolving this? Thanks,
CK
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
I am not a PHP developer, but I have been given a site that we need to host, which is in PHP. I have copied all of the files to my server and uploaded the db to my MySQL server. Everything on the site runs perfect, except for my admin page. I cannot my page to redirect to the proper page. Here is the code... again I did not write this so I have limited knowledge on why things are the way they are:Code: Select all
// *** 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 = "";
$MM_redirectLoginSuccess = "home.php";
$MM_redirectLoginFailed = "index.php?login=failed";
$MM_redirecttoReferrer = false;
mysql_select_db($database_connection, $connection);
$LoginRS__query=sprintf("SELECT username, password FROM admin_users WHERE username='%s' AND password='%s'",
get_magic_quotes_gpc() ? $loginUsername : addslashes($loginUsername), get_magic_quotes_gpc() ? $password : addslashes($password)) or die(mysql_error());
$LoginRS = mysql_query($LoginRS__query, $connection) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS) or die(mysql_error());
if ($loginFoundUser) {
$loginStrGroup = "";
//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 );
}
}on my server the page redirects to: http://www.mysite.com/admin/index.php?a ... 2Fhome.php
Can anyone help me out on resolving this? Thanks,
CK
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
[quote="[url=http://forums.devnetwork.net/viewtopic.php?t=30037]Forum Rules[/url] Section 1.1"][b]2.[/b] Use descriptive subjects when you start a new thread. Vague titles such as "Help!", "Why?" are misleading and keep you from receiving an answer to your question.[/quote]