Example
$query = mysql_query("UPDATE users SET auth_ticket = '$ticket' WHERE username = '$username'");
$query = mysql_query("UPDATE users SET ip_last = '".$_SERVER['REMOTE_ADDR']."' WHERE username = '$username'");
to
mysql_query("UPDATE users SET auth_ticket = '$ticket' WHERE username =...
EDIT:
Make sure your variables, in there, your c_images, are linked correctly and figuredata.txt and productdata
also figuredata.txt and productdata in your client.