Hi, I'm looking for some help as the Fasthosts support centre is not proving too supportive!
I've uploaded a single page, php website to www.hortonknightsmortgages.co.uk but whenever you try to visit it, your met with a 500 error. It seems to be a PHP issue, as the image files are available if you type in the direct URL, and when tested with a HTML doc, it loaded fine.
I've checked with Fasthosts and they first told me there was no problem, and that they could view the site. Turns out they couldn't. They're now saying it's a problem with the PHP script.
The website works perfectly when hosted on my domain, so I don't get it. I'm under the impression PHP script either works and loads, or it doesn't and that there is no in between.
Here's the script:
Can someone, somewhere help?!
Thanks in advance!
I've uploaded a single page, php website to www.hortonknightsmortgages.co.uk but whenever you try to visit it, your met with a 500 error. It seems to be a PHP issue, as the image files are available if you type in the direct URL, and when tested with a HTML doc, it loaded fine.
I've checked with Fasthosts and they first told me there was no problem, and that they could view the site. Turns out they couldn't. They're now saying it's a problem with the PHP script.
The website works perfectly when hosted on my domain, so I don't get it. I'm under the impression PHP script either works and loads, or it doesn't and that there is no in between.
Here's the script:
PHP:
<?php
function is_valid_email($email) {
return preg_match("/^[0-9a-z!#$%&'*+-\/\?^_`{|}~=\"]+(\.[0-9a-z!#$%&'*+-\/\?^_`{|}~=\"]+)*@([0-9a-z-]+(\.[0-9a-z-]+)*\.[a-z]{2,6}|(([0-9]|0[0-9][0-9]|[0-9][0-9]|1[0-9][0-9]|2([0-4][0-9]|5[0-5]))\.([0-9]|0[0-9][0-9]|[0-9][0-9]|1[0-9][0-9]|2([0-4][0-9]|5[0-5]))\.([0-9]|0[0-9][0-9]|[0-9][0-9]|1[0-9][0-9]|2([0-4][0-9]|5[0-5]))\.([0-9]|0[0-9][0-9]|[0-9][0-9]|1[0-9][0-9]|2([0-4][0-9]|5[0-5]))))$/i",$email);
}
function is_tel($telephone) {
// Valids all uk numbers including +44's or anything like that
$telephone = str_replace(" ","",$telephone);
$telephone = str_replace("+","",$telephone);
$pattern = '/^01[1-9]{1}|02[03489]{1}|05[0-9]|07[056789]{1}|08[047]{1}|441[1-9]{1}|442[03489]{1}|445[0-9]|447[056789]{1}|448[047]{1}$/Ui';
if (!preg_match($pattern, $telephone)) {
return false;
} else {
if(substr($telephone, 0, 2) == "44") {
$telephone = "0" . substr($telephone, 3, strlen($telephone));
}
if(strlen($telephone < 10)) {
return false;
}
return true;
}
}
if($_GET['action'] == "send") {
if(strlen($_POST['name']) > 2) {
if(is_tel($_POST['phone'])) {
if(is_valid_email($_POST['email'])) {
// Send message
$send_email = mail("hello@****************","Email From HKMS Website","Name: " . stripslashes($_POST['name']) . "\n\nPhone Number: " . $_POST['phone'] . "\n\nEmail: " . $_POST['email'],"FROM: " . $_POST['name'] . " <" . $_POST['email'] . ">");
?>
<div class="formerrormessage"><h3 style="color: #FFFFFF;">Thank You!</h3>
<strong>You're message has been sent. We'll call you as soon as possible.</strong></div>
<?php
if(!$send_email) {
?>
<div class="formerrormessage"><h3 style="color: #FFFFFF;">We're sorry, your message could not be sent.</h3>
<strong>An error has occurred and your message could not be sent. Please try again later. Sorry for any inconvenience caused.</strong></div>
<?php
}
} else {
// Invalid email.
$email_error = true;
$any_error = true;
}
} else {
// Phone number not valid.
$phone_error = true;
$any_error = true;
}
} else {
// Name too short.
$name_error = true;
$any_error = true;
}
}
?>
<form method="post" action="<?php echo(basename(__FILE__) . "?action=send"); ?>">
<?php
if($name_error) {
?>
<div class="formerrormessage"><strong>The name you've entered is not valid.</strong> Please use only letters.</div>
<?php
}
?>
<div class="formrow">
<div class="formlable">Your name</div>
<div class="formright"><input class="field" type="text" name="name" <?php if($any_error) { ?>value="<?=$_POST['name']?>"<?php } ?> /></div>
</div>
<?php
if($phone_error) {
?>
<div class="formerrormessage"><strong> The phone number you've entered is invalid.</strong> Your phone number must be UK based and not contain any letters.</div>
<?php
}
?>
<div class="formrow">
<div class="formlable">Phone number</div>
<div class="formright"><input class="field" type="text" name="phone" <?php if($any_error) { ?>value="<?=$_POST['phone']?>"<?php } ?> /></div>
</div>
<?php
if($email_error) {
?>
<div class="formerrormessage"><strong>The email address you've entered is invalid.</strong> Please check you have entered it correctly.</div>
<?php
}
?>
<div class="formrow">
<div class="formlable">Your email</div>
<div class="formright"><input class="field" type="text" name="email" <?php if($any_error) { ?>value="<?=$_POST['email']?>"<?php } ?> /></div>
</div>
<input class="button" type="image" src="images/structure/button01.png" value="Submit">
</form>
Can someone, somewhere help?!
Thanks in advance!