0

Can anyone work out why my code won't redirect, it was working two or three days ago, now it's not redirecting when it's meant to.. The full code is here:http://pastebin.com/ib0uQvQ7

Main part to look at

    <?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');
  }


    }
braidz
  • 45
  • 9
  • Is there any error printed or logged? – Kdecherf Jan 26 '16 at 12:51
  • No there's not, why is that? – braidz Jan 26 '16 at 12:58
  • [Your script is at risk for SQL Injection Attacks.](http://stackoverflow.com/questions/60174/how-can-i-prevent-sql-injection-in-php) – Jay Blanchard Jan 26 '16 at 13:29
  • Please [stop using `mysql_*` functions](http://stackoverflow.com/questions/12859942/why-shouldnt-i-use-mysql-functions-in-php). [These extensions](http://php.net/manual/en/migration70.removed-exts-sapis.php) have been removed in PHP 7. Learn about [prepared](http://en.wikipedia.org/wiki/Prepared_statement) statements for [PDO](http://php.net/manual/en/pdo.prepared-statements.php) and [MySQLi](http://php.net/manual/en/mysqli.quickstart.prepared-statements.php) and consider using PDO, [it's really pretty easy](http://jayblanchard.net/demystifying_php_pdo.html). – Jay Blanchard Jan 26 '16 at 13:29
  • Add error reporting to the top of your file(s) right after your opening ` – Jay Blanchard Jan 26 '16 at 13:29

1 Answers1

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