SA-MP Forums Archive
random string - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: random string (/showthread.php?tid=640588)



random string - Bussyman - 04.09.2017

Hi,

Код:
stock randomString(strDest[], strLen = 10)
{
	while(strLen--)
	{
	    new nntte = random(3);

	    if( nntte == 0 )
	    {
	        nntte = random(26) + 'A';
	    }
	    else if( nntte == 1 )
	    {
	        nntte = random(26) + 'A';
	    }
	    else if( nntte == 2 )
	    {
	        nntte = arraygf[random(sizeof(arraygf))] + '0';
	    }
		strDest[strLen] = nntte;
	}
}
With this function i create random string, and i write it in mysql database i need to escape it?


Re: random string - Vince - 04.09.2017

Oh for the love of ... Just use %e in mysql_format for whatever text you insert wherever. If it doesn't help it doesn't hurt either.




Re: random string - Bussyman - 04.09.2017

Yes i know need to escape, but i just ask for this specific function, do i need?


Re: random string - jlalt - 04.09.2017

Quote:
Originally Posted by Bussyman
Посмотреть сообщение
Yes i know need to escape, but i just ask for this specific function, do i need?
not really, as long as you don't have ; or ' characters.
and as Vince said just use %e to escape, if it won't help it won't hurt either.


Re: random string - Paulice - 04.09.2017

Never trust any input, these may change at any time. Escape everything.