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
}
}
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