Current location: Hot Scripts Forums » Programming Languages » PHP » Echo Inside If Statement


Echo Inside If Statement

Reply
  #1 (permalink)  
Old 07-19-06, 04:25 PM
sixflagsga sixflagsga is offline
Newbie Coder
 
Join Date: Sep 2004
Location: Atlanta, Georgia
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts
Echo Inside If Statement

I am trying to preserve my image URL (because it has other sensative information in it) so I am using an if statement so that if somebody goes to the URL img.php?img=_________ it pulls the image and masks its location. The issue is that I am automating the service for the owner of the website using echo = "$address". The issue is that I receive errors when trying to use the $address statement.

For example, on my site when you go to saidurl.php?address=IMAGE.JPG it should pull up the image (but if you try to view the source it shows the private directory). Thus, I am trying to mask it with said php code. Below is the error I receive and the original code and the code after I inputed the echo code:

ERROR:
Parse error: parse error, unexpected T_ECHO in /homepages/2/d161256532/htdocs/coasterworldnews/v2/media/bge07/images/image.php on line 13

CODE (FUNCTIONAL WITHOUT ERRORS)
PHP Code:

    if ($_GET["img"] == 1)

        
$filename "header.jpg"

CODE (WITH ERRORS AND ECHO COMMAND)
PHP Code:

if ($_GET["img"] == echo "$address")

        
$filename "http://www.coasterworldnews.com/v2/scripting/php/player/shows/mediacoverage/bge07/photos/echo "$address""
Reply With Quote
  #2 (permalink)  
Old 07-19-06, 04:43 PM
landing's Avatar
landing landing is offline
Coding Addict
 
Join Date: Jul 2006
Location: Scotland
Posts: 302
Thanks: 0
Thanked 0 Times in 0 Posts
Drop the echo.

PHP Code:

if ($_GET["img"] == $address


all echo does is just that - output's the variable content. It's not needed within an IF, and would make no difference if it was legal anyway.
__________________
Always sanitise your data


Best regards

Last edited by landing; 07-19-06 at 04:45 PM.
Reply With Quote
Reply

Bookmarks


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

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP Form to update a MySQL database? Scoobler PHP 9 09-04-08 01:41 AM
PHP Error Fairnie PHP 8 06-26-04 07:15 AM
need some help with this code buzzby PHP 0 06-20-04 03:07 AM
mysql query loading problem scorpioy PHP 0 05-23-04 03:16 PM
New Web Host, New Problem! justchat PHP 2 09-29-03 02:39 PM


All times are GMT -5. The time now is 07:21 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.