barneycg / temars-eve-api

17 stars 12 forks source link

Jabber Plugin -- Inserting Username into Database #21

Open drkthunder02 opened 9 years ago

drkthunder02 commented 9 years ago

When calling the function to add a user to Jabber the following source is not passing the correct variable. When the function is passing the variable, it only passes the Teamspeak formatted name as the username instead of the Jabber formatted username. I have isolated the function being called, just not the callee of the function. I could not get the function to use the UserService plugin for various reasons, which I think is because jabber isn't located in my /var/www/html directory, but is located elsewhere on the server.

Server Hardware: Dell PowerEdge R610 Ram: 8 GB HD: 500 GB OS: Ubuntu 14.04 LTS (64 bit)

File Location: /Sources/TEA_Jabber_OF.php

function add_user($uname, $pw, $name, $email, $groups) { $secret = $this -> modSettings['tea_jabber_secret']; $groups = implode(",", $groups); $uname = strreplace("'", "", $uname); $uname = strreplace(" ", "", $uname); $name = strreplace("'", "", $name); $name = strreplace(" ", "", $name);

    //$url = $this -> modSettings['tea_jabber_admin_url'].'/plugins/userService/userservice?type=add&secret='.$secret.'&username='.$uname.'&password='.$pw.'&name='.$name.'&email='.$email.'&groups='.$groups;
    //$url = str_replace(" ", "%20", $url);
    //$site = $this -> get_site($url);
    //return;
    $this -> db_connect();
    $check = $this -> select("SELECT username from ofUser WHERE username = '".mysql_real_escape_string($name)."'");
    if(!empty($check))
    {
        return("UserName Exists already");
    }
    $this -> query("INSERT INTO ofUser (username, plainPassword, email, creationDate, modificationDate) VALUES ('".mysql_real_escape_string($name)."', '".mysql_real_escape_string($pw)."', '".mysql_real_escape_string($email)."', ".time().", 0)");
}

To replicate this issue, comment out the lines in the file I have listed above, then add a new user into Jabber. When viewing the database for the Jabber service itself, the username is shown as the Teamspeak username rather than the Jabber username. I can be reached at mancuso.christopher@gmail.com if you have any further questions.