![]() |
|
What does this code do? - Printable Version +- Sinisterly (https://sinister.ly) +-- Forum: Coding (https://sinister.ly/Forum-Coding) +--- Forum: Coding (https://sinister.ly/Forum-Coding--71) +--- Thread: What does this code do? (/Thread-What-does-this-code-do) |
What does this code do? - MRIDGAF - 06-06-2014 Code: onclick=" document.getElementById('action').value='takeBet' ; document.getElementById('betId').value='253307' ; document.getElementById('form').submit(); return false;"I am playing an online browser MMORPG and I want to know how the 50/50 bet application functions and this code goes with the takebet link, can someone help me out? RE: What does this code do? - dropzon3 - 06-06-2014 When you click the button/link it executes the that javascript which: Gets the element with the id named 'action' and sets it to the value takeBet. I'd guess this is a hidden input element. Similarly it does the same for an element with the id 'betid' setting it to the value 253307 which likely changes per bet. Finally it submits the form which I imagine both of these elements were part of It returns false to prevent the click action from continuing and actually executing its normal action(like changing pages if its a link) RE: What does this code do? - MRIDGAF - 06-07-2014 Is there a way to be able to tell the outcome of when you click the link... whether or not you win or lose the bet? RE: What does this code do? - erpicci - 06-07-2014 If I understand correctly, once the form is submitted the server "takes" your bet and computes whether you won or not internally. In words, the random event takes place only after your bet, so you cannot tell if you are going to win or lose. As an alternative, you could try to hack the Random Number Generator (RNG) used by the server, but this sounds infeasible. RE: What does this code do? - dropzon3 - 06-07-2014 No you can't determine the outcome from the form submission. The outcome is determined on the server this just sends the bet to the server. Quote:As an alternative, you could try to hack the Random Number Generator (RNG) used by the server, but this sounds infeasible. Breaking pRNGs isn't actually all that infeasible in a lot of cases. Its sounds a lot more impressive than it actually is. Of course since its a gambling site you'd hope they are using a csprng (cryptographically secure prng) which generally is mathematically infeasible to break unless you find break mathematically. In general though its possible as many sites(and developers behind them) don't actually consider the security of their rng and may just use the default which is usually insecure. RE: What does this code do? - MRIDGAF - 06-08-2014 It isn't a gambling site, it is a MMORPG with a 50/50 bet feature in it. |