for some reasons i can't use PDO so i have created a simple function to clean input data, please view and suggest modification to prevent from SQL and XSS. here is function.
function cleanStr($cStr) {
$cStr = trim($cStr);
$cStr = htmlspecialchars($cStr);
$cStr = addslashes($cStr);
return $cStr; }