Mouhssin Daraoui Mouhssin Daraoui - 5 years ago 122
HTML Question

Server Error 500 in php page

I have a problem with a PHP page returning a server error 500. This only happens in a single page. I spoke to the host and they told me that I have an issue in my code.

This is the content of the file exhibiting the error

define('APP_URL', '');
define('APP_ID', 'xxxxx');
define('APP_SECRET', 'xxxxx');
?><!DOCTYPE html>
<html lang="en">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<meta property="og:title" content="Which of your friends are secretly smoking?" />
<meta property="og:url" content="<?php echo APP_URL . 'result.php?id=<?php echo trim(htmlentities($_GET['id']))'; ?>"/>
<meta property="og:description" content="test" />
<meta property="og:image" content="<?php echo APP_URL . 'converted/<?php echo $_GET['id']'; ?>.jpg" />
<meta property="fb:app_id" content="<?php echo APP_ID; ?>" />
<meta name="medium" content="image" />

<a href="./">test</a>


Answer Source


<?php echo APP_URL . 'result.php?id=<?php echo trim(htmlentities($_GET['id']))'; ?>"/>

should be:

<?= APP_URL.'result.php?id='.htmlentities(trim($_GET['id'])) ?>

The same type of update also needs to be made to the other line that contains embedded <?php tags.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download