Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I get a line in my error_log PHP Parse error: syntax error, unexpected end of file in /home/short/public_html/index.php on line 468 but I don't understand where I went wrong?

if(isset($_POST['Submit'])){

$str = ereg_replace("[^A-Za-z0-9]", "", $_POST['url_code'] );

if (strlen($str) < 4)
{
echo '<b>ERROR: A short link can only contain 4 to 10 alphanumerical characters.</b><br>';
}
else {
$url_code = $str;
$id = $_POST['id'];
$u = $_POST['shrt'].$url_code;
$private = $_POST['private'];

$update = "UPDATE url_urls SET url_code='$url_code', u='$u', private='$private' WHERE id = '$id'";

Line 468 is between the above and below code

$conn->query($update) or die('<b>ERROR</b><br>This short link already exists<br><br><a href="'.$url_base.'?page=custom&id='.$id.'">Back</a>');//update or error

    }

    }
share|improve this question
5  
Whoo boy. You couldn't write worse code if you even tried. ereg has been deprecated/obsolete for a LONG time. YOu should NEVER be using it in code anymore. And your SQL is vulnerable to SQL injection attacks. Be more worried about these problems than your trivial syntax error. –  Marc B Mar 12 '14 at 20:57
    
Somewhere, likely in the code you've trimmed out, you've got an unmatched bracket or quotation mark. –  Sammitch Mar 12 '14 at 21:03

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.