Today's Posts Follow Us On Twitter! TFL Members on Twitter  
Forum search: Advanced Search  
Navigation
Marketplace
  Members Login:
Lost password?
  Forum Statistics:
Forum Members: 24,254
Total Threads: 80,792
Total Posts: 566,471
There are 1370 users currently browsing (tf).
 
  Our Partners:
 
  TalkFreelance     Design and Development     Programming     PHP and MySQL :

Mod rewrite

Thread title: Mod rewrite
Closed Thread    
    Thread tools Search this thread Display Modes  
05-30-2006, 09:22 PM
#1
.Nick is offline .Nick
.Nick's Avatar
Status: Request a custom title
Join date: Feb 2005
Location:
Expertise:
Software:
 
Posts: 1,159
iTrader: 3 / 100%
 

.Nick is on a distinguished road

  Old  Mod rewrite

Hey

Code:
RewriteRule ^filestore/(.*)  fileprotect.php?file=$1 [L]
PHP Code:
<?php

$filename 
addslashes($GET['file']).".zip";

$file "/home/thesigns/public_html/filestore/".$filename;

echo 
$file;

if(!
file_exists($file)) { die('hi'); }

echo 
'test';

?>
I have a test.zip in the filestore directory.

I try accessing domain.com/filestore/test, and get "/home/thesigns/public_html/filestore/.ziphi" as output. Why isn't 'test' getting passed on?

05-30-2006, 09:36 PM
#2
jjmac is offline jjmac
jjmac's Avatar
Status: Member
Join date: May 2006
Location:
Expertise:
Software:
 
Posts: 197
iTrader: 0 / 0%
 

jjmac is on a distinguished road

  Old

Everything looks to be in the right syntax. Have you tried replacing your regular expression to see if maybe that's it? I only say that because anytime I have problems with a rewrite rule it's the regex, but that's just because I'm no good at them FYI all of the rewrite rules I've used use brackets to hold the regular expression, I don't know if that makes a difference or not. Ex: ([0-9])

05-30-2006, 09:55 PM
#3
.Nick is offline .Nick
.Nick's Avatar
Status: Request a custom title
Join date: Feb 2005
Location:
Expertise:
Software:
 
Posts: 1,159
iTrader: 3 / 100%
 

.Nick is on a distinguished road

  Old

Haha, I suck at regex too

Tried the brackets out... gave me 404s

05-30-2006, 10:44 PM
#4
iisbum is offline iisbum
iisbum's Avatar
Status: Member
Join date: Oct 2005
Location: Clifton Park, NY, USA
Expertise:
Software:
 
Posts: 273
iTrader: 4 / 100%
 

iisbum is on a distinguished road

  Old

You need to use:
$_GET

instead of $GET

Rest of it looks ok.

HTH,
Mubs

05-30-2006, 11:14 PM
#5
.Nick is offline .Nick
.Nick's Avatar
Status: Request a custom title
Join date: Feb 2005
Location:
Expertise:
Software:
 
Posts: 1,159
iTrader: 3 / 100%
 

.Nick is on a distinguished road

  Old

Doh! Knew it had to be something small like that.

Thanks!

05-30-2006, 11:56 PM
#6
jjmac is offline jjmac
jjmac's Avatar
Status: Member
Join date: May 2006
Location:
Expertise:
Software:
 
Posts: 197
iTrader: 0 / 0%
 

jjmac is on a distinguished road

  Old

Good eye iisbum

05-31-2006, 01:48 AM
#7
iisbum is offline iisbum
iisbum's Avatar
Status: Member
Join date: Oct 2005
Location: Clifton Park, NY, USA
Expertise:
Software:
 
Posts: 273
iTrader: 4 / 100%
 

iisbum is on a distinguished road

  Old

I've spent many an hour looking for small mistakes like that in my own code, so I learned to look better

Closed Thread    


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

  Posting Rules  
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump:
 
  Contains New Posts Forum Contains New Posts   Contains No New Posts Forum Contains No New Posts   A Closed Forum Forum is Closed