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 _OnSubmit(){
$descript = $_GET['descript'];
$email = $_GET['email'];
$phone = $_GET['phone'];
$contact = $_GET['contact'];
$details = $_GET['details'];
$passw = $_GET['passw'];
ClearInput($descript, 255 );
ClearInput($email, 50 );
ClearInput($phone, 30 );
ClearInput($contact, 30 );
ClearInput($details, 512 );
ClearInput($passw, 12 );
if ($descript != "" && $email!="" && $phone!="" && $passw!="") {
$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 `freelance`"
. " ( `id` , `submitted` , `descript` , `details`, `email` , `phone` , `contact` , `passw`) "
. " VALUES ( '', now(), '".$descript."', '".$details."', '".$email."', '".$phone."', '".$contact."', '".$passw."' )";
//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();
//echo "Service temporary unavailable. Please try again later.
\n";
}
else if ($operation == "F") {
echo "Your information has not been submitted. Please try again later.
\n";
}
else if ($operation == "OK") {
echo "Your project has been submitted successfully.
\n";
echo "Submit a new project:
\n";
include ("submit.html");
}
else if ($operation == "M") {
echo "Please provide all the requested information.
\n";
include ("submit.html");
}
else {
include ("submit.html");
}
include ("foot.txt");
?>