Beispiel #1
0
function verify_email($email)
{
    $errors = $GLOBALS['errors'];
    if (!empty($email)) {
        // preg_match("#[^0-9 a-z\.-_]+@[0-9 a-z\.-_]+$#i", $email)
        if (preg_match("/^\\w[[:alnum:]\\.-_]+@[[:alnum:]\\.-_]+\\.[[:alnum:]]{2,4}\$/i", $email) and filter_var($email, FILTER_VALIDATE_EMAIL)) {
            $cxn = $GLOBALS['cxn'];
            //$email = mysql_real_escape_string($cxn, $email);
            if (find_email($email)) {
                //checks to see if email is in system
                return $email;
            } else {
                $errors .= "Oh No couldn't find {$email} in our system!<br>";
                $GLOBALS['errors'] = $errors;
                return false;
            }
        } else {
            $errors .= "Oh No, that email was an incorrect format, try again <br>";
            $GLOBALS['errors'] = $errors;
            return false;
        }
    } else {
        $errors .= "Oh No, the email was empty, try again<br>";
        $GLOBALS['errors'] = $errors;
        return false;
    }
}
Beispiel #2
0
<body>

<?php 
if (!isset($_GET['email'])) {
    print_r("pas d'email");
    exit;
}
if (!isset($_GET['autre'])) {
    print_r("erreur dans l'url");
    exit;
}
$email = test_input(urldecode($_GET['email']));
$id = test_input($_GET['autre']);
$app = new iSDK();
if ($app->cfgCon("connectionName")) {
    if (find_email($id, $app) != $email) {
        echo "erreur de chargement de données!";
        exit;
    }
    $returnFields = array('FirstName', 'LastName', 'Id', 'Email');
    $conDat = $app->dsLoad("Contact", $id, $returnFields);
} else {
    echo "Erreur de connexion ifst";
    exit;
}
?>


<div class="col-md-12 ">
<?php 
//include ('entete.html');
Beispiel #3
0
 $fields_with_length = array('name' => 20, 'username' => 14, 'spoj' => 14, 'codechef' => 14, 'hackerrank' => 16, 'phone_number' => 10);
 foreach ($fields_with_length as $fieldname => $maxlength) {
     if (strlen(mysql_prep($_POST[$fieldname])) > $maxlength) {
         $errors[] = $fieldname;
     }
 }
 $field_patterns = array('name' => '/^[a-zA-Z ]{3,20}$/', 'username' => '/^[a-z]{1}[a-z0-9_]{3,13}$/', 'spoj' => '/^[a-z]{1}[a-z0-9_]{2,13}$/', 'codechef' => '/^[a-z]{1}[a-z0-9_]{3,13}$/', 'hackerrank' => '/^[a-zA-Z0-9_]{5,16}$/', 'phone_number' => '/^[7-9]{1}[0-9]{9}/', 'email' => '/^[\\w-\\.]+@([\\w-]+\\.)+[\\w-]{2,4}$/', 'admission' => '/^[2]{1}[0-1]{2}[0-9]{1}[a-zA-Z]{2}[0-9]{4}$/');
 foreach ($field_patterns as $fieldname => $pattern) {
     if (preg_match($pattern, $_POST[$fieldname]) == 0) {
         $errors[] = $fieldname;
     }
 }
 if (!is_null(find_user_exist($_POST['username']))) {
     $errors[] = 'username';
 }
 if (!is_null(find_email($_POST['email']))) {
     $errors[] = 'email';
 }
 if (is_null(find_member($_POST['member']))) {
     $errors[] = 'member';
 }
 if (!is_null(find_member_exist($_POST['member']))) {
     $errors[] = 'member';
 }
 if (!empty($errors)) {
     //print_r($errors) ;
     redirect_to("login.php");
 } else {
     $username = mysql_prep($_POST["username"]);
     $verification_link = random_string();
     $verification_link_send = urlencode($verification_link);
function send_update_on_bought($auction)
{
    $item_id = $auction["item_id"];
    $item = get_item_id($item_id);
    $subject = "Receipt for your new item";
    $message = "<b>You have recently bought an item</b><br>";
    $message .= "<h1>" . $item["name"] . "</h1><br>";
    $highest = get_highest_bid($auction["id"]);
    $seller = find_email($highest["user_id"]);
    $to = $seller["email"];
    $message .= "<b>Item:" . $item["name"] . "</b><br>";
    $message .= "<b>Seller :" . $auction["seller_id"] . "</b><br>";
    $message .= "<b>Price :£" . $highest["price"] . "</b><br>";
    echo $message;
    $header = "From:no-reply-auctions@gmail.com \r\n";
    $header .= "MIME-Version: 1.0\r\n";
    $header .= "Content-type: text/html\r\n";
    $retval = mail($to, $subject, $message, $header);
    if ($retval == true) {
        echo "Message sent successfully...";
    } else {
        echo "Message could not be sent...";
    }
}
Beispiel #5
0
<?php

require 'cxn.php';
// tests email uniqueness through ajax
function find_email($email)
{
    $cxn = $GLOBALS['cxn'];
    $query_email = "SELECT email FROM user_list WHERE email=?";
    $stm = $cxn->prepare($query_email);
    $stm->bind_param("s", $email);
    $stm->execute();
    $stm->bind_result($db_email);
    $stm->fetch();
    $stm->close();
    if ($db_email == $email or !preg_match("/^\\w[[:alnum:]\\.-_]+@[[:alnum:]\\.-_]+\\.[[:alnum:]]{2,4}\$/i", $email) or !filter_var($email, FILTER_VALIDATE_EMAIL)) {
        return true;
    } else {
        return false;
    }
}
//end find_email()
$email = $_REQUEST['test_mail'];
// 1 is true, matched in DB. 0 is false, not found in DB
if (find_email($email)) {
    echo 1;
} else {
    echo 0;
}
Beispiel #6
0
function verify_email($email)
{
    if (!empty($email)) {
        if (preg_match("/^\\w[[:alnum:]\\.-_]+@[[:alnum:]\\.-_]+\\.[[:alnum:]]{2,4}\$/i", $email) and filter_var($email, FILTER_VALIDATE_EMAIL)) {
            if (!find_email($email)) {
                return true;
            } else {
                return false;
            }
        } else {
            return false;
        }
    } else {
        return false;
    }
}
Beispiel #7
0
function tags_by_id($cid, $app)
{
    if (find_email($cid, $app) != "") {
        $fields = array('GroupId');
        $query = array('ContactId' => $cid);
        return $result = $app->dsQuery('ContactGroupAssign', 1000, 0, $query, $fields);
    }
}
Beispiel #8
0
<?php

require_once './includes/config.inc.php';
require_once './includes/functions.inc.php';
sleep(2);
// Don't touch this!
$email = $_GET['query'];
// Check if it is a valid email
if (!valid_email($email)) {
    // Return an error if not valid
    echo json_encode(array('error' => 'Invalid Email address!'));
} else {
    // Check that the file exists and is not empty
    if (!file_exists(FACULTY_FILE) || filesize(FACULTY_FILE) == 0) {
        // If not, create the file
        if (!create_faculty_file()) {
            echo json_encode(array('error' => 'Server error. Please try again.'));
            return;
        }
    }
    $result = find_email($email);
    // Search for the email
    // Check if a result was found
    if (isset($result)) {
        // Return the result
        echo $result;
    } else {
        // Return an error not found
        echo json_encode(array('error' => 'Email not found!'));
    }
}