This is the code for inserting and checking for empty fields:
$username = $_POST['username'];
$password = $_POST['password'];
$name = $_POST['name'];
$surname = $_POST['surname'];
$tel = $_POST['tel'];
$mob = $_POST['mob'];
$email = $_POST['email'];
$dobday = $_POST['dobday'];
$dobmonth = $_POST['dobmonth'];
$dobyear = $_POST['dobyear'];
$idcard = $_POST['idcard'];
$gender = $_POST['gender'];
$address = $_POST['address'];
$location = $_POST['location'];
$allergies = $_POST['allergies'];
$aboutus = $_POST['aboutus'];
$numcheck = $_POST['numcheck'];
$validationnumber = $_POST['validationnumber'];
//check verification doe
if($numcheck != $validationnumber)
{
header("location:register.php?ErrorRegister=<strong> Sorry but the verification number is not valid </strong><a href=JavaScript:history.back();> Click here to change the Details</a>");
mysql_close();
}
elseif ($numcheck == $validationnumber)
{
//connect to dayabase
//CHECK IF ID CARD USERNAME OR EMAIL ARE ALREADY IN DATABASE
$check = mysql_query("SELECT * FROM clientstable WHERE idcard = \"$idcard\" OR username = \"$username\" OR email =\"$email\" ");
$returned = mysql_fetch_array($check);
//if a user with the same idcard, username or e-mail is returned we redirect the register page
if(!empty($returned))
{
header("location:register.php?ErrorRegister=We are Sorry <strong>$bookingname,$bookingsurname</strong> but there is already a user with the same ID CARD No <strong> $idcard </strong>, with the same USERNAME <strong> $username </strong> or with the same E-MAIL <strong> $email - </strong><a href=JavaScript:history.back();> Click here to change the Details</a>");
mysql_close();
}
else
{
//connect to database
mysql_query("INSERT INTO clientstable (username, password, name, surname, tel, mob, email, dobday, dobmonth, dobyear, idcard, gender, address, location, allergies, aboutus) VALUES('".$_POST['username']."', '".$_POST['password']."', '".$_POST['name']."', '".$_POST['surname']."', '".$_POST['tel']."', '".$_POST['mob']."', '".$_POST['email']."', '".$_POST['dobday']."', '".$_POST['dobmonth']."', '".$_POST['dobyear']."', '".$_POST['idcard']."', '".$_POST['gender']."', '".$_POST['address']."', '".$_POST['location']."', '".$_POST['allergies']."', '".$_POST['aboutus']."')")
or die(mysql_error());
----------------------------------------------
Junk data:
Address filed:
<a href="
">samsung u740 alias</a> <a href="
">verizon no contract samsung alias phones</a> <a href="
">verizon samsung alias cell phone reviews</a> <a href="
">verizon wireless samsung alias</a> <a href="
">video format samsung u-740 alias</a> <a href="
">samsung i900</a> <a href="
">samsung i900 omnia</a> <a href="
">samsung omnia i900 sim free</a> <a href="
Name: molotov
Surname: molotov
Tel: tctDOTdqWUbZp
username: molotov
email: molotov@gmail.com
password : (is left blank)
location: (is left blank - the loction is selected from a drop down menu, in which on registration from the website, a value will be selected automatically, thus being left blank in the junk data)
I have much more data like this, around other 30's. Im not pretty sure what's causing this problem, and since i don't have direct access to the servers, im still waiting for an answer from the person with whom i host the website.
I will try and search the net for the sql injections and how to prevent them. thanks and hope the info i gave you can give you a better picture.