Help me please,

PHP coding talk.

Moderator: Moderators

Help me please,

Postby slope on Fri Dec 09, 2005 9:18 pm

Hi, first of all sorry if I speak a bad english, I'm spanish. I'm trying to integrate a phpbb2 forum in my webpage, but for moderators I use a session called $_SESSION['modding'] What I havet do do for launch that session when my users log in and it's a moderator? (We could know because in a phpbb_users I put a field with user_categorie so..) IF you don't understande me say me and I will try to explain again. thank's bye.
slope
Registered User
Registered User
 
Posts: 8
Joined: Fri Dec 09, 2005 9:13 pm

Postby DoubleJ on Fri Dec 09, 2005 10:42 pm

what phpBB does to check if a user is a moderator is see what the users level is:
if you include sessions.php (and some other things from common.php) you could use this to see if a person is a moderator or not.

Code: Select all
$userdata['user_level']

it will return 0, 1 or 2
0 = normal user
1 = Administrator
2 = Moderator.

If you wish to implement your $HTTP_SESSION_VARS['modding'] then you should have a look at sessions.php since that is the file that handles the sessions.
It never hurts to help.....
[ My phpBB Mods and Styles ]
My Mod: [ Simple Shoutbox Mod ]
[ DoubleJWeb ] [ Get Opera ]
User avatar
DoubleJ
Moderator
Moderator
 
Posts: 716
Joined: Sat Jan 22, 2005 9:58 pm
Location: DoubleJWeb.Net

Postby slope on Thu Dec 22, 2005 9:41 pm

WEell I had tryed to edit session.php and my results are:
Warning: Missing argument 7 for session_begin() in /home/z4o/public_html/phpBB2/includes/sessions.php on line 27

Warning: Cannot modify header information - headers already sent by (output started at /home/z4o/public_html/phpBB2/includes/sessions.php:27) in /home/z4o/public_html/phpBB2/includes/sessions.php on line 259

Warning: Cannot modify header information - headers already sent by (output started at /home/z4o/public_html/phpBB2/includes/sessions.php:27) in /home/z4o/public_html/phpBB2/includes/sessions.php on line 260

Warning: Cannot modify header information - headers already sent by (output started at /home/z4o/public_html/phpBB2/includes/sessions.php:27) in /home/z4o/public_html/phpBB2/includes/sessions.php on line 259

Warning: Cannot modify header information - headers already sent by (output started at /home/z4o/public_html/phpBB2/includes/sessions.php:27) in /home/z4o/public_html/phpBB2/includes/sessions.php on line 260

Warning: Cannot modify header information - headers already sent by (output started at /home/z4o/public_html/phpBB2/includes/sessions.php:27) in /home/z4o/public_html/phpBB2/includes/functions.php on line 832

My code now in sessions.php or best said, the changes I had made are:

Line 27- function session_begin($user_id, $user_ip, $page_id, $auto_create = 0, $enable_autologin = 0, $admin = 0, $user_categoria)

Line 174-177-
$sql = "UPDATE " . SESSIONS_TABLE . "
SET session_user_id = $user_id, session_start = $current_time, session_time = $current_time, session_page = $page_id, session_logged_in = $login, session_admin = $admin, session_categoria = $user_categoria
WHERE session_id = '" . $session_id . "'
AND session_ip = '$user_ip'";

Line 184-186-
$sql = "INSERT INTO " . SESSIONS_TABLE . "
(session_id, session_user_id, session_start, session_time, session_ip, session_page, session_logged_in, session_admin, session_categoria)
VALUES ('$session_id', $user_id, $current_time, $current_time, '$user_ip', $page_id, $login, $admin, '$user_categoria')";

And there's no more changes..why it didn't work? I had add to phpbb_sessions the row sessions_categoria and in phpbb_users the row users_categorai and I don't know why it didn't work, can you help me please? thanks
slope
Registered User
Registered User
 
Posts: 8
Joined: Fri Dec 09, 2005 9:13 pm

Postby DoubleJ on Thu Dec 22, 2005 9:54 pm

you'd better not edit sessions.php
some simple modifications to common.php will do the trick.
It never hurts to help.....
[ My phpBB Mods and Styles ]
My Mod: [ Simple Shoutbox Mod ]
[ DoubleJWeb ] [ Get Opera ]
User avatar
DoubleJ
Moderator
Moderator
 
Posts: 716
Joined: Sat Jan 22, 2005 9:58 pm
Location: DoubleJWeb.Net

Postby slope on Thu Dec 22, 2005 9:57 pm

So what can I do?
slope
Registered User
Registered User
 
Posts: 8
Joined: Fri Dec 09, 2005 9:13 pm

Postby slope on Fri Dec 23, 2005 1:59 pm

Ok I was continuing with session.php because in common.php I hadn't see nothing about it so I made that:
function session_begin($user_id, $user_ip, $page_id, $auto_create = 0, $enable_autologin = 0, $admin = 0, $user_categoria)
{
echo $user_id;
echo "<br>";
echo $user_ip;
echo "<br>";
echo $page_id;
echo "<br>";
echo $auto_create;
echo "<br>";
echo $enable_autologin;
echo "<br>";
echo $admin;
echo "<br>";
echo "<strong>".$user_categoria."</strong>";

And when I try to login appears:

Warning: Missing argument 7 for session_begin() in /home/z4o/public_html/phpBB2/includes/sessions.php on line 27
-1
503a2aeb
-1
1
0
0

Warning: Cannot modify header information - headers already sent by (output started at /home/z4o/public_html/phpBB2/includes/sessions.php:27) in /home/z4o/public_html/phpBB2/includes/sessions.php on line 273

Warning: Cannot modify header information - headers already sent by (output started at /home/z4o/public_html/phpBB2/includes/sessions.php:27) in /home/z4o/public_html/phpBB2/includes/sessions.php on line 274
4
503a2aeb
0

0
0
df2cd7104536553afde9f7d66133d578eccb4606
Warning: Cannot modify header information - headers already sent by (output started at /home/z4o/public_html/phpBB2/includes/sessions.php:27) in /home/z4o/public_html/phpBB2/includes/sessions.php on line 273

Warning: Cannot modify header information - headers already sent by (output started at /home/z4o/public_html/phpBB2/includes/sessions.php:27) in /home/z4o/public_html/phpBB2/includes/sessions.php on line 274

Warning: Cannot modify header information - headers already sent by (output started at /home/z4o/public_html/phpBB2/includes/sessions.php:27) in /home/z4o/public_html/phpBB2/includes/functions.php on line 832

In login.php I had added a variable here:
Line 60-62-
$sql = "SELECT user_id, username, user_password, user_active, user_level, user_categoria
FROM " . USERS_TABLE . "
WHERE username = '" . str_replace("\\'", "''", $username) . "'";

Line 89-
if(isset($row['user_Categoria']))
{
$categoria = '1';
}
else
{
$categoria = $row['user_categoria'];
}
$session_id = session_begin($row['user_id'], $user_ip, PAGE_INDEX, FALSE, $autologin, $admin, $categoria);


So I don't know how to continue but in the user categoria the second rang of numbers that apears it apears:
df2cd7104536553afde9f7d66133d578eccb4606
That is the same categorie that my user ID has so...I'm near in the result but I don't know how to repair it...
Why it creates me 2 sessions?
slope
Registered User
Registered User
 
Posts: 8
Joined: Fri Dec 09, 2005 9:13 pm

Postby Phantom on Fri Dec 23, 2005 4:42 pm

It seems to me you need to add ob_start(); at the top of your page, and ob_end_flush(); at the bottom.
"Best of the best of the best, sir! With honors!" -- MIB
[ jphantom.com ]
Phantom
Registered User
Registered User
 
Posts: 245
Joined: Mon Apr 18, 2005 3:24 am

Postby slope on Fri Dec 23, 2005 4:47 pm

Yeah ok, I can add it but the other line the:
Warning: Missing argument 7 for session_begin() in /home/z4o/public_html/phpBB2/includes/sessions.php on line 27
I don't understand why.. . I pass a variable as you can see in my code so... I don't know..what can I do?
slope
Registered User
Registered User
 
Posts: 8
Joined: Fri Dec 09, 2005 9:13 pm

Postby slope on Sun Dec 25, 2005 11:33 am

Ok I've done it but now I have a problem I add a line called $userdata['proba'] and ok there's no problem in log in and no errors but when I put if(isset($userdata['proba'].... it always apears that $userdata['proba'] doesn't exists. Why?

PD: I'm editing sessions.php with no problem except that
slope
Registered User
Registered User
 
Posts: 8
Joined: Fri Dec 09, 2005 9:13 pm

Postby Dandx on Mon Jan 30, 2006 11:43 pm

Help me plz.. I need WEB TEMPLATES and i dont know where to look.. I need it for a radio station plz some one tell me where to look or give me several to chose from... Plz someone help me :?: :(
Life is love live it
Dandx
Registered User
Registered User
 
Posts: 4
Joined: Sat Jan 21, 2006 3:39 pm
Location: Jamaica

Postby UseLess on Tue Jan 31, 2006 12:45 am

Greetings,

Dandx: Don't post a request for something in someone elses thread that has nothing to do with the thread content. And you want web templates try: http://www.templatemonster.com/ where you will find loads of web templates.

Slope: The array '$userdata' contains all the fields from the 'phpbb_users' table so unless you added the field 'proba' to the table it will never be set.
Movie Quote:
It's not the years honey, it's the mileage...

I do not provide any install services for phpBB, Mods or Styles.
Please do not pm me for support/scripting help - you won't get any reply. If you have a question then make a post in the appropriate forum.
User avatar
UseLess
Registered User
Registered User
 
Posts: 6220
Joined: Mon Sep 27, 2004 2:14 am
Location: North East, UK


Return to PHP Programming

Who is online

Users browsing this forum: Google [Bot] and 0 guests

cron