Форум Flasher.ru
Ближайшие курсы в Школе RealTime
Список интенсивных курсов: [см.]  
  
Специальные предложения: [см.]  
  
 
Блоги Правила Справка Пользователи Календарь Сообщения за день
 

Вернуться   Форум Flasher.ru > Flash > ActionScript 1.0/2.0

Версия для печати  Отправить по электронной почте    « Предыдущая тема | Следующая тема »  
Опции темы Опции просмотра
 
Создать новую тему Закрытая тема
Старый 26.02.2010, 01:31
Ar_PHARAZON вне форума Посмотреть профиль Отправить личное сообщение для Ar_PHARAZON Найти все сообщения от Ar_PHARAZON
  № 1  
Ar_PHARAZON

Регистрация: Feb 2010
Сообщений: 16
По умолчанию ошибка формы e-mail + php

Добрый вечер.
Проблема в строке e-mail формы отправки сообщений на флеше. Пишет:
"Please check email address - does not appear valid." При том, что сам адрес правильный и с собакой!

код первого фрейма:
Код AS1/AS2:
submit_mc._alpha = 40;
 
dataSender = new LoadVars();
 
dataReceiver = new LoadVars();
 
formCheck = new Object();
formCheck.onKeyUp = function() {
	if (name_txt.text != '' &&
			email_txt.text != '' &&
			subject_txt.text != '' &&
			message_txt.text != '') {
		alert_txt.text = '';
		submit_mc._alpha = 100;
	} else {
		submit_mc._alpha = 40;
	}
}
 
Key.addListener(formCheck);
 
 
normal_border = 0x7A7777;
focus_border = 0xFA8D00;
 
normal_background = 0xECECE6;
focus_background = 0xE9E3E3;
 
normal_color = 0x776D6C;
focus_color = 0x000000;
 
 
 
inputs=[name_txt,email_txt,subject_txt,message_txt];
 
 
 
for( var elem in inputs) {
	inputs[elem].border = true;
	inputs[elem].borderColor = normal_border;
	inputs[elem].background = true;
	inputs[elem].backgroundColor = normal_background;
	inputs[elem].textColor = normal_color;
}
 
 
TextField.prototype.onSetFocus = function() {
	this.borderColor = focus_border;
	this.backgroundColor = focus_background;
	this.textColor = focus_color;
}
 
TextField.prototype.onKillFocus = function() {
	this.borderColor = normal_border;
	this.backgroundColor = normal_background;
	this.textColor = normal_color;
}
 
 
Selection.setFocus(name_txt);
 
 
submit_mc.onRelease = function() {
	if (name_txt.text != '' &&
			email_txt.text != '' &&
			subject_txt.text != '' &&
			message_txt.text != '') {
		alert_txt.text='';
		_root.play();
		dataSender.name = name_txt.text;
		dataSender.email = email_txt.text;
		dataSender.subject = subject_txt.text;
		dataSender.message = message_txt.text;
		dataReceiver.onLoad = function() {
			if (this.response == "invalid") {
				_root.gotoAndStop(1);
				alert_txt.text = "Please check email address - does not appear valid."
			} else if (this.response == "error") {
				_root.gotoAndStop(3);
			} else if (this.response == "passed") {
				_root.gotoAndStop(4);
			}
		}
		dataSender.sendAndLoad("processEmail.php", dataReceiver, "POST");
	} else {
		alert_txt.text = "Please complete all fields before submitting form.";
	}
}
в php:
PHP код:
<?php

//create short variable names
$name=$_POST['name'];
$email=$_POST['email'];
$subject=$_POST['subject'];
$message=$_POST['message'];
$name=trim($name);
$email=trim($email);
$subject=StripSlashes($subject);
$message=StripSlashes($message);
//modify the next line with your own email address
$toaddress='ar.pharazon.kiev@gmail.com';


function 
validate_email($email) {

  
// Function to validate an e-mail address by both checking the
  // format of the address, and then testing it by holding an
  // authorisation conversation with the addresses SMTP server
  //
  // inputs - $email = the email address itself
  // 
  // returns - function has a return value of
  //           0 = success
  //           1 = failed, invalid address
  //           2 = system failure
  //
  // Written by Trib after reading, combining, enhancing and modifying
  // the efforts of too many other people to give a credit list. However
  // Jay Greenspan deserves a mention for his exhaustive work on address
  // parsing (see the link in the rutorial at 
  // http://www.trib-design.com/gurututs/validatemail.php
  // and also so does an unknown person who wrote the SMTP MX record
  // query program which got me to thinking about the problem from the 
  // SMTP perspective.
  //
  // You can also find the associated e-mail contact form at
  // <this address - later>
  //
  // Permission is hereby given to use, distribute and modify this code
  // without restriction or condition. However if you are a decent person
  // you might consider putting a credit into your comments. If you do,
  // I'm K. Salt (a.k.a. Trib) at http://www.trib-design.com. Thanks and ...
  //
  // enjoy .....

  
global $HTTP_HOST;

  
// Check for a malformed address (roughly)
  
if (!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$"$email)) { 
    
// it failed the simple format test, so return with an invalid address error
    
return 1;
  }  
  
// otherwise it passes the test so we can go off and do the 'real' validation
  //
  // first split #email up into parts
  
list ( $Username$Domain ) = split ("@",$email);

  
// look for an MX record and get the mail host name
  
if (checkdnsrr $Domain"MX" ))  {  
    if (
getmxrr ($Domain$MXrec))  {  
      
// save the MX hostname ready for Phase 3 testing
    
$Mailserver $MXrec[0];
    } else {
      
// there is an MX record, but we failed to retrieve it
      
return 2// return system error NOT invalid address
    
}
  } else {
    
// in this case there isn't an MX record so assume that the domain
    // portion is also the name of the mail server itself (it can happen)
    // save it as the mailserver address ready for Phase 3 testing
    
$Mailserver $Domain;
  }

  
// open a socket connection to the Mailserver
  
if ($Connection fsockopen($Mailserver25)) {

    
// start the SMTP validation

    
if (ereg("^220"$Rubbish fgets($Connection1024))) {
      
// it is an SMTP server so you can start talking to it

      // Tell it who you are and get the response (not needed later). 
      
fputs $Connection"HELO $HTTP_HOST\r\n" );  
      
$Rubbish fgets $Connection1024 );

      
// Ask it to accept mail from your $email user - store the response (needed later)
      
fputs $Connection"MAIL FROM: <{$email}>\r\n" );  
      
$Fromstring fgets $Connection1024 ); 

      
// Ask it to accept mail for your $email user - store the response (needed later)
      
fputs $Connection"RCPT TO: <{$email}>\r\n" );  
      
$Tostring fgets $Connection1024 );

      
// Now tell it you're done with chatting
      
fputs $Connection"QUIT\r\n");  
      
// and close the connection
       
fclose($Connection);  

      
// finally test the resonses did we get OK (type 250) messages?
      
if (ereg("^250"$Fromstring) && ereg("^250"$Tostring)) {
        
// YAHOOO .. we got a good one
        
return 0//  return successful validation
      
} else {
        
// the server refused the user
        
return 1// return invalid address
      
}
    } else {
      
// connected, to something but it failed to identfy itself as an SMTP server 
      // so assume its a bogus address
      
return 1// return invalid address error
    
}
  } else {
    
// it failed to connect 
    
return 1// return invalid address or system error - its your call
  
}
}

$valid validate_email($email);

switch (
$valid) {

  case 
0:
    
mail($toaddress,$subject,$message,"From: $name <$email>");
     
//clear the variables
     
$name='';
     
$email='';
     
$subject='';
     
$message='';
     echo 
'response=passed';
     break;
  case 
1:
     echo 
'response=invalid';
     break;
  case 
2:
     echo 
'response=error';
     break;

}
//end switch

?>
Реально чем-то помочь?
Если необходимо, я исходник выложу.

Старый 26.02.2010, 07:53
Juice_Green вне форума Посмотреть профиль Отправить личное сообщение для Juice_Green Посетить домашнюю страницу Juice_Green Найти все сообщения от Juice_Green
  № 2  
Juice_Green
 
Аватар для Juice_Green

Регистрация: Dec 2005
Адрес: Новосибирск
Сообщений: 529
Отправить сообщение для Juice_Green с помощью ICQ Отправить сообщение для Juice_Green с помощью Skype™
это сообщение, если смотреть по коду php может возвращатся и при неподключении к майл-серверу и при неудачной отправке

Старый 28.02.2010, 14:45
Ar_PHARAZON вне форума Посмотреть профиль Отправить личное сообщение для Ar_PHARAZON Найти все сообщения от Ar_PHARAZON
  № 3  
Ar_PHARAZON

Регистрация: Feb 2010
Сообщений: 16
ПОДНИМАЮ!!!!!!!

Старый 28.02.2010, 16:24
etc вне форума Посмотреть профиль Найти все сообщения от etc
  № 4  
etc
Et cetera
 
Аватар для etc

Регистрация: Sep 2002
Сообщений: 30,787
Цитата:
Сообщение от Ar_PHARAZON Посмотреть сообщение
ПОДНИМАЮ!!!!!!!
ОПУСКАЮЮЮЮ!!!!!!!!!!!!!!!!!

Создать новую тему Закрытая тема Часовой пояс GMT +4, время: 19:29.
Быстрый переход
  « Предыдущая тема | Следующая тема »  

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.


 


Часовой пояс GMT +4, время: 19:29.


Copyright © 1999-2008 Flasher.ru. All rights reserved.
Работает на vBulletin®. Copyright ©2000 - 2026, Jelsoft Enterprises Ltd. Перевод: zCarot
Администрация сайта не несёт ответственности за любую предоставленную посетителями информацию. Подробнее см. Правила.