As LC says, you need to put the code inside the { and } braces. This is your code:
Code:
if ((curPageName() == $url) && (curPageName() !== $index)) {
$class='current';
}
echo "<li><a href='$url' class='$class'>$name</a></li>";
elseif (curPageName() == $index) {
$class='current home';
}
That bold red line cannot be there. It must be either completely outside the if/elseif or inside one of the brace sets.