03laceys Posted September 2, 2008 Share Posted September 2, 2008 I am trying to set my game so members are able to choose the layout the wish to use. the bit i am stuck on is the globals.php It currently calls header.php i have changed it to call 3.php. This is 3.php <?php if($ir['layout'] == 1) { include "1.php"; } else { include "2.php"; } ?> What is wrong as the game only displays 2.php no matter what. Thanks for any help Quote Link to comment Share on other sites More sharing options...
Haunted Dawg Posted September 2, 2008 Share Posted September 2, 2008 Re: user change layout help? if($ir['layout'] == 1) { include("1.php"); } else if($ir['layout'] == 2) { include("2.php"); } Quote Link to comment Share on other sites More sharing options...
03laceys Posted September 2, 2008 Author Share Posted September 2, 2008 Re: user change layout help? Fatal error: Cannot instantiate non-existent class: headers in /mnt/web6/40/42/51656042/htdocs/hitmanv2/globals.php on line 74 Quote Link to comment Share on other sites More sharing options...
Haunted Dawg Posted September 2, 2008 Share Posted September 2, 2008 Re: user change layout help? yh on line 74. if($ir['layout'] == 1) { include("1.php"); } else if($ir['layout'] == 2) { include("2.php"); } Quote Link to comment Share on other sites More sharing options...
03laceys Posted September 2, 2008 Author Share Posted September 2, 2008 Re: user change layout help? put that in globals. instead of it calling 3.php? Quote Link to comment Share on other sites More sharing options...
Haunted Dawg Posted September 2, 2008 Share Posted September 2, 2008 Re: user change layout help? Why not just use: include($ir['layout'].".php"); Quote Link to comment Share on other sites More sharing options...
03laceys Posted September 2, 2008 Author Share Posted September 2, 2008 Re: user change layout help? Warning: main(.php) [function.main]: failed to open stream: No such file or directory in /mnt/web6/40/42/51656042/htdocs/hitmanv2/globals.php on line 23 Warning: main() [function.include]: Failed opening '.php' for inclusion (include_path='.:/opt/RZphp4/includes') in /mnt/web6/40/42/51656042/htdocs/hitmanv2/globals.php on line 23 Fatal error: Cannot instantiate non-existent class: headers in /mnt/web6/40/42/51656042/htdocs/hitmanv2/globals.php on line 74 Quote Link to comment Share on other sites More sharing options...
Haunted Dawg Posted September 2, 2008 Share Posted September 2, 2008 Re: user change layout help? Dude seriously get your coding right. I keep posting stuff but never work's for you. global $ir; if($ir['layout'] == 0) { echo 'Dumbass, you have no layout selected.'; exit; } include($ir['layout'].".php"); Quote Link to comment Share on other sites More sharing options...
Haunted Dawg Posted September 2, 2008 Share Posted September 2, 2008 Re: user change layout help? If that does not work post your globals.php here. Quote Link to comment Share on other sites More sharing options...
03laceys Posted September 2, 2008 Author Share Posted September 2, 2008 Re: user change layout help? Now i'm just getting dumbass you have no layout selected. <?php 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']; global $ir; if($ir['layout'] == 0) { echo 'Dumbass, you have no layout selected.'; exit; } include($ir['layout'].".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(); } ?> Quote Link to comment Share on other sites More sharing options...
Haunted Dawg Posted September 2, 2008 Share Posted September 2, 2008 Re: user change layout help? <?php 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']; global $ir; if($ir['layout'] == 0) { echo 'Dumbass, you have no layout selected.'; exit; } include($ir['layout'].".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(); } ?> Do you even have the code in the users table: ALTER TABLE users ADD layout INT(11) NOT NULL DEFAULT 1; Quote Link to comment Share on other sites More sharing options...
03laceys Posted September 2, 2008 Author Share Posted September 2, 2008 Re: user change layout help? yes i do have the field in the users table already. Quote Link to comment Share on other sites More sharing options...
Haunted Dawg Posted September 2, 2008 Share Posted September 2, 2008 Re: user change layout help? bet you dont have it set as default 1? Quote Link to comment Share on other sites More sharing options...
03laceys Posted September 2, 2008 Author Share Posted September 2, 2008 Re: user change layout help? yep i do :? Quote Link to comment Share on other sites More sharing options...
Haunted Dawg Posted September 2, 2008 Share Posted September 2, 2008 Re: user change layout help? ok replace my little code then if($ir['layout']) { echo 'Your layout is ('.$ir['layout'].')'; } include($ir['layout'].".php"); It will show you what number layout u got. Quote Link to comment Share on other sites More sharing options...
03laceys Posted September 2, 2008 Author Share Posted September 2, 2008 Re: user change layout help? Warning: main(.php) [function.main]: failed to open stream: No such file or directory in /mnt/web6/40/42/51656042/htdocs/hitmanv2/globals.php on line 31 Warning: main() [function.include]: Failed opening '.php' for inclusion (include_path='.:/opt/RZphp4/includes') in /mnt/web6/40/42/51656042/htdocs/hitmanv2/globals.php on line 31 Fatal error: Cannot instantiate non-existent class: headers in /mnt/web6/40/42/51656042/htdocs/hitmanv2/globals.php on line 85 Quote Link to comment Share on other sites More sharing options...
Haunted Dawg Posted September 2, 2008 Share Posted September 2, 2008 Re: user change layout help? Did it show what layout u got? Quote Link to comment Share on other sites More sharing options...
Decepti0n Posted September 3, 2008 Share Posted September 3, 2008 Re: user change layout help? Because you're trying to get $ir before it's even set...... if ($ir something) // Fifty lines later $ir = '' Quote Link to comment Share on other sites More sharing options...
03laceys Posted September 3, 2008 Author Share Posted September 3, 2008 Re: user change layout help? Yeah sorry forgot to post. It's fixed :) 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.