Question

I am creating a contact form for a website but when I try a test message I am getting this error: 401 - Unauthorized: Access is denied due to invalid credentials

The website is: http://zimik-webdesign.com/contact_us.html

Here is the PHP:

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Submitting...</title>

</head>

<body>

<?php
$First_Name = $_POST ['first_name'];
$Last_Name = $_POST ['last_name'];
$Email = $_POST['email'];
$Number = $_POST['phone_number'];
$Company = $_POST['company'];
$Country = $_POST ['country'];
$Message = $_POST['message'];
$formcontent="First Name: $First_Name
\n Last Name: $Last_Name
\n Email: $Email 
\n Number: $Number
\n Company: $Company
\n Country: $Country
\n Message: $Message";
$recipient = "tristan@ukbigbuy.com";
$subject = "Contact";
$mailheader = "From: $Email \r\n";
ini_set("sendmail_from","tristan@ukbigbuy.com");
mail($recipient, $subject, $formcontent, $mailheader) or die("Please try again.");
echo "Form Submitted.";
header("Location: http://www.zimik-webdesign.com/contact_us.html");
?>

</body>
</html>

And here is the html for the form:

<form id="contact_form" action="mail.php" method="post" name="contact_form">
<table border="0" align="center">
<tr>
<td rowspan="10">&nbsp;</td>
<td align="left"><label for="first_name">
<span class="b1" style="text-align:left;">First Name</span></label></td>
<td rowspan="10">&nbsp;</td>
<td align="left"><label for="message"><span class="b1" style="text-align:center;">Message</span></label></td>
<td rowspan="10">&nbsp;</td>
<td align="left"><label for="phone_number"><b1><span class="b1" style="text-align:left;">Phone Number</span></b1></label></td>
<td rowspan="10">&nbsp;</td>
</tr>
<tr>
<td><input type="text" name="first_name" class="text" id="first_name">
</td>
<td rowspan="7">
<textarea name="message" id="message"></textarea>
</td>
<td>
<input type="text" name="phone_number" class="text" id="phone_number">
</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td align="left"><label for="last_name"><span class="b1">Last Name</span></label></td>
<td align="left"><label for="company"><span class="b1">Company</span></label></td>
</tr>
<tr>
<td><input type="text" class="text" name="last_name" id="last_name"></td>
<td><input type="text" class="text" name="company" id="company"></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td align="left"><label for="email"><span class="b1">Email</span></label></td>
<td align="left"><label for="country"><span class="b1">Country</span></label></td>
</tr>
<tr>
<td><input type="text" class="text" name="email" id="email"></td>
<td><input type="text" class="text" name="country" id="country"></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td align="center"><input name="Submit" type="submit" id="Submit" form="contact_form" formaction="mail.php" formenctype="multipart/form-data" formmethod="POST" formtarget="_self" title="Submit" value="Submit"/></td>
<td>&nbsp;</td>
</tr>
</table>
</form>

Any help on this would be greatly appreciated. Thanks.

I checked the permissions as suggested by Raj and changed the owner permissions from write to read/write and also set the group permissions to read too, this has solved the issue.

Thanks to Raj for your help.

Was it helpful?

Solution

This is answer is by Raj and all credit goes to him.

The problem was that the owner and group permissions where set to write only so I changed them both to read/write which solved the problem. Big thanks to Raj.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top