$CaseId=$_SESSION[`CaseId`];
$ProjectId=$_SESSION[`ProjectId`];
$UserId=$_SESSION[`UserId`];

if ($CaseId==-1)
  {
    $rUnique=ShowQueryResultScalar("select max(rUnique) from Responses where qID=`GB_C_Name` and CaseID=`-1`");
    $_SESSION[`CaseId`]=$rUnique;
    ExecuteSQL("update Responses set CaseID=`$rUnique` where rUnique=`$rUnique`");
    $_SESSION[`MsgTxt`]=`Your questbook entry has been logged.  Thanks!`;
  }
$stat=1;