[PHP] Hi. I need your help here

2007-06-24 Thread J S
Hi. I came across your contact info at php.zend.com and was hoping you could 
help me out with this question.
  I recently installed Rubberwall10, a free software that protects from 
hotlinking and although I managed to installed the software correctly at my 
site, I came across the fact that when I tried to download an image from the 
site to my computer, the image came out with 0 kbs.
   
  Someone who also installed the software made a comment on the internet 
stating he solved the problem adding a trim function to three of the variables 
in the filescrapper.php file. 
   
  My question to you is, how can I do that. I am not familiar with php, 
although I have understood some minimal basics. Adding trim function to $ct, 
$webaddress and $wantedfilename seemed to have solved the problem according to 
the user who solved the problem but did not specify how he did it. Can you tell 
me how I can add trim function to the above three variables?. Your help is 
greatly appreciated. The code is below. Thanks. John
  /***
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version.
 *
 ***/
$allowed = 0;
include('config.php');
  if($allowblank  0) { if($_SERVER['HTTP_REFERER']==) { $allowed = 1; }}
  $domains = count($alloweddomains);
  for($y=0;$y$domains+1;$y++) {
 if((stristr($_SERVER['HTTP_REFERER'], $alloweddomains[$y]))) { $allowed = 1;}
}
  if($allowed  0) {
  $namenumberarray = file($webaddress.fileindex.txt);
  $numberoffiles = count($namenumberarray);
  $filenames = array();
  
  for($x=0;$x$numberoffiles+1;$x++) {
   $temporary = explode(:,$namenumberarray[$x]);
   $tempname = explode(\n,$temporary[1]);
   $filenames[$temporary[0]] = $tempname[0];
  }
  
  if(!isset($filenames[$_GET['serve']])) { 
   if($logging  0){
$status = ReqNF;
include('logit.php');
   }
   echo('That number wasnt found!');
   exit;
  }
  
  $wantedfilename = $filenames[$_GET['serve']];
  
  
  $extension = explode(., $wantedfilename);
  $numberinarray = count($extension);
  
  $lcext = strtolower($extension[$numberinarray-1]);
  
  //BEGIN CONTENT TYPES BLOCK. ADD OR REMOVE FILE TYPES HERE, AS SHOWN //
  //DON'T EDIT THIS UNLESS YOU KNOW WHAT YOU ARE DOING!//
  //MOST COMMON FILE TYPES ARE ALREADY INCLUDED//
  
  switch($lcext) {
   case ($lcext == swf): 
$commonname=flash; 
$ct = Content-type: application/x-shockwave-flash;
   break;
   case ($lcext == wmv): 
$commonname=wmv; 
$ct = Content-type: video/x-ms-wmv;
   break;
   case ($lcext == mov): 
$commonname=quicktime movie; 
$ct = Content-type: video/quicktime;
   break;
   case ($lcext == avi): 
$commonname=avi video; 
$ct = Content-type: video/avi;
   break;
   case ($lcext == rar): 
$commonname=winrar; 
$ct = Content-type: application/octet-stream;
   break;
   case ($lcext == zip): 
$commonname=zip; 
$ct = Content-type: application/octet-stream;
   break;
   case ($lcext == bmp): 
$commonname=bitmap; 
$ct = Content-type: image/bmp;
   break;
   case ($lcext == gif): 
$commonname=gif; 
$ct = Content-type: image/gif;
   break;
   case ($lcext == jpeg || $lcext == jpg || $lcext == jpe): 
$commonname=jpeg; 
$ct = Content-type: image/jpeg;
   break;
   case ($lcext == mpeg || $lcext == mpg || $lcext == mpe): 
$commonname=mpeg; 
$ct = Content-type: video/mpeg;
   break;
   case ($lcext == png): 
$commonname=png; 
$ct = Content-type: image/png;
   break;
   
   //END//
   
   default: 
$commonname=Generic Filetype; 
$ct = Content-type: application/octet-stream;

if($logging  0){
 $status = Generic_Filetype;
 include('logit.php');
}
   
  }
  
  $handle = fopen($webaddress.$wantedfilename, rb);
  header(Cache-Control: ); //keeps ie happy
  header(Pragma: ); //keeps ie happy
  header($ct); //content type as set above from explode();
  
  if(!stristr($lcext, swf)){//flash plays, it isnt downloaded as an 
actual file.
   header(Content-Disposition: attachment; 
filename=\.$wantedfilename.\);
  }
  
  header(Content-Length: .filesize($path.$wantedfilename));
  
  fpassthru($handle);
  if($logging  0){
   $status = Granted;
   include('logit.php');
  }
  exit;
}
  else {
 if($logging  

Re: [PHP] OR Problems

2001-07-26 Thread J S R

Thank you s much david.
David Robley [EMAIL PROTECTED] wrote in message
01072515394001.32266@www">news:01072515394001.32266@www...
 On Wed, 25 Jul 2001 13:36, J S R wrote:
  Shouldn't this work?  I did it because I want the link to change to the
  top-alt class when the certain link is selected.
 
  but when i do this... they if statement is always active even if its
  not on the page.
 
  what am i doing wrong.

 Several things, by the looks of it :-:

 
  ?php
$name = getenv (SCRIPT_NAME);
  ?
 
  ?php
  if($name == /site/portfolio.php or /site/portfolio-ps.php)

 if($name == /site/portfolio.php or $name == /site/portfolio-ps.php)
 {

   echo td nowrapimg src=\images/spacer.gif\ width=\110\
  height=\1\a class=\top-alt\
  href=\portfolio.php\portfolio/a/td;
  else

 } else {

   echo td nowrapimg src=\images/spacer.gif\ width=\110\
  height=\1\a class=\top\
  href=\portfolio.php\portfolio/a/td ?
?php
  if($name == /site/services.php or /site/services-ws.php)
   echo td nowrapimg src=\images/spacer.gif\ width=\20\
  height=\1\a class=\top-alt\
  href=\services.php\services/a/td; else
   echo td nowrapimg src=\images/spacer.gif\ width=\20\
  height=\1\a class=\top\ href=\services.php\services/a/td
?
?php
  if($name == /site/casestudies.php or /site/casestudies-ap.php)
   echo td nowrapimg src=\images/spacer.gif\ width=\20\
  height=\1\a class=\top-alt\ href=\casestudies.php\case
  studies/a/td;
  else
   echo td nowrapimg src=\images/spacer.gif\ width=\20\
  height=\1\a class=\top\ href=\casestudies.php\case
  studies/a/td
?

 and there are a few more of thtose down the page. I'll leave you to sort
 them out :-)

 --
 David Robley  Techno-JoaT, Web Maintainer, Mail List Admin, etc
 CENTRE FOR INJURY STUDIES  Flinders University, SOUTH AUSTRALIA

I'm embarrassed, Tom admitted readily.



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] OR Problems

2001-07-24 Thread J S R

Shouldn't this work?  I did it because I want the link to change to the
top-alt class when the certain link is selected.

but when i do this... they if statement is always active even if its not
on the page.

what am i doing wrong.

?php
  $name = getenv (SCRIPT_NAME);
?

?php
if($name == /site/portfolio.php or /site/portfolio-ps.php)
 echo td nowrapimg src=\images/spacer.gif\ width=\110\
height=\1\a class=\top-alt\
href=\portfolio.php\portfolio/a/td;
else
 echo td nowrapimg src=\images/spacer.gif\ width=\110\
height=\1\a class=\top\ href=\portfolio.php\portfolio/a/td
  ?
  ?php
if($name == /site/services.php or /site/services-ws.php)
 echo td nowrapimg src=\images/spacer.gif\ width=\20\
height=\1\a class=\top-alt\ href=\services.php\services/a/td;
else
 echo td nowrapimg src=\images/spacer.gif\ width=\20\
height=\1\a class=\top\ href=\services.php\services/a/td
  ?
  ?php
if($name == /site/casestudies.php or /site/casestudies-ap.php)
 echo td nowrapimg src=\images/spacer.gif\ width=\20\
height=\1\a class=\top-alt\ href=\casestudies.php\case
studies/a/td;
else
 echo td nowrapimg src=\images/spacer.gif\ width=\20\
height=\1\a class=\top\ href=\casestudies.php\case
studies/a/td
  ?



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]