can anyone help me, just registered with 1and1 for the webspace and mysql database and am having some problems, i uploaded phpmyadmin, and got a table on the database but when i try to interact with it for example, add a user, i keep getting this error:
Parse error: parse error, unexpected '{' in /homepages/24/d136628883/htdocs/register.php on line 98
heres the code for the page...
<?php
include 'db.inc';
// Define post fields into simple variables
$email = $_POST['email'];
$fname = $_POST['f_name'];
$sname = $_POST['s_name'];
$street = $_POST['street'];
$city = $_POST['city'];
$county = $_POST['county'];
$pcode = $_POST['p_code'];
$ref_email = $_POST['referral'];
$ipod_code = $_POST['ipod_code'];
$email = stripslashes($email);
$f_name = stripslashes($f_name);
$s_name = stripslashes($s_name);
$street = stripslashes($street);
$city = stripslashes($city);
$county = stripslashes($county);
$p_code = stripslashes($p_code);
$ref_email = stripslashes($ref_email);
$ipod_code = stripslashes($ipod_code);
if((!email) || (!$f_name) || (!$s_name) || (!$street) || (!$city) || (!$county) || (!p_code)){
echo 'You did not submit the following required information: <br />';
if(!$email){
echo "Email is a required field. Please enter it below.<br />";
}
if(!$f_name){
echo "First Name is a required field. Please enter it below.<br />";
}
if(!$s_name){
echo "Surname is a required field. Please enter it below.<br />";
}
if(!$street){
echo "Street is a required field. Please enter it below.<br />";
}
if(!$city){
echo "City is a required field. Please enter it below.<br />";
}
if(!$county){
echo "County is a required field. Please enter it below.<br />";
}
if(!$p_code){
echo "Post Code is a required field. Please enter it below.<br />";
}
echo "Please <a href=javascript:history.back()>Click Here</a> to return to the form";
exit();
}
$sql_email_check = mysql_query("SELECT email FROM members
WHERE email = '$email'");
$email_check = mysql_num_rows($sql_email_check);
if(($email_check > 0){
echo "Please fix the following errors: <br />";
if($email_check > 0){
echo "<strong>Your email address has already been used by another member
in our database. Please submit a different Email address!<br />";
unset($email);
}
echo "Please <a href=javascript:history.back()>Click Here</a> to return to the form";
exit();
}
function makeRandomPassword() {
$salt = "abchefghjkmnpqrstuvwxyz0123456789";
srand((double)microtime()*1000000);
$i = 0;
while ($i <= 7) {
$num = rand() % 33;
$tmp = substr($salt, $num, 1);
$pass = $pass . $tmp;
$i++;
}
return $pass;
}
$random_password = makeRandomPassword();
$db_password = md5($random_password);
// Enter info into the Database.
$sql = mysql_query("INSERT INTO members (email, password, f_name, s_name, street, city, county, p_code, referral, ipod_code, signup_date)
VALUES('$email', '$db_password', '$f_name', '$s_name', '$street', '$city', $county, $p_code, $referral, $ipod_code, now())")
or die (mysql_error());
if(!$sql){
echo 'There has been an error creating your account. Please contact the webmaster.';
}
}
?>
<br /><br />
</center>
</td >
<tr>
<td colspan="3"><br /></td>
</tr>
</div>
..also can anyone help me with the exact script i should have in my db.inc file, thanks
stu