include ("head.txt");
function ClearInput(&$string, $leng){
$string = ereg_replace("\<[^>]*>", "", $string);
$string = ereg_replace("\n", "
\n", $string);
if (strlen($string)> $leng) $string = substr($string, 0, $leng);
$string= str_replace ("\n", "
", $string);
$string= str_replace ("\r", "", $string);
$string= str_replace ("'", "", $string);
$string= str_replace ("\"", "", $string);
}
function ShowRegistrationForm___( )
{
echo "Service temporary unavailable. Please try again later.
\n";
}
function ShowRegistrationForm( )
{
echo "
\n";
}
function _OnSubmit(){
$area = $_GET['area'];
$email = $_GET['email'];
$phone = $_GET['phone'];
$web = $_GET['web'];
$name = $_GET['name'];
ClearInput($area, 3 );
ClearInput($email, 50 );
ClearInput($phone, 30 );
ClearInput($name, 30 );
ClearInput($web, 50 );
if ($area != "" && $email!="" && $phone!="" && $name!="") {
$dbuser = 'jacob';
$dbpass = 'paswyas';
$dbname = 'realty';
mysql_connect('127.0.0.1',$dbuser , $dbpass) or die ("Can't connect DB\n");
mysql_select_db($dbname) or die("Can't select database". mysql_error());
$sql = "INSERT INTO `lancers`"
. " ( `id` , `submitted` , `name` , `web`, `email` , `phone` , `area` ) "
. " VALUES ( '', now(), '".$name."', '".$web."', '".$email."', '".$phone."', '".$area."' )";
//echo $sql . "
\n";
if ( mysql_query ($sql) == TRUE ) {
echo "\n";
}
else {
echo "\n";
}
}
else {
echo "\n";
}
}
$operation = $_GET['o'];
ClearInput($operation, 20 );
if ($operation == "s") {
_OnSubmit();
}
else if ($operation == "F") {
echo "Your registration details has not been submitted. Please try again later.
\n";
}
else if ($operation == "OK") {
echo "Your registration details has been submitted successfully.
We recommend you to view current projects
\n";
}
else if ($operation == "M") {
echo "Please provide all the requested information.
\n";
ShowRegistrationForm();
}
else {
ShowRegistrationForm();
}
include ("foot.txt");
?>