illegalife Posted January 23, 2009 Posted January 23, 2009 Can someone help me? I want a whole different file (header2.php) to display when you are in hospital instead of (header.php) i tried to mess with globals.php a little bit but couldnt get it to work. Quote
Tonka Posted January 23, 2009 Posted January 23, 2009 Re: Changing Whole Header when in hospital if by header you mean header image, here if($ir['jail']) { echo "[img=jail.jpg] "; } else if($ir['hospital']) { echo "[img=hospital.jpg] "; } else { echo "[img=header.jpg] "; } Quote
illegalife Posted January 23, 2009 Author Posted January 23, 2009 Re: Changing Whole Header when in hospital no by header i mean the whole file header.php Quote
AlabamaHit Posted January 23, 2009 Posted January 23, 2009 Re: Changing Whole Header when in hospital May try this? Open globals.php find: require "header.php"; change to this... if($ir['hospital']) { require "header2.php"; } else { require "header.php"; } Quote
Dave Posted January 23, 2009 Posted January 23, 2009 Re: Changing Whole Header when in hospital May try this? Open globals.php find: require "header.php"; change to this... if($ir['hospital']) { require "header2.php"; } else { require "header.php"; } In mccodes $ir isn't declared before include "header.php"; its quite a bit after it. When i had a theme changer i used sessions instead. Quote
POG1 Posted January 23, 2009 Posted January 23, 2009 Re: Changing Whole Header when in hospital in each of the page functions just use if statements, here is a simple example. <?php function startheaders() { global $ir; if($ir['jail'] > 0) { // startjail headers } elseif ($ir['hospital'] > 0) { // start hospital headers } else { // start normal headers } } ?> Thats the first way i thought of doing so. Quote
AlabamaHit Posted January 23, 2009 Posted January 23, 2009 Re: Changing Whole Header when in hospital This works have tested on local server. In globals.php Find: <?php /*--------------------------------- -- MCCodes 2.0 -- By Dabomstew ---------------------------------*/ session_start(); ob_start(); if(get_magic_quotes_gpc() == 0) { die("Fatal error: MCCode cannot function without MagicQuotes GPC being turned on in PHP.INI."); } 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; Chanage to this.. <?php /*--------------------------------- -- MCCodes 2.0 -- By Dabomstew ---------------------------------*/ session_start(); ob_start(); if(get_magic_quotes_gpc() == 0) { die("Fatal error: MCCode cannot function without MagicQuotes GPC being turned on in PHP.INI."); } require "global_func.php"; if($_SESSION['loggedin']==0) { header("Location: login.php");exit; } $userid=$_SESSION['userid']; 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; $hospital_check = sprintf("SELECT hospital FROM users WHERE userid = %u",($userid)); $check = mysql_query($hospital_check); $hc = mysql_fetch_array($check); if($hc['hospital'] == 0) { require "header.php"; } else { require "header2.php"; } Tested and working. Quote
castle Posted January 27, 2009 Posted January 27, 2009 Re: Changing Whole Header when in hospital can alabamahit's example be changed to show different headers for hospital and jail? Quote
Haunted Dawg Posted January 27, 2009 Posted January 27, 2009 Re: Changing Whole Header when in hospital Yes. Just use this: <?php /*--------------------------------- -- MCCodes 2.0 -- By Dabomstew ---------------------------------*/ session_start(); ob_start(); if(get_magic_quotes_gpc() == 0) { die("Fatal error: MCCode cannot function without MagicQuotes GPC being turned on in PHP.INI."); } require "global_func.php"; if($_SESSION['loggedin']==0) { header("Location: login.php");exit; } $userid=$_SESSION['userid']; 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; $hospital_check = sprintf("SELECT hospital FROM users WHERE userid = %u",($userid)); $check = mysql_query($hospital_check); $hc = mysql_fetch_array($check); if($hc['hospital'] == 0) { include_once("header.php"); //Normal Header } else if($hc['hospital'] != 0) { include_once("header2.php"); //Hospital Header } else if($hc['jail'] != 0) { include_once("header3.php"); //Jail Header } Quote
Karlos Posted January 27, 2009 Posted January 27, 2009 Re: Changing Whole Header when in hospital Incorrect Killah.. You may see that Alabama Doesn't use * So if you want Jail And Hosp aswell try: <?php /*--------------------------------- -- MCCodes 2.0 -- By Dabomstew ---------------------------------*/ session_start(); ob_start(); if(get_magic_quotes_gpc() == 0) { die("Fatal error: MCCode cannot function without MagicQuotes GPC being turned on in PHP.INI."); } require "global_func.php"; if($_SESSION['loggedin']==0) { header("Location: login.php");exit; } $userid=$_SESSION['userid']; 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; $hospital_check = sprintf("SELECT hospital, jail FROM users WHERE userid = %u",($userid)); $check = mysql_query($hospital_check); $hc = mysql_fetch_array($check); if($hc['hospital'] != 0) { require "hospheader.php"; } if($hc['jail'] != 0) { require "jailheader.php"; } else { require "header.php"; } Quote
Haunted Dawg Posted January 27, 2009 Posted January 27, 2009 Re: Changing Whole Header when in hospital Yeah i forgot to add the ,jail. But and agen.. why you remove the include_once? Quote
Karlos Posted January 27, 2009 Posted January 27, 2009 Re: Changing Whole Header when in hospital I didn't copy and paste yours... i just grabbed alabama's code. Quote
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.