Tysoon Posted January 18, 2012 Share Posted January 18, 2012 Hello! my usersonline.php doesnt show online users, doesnt show on profile either, there is no coding errors etc, PHP Notice: Undefined index: loggedin in /var/www/html/globals.php on line 21 thats the only error i got in ssh root putty. I've got NO idea of what is causing this ? i would really appreciate some help about now:confused: Quote Link to comment Share on other sites More sharing options...
a_bertrand Posted January 18, 2012 Share Posted January 18, 2012 I would not rate this as "URGENT" ;) As you can certainly live without online players on a game... Quote Link to comment Share on other sites More sharing options...
Tysoon Posted January 18, 2012 Author Share Posted January 18, 2012 (edited) <?php /*--------------------------------- -- MCCODES V2 -- ---------------------------------*/ session_start(); ob_start(); if(get_magic_quotes_gpc() == 0) { foreach($_POST as $k => $v) { $_POST[$k]=addslashes($v); } foreach($_GET as $k => $v) { $_GET[$k]=addslashes($v); } } require "global_func.php"; if($_SESSION['loggedin']==0) { header("Location: login.php");exit; } $userid=$_SESSION['userid']; require "header.php"; include "config.php"; global $_CONFIG; define("MONO_ON", 1); require "class/class_db_{$_CONFIG['driver']}.php"; $db=new database; $db->configure($_CONFIG['hostname'], $_CONFIG['username'], $_CONFIG['password'], $_CONFIG['database'], $_CONFIG['persistent']); $db->connect(); $c=$db->connection_id; $set=array(); $settq=$db->query("SELECT * FROM settings"); while($r=$db->fetch_row($settq)) { $set[$r['conf_name']]=$r['conf_value']; } $domain=$_SERVER['HTTP_HOST']; global $jobquery, $housequery; if($jobquery) { $is=$db->query("SELECT u.*,us.*,j.*,jr.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid LEFT JOIN jobs j ON j.jID=u.job LEFT JOIN jobranks jr ON jr.jrID=u.jobrank WHERE u.userid=$userid"); } else if($housequery) { $is=$db->query("SELECT u.*,us.*,h.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid LEFT JOIN houses h ON h.hWILL=u.maxwill WHERE u.userid=$userid"); } else { $is=$db->query("SELECT u.*,us.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid WHERE u.userid=$userid"); } $ir=$db->fetch_row($is); if($ir['force_logout']) { $db->query("UPDATE users SET force_logout=0 WHERE userid=$userid"); session_unset(); session_destroy(); header("Location: login.php"); exit; } global $macropage; if($macropage && !$ir['verified'] && $set['validate_on']==1) { header("Location: macro1.php?refer=$macropage"); exit; } check_level(); $h = new headers; $h->startheaders(); $fm=money_formatter($ir['money']); $cm=money_formatter($ir['crystals'],''); $lv=date('F j, Y, g:i a',$ir['laston']); global $atkpage; if($atkpage) { $h->userdata($ir,$lv,$fm,$cm,0); } else { $h->userdata($ir,$lv,$fm,$cm); } global $menuhide; if(!$menuhide) { $h->menuarea(); } //Shoutbox function anti_inject($campo) { foreach($campo as $key => $val) { $val = mysql_real_escape_string($val); // store it back into the array $campo[$key] = $val; } return $campo; //Returns the the var clean } //the next two lines make sure all post and get vars are filtered through this function $_POST = anti_inject($_POST); $_GET = anti_inject($_GET); ?> Edited January 18, 2012 by Tysoon Quote Link to comment Share on other sites More sharing options...
Tysoon Posted January 18, 2012 Author Share Posted January 18, 2012 well, i would really appreciate some help please! :( Quote Link to comment Share on other sites More sharing options...
Danny696 Posted January 18, 2012 Share Posted January 18, 2012 Seems to be an error with the auth.php please post that up. Also, those last lines of the globals.php gave me a laugh Quote Link to comment Share on other sites More sharing options...
Tysoon Posted January 18, 2012 Author Share Posted January 18, 2012 <?php session_start(); if(get_magic_quotes_gpc() == 0) { foreach($_POST as $k => $v) { $_POST[$k]=addslashes($v); } foreach($_GET as $k => $v) { $_GET[$k]=addslashes($v); } } include "config.php"; global $_CONFIG; define("MONO_ON", 1); require "class/class_db_{$_CONFIG['driver']}.php"; $db=new database; $db->configure($_CONFIG['hostname'], $_CONFIG['username'], $_CONFIG['password'], $_CONFIG['database'], $_CONFIG['persistent']); $db->connect(); $c=$db->connection_id; $set=array(); $settq=$db->query("SELECT * FROM settings"); while($r=$db->fetch_row($settq)) { $set[$r['conf_name']]=$r['conf_value']; } if ($_POST['username'] == "" || $_POST['password'] == "") { die("<h3>{$set['game_name']} Error</h3> You did not fill in the login form!<br> <a href=login.php>> Back</a>"); } $uq=$db->query("SELECT userid FROM users WHERE login_name='{$_POST['username']}' AND `userpass`=md5('{$_POST['password']}')"); if ($db->num_rows($uq)==0) { die("<h3>{$set['game_name']} Error</h3> Invalid username or password!<br> <a href=login.php>> Back</a>"); } else { $_SESSION['loggedin']=1; $mem=$db->fetch_row($uq); $_SESSION['userid']=$mem['userid']; $IP = $_SERVER['REMOTE_ADDR']; $IP = mysql_real_escape_string($IP); $db->query("UPDATE users SET lastip_login='$IP',last_login=unix_timestamp() WHERE userid={$mem['userid']}"); if($set['validate_period'] == "login" && $set['validate_on']) { $db->query("UPDATE users SET verified=0 WHERE userid={$mem['userid']}"); } header("Location: loggedin.php"); } ?> Quote Link to comment Share on other sites More sharing options...
Tysoon Posted January 18, 2012 Author Share Posted January 18, 2012 if($_SESSION['loggedin']==0) { header("Location: login.php");exit; } thats the line 21 in globals.php the code i posted above this post is authenticate.php im willing to pay a couple dollars for a fix... Quote Link to comment Share on other sites More sharing options...
a_bertrand Posted January 19, 2012 Share Posted January 19, 2012 Change the line 21 with: if(!isset($_SESSION['loggedin']) || $_SESSION['loggedin']==0) { header("Location: login.php");exit; } Quote Link to comment Share on other sites More sharing options...
Tysoon Posted January 19, 2012 Author Share Posted January 19, 2012 Dave fixed it. Quote Link to comment Share on other sites More sharing options...
a_bertrand Posted January 19, 2012 Share Posted January 19, 2012 Then state it such that others don't reply for nothing ;) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.