This is my fix for the issue I brought up at Bug? Should it work this way?.
This code fixes it so that when a user is logged into IndexU,
if they access either the login.php or register.php page, they will be redirected to the index.php page.
Fixing this issue involves some minor modifications to the login.php and register.php files.
Open login.php and replace the following function:
With this:Code:function ShowFormLogin() { // vars global configuration global $theme_path; // vars url & form global $f, $b; // vars template global $error_msg; if ($f == 1) DisplayTemplate($theme_path . "permission_error.html", "\$error_msg,\$username,\$password,\$f,\$b"); else DisplayTemplate($theme_path . "login_form.html", "\$error_msg,\$username,\$password,\$f,\$b"); }
Code:function ShowFormLogin() { // vars global configuration global $theme_path; // vars url & form global $f, $b; // vars template global $error_msg; $users_obj = new clsUsers; if ($users_obj->GetUserAuthentication() == 0) { if ($f == 1) DisplayTemplate($theme_path . "permission_error.html", "\$error_msg,\$username,\$password,\$f,\$b"); else DisplayTemplate($theme_path . "login_form.html", "\$error_msg,\$username,\$password,\$f,\$b"); } else { Redirect("index.php"); } }
Now open register.php and replace the following function:
Code:function ShowFormRegister() { // vars global configuration global $theme_path; // vars template global $error_msg; DisplayTemplate($theme_path . "register_form.html", "\$error_msg,\$username,\$password,\$password2,\$email"); }
With this:
Thats all there is to it.Code:function ShowFormRegister() { // vars global configuration global $theme_path; // vars template global $error_msg; $users_obj = new clsUsers; if ($users_obj->GetUserAuthentication() == 0) { DisplayTemplate($theme_path . "register_form.html", "\$error_msg,\$username,\$password,\$password2,\$email,\$logged_in"); } else { Redirect("index.php"); } }
You can download the login.php and register.php files for free along with the instructions in zip format at http://store.scriptdragon.com/viewitem.php?ItemID=8
Wayne


LinkBack URL
About LinkBacks

