vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Member Archives (https://vborg.vbsupport.ru/forumdisplay.php?f=202)
-   -   After an Action Redirecting (https://vborg.vbsupport.ru/showthread.php?t=37469)

alexwriting 04-15-2002 08:05 PM

After an Action Redirecting
 
Hi Everyone,

After subscribing to a thread or a Forum, it redirects you back. Within the program, what contols that? How would I write it to redirect and log out?

I think it has something to do with this code in the member2.php file:

eval("standardredirect(\"".gettemplate("redirect_s ubsadd")."\",\"\$url\");");


Thanks,

Alex

tubedogg 04-16-2002 12:46 AM

You want to be automatically logged out after subscribing to a thread?

alexwriting 04-16-2002 01:09 AM

Hi Tubedogg,


Thanks for replying!! :) :) Yes, that's right. How to rewrite it so that it subscribes you, but then you come back logged out.

All the best,

Alex

Mike Sullivan 04-16-2002 03:15 PM

The $url variable is dynamic -- it varies based on where you last came from.

If you replace the:

\$url

in that line (yes, include the \), with:

member.php?action=logout&s=\$session[sessionhash]

it should work.

eval("standardredirect(\"".gettemplate("redirect_s ubsadd")."\",\"member.php?acti on=logout&s=\$session[sessionhash]\");");

alexwriting 04-16-2002 07:03 PM

Hi Ed,

That's what I wanted :) But, I think we both overlooked one detail. Because the subscription process includes the .gettemplate("redirect_subsadd") as the second to last step, the logout works great, and the return too, but that .gettemplate("redirect_subsadd") is the returned to location, which then goes to the logout, which then goes to the... and it gets in a loop. How would I write it so it redirects back ?2? places, instead of just to the immediately previous location

Many, many thanks, :) :) :)

Alex

Mike Sullivan 04-16-2002 09:37 PM

Logging out shouldn't be a redirect, and the template that is used to say you're now logged out -- error_cookieclear -- doesn't have any references to $url, so that shouldn't be happening. Have you hacked logging out so it redirects as well?

alexwriting 04-16-2002 09:56 PM

Dr. E,

Of course you were right. :classic: I had. Took that out. Now, it subscribes them, and they finish at the "All cookies cleared. Click here to return to the forums index." What would I need to add to have it redirect them back as the last step?

Thanks, :):) :)

Alex

Mike Sullivan 04-16-2002 10:03 PM

Presumably, if you change the subscription redirection to include $url:

eval("standardredirect(\"".gettemplate("redirect_s ubsadd")."\",\"member.php?action=logout&url=\$url& s=\$session[sessionhash]\");");

Then put your $url-dependent logout code back in, it should work. No guarantees though. :)

alexwriting 04-17-2002 05:00 PM

Hey Dr. E,

I had used this one for the logout

https://vborg.vbsupport.ru/showthrea...hreadid=24889.

That's the only hack I have right now. Everything else is native.

Added that back with your new code, but still got subscribe, logout then stop there, no redirect. Tried to rewrite it a few other ways, but came up empty :P Any other way to write it? I can remove that hack if it will help.

Thanks, :) :) :)

Alex

Admin 04-17-2002 05:55 PM

You can also stick the code from member.php's logout action in member2.php, and change the redirect to a standarderror. If you need more info let me know. :)

(and stop with all the smilies, makes the page load slower ;) j/k)

alexwriting 04-18-2002 12:53 AM

Hi FireFly,

Wow, thanks for replying! smile, smile, smile, ;)

The closest I got was, subscribe, log out and then the redirect code broke into the top of the screen. Darn... close! Any suggestions?

Thanks,

Alex

Admin 04-18-2002 10:36 AM

Try this, not tested but should work.

In member2.php replace this:
Code:

  if (!$checkid=$DB_site->query_first("SELECT $tableid FROM $table WHERE userid=$bbuserinfo[userid] AND $typeid=".intval($id))) {
    $id=verifyid($type,$id);
    $DB_site->query("INSERT INTO $table ($tableid,userid,$typeid) VALUES (NULL,$bbuserinfo[userid],".intval($id).")");
  }

  $url = str_replace("\"", "", $url);
  eval("standardredirect(\"".gettemplate("redirect_subsadd")."\",\"\$url\");");

With this:
Code:

  if (!$checkid=$DB_site->query_first("SELECT $tableid FROM $table WHERE userid=$bbuserinfo[userid] AND $typeid=".intval($id))) {
    $id=verifyid($type,$id);
    $DB_site->query("INSERT INTO $table ($tableid,userid,$typeid) VALUES (NULL,$bbuserinfo[userid],".intval($id).")");
  }

  vbsetcookie("bbuserid","",1);
  vbsetcookie("bbpassword","",1);
  vbsetcookie("bbstyleid","",1);

  if ($bbuserinfo[userid]!=0 and $bbuserinfo[userid]!=-1) {
    $DB_site->query("UPDATE user SET lastactivity='".(time()-$cookietimeout)."',lastvisit='".time()."' WHERE userid='$bbuserinfo[userid]'");
  }

  //$DB_site->query("UPDATE session SET userid=0 WHERE sessionhash='".addslashes($session[sessionhash])."'");
  $DB_site->query("DELETE FROM session WHERE sessionhash='".addslashes($session[dbsessionhash])."'");
  // make sure any other of this user's sessions are deleted (incase they ended up with more than one)
  $DB_site->query("DELETE FROM session WHERE userid='$bbuserinfo[userid]'");

  $session['sessionhash']=md5(uniqid(microtime()));
  $session['dbsessionhash']=$session['sessionhash'];
  $DB_site->query("INSERT INTO session (sessionhash,userid,host,useragent,lastactivity,styleid) VALUES ('".addslashes($session['sessionhash'])."','0','".addslashes($session['host'])."','".addslashes($session['useragent'])."','".time()."','0')");
  vbsetcookie("sessionhash",$session['sessionhash'],0);

  eval("standarderror(\"".gettemplate("redirect_subsadd")."\");");



All times are GMT. The time now is 04:44 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.00971 seconds
  • Memory Usage 1,740KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (12)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete