Go Back   vb.org Archive > Community Discussions > Modification Requests/Questions (Unpaid)
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 05-10-2004, 05:30 PM
Bone Head Bone Head is offline
 
Join Date: May 2002
Posts: 3
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Login Script

I posted this at Vbulletin.com and they said I should post it here

As I mentioned in the other thread we use Vbulletin as the back bone of our site as many folk do, since the upgrade to v3 we havent been able to log our users into the passworded areas of our site because I cant get the login page working.

The login page is created with PHAkt which is a dreamweaver MX extension, lame I know but I'm still learning php :ermm:

This is the script that PHAkt creates:

Code:
<?php
//Connection statement
require_once('../Connections/Comms.php');
//Aditional Functions
require_once('../includes/functions.inc.php');
// *** Start the session
session_start();
// *** Validate request to log in to this site.
$KT_LoginAction = $HTTP_SERVER_VARS["REQUEST_URI"];
if (isset($HTTP_POST_VARS["user"])) {
  $KT_valUsername = $HTTP_POST_VARS['user'];
  $KT_fldUserAuthorization = "";
  $KT_redirectLoginSuccess = "sucess.php";
  $KT_redirectLoginFailed = "failed.php";
  $KT_rsUser_Source = "SELECT username, password ";
  if ($KT_fldUserAuthorization != "") $KT_rsUser_Source .= "," . $KT_fldUserAuthorization;
  $KT_rsUser_Source .= " FROM user WHERE username='" . $KT_valUsername . "' AND password='" . $HTTP_POST_VARS['pass'] . "'";
  $KT_rsUser=$Comms->Execute($KT_rsUser_Source) or DIE($Comms->ErrorMsg());
  if (!$KT_rsUser->EOF) {
	// username and password match - this is a valid user
	$KT_Username=$KT_valUsername;
  
	KT_session_register("KT_Username");
	if ($KT_fldUserAuthorization != "") {
	  $KT_userAuth=$KT_rsUser->Fields($KT_fldUserAuthorization);
	} else {
	  $KT_userAuth="";
	}
  
	KT_session_register("KT_userAuth");
	if (isset($HTTP_GET_VARS['accessdenied']) && false) {
	  $KT_redirectLoginSuccess = $HTTP_GET_VARS['accessdenied'];
	}
	$KT_rsUser->Close();
  
	KT_session_register("KT_login_failed");
	$KT_login_failed = false;
	// Add code here if you want to do something if login succeded
KT_redir($KT_redirectLoginSuccess);
  }
  $KT_rsUser->Close();
  $KT_login_failed = true;
  
  KT_session_register("KT_login_failed");
  // Add code here if you want to do something if login fails
KT_redir($KT_redirectLoginFailed);
}
 //PHP ADODB document - made with PHAkt 2.7.3?>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<form name="form1" method="POST" action="<?php echo $KT_LoginAction?>">
Username:
<input name="user" type="text" id="user">
Password: 
<input name="pass" type="password" id="pass">
<input type="submit" name="Submit" value="Submit">
</form>
</body>
</html>

Now I realsie I have to get something like: MD5(CONCAT(MD5($HTTP_POST_VARS['pass']), salt)) in this code and I have tried doing just that but it doesnt work. I would really appreciate some help fixing this code if anyone cares to help.

Fingers crossed TIA Bone
Reply With Quote
  #2  
Old 05-10-2004, 05:44 PM
AlexanderT's Avatar
AlexanderT AlexanderT is offline
 
Join Date: Mar 2003
Posts: 294
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Someone else asked me a similar question. I suggest you add the following to your own code:

PHP Code:
<?php
// ####################### SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);

// #################### DEFINE IMPORTANT CONSTANTS #######################
define('NO_REGISTER_GLOBALS'1);

// ######################### REQUIRE BACK-END ############################
require_once('./global.php');

// #######################################################################
// ######################## START MAIN SCRIPT ############################
// #######################################################################

// is user logged in?
if (!$bbuserinfo['userid']) {
    
print_no_permission();
}
else {
    
$url "index.php?$session[sessionurl]";
    eval(
print_standard_redirect('redirect_login'));
}
?>
In the code, you can replace 'index.php' with the script you want the user to be redirected to after a successful login.

Greets
Alex
Reply With Quote
  #3  
Old 05-10-2004, 08:09 PM
Bone Head Bone Head is offline
 
Join Date: May 2002
Posts: 3
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks for the input not sure if its going to work for me though. PHAkt creates pages that you can deny access to depending on teh users usergroup. The script I posted above is the login page for that, once a user is recognised they are sent to one of those pages.

Ill give it a go though.
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


All times are GMT. The time now is 06:40 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.04181 seconds
  • Memory Usage 2,190KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_code
  • (1)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (3)post_thanks_box
  • (3)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (3)post_thanks_postbit_info
  • (3)postbit
  • (3)postbit_onlinestatus
  • (3)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete