login redirect to private page

lausianne

#8
Works fine. In login_form.php I simply exchanged the original form line
<form action="<?php echo WB_URL.'/account/login.php'?>" method="post">
by
<?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">';
} else {
echo '<form action="'.WB_URL.'/account/login.php>" method="post">';
}
?>

And then it did not work, still directing to home, because of this:
<p style="display:none;"><input type="hidden" name="redirect" value="<?php echo $thisApp->redirect_url;?>" /></p>
Needed to be replaced by this:
<p style="display:none;"><input type="hidden" name="redirect" value="<?php echo WB_URL.'/pages/wbuser.php'?>" /></p>
Done. Replace wbuser.php by a page of your choice.

Cheers, Ralf.

pm. Seagulls code also worked right away, but I wanted to keep the original design.
ppm. If you don't find the file to change, it's in the folder "account", of course 8-)

KP

I'd be very interested to know about this as well. any new developments? does this work as is?

I'm a graphic designer and not a developer, so any help would be appreciated.

thanks,
kevin

foonji


seagull

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>';
}
?>

hanp

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


Quote from: pcwacht on February 16, 2010, 02:55:27 PM

<?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 ;)

John

pcwacht


<?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 ;)

John
[url="http://www.ictwacht.nl"]http://www.ictwacht.nl[/url] = Dutch ICT info
[url="http://www.pcwacht.nl"]http://www.pcwacht.nl[/url] = My first
both still work in progress, since years.....

crnogorac081

cool, looks nice, I will test this..

thanks for sharing !
Web developer

hanp

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>