-
[RESOLVED] loading variable values in php, confused
Good day,
I'm using this server that allows the interactivity with several languages and I finally opted for php to send email messages from it but I can't get it together...
I've tried replacing these lines in my php script just basing myself on common sense, but mine is probably getting rusty.
It seems to be simple because it's only 4 values to be taken care off.
This is how my as code is like (I'm never sure whether it's AS1 or AS2 if it's a class) :
Code:
function handleRequest(cmd, params, user, fromRoom)
{
if (cmd == "getData")
{
var sql = "SELECT * FROM contacts ORDER BY name";
var queryRes = dbase.executeQuery(sql);
var response = {};
response._cmd = "getData";
response.db = [];
if (queryRes != null)
{
for (var i = 0; i < queryRes.size(); i++)
{
var tempRow = queryRes.get(i);
var item = {};
item.id = tempRow.getItem("id");
item.name = tempRow.getItem("name");
item.location = tempRow.getItem("location");
item.email = tempRow.getItem("email");
item.message = tempRow.getItem("message");
response.db.push(item);
}
}
else
{
trace("DB Query failed");
}
_server.sendResponse(response,-1,null,[user]);
}
else if (cmd == "addData")
{
var id = getTimer();
var sql = "INSERT INTO contacts (id, name, location, email, message) VALUES (";
sql += "'" + id + "', ";
sql += "'" + _server.escapeQuotes(params.name) + "', ";
sql += "'" + _server.escapeQuotes(params.location) + "', ";
sql += "'" + _server.escapeQuotes(params.email) + "', ";
sql += "'" + _server.escapeQuotes(params.message) + "')";
var success = dbase.executeCommand(sql);
if (success)
{
var response = {};
response._cmd = "addData";
response.id = id;
response.name = params.name;
response.location = params.location;
response.email = params.email;
response.message = params.message;
/*var from = "jpuigmiquel@gmail.com";
var to = response.email;
var subject = "Your message at webs.ono.com/jpdurba has been received!";
var missatge = "Thank you for your message!";
var lvSend = new LoadVars();
lvSend.from;
lvSend.to;
lvSend.subject;
lvSend.missatge;
lvSend.sendAndLoad("http://localhost/sendEmail.php",lvSend,"POST");*/
_server.sendResponse(response,-1,null,[user]);
}
}
}
In my php script, I have this:
PHP Code:
<?php
require 'class.phpmailer.php'; $mail = new PHPMailer(); $mail->IsSMTP(); $mail->Mailer = 'smtp'; $mail->SMTPAuth = true; $mail->Host = 'smtp.gmail.com'; $mail->Port = 25; $mail->SMTPSecure = 'tls';
$mail->Username = "jpuigmiquel@gmail.com"; $mail->Password = "******";
$mail->IsHTML(true);
$mail->From = "jpuigmiquel@gmail.com"; $mail->FromName = "Jordi";
$mail->addAddress("jpuigmiquel@gmail.com"); //$mail -> addAddress = ($_REQUEST['to']);
$mail->Subject = "Testing PHPMailer with localhost"; //$mail -> Subject = ($_REQUEST['subject']);
$mail->Body = "Hi,<br /><br />This system is working perfectly."; //$mail -> Body = ($_REQUEST['missatge']);
if(!$mail->Send()) echo "Message was not sent <br />PHPMailer Error: " . $mail->ErrorInfo; else echo "Message has been sent"; ?>
Excuse the long code. I'm not sure of what should be relevant or not, so I'm posting all that I'm not sure of. The comments in the PHP script are my non working changes to the original
Thanks for any help,
Last edited by capdetrons; 11-03-2013 at 08:22 AM.
-
Fixed it. To be honest, I forgot how I did it... Just had to get rid of one of the parameters in the requesting from the php.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|