Jump to content
MakeWebGames

Recommended Posts

Posted

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.

Posted

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]
";
}
Posted

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";
}
Posted

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.

Posted

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.

Posted

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.

Posted

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
}
Posted

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";
}

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...