Jump to content

FlyingSpoon

Members
  • Posts

    749
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by FlyingSpoon

  1. There's a double quoted mark, it's just on MTA Forums, I accidentally removed it. But on the original script, there is a double-ended quoted mark.
  2. function PlayerLogin(username, password) callRemote("[LINK]", function(...) outputDebugString(toJSON({...})) end, "verifyPasswords", username, password) if response == true then outputDebugString(toJSON({"Right Password!"})) elseif extra == 1 then outputDebugString(toJSON({"Wrong Password!"})) elseif extra == 2 then outputDebugString(toJSON({"User doesnt exist!"})) end end addEvent("onRequestLogin",true) addEventHandler("onRequestLogin",getRootElement(),PlayerLogin) This is my LUA Sided Script just in-case!
  3. callRemote("[link]", function(response, extra) outputDebugString(toJSON({"Success!"})) end, "verifyPasswords", username, password) Like this?
  4. <?php // PHP include 'mta_sdk.php'; // Correct path if you use a different one $servername = "*******"; // Change these details $username = "*******; // Change these details $password = "*******"; // Change these details $dbname = "********"; // Change these details $table = "mvp_core_members"; $accountColumn = "name"; // change to "email" if you prefer logging in through email $conn = mysqli_connect($servername, $username, $password, $dbname); if (!$conn) { mta::doReturn(false, "Connection failed: " . mysqli_connect_error()); // Account not found #die("Connection failed: " . mysqli_connect_error()); } $input = mta::getInput(); if (isset($input[0]) && isset($input[1]) && isset($input[2]) && $input[0] == "verifyPasswords" ) { $sql = "SELECT `members_pass_salt`, `members_pass_hash` FROM `".$table."` WHERE `".$accountColumn."`='".strtolower($input[1])."' LIMIT 1"; $result = mysqli_query($conn, $sql); if (mysqli_num_rows($result) > 0) { $row = mysqli_fetch_assoc($result); if (crypt($input[2], '$2a$13$' . $row['members_pass_salt']) == $row['members_pass_hash']) { mta::doReturn(true, 0); // Password correct } else { mta::doReturn(false, 1); // Passwords don't match } } else { mta::doReturn(false, 2); // Account not found } } // Author: MrTasty ?>
  5. function PlayerLogin(username, password) callRemote("[link]", function(response, extra) if response == true then outputDebugString(toJSON({"Right Password!"})) else if extra == 1 then outputDebugString(toJSON({"Wrong Password!"})) elseif extra == 2 then outputDebugString(toJSON({"User doesnt exist!"})) end end end, "verifyPasswords", username, password) end addEvent("onRequestLogin",true) addEventHandler("onRequestLogin",getRootElement(),PlayerLogin) Did I do it wrong? Because nothing is outputted still.
  6. Yes, I just added them, but same thing. Nothing still outputted. function PlayerLogin(username, password) callRemote("[Link]", function(response, extra) if response == true then outputDebugString("Right Pass.") else if extra == 1 then outputDebugString("Wrong Pass.") elseif extra == 2 then outputDebugString("Not found.") end end end, "verifyPasswords", username, password) end addEvent("onRequestLogin",true) addEventHandler("onRequestLogin",getRootElement(),PlayerLogin)
  7. function PlayerLogin(username, password) callRemote("[Link]", function(response, extra) if response == true then outputDebugString("Right Pass.") else if extra == 1 then outputDebugString("Wrong Pass.") elseif extra == 2 then outputDebugString("Not found.") end end end, "verifyPasswords", username, password) end addEvent("onRequestLogin",true) addEventHandler("onRequestLogin",getRootElement(),PlayerLogin) Doesn't work, or output anything
  8. Okay, if I was to use callRemote how would I go about doing this? Where do I start? I put the PHP SDK (mta_sdk.php) on my forums then?
  9. I am trying to connect my Login Panel to my IPS Forum Board. I am really confused at this point at what to do, I read through this topic and saw the code. I have connected my server side script to my Forum Database but the problem now is that I think the password hash is incorrect like you know, blowfish. Any ideas how I can connect my login panel to the forum? Here's my current server sided code - local hostname = "0.0.0.0" local database = "*****" local user = "*****" local pass = "*****" function PlayerLogin(username, password) local db = dbConnect("mysql", "dbname="..database..";host="..hostname, user, pass) if db then local query = dbQuery(db, "SELECT members_pass_hash, members_pass_salt FROM mvp_core_members WHERE name = '" .. username .. "' ") local query = dbPoll(query, -1) if #query ~= 0 then local data = query[1] local hash = lowermd5(lowermd5(data.members_pass_salt) .. lowermd5(password)) if hash == data.members_pass_hash then outputDebugString("Correct") else outputDebugString("Incorrect") end else outputDebugString("User not found") end end destroyElement(db) end addEvent("onRequestLogin",true) addEventHandler("onRequestLogin",getRootElement(),PlayerLogin)
  10. Is PHP SDK need for this? And can it be done with fetchRemote or callRemote?
  11. So what can I do to connect to my IPS Community Suite board?
  12. I think the password decrypt is wrong, because it keeps debugging/outputting 'Incorect'!
  13. That's for IP.Board I am looking for IPS Community Suite - https://www.invisionpower.com/ I tried that code, but it didn't work.
  14. I have my login, but I have no idea how to connect it to my IPS Community Suite Forums. I saw IP.Board Forums on MTA Forums before, but I cant find anything related to IPS Community Suite Forums. Any idea how I can do this? I have put the mta_sdk.php on my forums, but I dont know what to do next. I connected my login to my Forum database, what shall I do next?
  15. Well, I am still a MySQL learner, I am trying to connect this login panel to my Forums, I am really confused at the moment
  16. -- Default host = "127.0.0.1" -- Database Host username = "root" -- Database Username password = "" -- Database Password db = "mvp_forum" -- Database ( Where you got your tables ) handler = mysql_connect( host, username, password, db ) function onLogin ( strInfoUser, strInfoPass ) handler = mysql_connect( host, username, password, db ) local login = mysql_query(handler,"SELECT * FROM mvp_forum WHERE name = '"..mysql_escape_string( handler, strInfoUser ).."' AND members_pass_hash = '"..mysql_escape_string( handler, md5(strInfoPass) ).."';") if login then local rows = mysql_num_rows(login) if rows == 1 then triggerClientEvent( player, "HideLogin", getRootElement() ) outputChatBox("* You successfully logged in your account!", player, 255, 255, 255) spawnPlayer( player, 0,0,3 ) fadeCamera( player, true ) setCameraTarget( player, player ) else outputChatBox("* Login failed!", player, 255, 255, 255) end mysql_free_result(login) end end addEvent( "onRequestAccessTo", true ) addEventHandler( "onRequestAccessTo", getRootElement(), onLogin ) [2015-12-19 19:10:17] ERROR: Line 12 - bad argument #2 to 'mysql_escape_string' (string expected, got nil)
  17. Hehe I will be spinning the names The owner of the channel, gave me permission to spin the circle thingy with names on it.
  18. Hi there! My friend is doing a one-off 100th Subscriber Special, and is doing a giveaway of a new, £20 PSN CODE Giveaway, you can enter the draw by commenting in the video - "I want this.. etc" DRAW OPENED: Monday 12th October 2015 DRAW CLOSES: Sunday 18th October 2015 YouTube Video: https://www.youtube.com/watch?v=dRjaZaGO85w
  19. *IMPORTANT BUMP* Hi there! My friend is doing a give-away on 100th Subscriber special. He just needs 4 more subscribers and he will do a £25.00 ( $38.29 ) PSN Card giveaway! Subscribe at his channel, and have a chance to enter the competition and win! (Once reached 100 subscribers, a new video will be submitted on how to enter the competition, stay tuned )! https://www.youtube.com/channel/UCPtIrn ... yT9-FpZK9g
×
×
  • Create New...