I have a simple modal dialog that I developed on my own linux server, running php 5.3. The script (shown below) runs fine on my server. However, I moved it to my client's linux server and instead of echoing the text/html that it apparently is supposed to do, it echos ALL the actual php code from the > (greater than) character on. Does anyone know why it would echo the actual code? Is there a php.ini setting that causes this? or file encoding difference in the two setups?
<?php
$to_email = '[email protected]';
$link = $_GET['link'];
if(!$link){
echo '<p>Have a suggestion?<br />Enter the URL below!</p>';
}else if(strlen($link) > 256 || !preg_match('/^(http:\/\/)?subdomain\.somesite\.com\/(somedir\/)?anotherdir\/(.+)/',$link) && !preg_match('/^(http:\/\/)?somedomain2\.com\/somedir2\/(.+)/',$link)){
echo '<p class="error">Whoops, the URL entered doesn\'t <br />match the criteria.</p>';
}else{
$link = str_replace("\n.", "\n..", $link);
if(!preg_match('/^http:\/\//',$link)){
$link = 'http://'.$link;
}
mail($to_email, 'New URL Suggestion', "A new URL has been suggested from your site:\n\n".$link,"From: ".$to_email."\r\n");
echo '<p>Thank you for submitting this URL! <br />It should be live within 24 hours.</p>';
}
?>
The result on my client's server is:
256 || !preg_match('/^(http:\/\/)?subdomain\.somesite\.com\/(somedir\/)?anotherdir\/(.+)/',$link) &&
!preg_match('/^(http:\/\/)?somedomain2\.com\/somedir2\/(.+)/',$link)){ echo '
Whoops, the URL entered doesn\'t
match the criteria.
'; }else{ $link = str_replace("\n.", "\n..", $link);
if(!preg_match('/^http:\/\//',$link)){ $link = 'http://'.$link; } mail($to_email,
'New URL Suggestion', "A new URL has been suggested from your site:\n\n".$link,"From:
".$to_email."\r\n"); echo '
Thank you for submitting this URL!
It should be live within 24 hours.
'; } ?>