Page 1 of 1

newbie question

Posted: Mon Jun 06, 2005 10:32 pm
by chiltonpr
Can Someone help me with this error
I have the following error:
[06-Jun-2005 22:14:01] PHP Parse error: parse error, unexpected $ in /home/chilton/public_html/simg/simg.php on line 63

Code: Select all

<?php 

require_once( &quote;../inc/header.inc.php&quote; );

ob_start();
session_start();

$bgurl = rand(1, 3);
$cmd  = $CONVERT;
$cmd .= 'images/bg'.$bgurl.'.jpg';
$cmd .= '-crop 200x35+'. rand(0,180) . '+' . rand(0,315);
$cmd .= '/images/tmp/bg'.$bgurl.'.jpg';

exec($cmd);


$im = &quote;images/tmp/bg&quote;.$bgurl.&quote;.jpg&quote;;

$chars = array(&quote;a&quote;,&quote;A&quote;,&quote;b&quote;,&quote;B&quote;,&quote;c&quote;,&quote;C&quote;,&quote;d&quote;,&quote;D&quote;,&quote;e&quote;,&quote;E&quote;,&quote;f&quote;,&quote;F&quote;,&quote;g&quote;,&quote;G&quote;,&quote;h&quote;,&quote;H&quote;,&quote;i&quote;,&quote;I&quote;,&quote;j&quote;,&quote;J&quote;,
			   &quote;k&quote;,&quote;K&quote;,&quote;l&quote;,&quote;L&quote;,&quote;m&quote;,&quote;M&quote;,&quote;n&quote;,&quote;N&quote;,&quote;o&quote;,&quote;O&quote;,&quote;p&quote;,&quote;P&quote;,&quote;q&quote;,&quote;Q&quote;,&quote;r&quote;,&quote;R&quote;,&quote;s&quote;,&quote;S&quote;,&quote;t&quote;,&quote;T&quote;,
			   &quote;u&quote;,&quote;U&quote;,&quote;v&quote;,&quote;V&quote;,&quote;w&quote;,&quote;W&quote;,&quote;x&quote;,&quote;X&quote;,&quote;y&quote;,&quote;Y&quote;,&quote;z&quote;,&quote;Z&quote;,&quote;1&quote;,&quote;2&quote;,&quote;3&quote;,&quote;4&quote;,&quote;5&quote;,&quote;6&quote;,&quote;7&quote;,&quote;8&quote;,&quote;9&quote;);
$textstr = '';
for ($i = 0, $length = 8; $i < $length; $i++) {
   $textstr .= $charsїrand(0, count($chars) - 1)];
}

$hashtext = md5($textstr);
$tmpname = $hashtext.'.jpg';
$_SESSIONї'strSec'] = $hashtext;


$font = &quote;arial.ttf&quote;;
$size = rand(24, 36);
$hexValues = array('0','1','2','3','4');
$numHex = count($hexValues);
$color = '';
for ($i = 0; $i < 6; $i++) {
	$color .= $hexValuesїrand(0, $numHex-1)];
}

$gravities = array('West', 'Center', 'East');
$gravity = $gravitiesїrand(0, count($gravities)-1)];

$angle = rand(-10, 10);

$cmd  = $CONVERT;
$cmd .= ' -font &quote;'.$font.'&quote;';
$cmd .= ' -fill &quote;#'.$color.'&quote;';
$cmd .= ' -pointsize '.$size;
$cmd .= ' -gravity &quote;'.$gravity.'&quote;';
$cmd .= ' -draw \'text 1,0 &quote;'.$textstr.'&quote;\'';
$cmd .= ' -rotate '.$angle;
$cmd .= ' /&quote;.$im&quote;&quote;/home/chilton/public_html/simg/images/tmp/&quote;.$tmpname;

exec($cmd);
exec(&quote;rm -f&quote;&quote;.$im.&quote;);

header(&quote;Content-Type: image/jpg&quote;);
print fread(fopen(&quote;/images/tmp/&quote;.$tmpname,&quote;r&quote;&quote;), filesize(&quote;/images/tmp/&quote;.$tmpname));
exec(rm -f &quote;/home/chilton/public_html/simg/images/tmp/&quote;.$tmpname.);
  
ob_end_flush(); 
?>
JCART | Please use

Code: Select all

tags when posting php code. Review [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color][/size]

Posted: Mon Jun 06, 2005 10:34 pm
by Burrito
put your code in

Code: Select all

tags...it will make it much easier to read and we can better help you.

Posted: Tue Jun 07, 2005 2:42 pm
by Skara
here's how you read errors: go to the line in question. Look around that line for an error. Easy, huh?

Code: Select all

exec("rm -f"".$im.");
You have Two extra quotes and a missing space.

Code: Select all

exec("rm -f ".$im);