Jump to content


Photo

phpbb Session problems


  • Please log in to reply
3 replies to this topic

#1 Lessur

Lessur
  • Members
  • PipPip
  • Member
  • 26 posts

Posted 20 July 2006 - 02:40 AM

Ok, I am trying to hook the popular phpbb bullitin board system with a uploading system that I created.  I have merged the two databases together, so if someone signs up for phpbb (my forum) they also becsome a member of the uploading system.  Here are my files:

Ok, I have a simple script like this:

login.php:

if ($_GET['submit']){
$username=addslashes(strip_tags($_POST['username']));
$password=addslashes(strip_tags($_POST['password']));
$password_md5=md5($password);
$check=mysql_num_rows(mysql_query("SELECT * FROM `phpbb_users` WHERE username = '$username' LIMIT 1"));
$check2=mysql_num_rows(mysql_query("SELECT * FROM `phpbb_users` WHERE `username` = '$username' AND `user_password` = '$password_md5' LIMIT 1"));

...


session_register('username');
$_SESSION['username'] = $username;
session_register('password');
$_SESSION['password'] = $password_md5;
echo "You are now logged in with the username $username! <a href='index.php'>Home</a>";


On other file:


<?php
if ($_SESSION['username']){ 
echo "

This, does not work, because phpbb is coding that is out of my knoledge. I will post phpbb's login.php file if it is needed.


For those more experianced people here that know how phpbb or a good forum runs, how can I make this work correctly?  ???

#2 hitman6003

hitman6003
  • Members
  • PipPipPip
  • Advanced Member
  • 1,807 posts

Posted 20 July 2006 - 02:46 AM

make sure session_start() is at the top of all of your pages that use session variables.

#3 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 20 July 2006 - 03:07 AM

<table cellpadding=5><tr valign=top class=mes><td align=center>
<fieldset>
<legend style="color: #ffffff; font-family: verdana; font-size: 10pt;"> <b>Forum Setup</b>&nbsp;</legend>
<table width="300" class=mes><tr><td align=center>

<?
if ($mode==''){

//// EDIT THIS LINE ////

$table_prefix = 'phpbb_'; // your phpBB table_prefix (check your phpBB config.php after installation)
////////////////////////

$phpBB_table = 'users';
$tmp=mysql_query("SELECT * FROM your database"); 
while($phpBB=mysql_fetch_array($tmp)) { 
$phpBB_id = ($phpBB['id']);
$phpBB_n = ($phpBB['name']);
$phpBB_p = md5($phpBB['password']); // use md5 encryption
$phpBB_e = ($phpBB['email']);
$phpBB_reg = ($phpBB['regdate']);
$sql = "INSERT INTO ".$table_prefix.$phpBB_table." (user_id, username, user_level, user_regdate, user_password, user_email, user_icq, user_website, user_occ, user_from, user_interests, user_sig, user_viewemail, user_style, user_aim, user_yim, user_msnm, user_posts, user_attachsig, user_allowsmile, user_allowhtml, user_allowbbcode, user_allow_pm, user_notify_pm, user_allow_viewonline, user_rank, user_avatar, user_lang, user_timezone, user_dateformat, user_actkey, user_newpasswd, user_notify, user_active) VALUES ( '$phpBB_id', '$phpBB_n', 0, '$phpBB_reg', '$phpBB_p', '$phpBB_e', '', '', '', '', '', '', 0, NULL, '', '', '', 0, 0, 1, 0, 1, 0, 1, 1, NULL, '', '', 0, '', '', '', 0, 1)";mysql_query($sql) or die(mysql_error());
}}
echo "Your members have been added to your phpBB users table.<br><br>";
echo "If you are logged in to the  script,<br><a href=phpBB_setup.php?mode=test_login class=menu>click here</a> to test the forum login.";
if ($mode!=''){
$tmp=mysql_query("SELECT * FROM xxxxx WHERE id= xxx LIMIT 1"); 
while($phpBB=mysql_fetch_array($tmp)) {
$phpBB_n = ($phpBB['name']);
$phpBB_p = ($phpBB['password']);

//// EDIT THIS LINE ////
echo "<form action=\"http://your_url/login.php\" method=\"post\" target=\"_blank\">";
////////////////////////

echo "<input type=\"hidden\" name=\"username\" size=\"25\" value=\"$phpBB_n\" maxlength=\"40\">";
echo "<input type=\"hidden\" name=\"password\" size=\"25\" value=\"$phpBB_p\" maxlength=\"32\">";
echo "<input type=\"submit\" name=\"login\" value=\"Test Login\">";
echo "</form>";}
}

?>

Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#4 Lessur

Lessur
  • Members
  • PipPip
  • Member
  • 26 posts

Posted 20 July 2006 - 01:18 PM

phpBB_setup.php?mode=test_login class=menu?  Where is that file?

And was I jupposed to put this code in my login.php file?  Im really confused.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users