示例#1
0
         if (!$r->optionnel) {
             if ($conformes) {
                 echo "<div class=\"error\">\n";
             }
             echo "<p>Le fichier « {$r->nom} » manque.</p>\n";
             $conformes = FALSE;
         }
     }
 }
 // Vérification des adresses e-mail
 for ($i = 1; $i <= 3; $i++) {
     if (isset($_POST["email" . $i]) && trim($_POST["email" . $i]) != "") {
         $email = trim($_POST["email" . $i]);
         $teststr = "E-mail " . htmlspecialchars($email);
         $infos = array();
         if (Local::is_valid_email($_SESSION["login"], $email, $infos)) {
             echo "<!-- {$teststr} OK (";
             foreach ($infos as $k => $v) {
                 echo htmlspecialchars($k) . ": " . htmlspecialchars($v) . ", ";
             }
             echo ") -->\n";
             $email_check[$i] = "ok";
         } else {
             if ($conformes) {
                 echo "<div class=\"error\">\n";
             }
             echo "<p>{$teststr} invalide !</p>";
             $conformes = FALSE;
             $email_check[$i] = "nok";
         }
     }
示例#2
0
   Envoi is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with Envoi.  If not, see <http://www.gnu.org/licenses/>.

   (c) Christophe Jacquet, 2014.
*/
session_start();
if (!isset($_SESSION["role"])) {
    header("HTTP/1.1 401 Vous devez etre connecte.");
    die;
}
if (!isset($_GET["method"])) {
    header("HTTP/1.1 400 Methode manquante.");
    die;
}
$method = $_GET["method"];
if ($method == "is_valid_email") {
    if (!isset($_GET["email"])) {
        header("HTTP/1.1 400 Parametre email manquant.");
        die;
    }
    $infos = array();
    $valid = Local::is_valid_email($_SESSION["login"], $_GET["email"], $infos);
    $infos["valid"] = $valid ? 1 : 0;
    echo json_encode($infos);
}