I just finished work on my beautiful PHP script, which needs the ability to use GET variables. However, when I handed over the script to the guy it's made for, I figured out that they have a bunch of rewrite rules enabled for AJAX loading.
His old webmaster wrote these rules, but failed to comment them, and we cannot seem to get in contact with him, so now it seems to be my problem.

Heres the specific case:
My script is located at /_ajax/program2.php
This is the rewrite rule:
Code:
RewriteRule ^ajax/([^/]*)/([^/]*)/?([^/]*)/?$ /_ajax.php?popup=yes&mode=$1&id=$2&ting=$3&%{QUERY_STRING} [L]
And finally _ajax.php which handles the corresponding requests:
PHP Code:
<?php
include_once($_SERVER['DOCUMENT_ROOT'] . "/includes/func.php");

#require_once($_SERVER['DOCUMENT_ROOT'] . "/includes/cache_start.php");

 
if(isset($_SESSION['admtime']) && $_SESSION['admtime'] < time()) {
  unset(
$_SESSION['admtime']);
  unset(
$_SESSION['admlogin']);
 }


  if(
$_GET["mode"] == "404"){
   
$_GET["mode"] = str_replace("/"""$_SERVER['REQUEST_URI']);

 }
 if(isset(
$_GET["mode"])) $site $_GET["mode"];
 
    if(isset(
$_GET['id']) && file_exists($_SERVER['DOCUMENT_ROOT']  ."/_ajax/"mb_strtolower($_GET['mode'] ."-"$_GET['id']) .".php")) $site $_GET['mode'] ."-"$_GET['id'];
    

 
//echo $site."<br/>";
 
if(empty($site) || file_exists($_SERVER['DOCUMENT_ROOT']  ."/_ajax/"mb_strtolower($site) .".php") === false) {
  
$site "frontpage";
 }
 
 include(
$_SERVER['DOCUMENT_ROOT'] ."/_ajax/" mb_strtolower($site) . ".php"); 
?>
How would I want to modify this file (or the htaccess) in order to be able to use the GET variables such as /program2/?mystuff=foobar? I assume the rewrite rules somehow allows for passing some information through the URL.