BigBobby Posted July 19, 2007 Share Posted July 19, 2007 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 any one notice anyhting? Quote Link to comment Share on other sites More sharing options...
fenway Posted July 20, 2007 Share Posted July 20, 2007 What problems? You're hiding errors, and you haven't posted final queries. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.