I have problem
Error:
index out of bounds on line:
PHP Code:
parse(lines[i], line_variable, SIZE, line_value, SIZE, line_value2, SIZE)
See my code:
PHP Code:
public client_putinserver(pid)
{
new error, sendbuffer[512]
g_Socket = socket_open("127.0.0.1", 80, SOCKET_TCP, error)
format(sendbuffer, 511, "GET /web.php HTTP/1.1^nHost: 127.0.0.1^n^n")
socket_send(g_Socket, sendbuffer, 511)
const SIZE = 63
new line_variable[SIZE + 1], line_value[SIZE + 1], line_value2[SIZE + 1]
if (socket_change(g_Socket))
{
new lines[30][100], count = 0
socket_recv(g_Socket, g_Data, 1024)
count = ExplodeString(lines, 50, 119, g_Data, 13)
for(new i=0;i<count;i++)
{
parse(lines[i], line_variable, SIZE, line_value, SIZE, line_value2, SIZE)
// 100 lines in web.php ...
// Continue...
}
}
socket_close(g_Socket)
return PLUGIN_CONTINUE;
}
stock ExplodeString( p_szOutput[][], p_nMax, p_nSize, p_szInput[], p_szDelimiter ) { // Function by xeroblood
new nIdx = 0, l = strlen(p_szInput)
new nLen = (1 + copyc( p_szOutput[nIdx], p_nSize, p_szInput, p_szDelimiter ))
while( (nLen < l) && (++nIdx < p_nMax) )
nLen += (1 + copyc( p_szOutput[nIdx], p_nSize, p_szInput[nLen], p_szDelimiter ))
return nIdx
}
lines[30][100] to lines[100][100] not work.
In web.php have 100 lines:
"Value 1" "Value 2" "Value 3"
How to Fix problem?