<?php 

include 'ipp.php';

if (($_SERVER[REQUEST_METHOD] != 'POST') && ($_SERVER[REQUEST_METHOD] != 'GET')) {
  menu ('ipp.menu.dat', 'Select Project', 'ipp.css', '', '');
  echo "Invalid Client Request<br>\n";
  menu_end ();
  exit ();
}

$ID = checkID ();

if ($_SERVER[REQUEST_METHOD] == 'GET') { 
  projectform ($ID);
}

if ($_SERVER[REQUEST_METHOD] == 'POST') { 

  if (key_exists (project, $_POST)) {
    $myProj = $_POST[proj];
    $ID['proj'] = $myProj;
    // validate the existence of the project

    // update ID['link']
    // $link is attached to every nav link
    $ID['link'] = "pass=" . $ID['pass'];
    if ($ID['proj']) {
      $ID['link'] = $ID['link'] . "&proj=" . $ID['proj'];
    }

    menu ('ipp.menu.dat', 'Select Project', 'ipp.css', $ID['link'], $ID['proj']);
    echo "New project is : $myProj<br>\n";
    menu_end();
  }
}
?>
