error help - Dynamic Image


Posted on 16th Feb 2014 07:03 pm by admin

I've been working on making my site less cluttered in the directories and more secure lately. In an attempt to prevent bandwidth theft from other people using images, I decided to switch all my site images to a dynamic image file. I've written a small test code to iron out as many bugs as I can BEFORE I impliment it fully.

Code:
Code: <?php
if ($_SESSION['i'] != "yes"}
{
$im = "theft";
}
else
{
$im = $_GET['i'];
}
switch($im)
{
case 'theft":
$image = imageCreateFromJPG('/theft.jpg');
break;
case 'logo':
$image = imageCreateFromJPG('/logo.jpg');
break;
}
imageJPG($image);
imageDestroy($image);
?>
When using it in the test copy of my site's index page (calling for the logo image) it works fine.

When I try opening the page (with the GET['i'] set to logo, theft, and not set at all), I get the following error:
QuoteParse error: syntax error, unexpected T_IF in /home/ck9/public_html/media/images/site.php on line 3

I tried setting the current If...else as a long comment and re-writting it another way, but that didn't fix the issue. I tried looking up the error in the PHP manual, but the information presented wasn't helpful to me.

Thanks in advance for any help you guys can provide (and the help here has always been great

No comments posted yet

Your Answer:

Login to answer
58 Like 42 Dislike
Previous forums Next forums
Other forums

Preventing SQL Injection
I have a question about SQL Injection, In some of our code we use this: view plaincopy to clipboa

Is this Safe or Unsafe?
Hi i made a few pages with lots of peoples help now i just want to know if they are safe or not can

Why does first ever HttpSendRequest take longer?
I promise this isn't as simple as it sounds. I'm wondering why the the first ever call to HttpSendRe

Something like an INI editor or a DelimitedText-Editor
Hi all,

Am very, very, very new to PHP and not sure if I should be posting this to a Javascri

To add a field on the screen XK02.
Hi All,

How to add an additional field in the vendor change control screen XK02.
The

Query output more than expected
$query=mysql_query("SELECT * FROM players, communities, divisions WHERE dob BETWEEN '{$start_da

login from external site
Hi my new experience begins, Now what i am trying to do is i make three pages, login.php logout.php

Getting the full city list from maxminds geoip database
I am suprised I can't find any references to this.

I have maxminds geoip lite installed and i

Content-Disposition: attachment; filename=... not working as i thought it should
taken the following code from the php.net site the script is not working.

what is not happeni

PHP Surveys
I really would like some advice.

If you have a client come to you asking for a survey to be d

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash