Hi All
I apologise if I come across slow at times - im fairly new to Actinic - especially Developement so your patients would be appreciated
.
I have found that the functionality of PHP is restricted but was trying to work out the best way of incorporating a Object Script.
I have searched but i get an error on one of the lines when I have passed through in the way that I would have expected.
But i keep getting...
Parse error: syntax error, unexpected ':' in main on line 50
The script is below
And for the config.php file - content...
Any help muchly appreciated as i have obviously missed w=something or it is possible that this just won't work
I apologise if I come across slow at times - im fairly new to Actinic - especially Developement so your patients would be appreciated
.I have found that the functionality of PHP is restricted but was trying to work out the best way of incorporating a Object Script.
I have searched but i get an error on one of the lines when I have passed through in the way that I would have expected.
But i keep getting...
Parse error: syntax error, unexpected ':' in main on line 50
The script is below
Code:
<?php
//
// Config
//
require('config.php');
$sucsess = false;
//
// Has the Submit button been pressed?
//
if( isset($_POST['Submit']))
{
$error = false;
//
// Get data
//
$name = trim(htmlspecialchars($_POST['name']));
$email = trim(htmlspecialchars($_POST['email']));
$address = trim(htmlspecialchars($_POST['address']));
$domain = trim(substr(stristr($email, "@"), 1));
//
// 1st Parse (easy)
//
if(strlen($name) < 5)
{
echo('<span class="style11">You MUST enter your NAME...<br /></span>');
$error = true;
}
if(strlen($email) < 9)
{
echo('<span class="style11">You MUST enter your EMAIL...<br /></span>');
$error = true;
}
if(strlen($address) < 15)
{
echo('<span class="style11">You MUST enter your ADDRESS...<br /></span>');
$error = true;
}
//
// Everything is OK..! 2nd Parse...!
//
if($error == false)
{
$hosts = gethostbynamel($domain);
$mx = array ();
if (!getmxrr($domain, $mx))
{
$error = true;
echo('<span class="style11">ERROR Checking DOMAIN '.$domain.'...'.$hosts[0].'<br /></span>');
}
//
// Finally
//
if($error == false)
{
$sucsess = true;
}
}
}
else
{
$name = '';
$email = '';
$address = '';
}
//
// Put the Form on the Page and fill in...
//
if($sucsess == false)
{
echo('
<table width="100%" border="0">
<tr>
<td width="26%" align="right" valign="middle">Name:</td>
<td width="38%" align="left" valign="bottom">
<input name="name" type="text" value="'.$name.'" size="45" /></td>
<td width="36%" rowspan="5" align="center"><img src="../images/ramb.jpg" alt="Ramblers" width="342" height="235" /></td>
</tr>
<tr>
<td align="right" valign="middle">E-Mail: </td>
<td align="left">
<input name="email" type="text" value="'.$email.'" size="45" /></td>
</tr>
<tr>
<td align="right" valign="middle">Address:</td>
<td align="left"> <textarea name="address" cols="40" rows="5" />'.$address.'</textarea></td>
</tr>
<tr>
<td rowspan="2" align="left" valign="bottom"> </td>
<td align="left" valign="bottom">
<input type="submit" name="Submit" value="Submit"></td>
</tr>
<tr>
<td align="left" valign="bottom"> </td>
</tr>
<tr>
<td colspan="3" align="left" valign="bottom"> </td>
</tr>
<tr>
<td colspan="3" align="left" valign="bottom">Entry to this competition is FREE. <br />
The closing date for the competition is 30th June 2008 and the winner who will be drawn at random will be notified within 28 days of this date.
<br/>
By providing your name, postal address and email address you are agreeing to subscribe to the Outdoors.co.uk newsletters and receive communications. <br />Your details will be held by Outdoors and passed to Ramblers Worldwide Holidays only.
<br />
Entrants must be over 18 years of age.</td>
</tr>
</table>
');
}
else
{
$message = $email . " thank you for your entry to the 'Outdoors/Ramblers Holiday' Competition, your details have been recorded\n\n" . $name . "\n". $address . "\n\n";
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers = "From: ".$email."\r\nCc:".$email."\r\nReturn-Path: enquiries@outdoors.co.uk";
mail("enquiries@outdoors.co.uk", "Outdoors Competition", $message, $headers);
mail("outdoors-join@outdoors.co.uk", "Outdoors Mailing List", $message);
$link = @mysql_connect('localhost', $dbuser, $dbpass);
if ($link)
{
$sql = "INSERT INTO competition (name, email, address) VALUES ('".$name."', '".$email."', '".$address."')";
@mysql_select_db($db_name, $link);
mysql_query($sql);
mysql_close($link);
}
echo("<br><br><center><h2>Thank you for your entry " . $name . "</h></center>");
}
//
// End php
//
?>
And for the config.php file - content...
Code:
<?php $db_name = 'user'; $dbpass = 'relevant password'; $dbuser = 'user'; ?>
Any help muchly appreciated as i have obviously missed w=something or it is possible that this just won't work
Comment