Example #1
0
function compare_date($connexion, $id, $date_now, $date_db)
{
    if ($date_db + 1800 > $date_now) {
        echo "compte desactivé";
    } else {
        echo "compte activé";
        email_validate($connexion, $id);
    }
}
Example #2
0
<?php

//if (!session_id()) session_start();
//    $dsp->authadmin->Init();
//    $notify = '';
$email = email_validate($_POST['email']);
if ($email) {
    $user = $dsp->usersadmin->getUserByEmail($email);
    if (!$user) {
        $_SESSION['admin_message'] = 'Пользователя с таким E-mail не существует';
    } else {
        require LIB_DIR . "class.phpmailer.php";
        $password = generatePass();
        $dsp->usersadmin->setNewPassword($password, $user['id']);
        $mail = new PHPMailer();
        $mail->CharSet = 'utf-8';
        $mail->setFrom('*****@*****.**', SITE_NAME);
        $mail->addAddress($email, $user['login']);
        $body = <<<EOF
Здравствуйте, {$user['login']}
Ваш новый пароль: {$password}
EOF;
        $mail->Subject = 'Восстановление пароля';
        $mail->Body = $body;
        $mail->send();
        Redirect('/admin/?restore=2');
    }
    if (strpos($_SERVER['REQUEST_URI'], 'e-notify=') !== FALSE) {
        $_SERVER['REQUEST_URI'] = substr($_SERVER['REQUEST_URI'], 0, strpos($_SERVER['REQUEST_URI'], 'e-notify=') - 1);
    }
    if (!empty($notify)) {
Example #3
0
<?php

require 'config.php';
$subject = $_REQUEST['subject'] . ' ' . EMAIL_SUBJECT;
// Subject of your email
$to = EMAIL_ADDRESS;
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= "From: " . $_REQUEST['email'] . "\r\n";
// Sender's E-mail
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$message .= 'Name: ' . $_REQUEST['name'] . "<br>";
$message .= $_REQUEST['message'];
if (email_validate($_REQUEST['email']) && @mail($to, $subject, $message, $headers)) {
    echo 'sent';
} else {
    echo 'failed';
}
}
if ($post) {
    $name = stripslashes($_POST['name']);
    $email = trim($_POST['email']);
    $subject = stripslashes($_POST['subject']);
    $message = stripslashes($_POST['message']);
    $error = '';
    // Check name
    if (!$name) {
        $error .= 'Please enter your name.<br />';
    }
    // Check email
    if (!$email) {
        $error .= 'Please enter an e-mail address.<br />';
    }
    if ($email && !email_validate($email)) {
        $error .= 'Please enter a valid e-mail address.<br />';
    }
    // Check message (length)
    if (!$message || strlen($message) < 10) {
        $error .= "Please enter your message. It should have at least 10 characters.<br />";
    }
    if (!$error) {
        $mail = mail(EMAIL_ADDRESS, $subject, $message, "From: " . $name . " <" . $email . ">\r\n" . "Reply-To: " . $email . "\r\n" . "X-Mailer: PHP/" . phpversion());
        if ($mail) {
            echo 'Message sent.';
        }
    } else {
        echo $error;
    }
}
 protected function checkUpdate(&$item)
 {
     $errors = array();
     if (strlen(trim($item['login'])) < 4) {
         $errors['login'] = '******';
     }
     if (trim($item['login']) == '') {
         $errors['login'] = '******';
     }
     $sql = "select count(*) from `" . $this->__tablename__ . "` where `login` = ? and `id` != ?" . '';
     $v = $this->dsp->db->SelectValue($sql, $item['login'], $item['id']);
     if ($v > 0) {
         $errors['login'] = '******';
     }
     if ($item['pass'] != '' && strlen($item['pass']) < 6) {
         $errors['pass'] = '******';
     }
     if ($item['pass'] != $item['pass2']) {
         $errors['pass'] = '******';
     }
     $item['email'] = email_validate($item['email']);
     if (!$item['email']) {
         $errors['email'] = 'Неверно введен email';
     } else {
         $sql = "select count(*) from `" . $this->__tablename__ . "` where `email` = ? and `id` != ?" . '';
         $v = $this->dsp->db->SelectValue($sql, $item['email'], $item['id']);
         if ($v > 0) {
             $errors['email'] = 'Такой email уже существует';
         }
     }
     return $errors;
 }
Example #6
0
<?php

$firstname = sanitization($_POST('fname'), 'Please input your name');
$lastname = sanitization($_POST('lname'), 'Please input your last name');
$email = email_validate($_POST('email'));
function sanitization($input, $noinput = '')
{
    $input = htmlspecialchars($input);
    $input = stripslashes($input);
    $input = trim($input);
    if ($noinput && strlen($input) == 0) {
        die($noinput);
    }
    return $input;
}
function show_error($error)
{
    ?>

     <strong>Please correct the following errors</strong><br>
      <?php 
    echo $error;
    ?>
    
<?php 
    exit;
}
?>
<php
function email_validate($email){
    htmlspecialchars($email);