Welcome, Guest. Please login or register.
Did you miss your activation email?
May 27, 2012, 05:13:51 AM

Login with username, password and session length
Search:     Advanced search
Interested in joining the WebsiteBaker team?
For more Information read here or on our new website.
155555 Posts in 21715 Topics by 7737 Members
Latest Member: gx-world
* Home Help Search Login Register
Pages: [1]   Go Down
Print
Author Topic: client login - go straight to clients page.  (Read 1918 times)
dfhectik

Offline Offline

Posts: 29



WWW
« on: December 06, 2007, 12:09:35 AM »

Hello,

Here is my dilemma.

I have 8 private client pages that 8 different clients are logging into from a login.php page
in order to view there own pages.

When "client01" logs in they are taken to a page (client-login.php) that has a link "client01", a link to preferences and an option to log out.

If they click the "client01" link they are taken to the "client 01" page which has all there private data

What i want to do is skip the  "client-login.php" page so the client is taken to there "client01" page as soon as they login.


Is there some php code that someone has written that can help me with this?

Thankyou bakers...Keep on Bakin!
« Last Edit: December 06, 2007, 12:19:05 AM by dfhectik » Logged
doc
Guest
« Reply #1 on: December 06, 2007, 05:35:39 AM »

Hello,

you can redirect users after login to a page of type code. From here you can check username (see WB Help site (advanced docu / coding) by the use of PHP. Try to search the forum for redirect, I posted a solution some time ago.

Regards Christian
Logged
dfhectik

Offline Offline

Posts: 29



WWW
« Reply #2 on: December 07, 2007, 12:37:22 AM »

I had a look through the forum by use of a "redirect" search.

the only post i found that is similar to mine is this

http://forum.websitebaker.org/index.php/topic,2559.0.html

which unfortunately doesn't give me the solution.

the solution should have something to do with this line of code in accounts/login.php

"DEFAULT_URL" => WB_URL.PAGES_DIRECT ORY."/client-login".PAGE_EXTENSION,        

but rather then all clients going straight to client-login.php    

it be nice if when client 2 logs in that they be taken to directly to /client-login/client-02.php...

Im no php expert so i can only imagine that it would take some bulky php code to get my "dream to come true"


What do you mean page of "type code"

thanks for your help - "Shake and Bake"
Logged
ruebenwurzel
WebsiteBaker Org e.V.

Offline Offline

Posts: 7973



WWW
« Reply #3 on: December 07, 2007, 05:29:31 AM »

Hello,

not shur if this is what you want, but i had some similar done on a clients side. I made my own login form page (http://www.runaway-music.de/pages/login.php). Created a page (could also be a login section in the template) and used the following code wich i added in the source window of the WYSIWYG Editor:

Code:
<div style="text-align: center;"><font size="5">Mitgliederbereich</font></div>
<form class="login_table" method="post" action="http://www.runaway-music.de/account/login.php?redirect=http://www.runaway-music.de/pages/mitgliederbereich.php" name="login">
    <table width="50%" cellspacing="0" cellpadding="5" border="0" align="center">
        <tbody>
            <tr>
                <td style="text-align: right;">Benutzername:</td>
                <td><input type="text" name="username" /></td>
            </tr>
            <tr>
                <td style="text-align: right;">Passwort:</td>
                <td><input type="password" name="password" /></td>
            </tr>
            <tr>
                <td style="text-align: left;">&nbsp;</td>
                <td><input type="submit" value="Anmelden" name="submit" /></td>
            </tr>
            <tr align="left">
                <td style="text-align: center;" colspan="2"><a href="http://www.runaway-music.de/account/forgot.php">Anmeldedaten vergessen?</a></td>
            </tr>
        </tbody>
    </table>
</form>

As soon as a member logs in he gots redirected in my case to "redirect=http://www.runaway-music.de/pages/mitgliederbereich.php" wich is a private page and only viewable after login.

No changes on core files, simply using what WB has already included.

Hope this helps

Matthias
Logged
iti

Offline Offline

Posts: 31


« Reply #4 on: March 27, 2008, 10:11:55 PM »

hi
 just in case someone needs to return to the same page after login/logout:

I added this ?redirect=<?php echo $_SERVER['REQUEST_URI'] ?> to the action both in login and logout and changed account/logout.php :

Code:
if(INTRO_PAGE) {
header('Location:' .$_REQUEST['redirect']);
    //header('Location: '.WB_URL.PAGES_DIRECTORY.'/index'.PAGE_EXTENSION.'?redirect='.$_REQUEST['redirect']);
} else {
    //header('Location: '.WB_URL.'/index'.PAGE_EXTENSION.'?redirect='.$_REQUEST['redirect']);
    header('Location:' .$_REQUEST['redirect']);
}
And it returns me to the same page I was on. hope it helps someone. I find it better so.
cheers
Logged
Lotus

Offline Offline

Posts: 184


« Reply #5 on: April 04, 2008, 05:27:36 PM »

Sounds intresting but I am a bit new to PHP programming..

Is this how you do it?

Template
Form Login/logout

Code:
<form name="login" action="?redirect=<?php echo $_SERVER['REQUEST_URI'?>" method="post">

Code:
<form name="logout" action="?redirect=<?php echo $_SERVER['REQUEST_URI'?>" method="post">

account/logout.php
Code:

<?php
require("../config.php");

if(isset(
$_COOKIE['REMEMBER_KEY'])) {
    
setcookie('REMEMBER_KEY'''time()-3600'/');
}

$_SESSION['USER_ID'] = null;
$_SESSION['GROUP_ID'] = null;
$_SESSION['USERNAME'] = null;
$_SESSION['PAGE_PERMISSIONS'] = null;
$_SESSION['SYSTEM_PERMISSIONS'] = null;
$_SESSION = array();
session_unset();
unset(
$_COOKIE[session_name()]);
session_destroy();

if(
INTRO_PAGE) {
header('Location:' .$_REQUEST['redirect']);
    
//header('Location: '.WB_URL.PAGES_DIRECTORY.'/index'.PAGE_EXTENSION.'?redirect='.$_REQUEST['redirect']);
} else {
    
//header('Location: '.WB_URL.'/index'.PAGE_EXTENSION.'?redirect='.$_REQUEST['redirect']);
    
header('Location:' .$_REQUEST['redirect']);
}


?>



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!