Since the question is a bit vague and unclear, I will clarify what I mean in the following sentences.
The main page of my website is called index3.php and in there, there is the appropriate log in form which requires username and password fields for the user to log in.
What I am trying to do but I couldn’t manage yet, is on submit to be redirected in index3.php but instead of the log-in form to see text saying “Logged-in as:” in the log-in div. In other words replacing the form with Dynamic Text in the same div the form was in previously. Currently what it does is to redirect you to another page called login.php.
here is the php-code of the index3.php
<?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 = "";
$MM_redirectLoginSuccess = "login.php";
$MM_redirectLoginFailed = "index3.php";
$MM_redirecttoReferrer = false;
mysql_select_db($database_ideatedb, $ideatedb);
$LoginRS__query=sprintf("SELECT username, password FROM users WHERE username=%s AND password='".md5($_POST['password'])."'",
GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text"));
$LoginRS = mysql_query($LoginRS__query, $ideatedb) 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 );
}
}
?>
Any help or direction will be greatly appreciated.
This line determines where you are redirected:
So if you want to go to
index3.php, just changelogin.phptoindex3.php.Then, you’ll have to alter
index3.phpto display the signed-in message instead of the login form. As far as I can tell, this happens in a part of the file you haven’t supplied, but the basic idea would probably be like this:(In case you’re confused by the lack of curly braces, I used the alternative syntax for control structures, because it’s slightly nicer when writing spaghetti code.)