Front-end Users 1.2.5-DEV + solution ;-)
Front-end Users 1.2.5-DEV + solution ;-)
Hello
Does the release 1.2.5-DEV Support Front-end Users? I saw the backend User Administration.
I have Site running Release 1.1-RC4 27-08-2004 and can only upgrade if this function is supported.
Or does any body run a site release 1.2.5-DEV with the mod_ragi_read Mod
Thanks, Sven
Does the release 1.2.5-DEV Support Front-end Users? I saw the backend User Administration.
I have Site running Release 1.1-RC4 27-08-2004 and can only upgrade if this function is supported.
Or does any body run a site release 1.2.5-DEV with the mod_ragi_read Mod
Thanks, Sven
Re: Front-end Users 1.2.5-DEV
I have done it.ssyfrig wrote:Hello
Does the release 1.2.5-DEV Support Front-end Users? I saw the backend User Administration.
I have Site running Release 1.1-RC4 27-08-2004 and can only upgrade if this function is supported.
Or does any body run a site release 1.2.5-DEV with the mod_ragi_read Mod
Thanks, Sven
Step1.
Find in index.php the following:
if(!isset($_SESSION['frontend_user'])) {
$_SESSION['frontend_user']['id'] = 0;
$_SESSION['frontend_user']['login'] = 'guest';
$_SESSION['frontend_user']['name'] = 'Guest';
// start frontend user login
if(isset($_POST['fe_user_submit']) || isset($_POST['fe_user_login'])) {
require_once ("include/inc_lib/general.inc.php");
require_once ("include/inc_front/front.func.inc.php");
}
}
and replace it with the following:
if(!isset($_SESSION['frontend_user']) || empty($_SESSION['frontend_user']['id'])) {
$_SESSION['frontend_user']['id'] = 0;
$_SESSION['frontend_user']['login'] = 'guest';
$_SESSION['frontend_user']['name'] = 'Guest';
// start frontend user login
if(isset($_POST['fe_user_submit']) || isset($_POST['fe_user_login'])) {
require_once ("include/inc_lib/general.inc.php");
require_once ("include/inc_front/front.func.inc.php");
$res = login_fe_user($_POST['fe_user_login'],$_POST['fe_user_pass']);
} else {
//Updaten, wenn User ausgewählt
$sql = "UPDATE ".DB_PREPEND."phpwcms_userlog SET logged_in = 0, logged_change = ". time() .
"WHERE logged_in = 1 AND (" . time() ." - logged_change ) > ".$phpwcms["max_time"].";";
mysql_query($sql, $db);
}
}
if(isset($_POST['fe_user_logout'])) {
session_destroy();
unset($_SESSION['frontend_user']);
header("Location:".$phpwcms["site"]);
}
Step 2:
Save the following as phpwcms_template/fe_user_login_form.php
<?php
$fe_login_form = '<form class="login_form" name="fe_login" method="post" action="'.FE_CURRENT_URL.'" style="margin:0;padding:0;"><table class="login_table" border="0" cellspacing="0" cellpadding="1">
<tr class="login_row">
<td style="font-size:10px;font-family:Verdana, Arial, Helvetica, sans-serif" class="login_data">Login: </td>
<td class="login_data"><input name="fe_user_login" type="text" id="fe_user_login" size="20" maxlength="30" style="font-size:12px;font-family:Verdana, Arial, Helvetica, sans-serif;width:130px;"></td>
</tr>
<tr class="login_row">
<td style="font-size:10px;font-family:Verdana, Arial, Helvetica, sans-serif" class="login_data">Password: </td>
<td class="login_data"><input name="fe_user_pass" type="password" id="fe_user_login" size="20" maxlength="100" style="font-size:12px;font-family:Verdana, Arial, Helvetica, sans-serif;width:130px;"></td>
</tr>
<tr class="login_row">
<td class="login_data"> </td>
<td class="login_data"><input type="submit" name="fe_user_submit" value="Anmelden" style="margin-top:2px;font-size:10px;font-family:Verdana, Arial, Helvetica, sans-serif"></td>
</tr>
</table>
</form>';
?>
Step 3:
Find the following in include/inc_front/content.func.inc.php
// put in the complete rendered content
$content["all"] = str_replace('{CONTENT}', $content["main"], $content["all"]);
and replace it with the following:
if(empty($_SESSION['frontend_user']['id']) && $content["struct"][$aktion[0]]['acat_regonly']==1) {
// put in the login form instead of complete content include(PHPWCMS_ROOT."/".$phpwcms["templates"]."/inc_script/fe_user_login_form.php");
$content["all"] = str_replace('{CONTENT}', $fe_login_form, $content["all"]);
} else
{
// put in the complete rendered content
$content["all"] = str_replace('{CONTENT}', $content["main"], $content["all"]);
}
Step 4:
Save the following as phpwcms_template/inc_script/frontend_render/logout.php
<?php
// by Tamer ERDOGAN, 2005 - returns logout submit button
$logout_form = '<form class="logout_form" name="fe_login" method="post" action="'.FE_CURRENT_URL.'" style="margin:0;padding:0;">
<input type="submit" name="fe_user_logout" id="fe_user_logout" value="Abmelden" class="logout_button"></form>';
if( ! ( strpos($content["all"],'{LOGOUT')===false ) ) {
$content["all"] = str_replace("{LOGOUT}", $logout_form, $content["all"]);
}
// LOGOUT replacement (by Tamer ERDOGAN, 2005)
// -------------------------------------------------------------
?>
That is it.
And you can use the {LOGOUT} tag to put the logout button wherever you want in the closed category.
enjoy it.
can someone confirm that this work?
If so - maybe it should be posted in the hack section
If so - maybe it should be posted in the hack section
http://www.studmed.dk Portal for doctors and medical students in Denmark
I tried, but I couldn't have the login form for protected pages.
And there is a little mistake in the script:
In the file content.func.inc.php, the file fe_user_login_form.php is in ".$phpwcms["templates"]."/inc_script/fe_user_login_form.php" and msdesign said to create it in phpwcms_template/fe_user_login_form.php.
Is it a mistake ?
And there is a little mistake in the script:
In the file content.func.inc.php, the file fe_user_login_form.php is in ".$phpwcms["templates"]."/inc_script/fe_user_login_form.php" and msdesign said to create it in phpwcms_template/fe_user_login_form.php.
Is it a mistake ?
-
- Posts: 32
- Joined: Mon 16. Feb 2004, 13:10
- Location: Belgium
- Contact:
True
Nope, followed instructions, and can't get it to work.
However, I think it must be something small though...
However, I think it must be something small though...
well the code doesnt worked for me...dbaron wrote:Nobody tried it?
http://www.studmed.dk Portal for doctors and medical students in Denmark