Zurück   Flashforum > Flash > Flash Einsteiger

Antwort
 
LinkBack Themen-Optionen Ansicht
Alt 22-11-2010, 12:14   #1 (permalink)
Neuer User
 
Registriert seit: Sep 2010
Beiträge: 9
Problem mit kontakt & gästebuch...

Hy ihr lieben...

Also ich bin im moment dabei mit meiner as3 website von einem hoster auf einen neuen zu wechseln, doch komischerweise funktionieren kontakt & gästebuch nicht mehr obwohl ich mysql, as3 & php genau gleich eingestellt habe (bis auf die url request und mysql zugangsdaten natürlich) auf jeden fall bekomme ich jetzt folgende Fehlermeldung:

Error: Error #2101: Der an URLVariables.decode() übergebene String muss ein URL-kodierter Abfrage-String mit Name/Wert-Paaren sein.
at Error$/throwError()
at flash.net::URLVariables/decode()
at flash.net::URLVariables()
at flash.net::URLLoader/onComplete()[/COLOR]

Meine Scripts:

Kontakt as3:
// Set text formatting colors for errors, waiting..., and success mechanisms
var errorsFormat:TextFormat = new TextFormat();
errorsFormat.color = 0xFF0000;

var waitingFormat:TextFormat = new TextFormat();
waitingFormat.color = 0x339900;

var successFormat:TextFormat = new TextFormat();
successFormat.color = 0x3366FF;

// hide the little processing movieclip
processing_mc.visible = false;

// Assign a variable name for our URLVariables object
var variables:URLVariables = new URLVariables();

// Build the varSend variable
var varSend:URLRequest = new URLRequest("http://creepforce.cr.funpic.de/forms/contact_parse.php");
varSend.method = URLRequestMethod.POST;
varSend.data = variables;

// Build the varLoader variable
var varLoader:URLLoader = new URLLoader;
varLoader.dataFormat = URLLoaderDataFormat.VARIABLES;
varLoader.addEventListener(Event.COMPLETE, completeHandler);


// Handler for PHP script completion and return
function completeHandler(event:Event):void{
// remove processing movieclip
processing_mc.visible = false;
// Clear the form fields
name_txt.text = "";
email_txt.text = "";
msg_txt.text = "";
// Load the response from the PHP file
status_txt.text = event.target.data.return_msg;
status_txt.setTextFormat(successFormat);
}

// Add an event listener for the submit button and what function to run
submit_btn.addEventListener(MouseEvent.CLICK, ValidateAndSend);

// Validate form fields and send the variables when submit button is clicked
function ValidateAndSend(event:MouseEvent):void{

//validate form fields
if(!name_txt.length) {
status_txt.text = "Gib bitte deinen Namen ein.";
status_txt.setTextFormat(errorsFormat);
} else if(!email_txt.length) {
status_txt.text = "Gib bitte deine E-Mail ein";
status_txt.setTextFormat(errorsFormat);
} else if(!validateEmail(email_txt.text)) {
status_txt.text = "Das ist keine E-Mail Ardesse";
status_txt.setTextFormat(errorsFormat);
} else if(!msg_txt.length) {
status_txt.text = "Gib bitte deine Nachricht ein.";
status_txt.setTextFormat(errorsFormat);
} else {

// All is good so send the message to the parse file
// Show the little "processing_mc" movieclip
processing_mc.visible = true;

// Ready the variables for sending
variables.userName = name_txt.text;
variables.userEmail = email_txt.text;
variables.userMsg = msg_txt.text;

// Send the data to the php file
varLoader.load(varSend);

// Put a temporary message in the response field while the PHP file sends back
// If the code does not connect to the PHP file this message will remain visible to user
status_txt.text = "Warte auf Server Connection...";
status_txt.setTextFormat(waitingFormat);

} // close else after form validation

} // Close ValidateAndSend function //////////////////////////////////////////////////////////////


// Validate email function
function validateEmail(str:String):Boolean {
var pattern:RegExp = /(\w|[_.\-])+@((\w|-)+\.)+\w{2,4}+/;
var result:Object = pattern.exec(str);
if(result == null) {
return false;
}
return true;
}

kontakt php:

<?
/*
--- Created by Adam Khoury @ Learn Web Design Online Free ---

*/
// Create local variables from the Flash ActionScript posted variables
$senderName = $_POST['userName'];
$senderEmail = $_POST['userEmail'];
$senderMessage = $_POST['userMsg'];

// Strip slashes on the Local variables for security
$senderName = stripslashes($senderName);
$senderEmail = stripslashes($senderEmail);
$senderMessage = stripslashes($senderMessage);

// IMPORTANT - Change these lines to be appropriate for your needs - IMPORTANT
$to = "djk90@hotmail.de";
$from = "$senderEmail";
$subject = "Contact from your site";
// Modify the Body of the message however you like
$message = "Message from your website:

Their Name: $senderName

Their Email: $senderEmail

Their Message is below:

$senderMessage";
// Build $headers Variable
$headers = "From: $from\r\n";
$headers .= "Content-type: text\r\n";
$to = "$to";
// Send the email
mail($to, $subject, $message, $headers);

// Assemble the message that goes back to Flash
// The flash ActionScript is looking for a return variable of "return_msg"
$my_msg = "Thanks $senderName, your message has been sent.";
// Print the data back to flash who is patiently waiting for it in the onCompleteHandler
print "return_msg=$my_msg";
// Exit script
exit();
?>

Gästebuch as3 (request entry):

// This section of code gets all the comments for initial viewing
// Assign a variable name for our URLVariables object
var variables_re:URLVariables = new URLVariables();
// Build the varSend variable
var varSend_re:URLRequest = new URLRequest("http://creepforce.cr.funpic.de/forms/guestbookParse.php");
varSend_re.method = URLRequestMethod.POST;
varSend_re.data = variables_re;
// Build the varLoader variable
var varLoader_re:URLLoader = new URLLoader;
varLoader_re.dataFormat = URLLoaderDataFormat.VARIABLES;
varLoader_re.addEventListener(Event.COMPLETE, completeHandler_re);
// Handler for PHP script completion and return
function completeHandler_re(event:Event):void{
// Load the response from the PHP file
if (event.target.data.returnBody == "") {
gbOutput_txt.text = "Kein Eintrag vorhanden";
} else {
gbOutput_txt.condenseWhite = true;
gbOutput_txt.htmlText = "" + event.target.data.returnBody;
}
}
// Ready any variables for sending
variables_re.comType = "requestEntries";
// Send the data to the php file
varLoader_re.load(varSend_re);

Gästebuch as3 (Send Entry Code):

msg_txt.restrict = "A-Za-z 0-9";
name_txt.restrict = "A-Za-z 0-9";
location_txt.restrict = "A-Za-z 0-9";
// Set text formatting colors for errors, waiting..., and success mechanisms
var errorsFormat:TextFormat = new TextFormat();
errorsFormat.color = 0xFF0000;
// hide the little processing movieclip
processing_mc.visible = false;
// Assign a variable name for our URLVariables object
var variables:URLVariables = new URLVariables();
// Build the varSend variable
var varSend:URLRequest = new URLRequest("http://creepforce.cr.funpic.de/forms/guestbookParse.php");
varSend.method = URLRequestMethod.POST;
varSend.data = variables;
// Build the varLoader variable
var varLoader:URLLoader = new URLLoader;
varLoader.dataFormat = URLLoaderDataFormat.VARIABLES;
varLoader.addEventListener(Event.COMPLETE, completeHandler);
// Handler for PHP script completion and return
function completeHandler(event:Event):void{
// remove processing movieclip
processing_mc.visible = false;
// Clear the form fields
name_txt.text = "";
location_txt.text = "";
msg_txt.text = "";
// Load the response from the PHP file
status_txt.text = event.target.data.return_msg;
gbOutput_txt.condenseWhite = true;
gbOutput_txt.htmlText = "" + event.target.data.returnBody;
}
// Add an event listener for the submit button and what function to run
submit_btn.addEventListener(MouseEvent.CLICK, ValidateAndSend);
// Validate form fields and send the variables when submit button is clicked
function ValidateAndSend(event:MouseEvent):void{

// validate all the form fields
if(!name_txt.length) {
status_txt.text = "Gib bitte deinen Namen ein.";
status_txt.setTextFormat(errorsFormat);
} else if(!location_txt.length) {
status_txt.text = "Gib bitte deine Stadt ein";
status_txt.setTextFormat(errorsFormat);
} else if(!msg_txt.length) {
status_txt.text = "Gib bitte dine Nachricht ein.";
status_txt.setTextFormat(errorsFormat);
} else {
// All is good so send the message to the parse file
// Show the little "processing_mc" movieclip
processing_mc.visible = true;
// Ready the variables for sending
variables.comType = "parseComment";
variables.userName = name_txt.text;
variables.userLocation = location_txt.text;
variables.userMsg = msg_txt.text;
// Send the data to the php file
varLoader.load(varSend);
// Put a temporary message in the response field while the PHP file sends back
// If the code does not connect to the PHP file this message will remain visible to user
status_txt.text = "Warte auf Server Verbindung...";
} // close else after form validation

} // Close ValidateAndSend function ////////////////////


Ich hoffe das ihr da durchblickt und mir helfen könnt.
Dankeschön im Vorraus...
CreepForce ist offline   Mit Zitat antworten
Alt 22-11-2010, 12:16   #2 (permalink)
Neuer User
 
Registriert seit: Sep 2010
Beiträge: 9
ps...

Übrigens der code funktionierte genau so unter:
creepforce.tk
CreepForce ist offline   Mit Zitat antworten
Antwort

Lesezeichen

Stichworte
fehler, gästebuch, hilfe, kontakt

Themen-Optionen
Ansicht

Forumregeln
Es ist Ihnen nicht erlaubt, neue Themen zu verfassen.
Es ist Ihnen nicht erlaubt, auf Beiträge zu antworten.
Es ist Ihnen nicht erlaubt, Anhänge hochzuladen.
Es ist Ihnen nicht erlaubt, Ihre Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks sind an
Pingbacks sind an
Refbacks sind an


Ähnliche Themen
Thema Autor Forum Antworten Letzter Beitrag
[Flash CS4] Kontakt Script Problem anacotic Flash Einsteiger 2 03-08-2009 10:39
Problem mit Gästebuch JUCO Flash und Datenbanken 8 27-03-2007 18:12
Problem mit Gästebuch Tobian Flash MX 1 27-09-2003 18:03
Gästebuch Problem ovd-sama ActionScript 1 11 20-02-2003 17:41
php-gästebuch problem Der Dude Flash 4 und Flash 5 8 05-05-2002 17:36


Alle Zeitangaben in WEZ +1. Es ist jetzt 08:07 Uhr.

Domains, Webhosting & Vserver von Host Europe
Unterstützt das Flashforum!
Adobe User Group


Copyright ©1999 – 2012 Marc Thiele