Hallo Man, not working...
1. modify index.php:
uncomment on line 34
2. make a new php file in phpwcm root directory and name it authorize.php and add following code in
Code: Select all
<?php
if(isset($_POST['form_aktion']) && $_POST['form_aktion'] == 'login') {
$login_passed = 0;
$wcs_user = slweg(trim($_POST['form_loginname']));
$wcs_pass = slweg(trim($_POST['form_password']));
$sql_query = "SELECT * FROM ".DB_PREPEND."phpwcms_user WHERE usr_login='".
aporeplace($wcs_user)."' AND (usr_pass=PASSWORD('".
aporeplace($wcs_pass)."') OR usr_pass='".
aporeplace(md5($wcs_pass))."') AND usr_aktiv=1;";
if($result = mysql_query($sql_query)) {
if($row = mysql_fetch_array($result)) {
$_SESSION["wcs_user"] = $wcs_user;
$_SESSION["wcs_pass"] = $wcs_pass;
$_SESSION["wcs_user_name"] = ($row["usr_name"]) ? $row["usr_name"] : $wcs_user;
$_SESSION["wcs_user_id"] = $row["usr_id"];
$_SESSION["wcs_user_aktiv"] = $row["usr_aktiv"];
$_SESSION["wcs_user_rechte"] = $row["usr_rechte"];
$_SESSION["wcs_user_email"] = $row["usr_email"];
$_SESSION["wcs_user_avatar"] = $row["usr_avatar"];
$_SESSION["wcs_user_logtime"] = time();
$_SESSION["wcs_user_admin"] = $row["usr_admin"];
$_SESSION["wcs_user_thumb"] = 1;
if($row["usr_lang"]) {
$_SESSION["wcs_user_lang"] = $row["usr_lang"];
}
$_SESSION["structure"] = unserialize($row["usr_var_structure"]);
$_SESSION["klapp"] = unserialize($row["usr_var_privatefile"]);
$_SESSION["pklapp"] = unserialize($row["usr_var_publicfile"]);
$login_passed = 1;
$_SESSION["frontend_user_in"]=true; //changed this one
}
mysql_free_result($result);
}
}
?>
3. Then I made a custom form and named it frm_Login.php BUT insert
require_once ("include/inc_lib/general.inc.php"); code (
reference):
Code: Select all
<?php
require_once ("include/inc_lib/general.inc.php");
?>
<table border="0" cellpadding="0" cellspacing="0">
<form name="login_formular" method="post" action="<?php echo $_SERVER['PHP_SELF']."?".$_SERVER['QUERY_STRING'] ?>" autocomplete="off">
<tr><td width="389" class="title"><?php echo $GLOBALS["template_default"]["login_text"]; ?></td></tr>
<?php
if($err) {
echo '<tr><td><img src="img/leer.gif" width="1" height="10"></td></tr>';
echo '<tr><td class="error"><strong>'.$GLOBALS["template_default"]["login_error"].'</strong></td></tr>';
}
?>
<tr><td><img src="img/leer.gif" width="1" height="12"></td></tr>
<tr><td class="v10"><?php echo $GLOBALS["template_default"]["login_username"] ?>:</td></tr>
<tr><td><input name="form_loginname" type="text" id="form_loginname" class="f11b" style="width:250px;" size="30" maxlength="30" value="<?php echo html_specialchars($wcs_user); ?>"></td></tr>
<tr><td><img src="img/leer.gif" width="1" height="3"></td></tr>
<tr><td class="v10"><?php echo $GLOBALS["template_default"]["login_userpass"] ?>:</td></tr>
<tr><td><input name="form_password" type="password" id="form_password" class="f11b" style="width:250px;" size="30" maxlength="20"></td></tr>
<tr><td><img src="img/leer.gif" width="1" height="3"></td></tr>
<tr><td><img src="img/leer.gif" width="1" height="18"></td></tr>
<tr><td><input name="Submit" type="submit" class="button10" value="<?php echo $GLOBALS["template_default"]["login_button"] ?>"><input name="form_aktion" type="hidden" id="form_aktion" value="login"></td></tr>
</form>
</table>
4. also I added some lines into include\inc_conf\conf.template_default.inc.php
Code: Select all
// login form template
$template_default["login_text"] = "Please Log in";
$template_default["login_error"] ="Wrong password";
$template_default["login_username"] ="Username";
$template_default["login_userpass"] ="Password";
$template_default["login_button"] ="Login";
5. I had to change include\inc_front\content_func.inc.php
Find out code like
Code: Select all
$content["all"] = str_replace('{CONTENT}', $content["main"], $content["all"]);
and add there code which is cheking from site structure frontend menu status: is this visible for users logged on only.
Code: Select all
$cat=$content["cat_id"];
if($content["struct"][$cat]["acat_regonly"]==1)
{
//echo "Private area!!!";
include_once("authorize.php");
if(!$_SESSION["frontend_user_in"]) {
//show log in form, instead of page content";
$content["main"]="{PHP:frm_Login.php}";
}
}
$content["all"] = str_replace('{CONTENT}', $content["main"], $content["all"]);
6. I had to create new site structura level: "hidden" with chechked frontend menu status: "hide" and "visible for users logged on only" and status: checked "visible" and "public". (
reference...)
7. and added "ext. content" with
file/URL: http://localhost/fl/frm_Login.php, visible.
8. and added plain text content part in "Partner login" page:
[ID 78] User login [/ID]
The ID 78 is the ext. content (frm_Login.php) id.
When I click the login link, comes the login page without words, only form tags, but in the source:
Code: Select all
<form name="login_formular" method="post" action="http://localhost/fl/fl/frm_Login.php?" autocomplete="off">
<form name="login_formular" method="post" action="
http://localhost/fl/fl/frm_Login.php?" autocomplete="off">
Why two "fl" directory? The real path is: "
http://localhost/fl/frm_Login.php"
Shortly..
O, and, where I can find this MOD (
reference):
Tnx, Paul