vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=251)
-   -   do_login_redirect(); not working (https://vborg.vbsupport.ru/showthread.php?t=280839)

runnerjp 03-29-2012 11:06 AM

do_login_redirect(); not working
 
Hello guys,

I have used the following code to log users in automatically in the forum.

PHP Code:

<?php
/*======================================================================*\
|| #################################################################### ||
||                   Created by Jp                                      ||
|| #################################################################### ||
\*======================================================================*/
session_start();
$myname $_SESSION["frontenduser_username"];
if (isset(
$_GET['bd']))
{
define('THIS_SCRIPT''login');
require_once(
'./global.php');
require_once(
'./includes/functions_login.php');
$myname $_SESSION["frontenduser_username"];
$vbulletin->userinfo $vbulletin->db->query_first("SELECT userid,usergroupid, membergroupids, infractiongroupids, username, password, salt FROM " TABLE_PREFIX "user WHERE username = $myname");
if (!
$vbulletin->userinfo['userid']) die("Invalid username!");
else
{
vbsetcookie('userid'$vbulletin->userinfo['userid'], truetruetrue);
vbsetcookie('password'md5($vbulletin->userinfo['password'] . COOKIE_SALT), truetruetrue);
exec_unstrike_user($_GET['bd']);
process_new_login('cplogin'TRUETRUE);

do_login_redirect();
}
}
    


?>

When i follow the link directly it works fine: http://clubmonza.co.uk/forums/test.php?bd

BUT if i got via the main website and click on http://clubmonza.co.uk and click on club lounge... it does not seem to work.
(i have made it so it always logs into mart34 so no need to log in atm)

Any ideas guys?


Regards,

Jarratt

kh99 03-29-2012 11:09 AM

Not sure what you're saying - are you saying it logs you in but you don't stay logged in? Or are you saying that your script only works sometimes?

runnerjp 03-29-2012 11:14 AM

Sorry it logs me in but does not stay logged in

--------------- Added [DATE]1333033066[/DATE] at [TIME]1333033066[/TIME] ---------------

Could it also be due to the fact that i redirect the user via javascript

PHP Code:

<?php
require_once('./global.php');
if (
$vbulletin->userinfo['userid']!=0) {   
?>
<script type="text/javascript">
<!--
window.location = "forum.php";
//-->
</script>
<?
}
else
{?>
<script type="text/javascript">
<!--
window.location = "test.php?bd=1";
//-->
</script>
<?
}
?>



All times are GMT. The time now is 05:01 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.01203 seconds
  • Memory Usage 1,727KB
  • 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_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (3)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