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

PHP Cannot redeclare class
I have 6 files, and two of them do not seem to want to play well. I keep getting a "Cannot rede

Call to undefined function mysql_fetch_accoc()
New to php/mysql coding. What's wrong with this sequence, or am I
just not seeing to obvious?

Image loading
Hi Developers,

I'm trying to display an image from images/image.gif getting the url from mysq

Setting a default timezone?
I have read about how to change the timezone in PHPMYADMIN, but it changes back, it doesn't STAY the

Need help with an email blocker for a guessbook
I am new with php and here is a simple guessbook page but I am being hit with spam from a group of t

Help Optimizing code
Good Morning,

I wrote a small import function for a website of mine and I know there has to b

Using Microsoft Exchange Server with PHP
Hi,

I wanted to know if its possible to fetch email attachments from the exchange server usin

Need help with a mail notify function
I was tasked with setting up a site that's been prewritten. The site is basically a form that captur

A little help needed passing hidden values to next page
I have a page that has hidden values in a form.

example
Code: <input name='signupID

Need help adding a timestamp to my filename/variable
Hello,

I'm kind of stupid when it comes to php and I need a tiny bit of help. I've got a f

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