Esempio n. 1
0
 public function doLogin()
 {
     $email = safe($_POST['email']);
     $password = safe($_POST['password']);
     $remember = 1;
     if (empty($email) || empty($password)) {
         // $this->redirect(U('w3g/Public/login'), 3, '用户名和密码不能为空');
         echo '用户名或密码不能为空';
         exit;
     }
     if (!isValidEmail($email)) {
         // $this->redirect(U('w3g/Public/login'), 3, 'Email格式错误,请重新输入');
         echo 'Email格式错误,请重新输入';
         exit;
     }
     if ($user = model('Passport')->getLocalUser($email, $password)) {
         // dump($user);
         if ($user['is_active'] == 0) {
             // $this->redirect(U('w3g/Public/login'), 3, '帐号尚未激活,请激活后重新登录');
             echo '帐号尚未激活,请激活后重新登录';
             exit;
         }
         model('Passport')->loginLocal($email, $password, $remember);
         $this->setSessionAndCookie($user['uid'], $user['uname'], $user['email'], intval($_POST['remember']) === 1);
         // $this->recordLogin($user['uid']);
         // model('Passport')->registerLogin($user, intval($_POST['remember']) === 1);
         echo '1';
         exit;
     } else {
         // $this->redirect(U('w3g/Public/login'), 3, '帐号或密码错误,请重新输入');
         echo '帐号或密码错误,请重新输入';
     }
 }
Esempio n. 2
0
 public function doLogin()
 {
     $email = safe($_POST['email']);
     $password = safe($_POST['password']);
     $remember = intval($_POST['login_remember']);
     if (empty($email) || empty($password)) {
         // redirect(U('wap/Public/login'), 3, '用户名和密码不能为空');
         echo '用户名和密码不能为空';
     }
     if (!isValidEmail($email)) {
         // redirect(U('wap/Public/login'), 3, 'Email格式错误,请重新输入');
         echo 'Email格式错误,请重新输入';
     }
     if ($user = model('Passport')->getLocalUser($email, $password)) {
         if ($user['is_active'] == 0) {
             // redirect(U('wap/Public/login'), 3, '帐号尚未激活,请激活后重新登录');
             echo '帐号尚未激活,请激活后重新登录';
         }
         model('Passport')->loginLocal($email, $password, $remember);
         // model('Passport')->registerLogin($user, intval($_POST['remember']) === 1);
         redirect(U('wap/Index/index'));
         // echo '1';
     } else {
         // redirect(U('wap/Public/login'), 3, '帐号或密码错误,请重新输入');
         echo '帐号或密码错误,请重新输入';
     }
 }
Esempio n. 3
0
	function sendResetEmail( $username ) {
		
		$username = sqlEscape( $username );
		$sql = "SELECT * FROM users WHERE username='******'";
		$result = tmbo_query( $sql );
		if( mysql_num_rows( $result ) == 1 ) {
			$row = mysql_fetch_assoc( $result );
			$code = hashFromUserRow( $row );
			$message = "Someone (hopefully you) wants to reset your [this might be offensive] password. To reset your password, please visit the following link:

https://".$_SERVER['HTTP_HOST']."/offensive/pwreset.php?x=$code

			";
			
			if( isValidEmail( $row['email'] ) ) {

				mail( $row['email'], "resetting your [this might be offensive] password", $message, "From: offensive@thismight.be (this might be offensive)\r\n"/*bcc:ray@mysocalled.com"*/) or trigger_error("could not send email", E_USER_ERROR);

				echo "An email has been sent containing instructions for resetting your password.";
			}
			else {
				echo "Unfortunately, we don't have a valid email address for that account. There's nothing we can do for you.";
			}

		}

	}
Esempio n. 4
0
 function testValidEmailsTLD()
 {
     $testemails = array('*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', 'simple.email@domain.cancerresearch1', 'simple.email@domain.cancerresearch12', 'simple.email@domain.cancerresearch123');
     foreach ($testemails as $email) {
         $this->assertTrue(isValidEmail($email) !== false);
     }
 }
Esempio n. 5
0
	function handleAccountRequest() {
		
		global $username, $password, $referralcode, $accountCreated;
		
		$message = null;
		
		$emailValidation = isValidEmail( $_REQUEST['email'] );
		
		if( ! $emailValidation->status ) {
			return $emailValidation;
		}
		
		if( isValidUsername( $username )
				&& isValidPassword( $password )
				&& $username != $password )
		{
			
			$result = createAccount( $username, $password, $referralcode );
			if( $result == "OK" ) {
				$message = new statusMessage( true, "Account created." );
				$accountCreated = true;
			} else {
				$message = new statusMessage( false, $result );
			}
			
		}
		else {
			$message = new statusMessage( false, "Invalid username or password. Passwords must be at least 5 characters long and may consist of letters, numbers, underscores, periods, and dashes. Passwords must not be the same as your username." );
		}
		
		return $message;
	
	}
Esempio n. 6
0
 public function doAdminLogin()
 {
     // 检查验证码
     if (md5($_POST['verify']) != $_SESSION['verify']) {
         $this->error('验证码错误');
     }
     // 数据检查
     if (empty($_POST['password'])) {
         $this->error('密码不能为空');
     }
     if (isset($_POST['email']) && !isValidEmail($_POST['email'])) {
         $this->error('email格式错误');
     }
     // 检查帐号/密码
     $is_logged = false;
     if (isset($_POST['email'])) {
         $is_logged = service('Passport')->loginAdmin(NULL, $_POST['email'], $_POST['password']);
     } else {
         if ($this->mid > 0) {
             $is_logged = service('Passport')->loginAdmin($this->mid, NULL, $_POST['password']);
         } else {
             $this->error('参数错误');
         }
     }
     // 提示消息不显示头部
     $this->assign('isAdmin', '1');
     if ($is_logged) {
         $this->assign('jumpUrl', U('admin/Index/index'));
         $this->success('登陆成功');
     } else {
         $this->assign('jumpUrl', U('home/Public/adminlogin'));
         $this->error('登陆失败');
     }
 }
Esempio n. 7
0
function checkEmail($email, $vemail, $conn)
{
    // check if email exists in the database
    // $email = mysqli_escape_string();
    // $vemail = mysqli_escape_string();
    $query = "SELECT * FROM member WHERE email = '{$email}';";
    $result = mysqli_query($conn, $query);
    // check if email == vemail
    if ($email != $vemail) {
        $_SESSION['error'] = true;
        header('Location: registration.php?error=2');
        exit;
    }
    $validEmail = isValidEmail($email);
    if (!$validEmail) {
        header('Location: registration.php?error=2');
        exit;
    }
    // check if email is unique in the database
    if (mysqli_num_rows($result) != 0) {
        $_SESSION['error'] = true;
        header('Location: registration.php?error=3');
        exit;
    }
    // else email is unique
    return 1;
}
 public function doAdminLogin()
 {
     // 检查验证码
     if (md5($_POST['verify']) != $_SESSION['verify']) {
         $this->error(L('error_security_code'));
     }
     // 数据检查
     if (empty($_POST['password'])) {
         $this->error(L('password_notnull'));
     }
     if (isset($_POST['email']) && !isValidEmail($_POST['email'])) {
         $this->error(L('email_format_error'));
     }
     // 检查帐号/密码
     $is_logged = false;
     if (isset($_POST['email'])) {
         $is_logged = service('Passport')->loginAdmin($_POST['email'], $_POST['password']);
     } else {
         if ($this->mid > 0) {
             $is_logged = service('Passport')->loginAdmin($this->mid, $_POST['password']);
         } else {
             $this->error(L('parameter_error'));
         }
     }
     // 提示消息不显示头部
     $this->assign('isAdmin', '1');
     if ($is_logged) {
         $this->assign('jumpUrl', U('admin/Index/index'));
         $this->success(L('login_success'));
     } else {
         $this->assign('jumpUrl', U('home/Public/adminlogin'));
         $this->error(L('login_error'));
     }
 }
Esempio n. 9
0
 protected function _isValid($value, $params)
 {
     $result = isValidEmail($value, getValueFromArray($params, Flag::VALIDATE_DOMAIN, false));
     if (!$result) {
         Factory::log()->warn("O e-mail {$value} não é um e-mail válido");
         return false;
     }
     return true;
 }
Esempio n. 10
0
function sendEmail($email, $id)
{
    $msg = "Entry {$id} Inserted.";
    $msg = wordwrap($msg, 70);
    // send email if email is valid
    if (isValidEmail($email)) {
        mail($email, "Entry {$id} Inserted.", $msg);
    }
}
Esempio n. 11
0
/** Contact Form **/
function TB_ContactForm($emailTo, $emailCC = FALSE, $sentHeading = 'Your message has been successfully submitted..', $sentMessage = 'We will get back to you asap.')
{
    if (isset($_POST['contact_submit'])) {
        $error = "";
        $fullname = makeSafe($_POST['fullname']);
        $email = makeSafe($_POST['email']);
        $phone = makeSafe($_POST['phone']);
        $message = makesafe($_POST['message']);
        $subject = "Enquiry from Canareef Resort Maldives";
        $from_name = "Canareef";
        $from_email = "*****@*****.**";
        if (empty($fullname)) {
            $error['fullname'] = "Your Name";
        }
        if (empty($email) || !isValidEmail($email)) {
            $error['email'] = "Your Email";
        }
        if (empty($message)) {
            $error['message'] = "Your Message";
        }
        if (!empty($_POST['antispam'])) {
            echo '<p>We don&rsquo;t appreciate spam.</p>';
        } elseif (!empty($error)) {
            TB_DisplayForm($error);
        } else {
            $content = __('Name') . ' : ' . $fullname . "\n" . __('Email') . ' : ' . $email . "\n" . __('Phone Number') . ' : ' . $phone . "\n" . __('Message') . " : \n" . $message . "\n\n";
            $headers = 'From: =?UTF-8?B?' . base64_encode($fullname) . '?= <' . $email . '>' . "\r\n";
            // $headers = 'From: =?UTF-8?B?'.base64_encode($from_name).'?= <'.$from_email.'>'."\r\n";
            $emailBCC = '';
            if ($emailCC) {
                $headers .= 'CC: ' . $emailCC . "\r\n";
            }
            if ($emailBCC != '') {
                $headers .= 'BCC: ' . $emailBCC . "\r\n";
            }
            $headers .= 'Reply-To: ' . $email . "\r\n";
            $headers .= 'Content-type: text/plain; charset=UTF-8';
            if (mail($emailTo, $subject, $content, $headers)) {
                echo '<a id="contact-status" name="status"></a>' . "\n";
                echo '<p class="tbSuccess">' . __($sentHeading) . ' ' . __($sentMessage) . '</p>' . "\n";
                $fullname = "";
                $email = "";
                $phone = "";
                $message = "";
            } else {
                $error['sendemail'] = "Email could not be sent.";
            }
            TB_DisplayForm($error);
        }
    } else {
        TB_DisplayForm();
    }
}
 function validate()
 {
     $ci =& get_instance();
     $user_name = $ci->session->userdata('user_name');
     if ($this->actionType == 'CREATE') {
         $this->record['user_name'] = trim($this->record['user_name']);
         $this->record['full_name'] = trim($this->record['full_name']);
         $this->record['user_pwd'] = md5($this->record['user_name']);
         if (isset($this->record['email_address'])) {
             if (!isValidEmail($this->record['email_address'])) {
                 throw new Exception("Your email address format is incorrect");
             }
         }
         $this->record['p_user_id'] = $this->generate_id('ifl', 'p_user', 'p_user_id');
         $this->record['creation_date'] = date('d/m/Y');
         $this->record['created_by'] = $user_name;
         $this->record['updated_date'] = date('d/m/Y');
         $this->record['updated_by'] = $user_name;
     } else {
         //do something
         if (isset($this->record['user_name'])) {
             $this->record['user_name'] = trim($this->record['user_name']);
             if (empty($this->record['user_name'])) {
                 throw new Exception('Username Field is Empty');
             }
         }
         if (isset($this->record['full_name'])) {
             $this->record['full_name'] = trim($this->record['full_name']);
             if (empty($this->record['full_name'])) {
                 throw new Exception('Fullname Field is Empty');
             }
         }
         if (isset($this->record['user_pwd'])) {
             if (trim($this->record['user_pwd']) == '') {
                 throw new Exception('Password Field is Empty');
             }
             if (strlen($this->record['user_pwd']) < 5) {
                 throw new Exception('Mininum password length is 5 characters');
             }
             $this->record['user_pwd'] = md5($this->record['user_pwd']);
         }
         if (isset($this->record['email_address'])) {
             if (!isValidEmail($this->record['email_address'])) {
                 throw new Exception("Email Format is Not Valid");
             }
         }
         $this->record['updated_date'] = date('d/m/Y');
         $this->record['updated_by'] = $user_name;
     }
     return true;
 }
function doCreateUser($email, $password)
{
    if (isValidEmail($email)) {
        if (isValidPassword($password)) {
            $db = dbconnect();
            $stmt = $db->prepare("INSERT INTO users SET email = :email, password = :password, created = now()");
            $binds = array(":email" => $email, ":password" => sha1($password));
            if ($stmt->execute($binds) && $stmt->rowCount() > 0) {
                return true;
            }
        }
    }
    return false;
}
Esempio n. 14
0
function the_action_function()
{
    $email = trim($_POST['email']);
    $success = true;
    try {
        if (!isValidEmail($email)) {
            throw new Exception('email not valid', 500);
        }
        echo json_encode(array('msg' => 'Thanks for signing up!'));
    } catch (Exception $e) {
        echo json_encode(array('error' => array('msg' => $e->getMessage(), 'code' => $e->getCode())));
    }
    die;
}
function createNewUser($email, $password)
{
    if (isValidEmail($email)) {
        if (isValidPassword($password)) {
            $db = getDB();
            $stmt = $db->prepare("INSERT INTO users SET email = :email, password = :password, created = now()");
            $hashedPassword = hash('sha1', $password);
            $binds = array(":email" => $email, ":password" => $hashedPassword);
            if ($stmt->execute($binds) && $stmt->rowCount() > 0) {
                return true;
            }
        }
    }
    return false;
}
Esempio n. 16
0
 /**
  * Creates a new anonymous user and fills the current obj with the info
  * Desc: Tries to create an anonymous user. 
  *       If the user already exists it will fill this obj with the users info.
  *       If the email is not a valid email it will throw an Invalid Email error
  * @param: string $email the users email.
  * @return: a pointer this object or false if the user already existed.
  * @throw: Excption if invalid email.
  * @acces: public
  **/
 function createAnonUser($email)
 {
     if (!isValidEmail($email)) {
         throw new Exception('Invalid email.');
     }
     $this->email = $email;
     if (!$this->find(true)) {
         //The email doesn't exists.
         $this->joinDate = date("Y-m-d");
         $this->hash = md5($this->email . time());
         $this->validated = 0;
     } else {
         return false;
     }
     return $this;
 }
Esempio n. 17
0
/** Contact Form **/
function TB_ContactForm($emailTo, $emailCC = FALSE, $sentHeading = 'Your message was sent successfully.', $sentMessage = 'We will get back to you soon.')
{
    if (isset($_POST['contact_submit'])) {
        $error = "";
        $fullname = makeSafe($_POST['fullname']);
        $email = makeSafe($_POST['email']);
        $phone = makeSafe($_POST['phone']);
        $message = makesafe($_POST['message']);
        $subject = "Enquiry from Estadia by Hatten";
        if (empty($fullname)) {
            $error['fullname'] = "Your name";
        }
        if (empty($email) || !isValidEmail($email)) {
            $error['email'] = "Email Address";
        }
        if (empty($message)) {
            $error['message'] = "General Enquiry";
        }
        if (!empty($_POST['antispam'])) {
            echo '<p>We don&rsquo;t appreciate spam.</p>';
        } elseif (!empty($error)) {
            TB_DisplayForm($error);
        } else {
            $content = __('Name') . ' : ' . $fullname . "\n\n" . __('Email Address') . ' : ' . $email . "\n\n" . __('Contact No.') . ' : ' . $phone . "\n\n" . __('General Enquiry') . " : \n\n" . $message . "\n\n";
            $headers = 'From: =?UTF-8?B?' . base64_encode($fullname) . '?= <' . $email . '>' . "\r\n";
            $emailBCC = '';
            if ($emailCC) {
                $headers .= 'CC: ' . $emailCC . "\r\n";
            }
            if ($emailBCC != '') {
                $headers .= 'BCC: ' . $emailBCC . "\r\n";
            }
            $headers .= 'Reply-To: ' . $email . "\r\n";
            $headers .= 'Content-type: text/plain; charset=UTF-8';
            if (mail($emailTo, $subject, $content, $headers)) {
                echo '<a id="contact-status" name="status"></a>' . "\n";
                echo '<p class="tbSuccess">' . __($sentHeading) . ' ' . __($sentMessage) . '</p>' . "\n";
            } else {
                $error['sendemail'] = "Email could not be sent.";
            }
            TB_DisplayForm($error);
        }
    } else {
        TB_DisplayForm();
    }
}
Esempio n. 18
0
 /**
  * 登录后台
  * @return boolean 登录后台是否成功
  */
 public function adminLogin()
 {
     if (is_numeric($_POST['uid'])) {
         $map['uid'] = intval($_POST['uid']);
     } elseif (isValidEmail(t($_POST['email']))) {
         $map['email'] = t($_POST['email']);
     } else {
         $map['phone'] = t($_POST['email']);
     }
     $login = M('User')->where($map)->find();
     $loginName = $login['phone'] ?: $login['email'];
     if ($this->loginLocal($loginName, $_POST['password'])) {
         $GLOBALS['ts']['mid'] = $_SESSION['adminLogin'] = intval($_SESSION['mid']);
         return true;
     } else {
         return false;
     }
 }
 public function doLogin()
 {
     if (empty($_POST['email']) || empty($_POST['password'])) {
         redirect(U('wap/Public/login'), 3, '用户名和密码不能为空');
     }
     if (!isValidEmail($_POST['email'])) {
         redirect(U('wap/Public/login'), 3, 'Email格式错误,请重新输入');
     }
     if ($user = service('Passport')->getLocalUser($_POST['email'], $_POST['password'])) {
         if ($user['is_active'] == 0) {
             redirect(U('wap/Public/login'), 3, '帐号尚未激活,请激活后重新登录');
         }
         service('Passport')->registerLogin($user, intval($_POST['remember']) === 1);
         redirect(U('wap/Index/index'));
     } else {
         redirect(U('wap/Public/login'), 3, '帐号或密码错误,请重新输入');
     }
 }
Esempio n. 20
0
function validateUser($data)
{
    $errorCodes = array();
    if (!isValidName($data['name'])) {
        $errorCodes[] = 'name';
    }
    if (!isValidEmail($data['email'])) {
        $errorCodes[] = 'email';
    }
    if (!isValidCity($data['city'])) {
        $errorCodes[] = 'city';
    }
    $valid = empty($errorCodes);
    $result = array('valid' => $valid);
    if (!$valid) {
        $result['errorCodes'] = $errorCodes;
    }
    return $result;
}
function execute($notification)
{
    $notification = array_merge(['css' => '', 'html' => '', 'email' => ''], $notification);
    $data = [];
    if (isValidEmail($notification['email'])) {
        $body = createBodyMessage($notification['css'], $notification['html']);
        $subject = "CSS 3 Button generator";
        if (sendMail($notification['email'], $subject, $body)) {
            $data['status'] = 'success';
            $data['message'] = 'Сообщение успешло отправлено';
        } else {
            $data['status'] = 'error';
            $data['message'] = 'Ошибка отправки сообщения';
        }
    } else {
        $data['status'] = 'error';
        $data['message'] = 'Ошибка при проверке email';
    }
    return $data;
}
 public function doLogin()
 {
     //使用url+sessionId的方式解决手机不支持cookie的情况
     //http://topic.csdn.net/u/20091116/15/594891e2-9046-40b2-b324-b2220af31c4e.html?70417
     if (empty($_POST['email']) || empty($_POST['password'])) {
         $this->redirect(U('w3g/Public/login'), 3, '用户名和密码不能为空');
     }
     if (!isValidEmail($_POST['email'])) {
         $this->redirect(U('w3g/Public/login'), 3, 'Email格式错误,请重新输入');
     }
     if ($user = service('Passport')->getLocalUser($_POST['email'], $_POST['password'])) {
         if ($user['is_active'] == 0) {
             $this->redirect(U('w3g/Public/login'), 3, '帐号尚未激活,请激活后重新登录');
         }
         $this->setSessionAndCookie($user['uid'], $user['uname'], $user['email'], intval($_POST['remember']) === 1);
         $this->recordLogin($user['uid']);
         $this->redirect(U('w3g/Index/index'));
     } else {
         $this->redirect(U('w3g/Public/login'), 3, '帐号或密码错误,请重新输入');
     }
 }
Esempio n. 23
0
function validateUpdation()
{
    global $conn, $var_id;
    //implement logic here
    if (trim($_POST["txtUserName"]) == "" || trim($_POST["txtUserLogin"]) == "" || trim($_POST["txtEmail"]) == "") {
        return false;
    } elseif (!isValidUsername(trim($_POST["txtUserLogin"])) || !isValidEmail(trim($_POST["txtEmail"]))) {
        return false;
    } else {
        $sql = "Select nCompId from sptbl_companies where vDelStatus='0' AND nCompId='" . mysql_real_escape_string($_POST["cmbCompanyId"]) . "' ";
        if (mysql_num_rows(executeSelect($sql, $conn)) <= 0) {
            return false;
        } else {
            $sql = "Select nUserId from sptbl_users where vLogin='******' AND nUserId != '" . mysql_real_escape_string($var_id) . "'";
            if (mysql_num_rows(executeSelect($sql, $conn)) > 0) {
                return false;
            }
        }
    }
    return true;
}
Esempio n. 24
0
function registerUser($fullName, $username, $password, $email)
{
    // Check if required fields are empty
    if (empty($fullName) || empty($username) || empty($password) || empty($email)) {
        return returnResponse(0, "Registration failed, please complete all required fields.");
    }
    // Check if password is bit more complex
    if (strlen($password) < 6) {
        return returnResponse(0, "Registration failed, minimum password length is 6 characters.");
    }
    if (!preg_match('/[A-Z]/', $password)) {
        return returnResponse(0, "Registration failed, password should at least contain 1 upper case.");
    }
    if (!preg_match('/[0-9]/', $password)) {
        return returnResponse(0, "Registration failed, password should at least contain 1 digit.");
    }
    // Encrypt
    $password = password_hash($password, PASSWORD_DEFAULT);
    // Check if email address is valid
    $email = trim($email);
    if (!isValidEmail($email)) {
        return returnResponse(0, "Registration failed, invalid email address.");
    }
    $result = dbResultFromQuery("SELECT username, emailAddress FROM users WHERE username='******' OR emailAddress='{$email}' LIMIT 1;", $username, $email);
    if ($result->num_rows > 0) {
        $user = mysqli_fetch_assoc($result);
        if ($user['username'] === $username) {
            return returnResponse(0, "Registration failed, username already exists.");
        } else {
            return returnResponse(0, "Registration failed, email already exists.");
        }
    }
    $result = dbResultFromQuery("INSERT INTO users (fullName, username, password, emailAddress) VALUES ('{$fullName}', '{$username}', '{$password}', '{$email}');");
    if ($result) {
        return returnResponse(1, "Registration successful.");
    } else {
        return returnResponse(0, "Registration failed, please try again.");
    }
}
Esempio n. 25
0
function sendMailUsingMailer($to_emails, $subject, $body, $attachment_name = '', $actual_attachment = '')
{
    $mail = new PHPMailer();
    $mail->SMTPAuth = true;
    $mail->SMTPSecure = "tls";
    $mail->Host = "smtp.gmail.com";
    $mail->Port = 587;
    $mail->Username = "******";
    $mail->Password = "******";
    $mail->From = '*****@*****.**';
    $mail->FromName = 'Cigniti Chats';
    $mail->IsHTML(true);
    $mail->Subject = $subject;
    $valid_email_cnt = 0;
    $invalid_emails = '';
    $valid_email_adds = '';
    $to_list = explode(',', $to_emails);
    for ($c = 0; $c < count($to_list); $c++) {
        if (isValidEmail(trim($to_list[$c]))) {
            $valid_email_cnt++;
            $to_email = trim($to_list[$c]);
            $mail->AddAddress($to_email);
        } else {
            $invalid_emails .= $to_list[$c] . ",";
        }
    }
    if ($attachment_name) {
        $mail->AddAttachment($attachment_name, $actual_attachment);
        // attach files/invoice-user-1234.pdf, and rename it to invoice.pdf
    }
    $mail->Body = nl2br($body);
    if (!$mail->Send()) {
        return "Error sending: " . $mail->ErrorInfo;
    } else {
        return "Letter is sent";
    }
    $mail->ClearAllRecipients();
}
function pass_check_email()
{
    global $pro_mysql_pop_table;
    global $user;
    global $host;
    if (!isValidEmail($_REQUEST["adm_email_login"])) {
        die("Check: Incorrect email format!");
    }
    if (!isDTCPassword($_REQUEST["adm_email_pass"])) {
        die("Check: Incorrect password format!");
    }
    $q = "SELECT * FROM {$pro_mysql_pop_table} WHERE ";
    $tbl = explode('@', $_REQUEST["adm_email_login"]);
    $user = $tbl[0];
    $host = $tbl[1];
    $q = "SELECT * FROM {$pro_mysql_pop_table} WHERE id='{$user}' AND mbox_host='{$host}' AND passwd='" . $_REQUEST["adm_email_pass"] . "';";
    $res_mailbox = mysql_query($q) or die("Cannot execute query \"{$q}\" ! line: " . __LINE__ . " file: " . __FILE__ . " sql said: " . mysql_error());
    $n = mysql_num_rows($res_mailbox);
    if ($n == 1) {
        return true;
    } else {
        return false;
    }
}
Esempio n. 27
0
<?php

$myTemplate = file_get_contents('template.html');
$output = '';
// validate post
if (isset($_POST['number']) && isset($_POST['email']) && isValidNumber($_POST['number']) && (isValidEmail($_POST['email']) || $_POST['email'] == 'Enter your email(optional)')) {
    $number = $_POST['number'];
    $email = validateEmail($_POST['email']);
    $conn = new mysqli('localhost', 'muhibind_2012', 'rzabul01', 'muhibind_01');
    $response = array();
    // get results
    $myArray = $conn->query("SELECT number FROM emails");
    // fetch associative array
    while ($row = $myArray->fetch_assoc()) {
        $response[] = $row[number];
    }
    if (in_array($number, $response)) {
        $output = str_replace('[+result+]', 'This number has been already used', $myTemplate);
    } else {
        $result = $conn->query("INSERT INTO emails (email, number) values ('{$email}', '{$number}')");
        if ($result) {
            $output = str_replace('[+result+]', 'Thanks for subscribing', $myTemplate);
        } else {
            $output = str_replace('[+result+]', 'Something went wrong with the connection, please go back and try again', $myTemplate);
        }
    }
} else {
    $output = str_replace('[+result+]', 'Something went wrong, please go back and try again', $myTemplate);
}
echo $output;
function isValidNumber($numberIn)
Esempio n. 28
0
            $errors[] = lang("SQL_ERROR");
        } else {
            $successes[] = lang("FORGOTPASS_REQUEST_CANNED");
        }
    }
}
//Forms posted
if (!empty($_POST)) {
    $email = $_POST["email"];
    $username = sanitize($_POST["username"]);
    //Perform some validation
    //Feel free to edit / change as required
    if (trim($email) == "") {
        $errors[] = lang("ACCOUNT_SPECIFY_EMAIL");
    } else {
        if (!isValidEmail($email) || !emailExists($email)) {
            $errors[] = lang("ACCOUNT_INVALID_EMAIL");
        }
    }
    if (trim($username) == "") {
        $errors[] = lang("ACCOUNT_SPECIFY_USERNAME");
    } else {
        if (!usernameExists($username)) {
            $errors[] = lang("ACCOUNT_INVALID_USERNAME");
        }
    }
    if (count($errors) == 0) {
        //Check that the username / email are associated to the same account
        if (!emailUsernameLinked($email, $username)) {
            $errors[] = lang("ACCOUNT_USER_OR_EMAIL_INVALID");
        } else {
         $message .= "* World Pay Email -id  is required! <br>";
     }
     if (!isNotNull($worldpay_inst_Id)) {
         $message .= "* World Pay Installation -id  is required! <br>";
     }
 }
 if ($chkPaypal == "Y") {
     if (!isNotNull($txtPaypalEmail)) {
         $message .= "* Paypal Email empty<br>";
     }
     /*if ( !isNotNull($txtPaypalIDTOKEN)) {
           $message .= "* Paypal Identity token is empty<br>";
       }*/
 } else {
     if (isNotNull($txtPaypalEmail)) {
         if (!isValidEmail($txtPaypalEmail)) {
             $message .= "* Invalid Paypal Email <br>";
         }
     }
 }
 /*--------------paypal Parralel payment--------*/
 if ($chkPaypal == 'Y') {
     if (!isNotNull($txtPaypalUsername)) {
         $message .= "* Paypal API Username Empty<br>";
     }
     if (!isNotNull($txtPaypalPassword)) {
         $message .= "* Paypal API Password Empty<br>";
     }
     if (!isNotNull($txtPaypalSignature)) {
         $message .= "* Paypal API Signature Empty<br>";
     }
Esempio n. 30
0
     $error += 1;
     $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")) . "<br>\n";
 }
 if (!in_array(GETPOST('morphy'), array('mor', 'phy'))) {
     $error += 1;
     $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv('Nature')) . "<br>\n";
 }
 if (empty($_POST["lastname"])) {
     $error += 1;
     $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Lastname")) . "<br>\n";
 }
 if (empty($_POST["firstname"])) {
     $error += 1;
     $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Firstname")) . "<br>\n";
 }
 if (GETPOST("email") && !isValidEmail(GETPOST("email"))) {
     $error += 1;
     $langs->load("errors");
     $errmsg .= $langs->trans("ErrorBadEMail", GETPOST("email")) . "<br>\n";
 }
 $birthday = dol_mktime($_POST["birthhour"], $_POST["birthmin"], $_POST["birthsec"], $_POST["birthmonth"], $_POST["birthday"], $_POST["birthyear"]);
 if ($_POST["birthmonth"] && empty($birthday)) {
     $error += 1;
     $langs->load("errors");
     $errmsg .= $langs->trans("ErrorBadDateFormat") . "<br>\n";
 }
 if (!empty($conf->global->MEMBER_NEWFORM_DOLIBARRTURNOVER)) {
     if (GETPOST("morphy") == 'mor' && GETPOST('budget') <= 0) {
         $error += 1;
         $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("TurnoverOrBudget")) . "<br>\n";
     }