Hello,
I would like to use PHP to check for a active mm session just as your login_box.php does:
if($_SESSION[email_address] && $_SESSION[pass]) or
if( ! $_SESSION[mm_logged_in])
If there is not an active session I would like to automatically login with a "demo" user account i.e. with a associated email_address and password account I will create. Is there a login function that I can call with this email_address and password that will start a session and login the demo user automatically?
I would like crawlers and spiders to access my protected pages using this automated demo login and account information.
Mark,
If you start at the top of the .php file:
<?php
session_start();
//This will allow you to find the $_SESSION vars.
if(!$_SESSION[mm_logged_in]) { // check if not logged in
header('Location: /mm2/control_panel.php?email_address=demo@user.com&pass=pass_here');
}
?>
Should direct you to the control panel login with the details filled in automatically.
Make the code above is the start of the file. No blank lines above it at the top
Excellent! I will give this a try.
Mark,
If you start at the top of the .php file:
<?php
session_start();
//This will allow you to find the $_SESSION vars.
if(!$_SESSION[mm_logged_in]) { // check if not logged in
header('Location: /mm2/control_panel.php?email_address=demo@user.com&pass=pass_here');
}
?>
Should direct you to the control panel login with the details filled in automatically.
Make the code above is the start of the file. No blank lines above it at the top
Ok - Report back if you could. I did not test this so its off the top of my head. Let us know how it works.
Well this will automatically set the user and password within the control panel but it does not actually do the login. It requires a click by the user. Is there anyway to login automatically?
Mark
Ok - Report back if you could. I did not test this so its off the top of my head. Let us know how it works.
<?php
session_start();
//This will allow you to find the $_SESSION vars.
if(!$_SESSION[mm_logged_in]) { // check if not logged in
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<SCRIPT LANGUAGE="JavaScript">
function submitForm(){
document.form.submit();
}
</SCRIPT>
</head>
<body onload="submitForm()">
// Need to get the control_panel in here. If I look at the interface files the body tag is outside
// the literal edit section. How does this get done? Cannot include it can I set php variables with
// the email_address and pass so that I do not have to send the control panel the argument list?
// Then use include("mm2/control_panel.php").
mm2/control_panel.php?email_address=demo@user.com&pass=pass_here
</body>
</html>
?>
}
?>
The submit code is suppose to go on the login template:
/interface/user_login.php
Which actually we need to add more code to make it only have that code when directed to the control
panel from this redirect.
I can help with this after you place the submit java code on that user_login.php template.