function remove_contacts($text) { $text = preg_replace('/\\+?[0-9][0-9()-\\s+]{4,20}[0-9]/', '[blocked]', $text); /* checking for contact number and replacing it */ $text = preg_replace('#[^\\s]+@[^\\s]+#', ' [blocked] ', $text); /* checking and replacing email address */ return cleaner($text); }
SELECT s.*,t.id, day, to_char(coop_valid at time zone t.tzname, 'HH PM') as cv from summary s JOIN stations t on (t.iemid = s.iemid) WHERE day >= '{$sqlTS1}' and day <= '{$sqlTS2}' and id IN {$stationString} and network = '{$network}' ORDER by s.day ASC EOF; if ($what == "download") { header("Content-type: application/octet-stream"); header("Content-Disposition: attachment; filename=changeme.txt"); } else { header("Content-type: text/plain"); } $rs = pg_prepare($connection, "SELECT", $sqlStr); $rs = pg_execute($connection, "SELECT", array()); pg_close($connection); function cleaner($v) { if ($v == 0.0001) { return "T"; } if ($v == -99) { return 'M'; } return $v; } $cols = array("nwsli", "date", "time", "high_F", "low_F", "precip", "snow_inch", "snowd_inch"); $data = implode($d[$delim], $cols) . "\n"; for ($i = 0; $row = @pg_fetch_array($rs, $i); $i++) { $data .= sprintf("%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n", $row["id"], $d[$delim], $row["day"], $d[$delim], $row["cv"], $d[$delim], cleaner($row["max_tmpf"]), $d[$delim], cleaner($row["min_tmpf"]), $d[$delim], cleaner($row["pday"]), $d[$delim], cleaner($row["snow"]), $d[$delim], cleaner($row["snowd"])); } echo $data;
<?php include_once 'include/initialization.php'; define('USERNAME', 'admin'); define('PASSWORD', 'admin'); $name = cleaner($_POST['name']); $flag = false; // $admin_login = cleaner($_POST['admin_login']); // $admin_pass = cleaner($_POST['admin_pass']); $responses = ['error' => "Ton adresse mail ne semble pas juste...", 'pass-error' => "Login ou mot de passe invalide !", 'success' => "Ta demande d'inscription à bien été envoyée, tu vas recevoir un email de validation."]; if (!empty($_POST['name'])) { die; } if ($_SERVER['REQUEST_METHOD'] == 'POST') { $username = $_POST['USERNAME']; $password = $_POST['PASSWORD']; if ($username === 'admin' && $password === 'admin') { // $_SESSION['username'] = $username; header('Location: admin.php'); echo "C'est coul"; } else { $status = "C'est pas juste khey !"; echo "NON!"; } print_r($_POST); } ?> <!DOCTYPE html> <html> <head>
<?php include_once 'include/initialization.php'; ob_start(); //Help for redirection with header $name = cleaner($_POST['name']); $email = cleaner($_POST['email']); $flag = false; //Shows errors and success $responses = ['error' => "Ton adresse mail ne semble pas juste...", 'success' => "Ta demande d'inscription à bien été envoyée, tu vas recevoir un email de validation."]; if (!empty($_POST['name'])) { die; } if ($_SERVER['REQUEST_METHOD'] == 'POST') { if (filter_var($email, FILTER_VALIDATE_EMAIL) === false) { $flag = false; } else { $content = $email . " s'est inscrit a la newsletter !"; $flag = true; if (!mail('*****@*****.**', 'Mailinglist !', $content)) { $flag = false; die('email pas envoyé :('); } // Data base sent informations $uniqid = uniqid(); $date = date("Y-m-d H:i:s"); $sql = "INSERT INTO users(email, subscribed,register_date, role, confirmed, uniqid) \n VALUES(:email, :subscribed, :register_date, :role, :confirmed, :uniqid)"; $preparedStatement = $connexion->prepare($sql); $preparedStatement->bindValue('email', $email); $preparedStatement->bindValue('register_date', $date); $preparedStatement->bindValue('role', 'reader');
{ return filter_var($mail, FILTER_VALIDATE_EMAIL); } function cleaner($inputValue) { return trim(strip_tags($inputValue)); } if (count($_POST) > 0) { $firstName = cleaner($_POST["firstName"]); $lastName = cleaner($_POST["lastName"]); $birthDay = cleaner($_POST["birthDay"]); $birthMonth = cleaner($_POST["birthMonth"]); $birthYear = cleaner($_POST["birthYear"]); $mail = cleaner($_POST["mail"]); $adress = cleaner($_POST["adress"]); $q1 = cleaner($_POST["q1"]); $errors = ["Vous n'avez pas entré votre nom.", "Vous n'avez pas entré votre prénom.", "Vous n'avez pas entré votre adresse mail.", "Vous n'avez pas répondu à la question."]; if ($firstName == "") { echo $errors[0]; } if ($lastName == "") { echo $errors[1]; } if (is_valid_email($mail)) { echo $errors[2]; } if ($mail == "") { echo $errors[2]; } if (empty($q1)) { echo $errors[3];
function cleaner($array) { if (!is_array($array)) { return $array; } $newarray = array(); foreach ($array as $left => $right) { if (is_string($left)) { $newleft = stringcleaner(stripslashes($left)); } else { $newleft = $left; } if (is_string($right)) { $newright = stringcleaner($right); } else { if (is_array($right)) { $newright = cleaner($right); } else { $newright = $right; } } $newarray[$newleft] = $newright; } return $newarray; }
/** * Remove all url's from string. */ function cleaner($url) { $U = explode(' ', $url); $W = array(); foreach ($U as $k => $u) { if (stristr($u, 'http') || count(explode('.', $u)) > 1) { unset($U[$k]); return cleaner(implode(' ', $U)); } } return implode(' ', $U); }