mysql - Rewriting javascript code to php, what is the difficulty level -


this question has answer here:

im wondering better use security.

can written in php? id switch of functions of site javascript.

var withdrawing; function withdraw() {   withdrawing=false;   $.msgbox({     title:"withdraw funds",     content:"<div id=\"_withdraw_content\"><br><small>enter valid <?php echo $settings['currency_sign']; ?> address:</small><br><input id=\"w_valid_ltc\" type='text' class='l' style='width: 100%;'><br><br><small>enter amount paid-out:</small><br><input id=\"w_amount\" type='text' class='l' style='width: 100px; text-align: center;'><br><br><small><small>min. value: <b>0.001</b> <?php echo $settings['currency_sign']; ?><br>we charge fee <b>0.0002</b> <?php echo $settings['currency_sign']; ?> each withdrawal.</small></small></div>",     type:"info",     opacity:0.8,     buttons: [{ value: "withdraw" }, { value: "cancel" }],     success: function(button) {       if (button=="withdraw" && withdrawing==false) {         w_amount=$("input#w_amount").val();         w_valid=$("input#w_valid_ltc").val();         if (w_amount!='' && w_valid!='') {           $("#_withdraw_content").html('<div style=\"height: 50px;\"></div>&nbsp;&nbsp;&nbsp;<img src="content/images/ajax_loader.gif">');           withdrawing=true;           _requestwithdraw(w_amount,w_valid);         }         else {           alert('one of required fields stayed empty!');         }       }     }   });         return false; } 

if prot function escapes input code has no sql injection issue.

what code have though synchronization bug. if runs script multiple times @ same time it's possible transaction can happen multiple times - assuming webserver runs multiple php threads, does. means user can end negative balance.

you need implement kind of locking assure 1 seller can not initiate more 1 transaction @ time.

file locks (using flock) simple , straightforward way lock mutex in php.


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

inno setup - TLabel or TNewStaticText - change .Font.Style on Focus like Cursor changes with .Cursor -