代码在重定向时不会重定向

时间:2016-01-26 06:35:21

标签: php redirect

任何人都可以解释为什么我的代码不会重定向,它是在两三天前工作的,现在它没有重定向到它意味着...... 完整代码位于:http://pastebin.com/ib0uQvQ7

要看的主要部分

    <?php  
   /*------------includes--------------*/
   include ('./includes/connections.php');
   include ('./includes/brain_file.php');
   include ('./includes/style_top.php');
   /*------------includes--------------*/
    if($pl['my_jail'] > gmtime() || $pl['my_hosp'] > gmtime())
    {
    echo "<center><hr width='75%'/>Sorry this page is not viewable while in jail or hospital!<hr width='75%'/></center>";
    include ('./includes/style_bottom.php');
    exit();
    }
   if($_GET['action']) {
   if(!in_array($_GET['action'], array('interview','quit','promote','special'))) {
   echo "<center>Invalid action!</center>";
   include ('./includes/style_bottom.php');
   exit();
   }
   }
   $_GET['action'] = isset($_GET['action']) && ctype_alpha($_GET['action']) ? trim($_GET['action']) : 'index';
   switch($_GET['action'])
   {
   case 'interview':
   job_interview();
   break;

   case 'quit':
   quit_job();
   break;

   case 'special':
   job_specials();
   break;

   case 'promote':
   promote_me();
   break;

   default:
   job_index();
   break;
   }
   function job_index()
  {
   global $pl;
   $job = array();
   $q_ry = array();
   $q_ry = "SELECT `my_job`,`my_job_rank`,`armypoints`,`grocpoints`,`casipoints`,
                  `medipoints`,`educpoints`,`lawpoints`,`my_comp`
           FROM `members_extra`
           WHERE `playerid` = '".mysql_real_escape_string($_SESSION['playerid'])."'";
   $job = mysql_query($q_ry);
   $job = mysql_fetch_array($job);
   if(!$job['my_job']) {

   if(!$job['my_job'] && !$job['my_comp'])
  {
   header('location:newspaper.php?page=jobs');
    }
    else
       {
   header('location:companies.php');
  }


    }

1 个答案:

答案 0 :(得分:0)

header("Refresh:0; url=companies.php");