xLive_Gaming
07-19-2007, 11:54 PM
OK, I have jsut downlaoded a Instant Messenger script which I will hopefully integrate in to my site but I have ran in to a few problems, could anyone possiblely help:
So far I have the made it so the registration works and it adds to the right table which is the users.
Orginal Code:
case 'login':
///////////// login to the server /////////
// login parts (within array $_POST): //
// from - user logging in //
// pwd - password //
///////////////////////////////////////////
$query = @mysql_query("SELECT buddylist FROM ".SQL_PREFIX."users WHERE username='".mysql_real_escape_string($from)."' AND password='".$pwd."'");
if(@mysql_num_rows($query) > 0) {
$user = mysql_fetch_assoc($query);
$set_status = @mysql_query("UPDATE ".SQL_PREFIX."users SET is_online='1' WHERE username='".mysql_real_escape_string($from)."'");
if(strlen($user['buddylist']) > 0) {
$buddylist = user_event($from, $user['buddylist'], 'status,1');
$output['buddy'] = $json->encode($buddylist);
} else {
$output['buddy'] = Array();
}
print($json->encode($output));
} else {
print 'invalid';
}
break;
An here is my atempt at changing username and password to alias and pass.
I have added all the correct fields to my table.
case 'login':
///////////// login to the server /////////
// login parts (within array $_POST): //
// from - user logging in //
// pwd - password //
///////////////////////////////////////////
$query = @mysql_query("SELECT buddylist FROM users WHERE alias='".mysql_real_escape_string($from)."' AND pass='".$pwd."'");
if(@mysql_num_rows($query) > 0) {
$user = mysql_fetch_assoc($query);
$set_status = @mysql_query("UPDATE users SET is_online='1' WHERE alias='".mysql_real_escape_string($from)."'");
if(strlen($user['buddylist']) > 0) {
$buddylist = user_event($from, $user['buddylist'], 'status,1');
$output['buddy'] = $json->encode($buddylist);
} else {
$output['buddy'] = Array();
}
print($json->encode($output));
} else {
print 'invalid';
}
break;
Can anyone notice anyhting that make it not work?
Thanks
xLG
So far I have the made it so the registration works and it adds to the right table which is the users.
Orginal Code:
case 'login':
///////////// login to the server /////////
// login parts (within array $_POST): //
// from - user logging in //
// pwd - password //
///////////////////////////////////////////
$query = @mysql_query("SELECT buddylist FROM ".SQL_PREFIX."users WHERE username='".mysql_real_escape_string($from)."' AND password='".$pwd."'");
if(@mysql_num_rows($query) > 0) {
$user = mysql_fetch_assoc($query);
$set_status = @mysql_query("UPDATE ".SQL_PREFIX."users SET is_online='1' WHERE username='".mysql_real_escape_string($from)."'");
if(strlen($user['buddylist']) > 0) {
$buddylist = user_event($from, $user['buddylist'], 'status,1');
$output['buddy'] = $json->encode($buddylist);
} else {
$output['buddy'] = Array();
}
print($json->encode($output));
} else {
print 'invalid';
}
break;
An here is my atempt at changing username and password to alias and pass.
I have added all the correct fields to my table.
case 'login':
///////////// login to the server /////////
// login parts (within array $_POST): //
// from - user logging in //
// pwd - password //
///////////////////////////////////////////
$query = @mysql_query("SELECT buddylist FROM users WHERE alias='".mysql_real_escape_string($from)."' AND pass='".$pwd."'");
if(@mysql_num_rows($query) > 0) {
$user = mysql_fetch_assoc($query);
$set_status = @mysql_query("UPDATE users SET is_online='1' WHERE alias='".mysql_real_escape_string($from)."'");
if(strlen($user['buddylist']) > 0) {
$buddylist = user_event($from, $user['buddylist'], 'status,1');
$output['buddy'] = $json->encode($buddylist);
} else {
$output['buddy'] = Array();
}
print($json->encode($output));
} else {
print 'invalid';
}
break;
Can anyone notice anyhting that make it not work?
Thanks
xLG