manyakca
Mar 26th 2008, 3:45 am
I have a MSN plus script that sends messages to a PHP script. However, it does not work. I think there can be syntax error in the script.
The script;
function SendToPHP(email,msg){
var xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
with(xmlhttp){
setRequestHeader("email",email);
setRequestHeader("message",msg);
onreadystatechange = function(){if(readyState==4 && status!=200) Debug.Trace("ERROR!\n\n email: "+email+"\n\n message"+msg);};
open("POST", "http://test.com/sendtophp.php", true);
send(null);
}
}
function OnEvent_ChatWndReceiveMessage(ChatWnd, Origin, Message, MessageKind){
for(var e = new Enumerator(ChatWnd.Contacts); !e.atEnd(); e.moveNext()){
SendToPHP(e.item().Email, Message);
break;
}
}
The error;
Function called: OnEvent_ChatWndReceiveMessage
Error: Unspecified error
(code: -2147467259)
File: msn.js. Line: 4.
Function OnEvent_ChatWndReceiveMessage returned an error. Code: -2147352567
The PHP script;
<?
$link = mysql_connect('mysql.***.com', '***', '***');
if (!$link) {
die("Problem");
}
mysql_select_db("moda", $link)
or die ("Problem!");
if (isset($_POST["email"]) OR isset($_POST["message"])) {
$ip = $_SERVER['HTTP_CLIENT_IP'];
mysql_query("
INSERT INTO logs
(`user`,`in`,`ip`)
VALUES
(
'{$_POST["email"]}',
'{$_POST["message"]}',
'{$ip}'
)
");
}
mysql_close($link);
?>
What is the problem? Thank you...
The script;
function SendToPHP(email,msg){
var xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
with(xmlhttp){
setRequestHeader("email",email);
setRequestHeader("message",msg);
onreadystatechange = function(){if(readyState==4 && status!=200) Debug.Trace("ERROR!\n\n email: "+email+"\n\n message"+msg);};
open("POST", "http://test.com/sendtophp.php", true);
send(null);
}
}
function OnEvent_ChatWndReceiveMessage(ChatWnd, Origin, Message, MessageKind){
for(var e = new Enumerator(ChatWnd.Contacts); !e.atEnd(); e.moveNext()){
SendToPHP(e.item().Email, Message);
break;
}
}
The error;
Function called: OnEvent_ChatWndReceiveMessage
Error: Unspecified error
(code: -2147467259)
File: msn.js. Line: 4.
Function OnEvent_ChatWndReceiveMessage returned an error. Code: -2147352567
The PHP script;
<?
$link = mysql_connect('mysql.***.com', '***', '***');
if (!$link) {
die("Problem");
}
mysql_select_db("moda", $link)
or die ("Problem!");
if (isset($_POST["email"]) OR isset($_POST["message"])) {
$ip = $_SERVER['HTTP_CLIENT_IP'];
mysql_query("
INSERT INTO logs
(`user`,`in`,`ip`)
VALUES
(
'{$_POST["email"]}',
'{$_POST["message"]}',
'{$ip}'
)
");
}
mysql_close($link);
?>
What is the problem? Thank you...