SA-MP Forums Archive
Help converting PAWN function to PHP. - 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: Help converting PAWN function to PHP. (/showthread.php?tid=515780)



Help converting PAWN function to PHP. - Hashski - 27.05.2014

I'm currently working on a UCP for my for gamemode however when I created a login / register I realized that my script uses passwords that are whirpooled and then hashed which means I will have to do the same thing on the PHP side of things. So what I need is help converting this PAWN function into PHP, here it is.

Код:
salt[saltSize] = random(2) ? (random(26) + (random(2) ? 'a' : 'A')) : (random(10) + '0');



Re: Help converting PAWN function to PHP. - DobbysGamertag - 27.05.2014

It'd be the same in PHP wouldn't it?

Not sure if this helps:

http://www.w3schools.com/php/func_math_rand.asp
http://us2.php.net/manual/en/function.hash.php
http://stackoverflow.com/questions/2...ool-by-default


Re: Help converting PAWN function to PHP. - Hashski - 28.05.2014

Quote:
Originally Posted by DobbysGamertag
Посмотреть сообщение
Oh thanks, but what would the colons and question marks mean in the pawno and how would I do the same in php for those. If someone could rewrite it for me in php that'll be great.

Edit: I understand that the questions marks and colons are if...else statements but I have no idea how.


Re: Help converting PAWN function to PHP. - Threshold - 28.05.2014

They are called ternary operators. Slice made a helpful thread on these kind of tips and tricks that explain these operators in full detail.

https://sampforum.blast.hk/showthread.php?tid=216730