Mysidia Adoptables Support Forum  

Home Community Mys-Script Creative Off-Topic
Go Back   Mysidia Adoptables Support Forum > Mysidia Adoptables > Addons and Modifications > Mys v1.1.x Mods

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 01-23-2011, 06:06 AM
fadillzzz fadillzzz is offline
Dev Staff
 
Join Date: Jan 2010
Posts: 501
Gender: Male
Credits: 37,736
fadillzzz is an unknown quantity at this point
Default Redirect to Previous Page after Login/Logout

This is just a simple modification to rediret a user to the previous page they were viewing after login/logout.

NOTE:Please make a backup of your files before installing this mod!

Let's start with login.php

1.Open your login.php and go to line 144 and add this code
PHP Code:
header("Location: ".$_SERVER['HTTP_REFERER']); 
What we just did will redirect the users to the previous page immediately. So, the users won't see the login message that they usually see. If you still wanted to show them that message, add a timer.

If you want to add a timer, instead of using the above code use this instead
PHP Code:
header("Refresh: 2; URL=".$_SERVER['HTTP_REFERER']); 
Change the number 2 to how many seconds you want before the page redirect the users to the previous page

Move on to logout.php
2. Now to redirect the logout process. Open your logout.php, on line 80 put this code (same as above)
PHP Code:
header("Location: ".$_SERVER['HTTP_REFERER']); 
Again, if you want to add a timer so that the users still see the usual message use this code and change the number 2 to the number of how many seconds you want the users to wait before they get redirected
PHP Code:
header("Refresh: 2; URL=".$_SERVER['HTTP_REFERER']); 
Congrats! Now you'll save your users from their laziness of clicking! (well, not really actually)

You're not limited to this, for example if you wanted to redirect the users to the index page after logging out you can use this code
PHP Code:
header("Location: http://".$domain.$scriptpath); 
and if you want to add a timer use this
PHP Code:
header("Refresh: 2; URL=http://".$domain.$scriptpath); 

Last edited by fadillzzz; 01-25-2011 at 08:28 AM.
Reply With Quote
  #2  
Old 01-29-2011, 07:49 PM
Rozel Rozel is offline
Member
 
Join Date: Jun 2010
Posts: 144
Credits: 12,105
Rozel
Default

This seems awesome, but how do I know where to put the code? You said line 144, but I don't know how to tell which is line 144 using the 000webhost editor. :S
Reply With Quote
  #3  
Old 01-29-2011, 08:11 PM
fadillzzz fadillzzz is offline
Dev Staff
 
Join Date: Jan 2010
Posts: 501
Gender: Male
Credits: 37,736
fadillzzz is an unknown quantity at this point
Default

Use a PHP editor, you can use notepad++ if you want
Reply With Quote
  #4  
Old 01-29-2011, 10:24 PM
Kaeliah's Avatar
Kaeliah Kaeliah is offline
Premium Member
 
Join Date: Sep 2010
Location: Pennsylvania, United States
Posts: 485
Gender: Female
Credits: 38,470
Kaeliah will become famous soon enough
Send a message via AIM to Kaeliah Send a message via MSN to Kaeliah
Default

Just as a general note, using line numbers as a guide to put the code can be very faulty. If users have added other mods beforehand the lines will be messed up for them. I usually use a chunk of code that comes before or after the place the new code should go.
__________________
[My Shop] ♥ [My Blog] ♥ [Subscribe] ♥ [My Mods] ♥ [Mod TOS]
Reply With Quote
  #5  
Old 01-29-2011, 10:58 PM
fadillzzz fadillzzz is offline
Dev Staff
 
Join Date: Jan 2010
Posts: 501
Gender: Male
Credits: 37,736
fadillzzz is an unknown quantity at this point
Default

Ok, I'll keep that in mind for another tutorial
Reply With Quote
  #6  
Old 01-29-2011, 11:38 PM
Rozel Rozel is offline
Member
 
Join Date: Jun 2010
Posts: 144
Credits: 12,105
Rozel
Default

Ah, yeah, I do remember I had Notepad++. I'll use that, thanks. :o
Reply With Quote
  #7  
Old 02-02-2011, 06:24 PM
Tony's Avatar
Tony Tony is offline
I program.
 
Join Date: Jan 2011
Posts: 75
Gender: Male
Credits: 9,304
Tony is on a distinguished road
Default

On some hosts, the header redirect will be funky, especially if you have an email system somewhere. For an alternative, you can use the following.

PHP Code:
echo '<meta http-equiv="refresh" content="2;url=".$domain.$scriptpath">'
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Mys v1.3.4 Seamless Login/Logout Redirect to Index Kyttias Mys v1.3.x Mods 13 06-03-2020 11:13 AM
Redirect after login Empress_Swanbottom Questions and Supports 10 06-03-2020 11:12 AM
Login/Logout Error tahbikat Questions and Supports 15 02-15-2014 11:26 AM
New Users auto redirect to page mapleblade Mys v1.2.x Mods 6 02-09-2012 10:47 AM
Login page..? Tequila Questions and Supports 3 05-18-2011 05:39 PM


All times are GMT -5. The time now is 01:46 PM.

Currently Active Users: 1108 (0 members and 1108 guests)
Threads: 4,081, Posts: 32,031, Members: 2,016
Welcome to our newest members, jolob.
BETA





What's New?

What's Hot?

What's Popular?


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
vBCommerce I v2.0.0 Gold ©2010, PixelFX Studios
vBCredits I v2.0.0 Gold ©2010, PixelFX Studios
Emoticons by darkmoon3636