Go Back   CodingForums.com > :: Server side development > Apache configuration

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 06-13-2012, 01:14 AM   PM User | #1
Time Sheep
New Coder

 
Join Date: Sep 2011
Posts: 61
Thanks: 9
Thanked 1 Time in 1 Post
Time Sheep is an unknown quantity at this point
Help reading old rewrite rule

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.
__________________
Need help?
I work with the following languages:
HTML: Professional - PHP: Professional - Visual C#: Average - CSS: Average - ASP: Please don't hurt me! ;(
Currently practicing: Visual C#
Time Sheep is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:06 PM.


Advertisement
Log in to turn off these ads.