Jump to content

T_ELSE error


khile

Recommended Posts

im having a bit of problem with a section of code im tryingto help a friend code a app but its not working keep getting t_else error

 

<?php
        require FORUM_ROOT.'footer.php';
}
else if ($action == 'delete_avatar') // Shows this line has error
{
    if ($forum_user['id'] != $id && $forum_user['g_id'] > USER_MOD) xBB_Message($lang_common['No permission']);
    xBB_Confirm_Referrer('profile.php');
    @unlink($configuration['o_avatars_dir'].'/'.$id.'.jpg');
    @unlink($configuration['o_avatars_dir'].'/'.$id.'.png');
    @unlink($configuration['o_avatars_dir'].'/'.$id.'.gif');
    $db->query('UPDATE '.$db->prefix.'users SET use_avatar=0 WHERE id='.$id) or xBB_Error('Unable to update avatar state', __FILE__, __LINE__, $db->error());
    xBB_Redirect('profile.php?section=personality&id='.$id, $lang_profile['Avatar deleted redirect']);
}

Link to comment
Share on other sites

Try this:

 

require FORUM_ROOT.'footer.php';

if($action == 'delete_avatar'){
    if($forum_user['id'] != $id && $forum_user['g_id'] > USER_MOD){
	xBB_Message($lang_common['No permission']);
	xBB_Confirm_Referrer('profile.php');
	@unlink($configuration['o_avatars_dir'].'/'.$id.'.jpg');
	@unlink($configuration['o_avatars_dir'].'/'.$id.'.png');
	@unlink($configuration['o_avatars_dir'].'/'.$id.'.gif');
	$db->query('UPDATE '.$db->prefix.'users SET use_avatar=0 WHERE id='.$id) or xBB_Error('Unable to update avatar state', __FILE__, __LINE__, $db->error());
	xBB_Redirect('profile.php?section=personality&id='.$id, $lang_profile['Avatar deleted redirect']);
}
}

Link to comment
Share on other sites

im not saying i know alot just trying to help a friend i have changed code and get:

 

Parse error: syntax error, unexpected $end in C:\xampp\htdocs\2\profile.php on line 1649

and that line equals

 

<?php
    require FORUM_ROOT.'footer.php';
}
?>

 

Link to comment
Share on other sites

<?php
            }
        }
?>
            </form>
    </div>
<?php
    }
?>
    <div class="clearer"></div>
</div>
<?php
    require FORUM_ROOT.'footer.php';
            }
        }
?>

 

thats the code and says errors on line 1651, the very last line

 

i found and closed the open bracket

 

ps: sorry to be a pain

Link to comment
Share on other sites

i got profile php working but im trying to make my code php5 compliant

 

  $group_opt = ereg_replace($group.'"', $group.'" selected',$group_opt);

 

but get error Deprecated: Function ereg_replace() is deprecated

 

i found it need to be replaced with preg_replace but that gives a delimiter error

 

thanks

Link to comment
Share on other sites

http://www.php.net/manual/en/intro.pcre.php

The expression must be enclosed in the delimiters, a forward slash (/), for example. Delimiters can be any non-alphanumeric, non-whitespace ASCII character except the backslash (\) and the null byte. If the delimiter character has to be used in the expression itself, it needs to be escaped by backslash. Since PHP 4.0.4, you can also use Perl-style (), {}, [], and <>  matching delimiters.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.