PDA

View Full Version : [Release 2.0.3] Remote login


Snoozy
Tue 30th Oct '01, 1:12am
I have a little hack that I did for my vB that allows the people to login from non-vB pages and then have their login processed and then they would be taken back to wherever they were on the site. (this assumes that you are using a php site, it will not work if you implement in on an HTML page. The form for the login must be processed by php) It uses no cookies or anything, just passes some variables. Here is what I did:

I changed this little deal in member.php


if ($url!="" and $url!="index.php" and $url!=$HTTP_REFERER) {

if (strpos($url,"?")>0) {
$url.="&s=$session[dbsessionhash]";
} else {
$url.="?s=$session[dbsessionhash]";
}

$url = str_replace("\"", "", $url);
eval("standardredirect(\"".gettemplate("redirect_login")."\",\"$url\");");
} else {
$bbuserinfo=getuserinfo($userid);
eval("standardredirect(\"".gettemplate("redirect_login")."\",\"index.php?s=$session[dbsessionhash]\");");
}
}
to


if (isset($location)) {
eval("standardredirect(\"".gettemplate("redirect_login")."\",\"$location\");");
} else {
if ($url!="" and $url!="index.php" and $url!=$HTTP_REFERER) {

if (strpos($url,"?")>0) {
$url.="&s=$session[dbsessionhash]";
} else {
$url.="?s=$session[dbsessionhash]";
}

$url = str_replace("\"", "", $url);
eval("standardredirect(\"".gettemplate("redirect_login")."\",\"$url\");");
} else {
$bbuserinfo=getuserinfo($userid);
eval("standardredirect(\"".gettemplate("redirect_login")."\",\"index.php?s=$session[dbsessionhash]\");");
}
}

}


Then on the form I have this :

<form method="post" action="/forums/member.php?location=<?=$PHP_SELF ?>?<?=$QUERY_STRING ?>" name="login">


This will not affect your vB logins at all, but when somone logs in while reading a tutorial or something, they will be taken back to that tutorial, it even displays the little box saying thank you for loggin in (uses vB's template)

Very simple little hack, but I'd like to see it implemented on this site since I login when I realize it, and then I have to go back and find my place in the article.

This is my first hack so feel free to comment.