Welcome, Guest. Please login or register.
Did you miss your activation email?
February 13, 2012, 02:40:01 AM

Login with username, password and session length
Search:     Advanced search
Wollen Sie dem WebsiteBaker Team beitreten?
Nähere Informationen finden Sie unter hier und auf unserer neuen Webseite.
149700 Posts in 21103 Topics by 7538 Members
Latest Member: ionline
* Home Help Search Login Register
Pages: [1]   Go Down
Print
Author Topic: login redirect to private page  (Read 2405 times)
hanp

Offline Offline

Posts: 2


« on: February 16, 2010, 12:43:43 PM »

Searching the www I found the flw. page with a solution for a login and a redirect to a private page:

http://www.escpro.de/esc/posts/benutzer-auf-private-seite-weiterleiten-132.php

flw. I made a try to translate it to English

Users redirect to private page


Who would like to offer its users in WebsiteBaker an individual or group-page, Can as explained as follows redirect its users directly to his personal page( instead of the first beeing forwarded to the default WebsiteBaker home page.


For registration, we use the normal WebsiteBaker login mask, with a redirect to a hidden intermediate page (in this example wbuser.php)

This for example could look like this: (The page wbuser.php we set on the visibility: hidden)

<?php if(FRONTEND_LOGIN AND !$admin->is_authenticated()) {
                    $page = 'http://' .$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
                    ?>
<form name="login" action="<?php echo LOGIN_URL; ?>?redirect=<?php echo WB_URL; echo'/pages/'; echo 'wbuser.php';?>" method="post">
<fieldset class="topbox">
<legend><?php echo $TEXT['LOGIN']; ?></legend>
<fieldset class="topbox">
<div class="topboxbody">
<label for="username"><?php echo $TEXT['USERNAME']; ?>:</label>
<input type="text" name="username" id="username" class="text" />
<label for="password"><?php echo $TEXT['PASSWORD']; ?>:</label>
<input type="password" name="password" id="password" class="text" />
<input type="submit" name="submit" value="<?php echo $TEXT['LOGIN']; ?>" class="submit" /><br />
<a href="<?php echo FORGOT_URL; ?>"><?php echo $TEXT['FORGOT_DETAILS']; ?></a><br />
</div>
</fieldset>
</form>

What does this login in the template? As we have previously don't have a username, we redirect the user after te login to the page "mydomain.de/pages/wbuser.php.

Redirect the user to his personal page!

Now that the user is located on wbuser.php  we know his username and we can use it.
Now of course we also need to adapt this page the way the user is forwarded  to his personal page.
This we will obtain creating  a Code section on the wbuser.php page and introduce the following code:

echo'<meta http-equiv="refresh" content="5; url=';
echo WB_URL; echo'/pages/'; echo $admin->get_display_name(); echo '.php';
echo'">';


The user will now be redirected,  after waiting 5 seconds ("content"= 5) , to the page with his username.
In the example: www.mydomain.de / pages / myusername.php

To the  personal page, we can use different redirect types .
For example: over a php location or a redirect over a Meta function.

Group Login

Who wants to redirect the user  to a grouppage can use the variable $ group_name and redirect  the user from group "family" to the page "family".

Example WebsiteBaker Login redirect for groups:

echo'<meta http-equiv="refresh" content="5; url=';
echo WB_URL; echo'/pages/'; echo $admin->get_group_name(); echo '.php';
echo'">';

Alternative for redirection over  Location:

<?php
header('location: www.meine.domain.de/pages/username.php');
exit;
?>

As I am a nerd in PHP coding is ther someone who could help to translate the flw part to code so it can be used in a code page

<?php if(FRONTEND_LOGIN AND !$admin->is_authenticated()) {
                    $page = 'http://' .$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
                    ?>
<form name="login" action="<?php echo LOGIN_URL; ?>?redirect=<?php echo WB_URL; echo'/pages/'; echo 'wbuser.php';?>" method="post">
<fieldset class="topbox">
<legend><?php echo $TEXT['LOGIN']; ?></legend>
<fieldset class="topbox">
<div class="topboxbody">
<label for="username"><?php echo $TEXT['USERNAME']; ?>:</label>
<input type="text" name="username" id="username" class="text" />
<label for="password"><?php echo $TEXT['PASSWORD']; ?>:</label>
<input type="password" name="password" id="password" class="text" />
<input type="submit" name="submit" value="<?php echo $TEXT['LOGIN']; ?>" class="submit" /><br />
<a href="<?php echo FORGOT_URL; ?>"><?php echo $TEXT['FORGOT_DETAILS']; ?></a><br />
</div>
</fieldset>
</form>
Logged
crnogorac081
AddOn Development
*
Offline Offline

Posts: 1680



« Reply #1 on: February 16, 2010, 02:06:57 PM »

cool, looks nice, I will test this..

thanks for sharing !
Logged

Wow, I coded something myself: PM Messanger Modul ,Searchbox with suggestions
pcwacht
AddOn Development
*
Offline Offline

Posts: 2814



WWW
« Reply #2 on: February 16, 2010, 02:55:27 PM »

Code:
<?php 
if(FRONTEND_LOGIN AND !$admin->is_authenticated()) {
   
$page 'http://' .$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
echo 
'<form name="login" action="'.LOGIN_URL.'?redirect='.WB_URL.'/pages/wbuser.php" method="post">';
echo 
'  <fieldset class="topbox"><legend>'.$TEXT['LOGIN'].'></legend>';
echo 
'  <fieldset class="topbox">';
echo 
'    <div class="topboxbody">';
echo 
'      <label for="username">'.$TEXT['USERNAME'].':</label>';
echo 
'      <input type="text" name="username" id="username" class="text" />';
echo 
'      <label for="password">'.$TEXT['PASSWORD'].':</label>';
echo 
'      <input type="password" name="password" id="password" class="text" />';
echo 
'      <input type="submit" name="submit" value="'.$TEXT['LOGIN'].'" class="submit" /><br />';
echo 
'      <a href="'.FORGOT_URL.'">'.$TEXT['FORGOT_DETAILS'].'></a><br />';
echo 
'    </div>';
echo 
'  </fieldset>';
echo 
'</form>';
?>


Didn't test this buit I'm sure it will help you get started.
Remark, a closing fieldset is missing in your source and in my code Wink

John
Logged

http://www.ictwacht.nl = Dutch ICT info
http://www.pcwacht.nl = My first
both still work in progress, since years.....
hanp

Offline Offline

Posts: 2


« Reply #3 on: February 16, 2010, 07:02:53 PM »

Gracias for your reply
When I copy this to the "code area" of a normal page it doesn't work


Code:
<?php 
if(FRONTEND_LOGIN AND !$admin->is_authenticated()) {
   
$page 'http://' .$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
echo 
'<form name="login" action="'.LOGIN_URL.'?redirect='.WB_URL.'/pages/wbuser.php" method="post">';
echo 
'  <fieldset class="topbox"><legend>'.$TEXT['LOGIN'].'></legend>';
echo 
'  <fieldset class="topbox">';
echo 
'    <div class="topboxbody">';
echo 
'      <label for="username">'.$TEXT['USERNAME'].':</label>';
echo 
'      <input type="text" name="username" id="username" class="text" />';
echo 
'      <label for="password">'.$TEXT['PASSWORD'].':</label>';
echo 
'      <input type="password" name="password" id="password" class="text" />';
echo 
'      <input type="submit" name="submit" value="'.$TEXT['LOGIN'].'" class="submit" /><br />';
echo 
'      <a href="'.FORGOT_URL.'">'.$TEXT['FORGOT_DETAILS'].'></a><br />';
echo 
'    </div>';
echo 
'  </fieldset>';
echo 
'</form>';
?>


Didn't test this buit I'm sure it will help you get started.
Remark, a closing fieldset is missing in your source and in my code Wink

John
Logged
seagull

Offline Offline

Posts: 81


« Reply #4 on: February 16, 2010, 08:57:38 PM »

The '}" is missing at the end of the code en remember with this code if you are logged in as admin it does not show.

Jan


Quote
<?php
if(FRONTEND_LOGIN AND !$admin->is_authenticated()) {
   $page = 'http://' .$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
echo '<form name="login" action="'.LOGIN_URL.'?redirect='.WB_URL.'/pages/wbuser.php" method="post">';
echo '  <fieldset class="topbox"><legend>'.$TEXT['LOGIN'].'></legend>';
echo '  <fieldset class="topbox">';
echo '    <div class="topboxbody">';
echo '      <label for="username">'.$TEXT['USERNAME'].':</label>';
echo '      <input type="text" name="username" id="username" class="text" />';
echo '      <label for="password">'.$TEXT['PASSWORD'].':</label>';
echo '      <input type="password" name="password" id="password" class="text" />';
echo '      <input type="submit" name="submit" value="'.$TEXT['LOGIN'].'" class="submit" /><br />';
echo '      <a href="'.FORGOT_URL.'">'.$TEXT['FORGOT_DETAILS'].'></a><br />';
echo '    </div>';
echo '  </fieldset>';
echo '</form>';
}
?>
Logged
foonji

Offline Offline

Posts: 8


« Reply #5 on: March 25, 2010, 10:17:12 AM »

Did anyone get this working?
Logged
Pages: [1]   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!