Jump to content

Changing some fields


BigBobby

Recommended Posts

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?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.