Pages: [1]
Tags: TIM
  Author: Topic: main page
offline tmacdonald
Last Visit: 08/03/10

Moderator
Dev
Joined: 04/17/06
Forum Posts: 207
 main page
 Posted on: 07/26/10 at 05:58:18

How do you stop it from going to the profile page after logging in. I would like it to go to the main page.

Tim



Get'er Done
Logged
     
offline Woo Hoo
Last Visit: 09/09/10

Administrator
Dev
Joined: 05/26/06
Forum Posts: 2237
 Re: main page
 Posted on: 07/27/10 at 03:53:44

Well...

You would have to take a look at user.pl. The login goes through the login2 sub and
it ends with a call to the welcome sub like this:

code:

welcome("$username", "$usersid", "$usermac");



Now the welcome subs looks for the $returnpage variable set-up in the login2 sub.
This should resemble the page you are viewing when you log in. If not you go on
through the rest of the welcome sub until you hit the end. Which is a call to the
myprofile sub.

code:

myprofile("$username");



Now instead of going to the profile view what if you replace that call to myprofile
sub at the end of the welcome sub with this:

code:

print_main();



That should just load up the home page... I think.



0 but true
Logged
       
offline tmacdonald
Last Visit: 08/03/10

Moderator
Dev
Joined: 04/17/06
Forum Posts: 207
 Re: main page
 Posted on: 07/27/10 at 15:30:58

Thanks
Tim



Get'er Done
Logged
     
offline tmacdonald
Last Visit: 08/03/10

Moderator
Dev
Joined: 04/17/06
Forum Posts: 207
 Re: main page
 Posted on: 07/27/10 at 15:37:30

sub welcome {
#############

#loadcookie();
loaduser("hello", "$username");
#loaduser("hello", "$username", "$usersid", "$usermac");      

myprofile("$username");
print_main();
}

If I take out the myprofile("$username"); line then you cannot log in, it just refreshes the screen?

Tim



Get'er Done
Logged
     
offline tmacdonald
Last Visit: 08/03/10

Moderator
Dev
Joined: 04/17/06
Forum Posts: 207
 Re: main page
 Posted on: 07/27/10 at 15:39:58

It does log the visitor in but does not bring them to the home page with the menus on the side. How do I call the home page with the menus?

Tim



Get'er Done
Logged
     
offline Woo Hoo
Last Visit: 09/09/10

Administrator
Dev
Joined: 05/26/06
Forum Posts: 2237
 Re: main page
 Posted on: 07/28/10 at 03:15:51

Hmm...

I'm not sure what you mean by not being able to logging in when you remove the
myprofile sub. The myprofile sub has little to nothing to do with logging in from
what I can tell. It loads "after" a log in. The print_main sub loads the home page.

Look at the top of the welcome sub

code:

my($username, $usersid, $usermac) = @_;
if($returnpage ne '' && $errorpage ne "$NAFFIN") {
   print "Location: $scripturl/$cgi?action=$returnpage\n\n";
   exit;
}



If $returnpage exists then you are directed to it. If you logged in while viewing the
forum, for example, you would return to the forum after logging in. The code would
not go any further (exit;) and not even see the myprofile sub.

Maybe use a redirect at the end of the welcome sub or there's an unused sub (from
what I can tell) in user.pl called "login" of all things. It looks like this:

code:

###########
sub login {
###########
use lib "$scriptdir/Modules";
require "$sourcedir/security.pl";
   print "Location: $scripturl/$cgi\n\n";
   exit;
}



Maybe use that instead of myprofile (or print_main).


or... maybe it's the way this code works anymore. It's not a "coder" type of script
anymore. It would appear that everything may be too dependent on each other to work
and any slight change would upset the script. I try to write more modular code that
allows for quick little changes on the fly. That's why I stick with my old crap which
runs under strict and using taint.



0 but true
Logged
       
offline tmacdonald
Last Visit: 08/03/10

Moderator
Dev
Joined: 04/17/06
Forum Posts: 207
 Re: main page
 Posted on: 07/31/10 at 23:18:07

I replaced myprofile("$username"); with

print "Location: $scripturl/$cgi?action=$returnpage\n\n";

It return you to the main page with the menus

Tim



Get'er Done
Logged
     
offline Woo Hoo
Last Visit: 09/09/10

Administrator
Dev
Joined: 05/26/06
Forum Posts: 2237
 Re: main page
 Posted on: 08/01/10 at 00:38:58


tmacdonald said Yesterday, and 1 hour ago.:
I replaced myprofile("$username"); with

print "Location: $scripturl/$cgi?action=$returnpage\n\n";

It return you to the main page with the menus




You could probably leave off the "?action=$returnpage" because if you got that far in
the subroutine then $returnpage didn't exist and you are being sent to the home page
because of the empty action by default.



0 but true
Logged
       

  main page
  Support
  Forums
  
Pages: [1]
Hop to: