New mod_rewrite / redirect index file

View: New views
3 Messages — Rating Filter:   Alert me  

New mod_rewrite / redirect index file

by Verdon Vaillancourt-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

With the old $var1 $var2 model, I used to do the following in my  
mod's index.php file..

<?php

if (!defined('PHPWS_SOURCE_DIR')) {
     include '../../config/core/404.html';
     exit();
}

PHPWS_Core::initModClass('skeleton', 'Skeleton.php');
$skeleton = new Skeleton;

if (isset($_GET['var1'])) {
     $_REQUEST['skeleton_id'] = $_GET['skeleton_id'] = (int)$_GET
['var1'];
}

if (isset($_GET['var2'])) {
     $_REQUEST['bone_id'] = $_GET['bone_id'] = (int)$_GET['var2'];
}

if (isset($_REQUEST['aop'])) {
     $skeleton->adminMenu();
} elseif (isset($_REQUEST['uop'])) {
     $skeleton->userMenu();
} elseif (isset($_REQUEST['skeleton_id']) && isset($_REQUEST
['bone_id'])) {
     $skeleton->userMenu('view_bone');
} elseif (isset($_REQUEST['skeleton_id'])) {
     $skeleton->userMenu('view_skeleton');
} else {
     PHPWS_Core::home();
}


?>

How should I approach that now? Anything else I should be watching for?

Thanks,
verdon


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Phpwebsite-developers mailing list
Phpwebsite-developers@...
https://lists.sourceforge.net/lists/listinfo/phpwebsite-developers

Re: New mod_rewrite / redirect index file

by Matthew McNaney :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Verdon,

You won't watch for anything. If an address is in mod_rewrite format,
Forward.php places the key/value pairs into the _GET and _REQUEST
globals. So you could just drop the looks for var1 and var2.

Matt

Verdon Vaillancourt wrote:

> Hi,
>
> With the old $var1 $var2 model, I used to do the following in my  
> mod's index.php file..
>
> <?php
>
> if (!defined('PHPWS_SOURCE_DIR')) {
>      include '../../config/core/404.html';
>      exit();
> }
>
> PHPWS_Core::initModClass('skeleton', 'Skeleton.php');
> $skeleton = new Skeleton;
>
> if (isset($_GET['var1'])) {
>      $_REQUEST['skeleton_id'] = $_GET['skeleton_id'] = (int)$_GET
> ['var1'];
> }
>
> if (isset($_GET['var2'])) {
>      $_REQUEST['bone_id'] = $_GET['bone_id'] = (int)$_GET['var2'];
> }
>
> if (isset($_REQUEST['aop'])) {
>      $skeleton->adminMenu();
> } elseif (isset($_REQUEST['uop'])) {
>      $skeleton->userMenu();
> } elseif (isset($_REQUEST['skeleton_id']) && isset($_REQUEST
> ['bone_id'])) {
>      $skeleton->userMenu('view_bone');
> } elseif (isset($_REQUEST['skeleton_id'])) {
>      $skeleton->userMenu('view_skeleton');
> } else {
>      PHPWS_Core::home();
> }
>
>
> ?>
>
> How should I approach that now? Anything else I should be watching for?
>
> Thanks,
> verdon
>
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Phpwebsite-developers mailing list
> Phpwebsite-developers@...
> https://lists.sourceforge.net/lists/listinfo/phpwebsite-developers

--
Matthew McNaney
Electronic Student Services
Appalachian State University
Ext. 6493
http://ess.appstate.edu
http://phpwebsite.appstate.edu

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Phpwebsite-developers mailing list
Phpwebsite-developers@...
https://lists.sourceforge.net/lists/listinfo/phpwebsite-developers

Re: New mod_rewrite / redirect index file

by Verdon Vaillancourt-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Cool. I like that.

Thanks,
verdon

On 7-Aug-08, at 1:36 PM, matt wrote:

> Verdon,
>
> You won't watch for anything. If an address is in mod_rewrite format,
> Forward.php places the key/value pairs into the _GET and _REQUEST
> globals. So you could just drop the looks for var1 and var2.
>
> Matt
>
> Verdon Vaillancourt wrote:
>> Hi,
>>
>> With the old $var1 $var2 model, I used to do the following in my
>> mod's index.php file..
>>
>> <?php
>>
>> if (!defined('PHPWS_SOURCE_DIR')) {
>>      include '../../config/core/404.html';
>>      exit();
>> }
>>
>> PHPWS_Core::initModClass('skeleton', 'Skeleton.php');
>> $skeleton = new Skeleton;
>>
>> if (isset($_GET['var1'])) {
>>      $_REQUEST['skeleton_id'] = $_GET['skeleton_id'] = (int)$_GET
>> ['var1'];
>> }
>>
>> if (isset($_GET['var2'])) {
>>      $_REQUEST['bone_id'] = $_GET['bone_id'] = (int)$_GET['var2'];
>> }
>>
>> if (isset($_REQUEST['aop'])) {
>>      $skeleton->adminMenu();
>> } elseif (isset($_REQUEST['uop'])) {
>>      $skeleton->userMenu();
>> } elseif (isset($_REQUEST['skeleton_id']) && isset($_REQUEST
>> ['bone_id'])) {
>>      $skeleton->userMenu('view_bone');
>> } elseif (isset($_REQUEST['skeleton_id'])) {
>>      $skeleton->userMenu('view_skeleton');
>> } else {
>>      PHPWS_Core::home();
>> }
>>
>>
>> ?>
>>
>> How should I approach that now? Anything else I should be watching  
>> for?
>>
>> Thanks,
>> verdon
>>
>>
>> ---------------------------------------------------------------------
>> ----
>> This SF.Net email is sponsored by the Moblin Your Move Developer's  
>> challenge
>> Build the coolest Linux based applications with Moblin SDK & win  
>> great prizes
>> Grand prize is a trip for two to an Open Source event anywhere in  
>> the world
>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>> _______________________________________________
>> Phpwebsite-developers mailing list
>> Phpwebsite-developers@...
>> https://lists.sourceforge.net/lists/listinfo/phpwebsite-developers
>
> --
> Matthew McNaney
> Electronic Student Services
> Appalachian State University
> Ext. 6493
> http://ess.appstate.edu
> http://phpwebsite.appstate.edu
>
> ----------------------------------------------------------------------
> ---
> This SF.Net email is sponsored by the Moblin Your Move Developer's  
> challenge
> Build the coolest Linux based applications with Moblin SDK & win  
> great prizes
> Grand prize is a trip for two to an Open Source event anywhere in  
> the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Phpwebsite-developers mailing list
> Phpwebsite-developers@...
> https://lists.sourceforge.net/lists/listinfo/phpwebsite-developers


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Phpwebsite-developers mailing list
Phpwebsite-developers@...
https://lists.sourceforge.net/lists/listinfo/phpwebsite-developers