Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> PHP
Author Message
AYK
Hangin' Around



Joined: Apr 03, 2004
Posts: 32

PostPosted: Wed May 05, 2004 6:23 am Reply with quote

I have this question :
I'm hosting a PHP-BB forum and created some other pages. What I would like to do is user the USER-LOGIN info from the FORUM for my pages.

So when a user logs into the forum, he can acces the other pages, and these pages will know his name etc etc...

Is this hard to do ? Becuase I've been looking at the files, and they are pretty complex...
 
View user's profile Send private message Visit poster's website
AYK







PostPosted: Wed May 05, 2004 6:04 pm Reply with quote

Oh just found the solution to the problem... If anyone else in interested, just let me know...
 
Raven
Site Admin/Owner



Joined: Aug 27, 2002
Posts: 17088

PostPosted: Wed May 05, 2004 6:27 pm Reply with quote

I just caught up with this post. I would like to see what you are doing because I'm not quite clear on what you needed. Thanks!
 
View user's profile Send private message
DivideByZero
New Member
New Member



Joined: Apr 18, 2004
Posts: 2

PostPosted: Thu May 06, 2004 7:07 pm Reply with quote

AYK - please post what you did.

I have a web application and am building extra content that I only want to be accessable to registered users. I don't want the overhead of including mainfile.php, but would like to use the site's user authentication to grant access to the additional content.

Does anyone have a snippet of code that will allow you to get the user's site credentials without actually having to have the extra pages be nuke content?

Thanks.
 
View user's profile Send private message Visit poster's website
DivideByZero







PostPosted: Fri May 07, 2004 2:53 pm Reply with quote

This is what I came up with. Seems to work...

Code:


<?php



   $user = $HTTP_COOKIE_VARS["user"];
   $boolarray = is_array($user);

   if(!is_array($user)) {
   $user = base64_decode($user);
   $user = explode(":", $user);
        $uid = "$user[0]";
      $pwd = "$user[2]";
    } else {
        $uid = "$user[0]";
      $pwd = "$user[2]";
    }   

if ($uid != "" AND $pwd != "") {
   
   $db_username = "PUT USER NAME HERE";
   $db_password = "PUT PASSWORD HERE";
   $db_hostname = "PUT IP HERE";     
   $db_connect = mysql_connect($db_hostname, $db_username, $db_password)or die("Unable to connect to MySQL");

   $db_select = mysql_select_db("PUT DATABASE NAME HERE", $db_connect)or die("Unable to select servers");

   $sql = "SELECT user_password, username FROM nuke_users WHERE user_id='$uid'";
   $result = mysql_query($sql);
   $row = mysql_fetch_array($result);
   $pass = $row[user_password];
   $username = $row[username];
   if($pass == $pwd && $pass != ""){
      $user = $username;
   }else{
       $user  = "Anonymous";
    }

}else{
      $user  = "Anonymous";
}


?>
 
AYK







PostPosted: Tue May 11, 2004 2:35 pm Reply with quote

Sorry for late response. This is what I included :

Code:
<?php

/***************************************************************************
 *                                index.php
 *   initpage...Gekopieerd van phpbb forum
 *
 ***************************************************************************/

define('IN_PHPBB', true);
$phpbb_root_path = './fmcforum/';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);

//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_INDEX);
//
// End session management
//
session_start();

$_SESSION['usernr']=$userdata['user_id'];
$_SESSION['usernaam']=$userdata['username'];
$_SESSION['user_lastvisit']=$userdata['user_lastvisit'];
$_SESSION['user_level']=$userdata['user_level'];
?>
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> PHP

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©