Anyshop Fehler

10/15/2017 20:42 x_Core_x#1
Hi, habe den Anyshop eingefügt und bekomme folgende Fehler:


Ingame:


[Only registered and activated users can see links. Click Here To Register...]


Putty:


[Only registered and activated users can see links. Click Here To Register...]

Syserr's sind alle leer.

Jemand eine Idee?
10/16/2017 18:13 Lauling#2
man kann die bilder nicht sehen, lade sie doch auf den image host dienst von epvp hoch.

mfg
10/16/2017 18:41 MaxChri#3
Quote:
Originally Posted by Lauling View Post
man kann die bilder nicht sehen, lade sie doch auf den image host dienst von epvp hoch.

mfg
[Only registered and activated users can see links. Click Here To Register...]
10/16/2017 20:05 Lauling#4
der fehler in putty?
10/16/2017 21:23 x_Core_x#5
Bin zu blöd dafür xD Hier der Link müsst eigentlich gehn:
[Only registered and activated users can see links. Click Here To Register...]
10/16/2017 21:47 Lauling#6
dieser fehler erscheint normalerweise dann, wenn das passwort vom user root nicht mit dem passwort übereinstimmt, welches in den configs steht.

Hast du etwas am mysql ordner geändert oder an den core configs?

mfg
10/17/2017 00:07 x_Core_x#7
Ne nichts geändert und die configs sehen so aus:

PLAYER_SQL: localhost user pw player
10/17/2017 06:14 Lauling#8
poste mal die quest zu dem anyshop, eventuell wird da ne query oder so auf die db ausgeführt und wenn da das pw nicht stimmt stammt der fehler davon.
10/17/2017 12:16 x_Core_x#9
Ja da wird auf jeden Fall ne Query ausgeführt.
Wo müsste das Passwort dann eingetragen werden?

Hier der Ausschnitt aus der Quest:
Code:
				local stringTable, tableItems = {}, mysql_query("SELECT shopitems.vnum, shops.shop_id, categories.name as category, shopitems.preis, shopitems.rabatt, IFNULL(TIMESTAMPDIFF(second, NOW(), shopitems.angebot),0) as seconds, shops.suffix, categories.cat_id FROM anyshop.shopitems JOIN anyshop.shops ON shops.shop_id = shopitems.shop_id JOIN anyshop.categories ON categories.cat_id = shopitems.cat_id ORDER BY verkauft DESC;")
				if (tableItems==nil or tableItems[1]==nil) then syschat("Abbruch. Bitte fülle die Tabelle korrekt! Error:1") return end
				local tableCount = table.getn(tableItems)
				cmdchat("AnyShop ClearBoard/")
10/17/2017 12:28 Lauling#10
darin liegt der fehler.
Gibt es in der quest nirgends eine stelle wo das definiert wird, hast du schonmal gesucht?
10/17/2017 12:37 x_Core_x#11
Für mich nichts ersichtlich, hier die ganze Quest:

Code:
-- Quest File written by Kilroy.
-- Function: AnyShop Lua/Python/Sql
-- Questpart: 1/1
quest AnyShop begin
	state start begin
		when login begin
			cmdchat(string.format("AnyShop index/%d", q.getcurrentquestindex()))
		end
		when button begin
			cmdchat("getinputbegin")
			local INPUT = AnyShop.stringSplit(input(cmdchat("AnyShop input/")), "/")
			cmdchat("getinputend")
			if INPUT[1]=="open" then
				if not AnyShop.AntiFlood_(1, 3) then return end

				local stringTable, tableItems = {}, mysql_query("SELECT shopitems.vnum, shops.shop_id, categories.name as category, shopitems.preis, shopitems.rabatt, IFNULL(TIMESTAMPDIFF(second, NOW(), shopitems.angebot),0) as seconds, shops.suffix, categories.cat_id FROM anyshop.shopitems JOIN anyshop.shops ON shops.shop_id = shopitems.shop_id JOIN anyshop.categories ON categories.cat_id = shopitems.cat_id ORDER BY verkauft DESC;")
				if (tableItems==nil or tableItems[1]==nil) then syschat("Abbruch. Bitte fülle die Tabelle korrekt! Error:1") return end
				local tableCount = table.getn(tableItems)
				cmdchat("AnyShop ClearBoard/")


				local moneyQuery, moneyColumns = "", mysql_query("SELECT coin_column, suffix, name, shop_id FROM anyshop.shops;")
				if (moneyColumns==nil or moneyColumns[1]==nil) then syschat("Abbruch. Bitte fülle die Tabelle korrekt! Error:2") return end 
				for i=1, table.getn(moneyColumns), 1 do moneyQuery = moneyQuery..(i==1 and "" or ",")..moneyColumns[i][1] end
				local money = mysql_query("SELECT "..moneyQuery.." FROM account.account WHERE id = "..pc.get_account_id()..";")
				if (money==nil or money[1]==nil) then syschat("Abbruch. Bitte fülle die Tabelle korrekt! Error:3") return end 
				local moneyCMD = "AnyShop config/"
				for i=1, table.getn(money[1]), 1 do moneyCMD = moneyCMD..(i==1 and "" or "|")..money[1][i]..","..moneyColumns[i][2]..","..moneyColumns[i][3]..","..moneyColumns[i][4] end
				cmdchat(moneyCMD)


				if tableCount==0 then return end
				for i=1, tableCount, 1 do table.insert(stringTable, string.format("%d,%d,%s,%d,%d,%d,%s,%d", unpack(tableItems[i]))) end
				local AddToListCMD = "AnyShop AddToList/"..stringTable[1]
				for i=2, tableCount, 1 do
					if string.len(AddToListCMD)+string.len(stringTable[i])>=490 then
						cmdchat(AddToListCMD)
						AddToListCMD = "AnyShop AddToList/"..stringTable[i]
					else
						AddToListCMD = AddToListCMD.."|"..stringTable[i]
					end
					if i==tableCount then
						cmdchat(AddToListCMD)
						break
					end
				end
				cmdchat("AnyShop FinishSending/")

			elseif INPUT[1]=="buy" then
				if not AnyShop.AntiFlood_(2, 3) then return end

				local itemVnum = tonumber(INPUT[2])
				local itemCount = tonumber(INPUT[3])
				local shopId = tonumber(INPUT[4])
				if (itemVnum==nil or itemVnum<10) or (itemCount==nil or itemCount<1) then return end

				local choosenItem = mysql_query("SELECT shopitems.vnum, shopitems.preis, shopitems.rabatt, IFNULL(TIMESTAMPDIFF(second, NOW(), shopitems.angebot),0) as seconds, shops.coin_column, shops.suffix, shops.shop_id FROM anyshop.shopitems JOIN anyshop.shops ON shops.shop_id = shopitems.shop_id WHERE shopitems.vnum="..itemVnum.." and shopitems.shop_id="..shopId..";")
				if (choosenItem[1]~=nil or table.getn(choosenItem[1]))==0 then syschat("Das Item ist nicht (mehr) vorhanden!") return end
				local sqlVnum, itemPrice, itemRabatt, itemAngebotSek, moneyColumn, Suffix, sqlShopId = tonumber(choosenItem[1][1]),tonumber(choosenItem[1][2]),tonumber(choosenItem[1][3]),tonumber(choosenItem[1][4]),choosenItem[1][5],choosenItem[1][6],tonumber(choosenItem[1][7])
				if (sqlVnum~=itemVnum) or (sqlShopId~=shopId) then return end

				itemPrice = itemPrice * itemCount
				if (itemAngebotSek>=0 and itemRabatt>0) then
					itemPrice = itemPrice-math.floor(itemPrice*(itemRabatt/100))
				end

				local money = mysql_query("SELECT "..moneyColumn.." FROM account.account WHERE id = "..pc.get_account_id()..";")[1][1]
				if money<itemPrice then syschat("<Shop> Du hast nicht genug "..Suffix.." für dieses Item.") return end

				mysql_query("UPDATE account.account, anyshop.shopitems SET account."..moneyColumn.." = account."..moneyColumn.."-"..itemPrice..", shopitems.verkauft = shopitems.verkauft+1 WHERE account.id = "..pc.get_account_id().." AND (shopitems.vnum="..itemVnum.." AND shopitems.shop_id="..shopId..") ;")
				money = mysql_query("SELECT "..moneyColumn.." FROM account.account WHERE id = "..pc.get_account_id()..";")[1][1]
				cmdchat("AnyShop setmoney/"..shopId.."/"..money)

				pc.give_item2_select(itemVnum, 1)
				itemCount = itemCount - 1
				if item.has_flag(4) and itemCount>0 then
					for i=1, math.floor(itemCount/200), 1 do
						pc.give_item2(itemVnum, 200)
					end
					pc.give_item2(itemVnum, (itemCount - math.floor(itemCount/200)*200))
				else
					for i=1, itemCount, 1 do pc.give_item2(itemVnum) end
				end
			end
		end
		function stringSplit(str, sep)
			local sep, fields = sep or ",", {}
			local pattern = string.format("([^%s]+)", sep)
			string.gsub(str, pattern, function(c) table.insert(fields, c) end)
			return fields
		end
		function AntiFlood_(n, t)
			if pc.getqf("AntiFlood"..n)>get_time() then
				syschat(string.format("Deine nächste Anfrage geht erst in %d Sekunden!", pc.getqf("AntiFlood"..n)-get_time()))
				return false
			end
			pc.setqf("AntiFlood"..n, get_time()+t)
			return true
		end
	end
end
10/17/2017 12:45 Lauling#12
dann wird es in der questing.lua oder questlib.lua festgelegt.
suche nach mysql_query
PHP Code:
local ql = {
    [
"user"] = "root",
    [
"pass"] = "",
    [
"ip"] = "localhost",
    [
"db"]    = "player"
}
function 
mysql_query_old(query,user,pass,db,ip)
    
local pre ''
    
if query == '' or query == nil then
        error
("Query muss gesetzt sein!")
    
end
    user 
user or ql.mysql["user"]
    
pass pass or ql.mysql["pass"]
    
ip ip or ql.mysql["ip"
PHP Code:
mysql_query = function(query)
    if 
not pre then
        local rt 
io.open('CONFIG','r'):read('*all')
        
pre,_string.gsub(rt,'.+PLAYER_SQL:%s(%S+)%s(%S+)%s(%S+)%s(%S+).+','-h%1 -u%2 -p%3 -D%4')
    
end
    math
.randomseed(os.time())
    
local fi,t,out 'mysql_data_'..math.random(10^9)+math.random(2^4,2^10),{},{}
    --
os.execute('mysql '..pre..' --e='..string.format('%q',query)..' > '..fi) -- für MySQL51
    os
.execute('mysql '..pre..' -e'..string.format('%q',query)..' > '..fi) -- für MySQL55
    
for av in io.open(fi,'r'):lines() do table.insert(t,split(av,'\t')) endos.remove(fi);
    for 
2table.getn(t) do table.foreach(t[i],function(a,b)
        
out[i-1]               = out[i-1] or {}
        
out[i-1][a]            = tonumber(b) or or 'NULL'
        
out[t[1][a]]           = out[t[1][a]] or {}
        
out[t[1][a]][i-1]      = tonumber(b) or or 'NULL'
    
endend
    
return out
end 
da wird das definiert.
sieht das bei dir auch so aus?
10/17/2017 12:56 x_Core_x#13
Sieht bei mir so aus :
Code:
mysql_query = function(query)
	math.randomseed(os.time())
	local fi,t,out = 'mysql_data_'..math.random(10^9)+math.random(2^4,2^10),{},{}
	os.execute('mysql --login-path=local -e'..string.format('%q',query)..' > '..fi)
	for av in io.open(fi,'r'):lines() do table.insert(t,split(av,'\t')) end; os.remove(fi);
	for i = 2, table.getn(t) do 
		table.foreach(t[i],function(a,b)
		out[i-1]				= out[i-1] or {}
		out[i-1][a]				= tonumber(b) or b or 'NULL'
		out[t[1][a]]			= out[t[1][a]] or {}
		out[t[1][a]][i-1]		= tonumber(b) or b or 'NULL'
		end)
	end
	out.__lines = t[1]
	return out
end
und das noch :

Code:
--[[
    [MENTION=286917]name[/MENTION]   mysql_query_old
    [MENTION=1332190]author[/MENTION] Mijago
    [MENTION=1496828]needs[/MENTION]  split
    [MENTION=316630]DEsc[/MENTION]r
Die Alte Version der MySQL-Query-Funktion.
--]]
local ql = {
    ["user"] = "root",
    ["pass"] = "",
    ["ip"] = "localhost",
    ["db"]    = "player"
}
function mysql_query_old(query,user,pass,db,ip)
    local pre = ''
    if query == '' or query == nil then
        error("Query muss gesetzt sein!")
    end
    user = user or ql.mysql["user"]
    pass = pass or ql.mysql["pass"]
    ip = ip or ql.mysql["ip"]
    if user ~= '' and user ~= nil then pre = pre..' -u'..user end
    if pass ~= '' and pass ~= nil then pre = pre..' -p'..pass end
    if db ~= '' and db ~= nil then pre = pre..' -D'..db end
    if ip ~= '' and ip ~= nil then pre = pre..' -h'..ip end
    math.randomseed(os.time()); local rand = math.random(0,10^7) -- Erstellen der Pfadvariable
    local path = 'data/mysql_output_'..os.time()..'_'..rand..'_'..pc.get_vid()
    os.execute ("mysql "..pre.." --e=\""..query.."\" > "..path) -- Laden und Auflisten der Dateiinhalte
    local fi,q = io.open(path,"r"),{["l"] = {},["out"]={}}
    if fi == nil then
        return "ERROR"
    end
    for line in fi:lines() do table.insert(q.l,(split(line,"\t"))) end
    os.remove(path)
    if type(q.l[1]) ~= "table" then 
        return "ERROR"
        --error("Fehler bei der MySQL Verbindung oder bei der Rückgabe! Abbruch!")
    end
    local ix = 0
    table.foreachi(q.l,function(i,l)
        if i > 1 then table.foreach(l,function(i2,l2)
            if q.out[q.l[1][i2]] == nil then q.out[q.l[1][i2]] = {} end
            local c =  tonumber(l2)
            if type(c) == "number" and l2 == tostring(c) then
                q.out[q.l[1][i2]][i-1] = c
            else
                q.out[q.l[1][i2]][i-1] = l2
            end
        end) end
    end)
    -- ENDE der eigentlichen MySQL-Funktion
    -- START Zusatz: Hanashi-Kompatibilität & Fehlerbehandlung
    q.out.__data = q.l[1]
    setmetatable(q.out, { __index = function(a,b) 
        if type(b) == "number" then
            return (a[a.__data[b]] or {"ERROR"})
        end
        return "ERROR"
        --error("Fehler bei Indexierung: Index "..b.." ist nicht vorhanden!")
    end})
    return q.out
end
10/17/2017 15:23 Lauling#14
PHP Code:
 ["user"] = "root",
    [
"pass"] = "",
    [
"ip"] = "localhost",
    [
"db"]    = "player" 
schon mal versucht hier
PHP Code:
    ["pass"] = ""
dein pw einzusetzen
10/17/2017 15:31 x_Core_x#15
Kommen die gleichen Fehler