Jump to content

Need help with an basic code


--ss--

Recommended Posts

Well I recently started learning php so I haven't got much knowledge.

Anyway I wrote an simple script for my friend which uses GD libary to make an dynamic image sig, I tried expanding it so people can choose different designs for the sig and well i'm getting problems getting it to work.

Here's the script:

<?php
if $_GET['id'] == "1"
{
  header("Content-type: image/png");
  $habbo = $_GET['name'];
  $hotel = $_GET['hotel'];
  $im = imagecreatefromgif("back.gif");
  $in = imagecreatefromgif("http://www.habbo.$hotel/habbo-imaging/avatarimage?user=$habbo&action=&direction=3&head_direction=3&size=l&img_format=gif");
  $in_x = imagesx($in);
  $in_y = imagesy($in);
  imagecopymerge($im,$in,200,0,0,0,$in_x,$in_y,100);
  imagepng($im);
  imagedestroy($im);
}
elseif $_GET['id'] == "2"
{
  header("Content-type: image/png");
  $habbo = $_GET['name'];
  $hotel = $_GET['hotel'];
  $im = imagecreatefromgif("images/2.gif");
  $in = imagecreatefromgif("http://www.habbo.$hotel/habbo-imaging/avatarimage?user=$habbo&action=&direction=3&head_direction=3&size=l&img_format=gif");
  $in_x = imagesx($in);
  $in_y = imagesy($in);
  imagecopymerge($im,$in,165,0,0,0,$in_x,$in_y,100);
  imagepng($im);
  imagedestroy($im);
}
elseif $_GET['id'] == "3"
{
  header("Content-type: image/png");
  $habbo = $_GET['name'];
  $hotel = $_GET['hotel'];
  $im = imagecreatefromgif("images/3.gif");
  $in = imagecreatefromgif("http://www.habbo.$hotel/habbo-imaging/avatarimage?user=$habbo&action=wav&direction=3&head_direction=3&size=l&img_format=gif");
  $in_x = imagesx($in);
  $in_y = imagesy($in);
  imagecopymerge($im,$in,382,-17,0,0,$in_x,$in_y,100);
  imagepng($im);
  imagedestroy($im);
}
else $_GET['id'] == "4"
{
  header("Content-type: image/png");
  $habbo = $_GET['name'];
  $hotel = $_GET['hotel'];
  $im = imagecreatefromgif("images/4.gif");
  $in = imagecreatefromgif("http://www.habbo.$hotel/habbo-imaging/avatarimage?user=$habbo&action=&direction=2&head_direction=2&size=l&img_format=gif");
  $in_x = imagesx($in);
  $in_y = imagesy($in);
  imagepng($im);
  imagedestroy($im);
}
?>

I should be able to type http://www.shanes.sawhosting.com/hhgs/sig.php?name=--ss--&hotel=co.uk&id=1 in the url / get an form to do it for me but I keep getting errors such as

Parse error: syntax error, unexpected T_VARIABLE, expecting '(' in /home/shanessa/public_html/hhgs/sig.php on line 2

Can someone fix it up for me :(

Link to comment
https://forums.phpfreaks.com/topic/91391-need-help-with-an-basic-code/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.