Error Globals???
Warning: Unknown: Your script possibly relies on a session side-effect which existed until PHP 4.2.3. Please be advised that the session extension does not consider global variables as a source of data, unless register_globals is enabled. You can disable this functionality and this warning by setting session.bug_compat_42 or session.bug_compat_warn to off, respectively. in Unknown on line 0
Iemand een idee waar dit aan kan liggen?
Ik kan het inlog script wel posten als dat nodig is....
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<?
class PHPBB_Login {
function PHPBB_Login() {
}
function login( $phpbb_user_id ) {
global $db, $board_config;
global $HTTP_COOKIE_VARS, $HTTP_GET_VARS, $SID;
require_once( './phpBB2/config.php' );
define('IN_PHPBB',true);
$phpbb_root_path = "./phpBB2/";
require_once( $phpbb_root_path . "extension.inc" );
require_once( $phpbb_root_path . "common.php" );
return session_begin( $phpbb_user_id, $user_ip, PAGE_INDEX, FALSE, TRUE );
}
function logout( $session_id, $phpbb_user_id ) {
global $db, $lang, $board_config;
global $HTTP_COOKIE_VARS, $HTTP_GET_VARS, $SID;
require_once( './phpBB2/config.php' );
define('IN_PHPBB',true);
$phpbb_root_path = "./phpBB2/";
require_once( $phpbb_root_path . "extension.inc" );
require_once( $phpbb_root_path . "common.php" );
session_end( $session_id, $phpbb_user_id );
setcookie( $board_config[ "cookie_name" ] . "_sid", "", time() - 3600, " " );
setcookie( $board_config[ "cookie_name" ] . "_mysql", "", time() - 3600, " " );
}
} ?>
class PHPBB_Login {
function PHPBB_Login() {
}
function login( $phpbb_user_id ) {
global $db, $board_config;
global $HTTP_COOKIE_VARS, $HTTP_GET_VARS, $SID;
require_once( './phpBB2/config.php' );
define('IN_PHPBB',true);
$phpbb_root_path = "./phpBB2/";
require_once( $phpbb_root_path . "extension.inc" );
require_once( $phpbb_root_path . "common.php" );
return session_begin( $phpbb_user_id, $user_ip, PAGE_INDEX, FALSE, TRUE );
}
function logout( $session_id, $phpbb_user_id ) {
global $db, $lang, $board_config;
global $HTTP_COOKIE_VARS, $HTTP_GET_VARS, $SID;
require_once( './phpBB2/config.php' );
define('IN_PHPBB',true);
$phpbb_root_path = "./phpBB2/";
require_once( $phpbb_root_path . "extension.inc" );
require_once( $phpbb_root_path . "common.php" );
session_end( $session_id, $phpbb_user_id );
setcookie( $board_config[ "cookie_name" ] . "_sid", "", time() - 3600, " " );
setcookie( $board_config[ "cookie_name" ] . "_mysql", "", time() - 3600, " " );
}
} ?>
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
session_start();
session_id();
$dbhost = 'localhost';
$dbuser = '..';
$pass = '..';
$dbname = '..';
$domein = '..';
$db = mysql_connect("$dbhost","$dbuser","$pass") or die ("Sorry geen sql connectie:".mysql_error());
mysql_select_db("$dbname", $db) or die ("Database kan niet aangesporken worden:".mysql_error());
if(isset($_POST["loginusername"]) && isset($_POST["loginpassword"])){
$loginquery = "SELECT * FROM phpbb_users WHERE username='" .$_POST["loginusername"]."'";
$loginresult = mysql_query($loginquery) or die ("FOUT: " .mysql_error());
while (list($loginid, $loginactive, $loginusername, $loginpassword, $user_session_time, $user_session_page, $user_lastvisit, $user_regdate, $user_level, $user_posts, $user_timezone, $user_style, $user_lang, $user_dateformat, $user_new_privmsg, $user_unread_privmsg, $user_last_privmsg, $user_login_tries, $user_last_login_try, $user_emailtime, $user_viewemail, $user_attachsig, $user_allowhtml, $user_allowbbcode, $user_allowsmile, $user_allowavatar, $user_allow_pm, $user_allow_viewonline, $user_notify, $user_notify_pm, $user_popup_pm, $user_rank, $user_avatar, $user_avatar_type, $user_email, $user_icq, $user_website, $user_from, $user_sig, $user_sig_bbcode_uid, $user_aim, $user_yim, $user_msnm, $user_occ, $user_interests, $user_actkey, $user_newpasswd) =
mysql_fetch_row($loginresult)){
$logincheckpass = md5($_POST["loginpassword"]);
if($loginusername . $loginpassword == $_POST["loginusername"] . $logincheckpass){
$loginuserid = $loginid;
session_register("loginuserid");
$loginuser = $loginusername;
session_register("loginuser");
$rankquery = "SELECT * FROM phpbb_ranks WHERE rank_id='".$user_rank."'";
$rankresult = mysql_query($rankquery) or die ("FOUT: " .mysql_error());
while (list($rankid, $ranktitle, $rankmin, $rankspecial, $rankimage) = mysql_fetch_row($rankresult)){
$loginrank = $ranktitle;
session_register("loginrank");
$loginrankimage = "phpBB2/".$rankimage;
session_register("loginrankimage");
$phpbb = new PHPBB_Login();
$phpbb->login( $loginid );
}}}}
?>
session_start();
session_id();
$dbhost = 'localhost';
$dbuser = '..';
$pass = '..';
$dbname = '..';
$domein = '..';
$db = mysql_connect("$dbhost","$dbuser","$pass") or die ("Sorry geen sql connectie:".mysql_error());
mysql_select_db("$dbname", $db) or die ("Database kan niet aangesporken worden:".mysql_error());
if(isset($_POST["loginusername"]) && isset($_POST["loginpassword"])){
$loginquery = "SELECT * FROM phpbb_users WHERE username='" .$_POST["loginusername"]."'";
$loginresult = mysql_query($loginquery) or die ("FOUT: " .mysql_error());
while (list($loginid, $loginactive, $loginusername, $loginpassword, $user_session_time, $user_session_page, $user_lastvisit, $user_regdate, $user_level, $user_posts, $user_timezone, $user_style, $user_lang, $user_dateformat, $user_new_privmsg, $user_unread_privmsg, $user_last_privmsg, $user_login_tries, $user_last_login_try, $user_emailtime, $user_viewemail, $user_attachsig, $user_allowhtml, $user_allowbbcode, $user_allowsmile, $user_allowavatar, $user_allow_pm, $user_allow_viewonline, $user_notify, $user_notify_pm, $user_popup_pm, $user_rank, $user_avatar, $user_avatar_type, $user_email, $user_icq, $user_website, $user_from, $user_sig, $user_sig_bbcode_uid, $user_aim, $user_yim, $user_msnm, $user_occ, $user_interests, $user_actkey, $user_newpasswd) =
mysql_fetch_row($loginresult)){
$logincheckpass = md5($_POST["loginpassword"]);
if($loginusername . $loginpassword == $_POST["loginusername"] . $logincheckpass){
$loginuserid = $loginid;
session_register("loginuserid");
$loginuser = $loginusername;
session_register("loginuser");
$rankquery = "SELECT * FROM phpbb_ranks WHERE rank_id='".$user_rank."'";
$rankresult = mysql_query($rankquery) or die ("FOUT: " .mysql_error());
while (list($rankid, $ranktitle, $rankmin, $rankspecial, $rankimage) = mysql_fetch_row($rankresult)){
$loginrank = $ranktitle;
session_register("loginrank");
$loginrankimage = "phpBB2/".$rankimage;
session_register("loginrankimage");
$phpbb = new PHPBB_Login();
$phpbb->login( $loginid );
}}}}
?>
Code (php)
1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
<?php if(isset($_GET["logout"]) && !isset($_POST["loginusername"])){
$loginquery = "SELECT user_id FROM phpbb_users WHERE username='" .$_SESSION["loginuser"]."'";
$loginresult = mysql_query($loginquery) or die ("FOUT: " .mysql_error());
while (list($loginid) = mysql_fetch_row($loginresult)){
$phpbb = new PHPBB_Login();
$phpbb->logout( session_id(), $loginid) ;}
session_unset();
session_destroy();
}
?>
$loginquery = "SELECT user_id FROM phpbb_users WHERE username='" .$_SESSION["loginuser"]."'";
$loginresult = mysql_query($loginquery) or die ("FOUT: " .mysql_error());
while (list($loginid) = mysql_fetch_row($loginresult)){
$phpbb = new PHPBB_Login();
$phpbb->logout( session_id(), $loginid) ;}
session_unset();
session_destroy();
}
?>
session_register('loginid');
Weet iemand of het in nieuwe versies van PHP niet meer mogelijk is om variabelen op te slaan in de session of hoe ik dat dan wel moet doen?
$_SESSION['loginid'] = $id;
Zijn inmiddels vervangen door :
$_COOKIE en $_GET
het jaar sandaal lol :D PHP is nog niet zo oud... Maar het is idd erg belangrijk om de nieuwe globals te gebruiken. In PHP 5.5/6 zijn de oude ( HTTP_*_VARS ) simpelweg niet meer beschikbaar.