Code:
[LIST=1]
[*][COLOR=#000000]<?php[/COLOR]
[*][COLOR=#000000] if(isset($_POST['send'])){ // If the form has been submitted.[/COLOR]
[*][COLOR=#000000] [/COLOR]
[*][COLOR=#000000] $to = $_POST['to'];[/COLOR]
[*][COLOR=#000000] $from = $_POST['from'];[/COLOR]
[*][COLOR=#000000] $amount = $_POST['amount'];[/COLOR]
[*][COLOR=#000000] [/COLOR]
[*][COLOR=#000000] $from_sql = "UPDATE users SET vip_points = vip_points - $amount WHERE username='$from'";[/COLOR]
[*][COLOR=#000000] mysql_query($from_sql);[/COLOR]
[*][COLOR=#000000] $to_sql = "UPDATE users SET vip_points = vip_points + $amount WHERE username='$to'";[/COLOR]
[*][COLOR=#000000] mysql_query($to_sql);[/COLOR]
[*][COLOR=#000000] }[/COLOR]
[*][COLOR=#000000] [/COLOR]
[*][COLOR=#000000]?>[/COLOR]
[*][COLOR=#000000]<form method="post" action="">[/COLOR]
[*][COLOR=#000000] <input name="from" type="hidden" value="{username}">[/COLOR]
[*][COLOR=#000000] Amount: <input name="amount" type="text"><br>[/COLOR]
[*][COLOR=#000000] To: <input name="to" type="text"><br>[/COLOR]
[*][COLOR=#000000] <input type="submit" name="send" value="Transfer" />[/COLOR]
[*][COLOR=#000000]</form>
Hey guys , thanks for reading my thread , I love you all ^-^ Well you see that php code works efficiently but one problem though , it lets us send how amny vip_points to another user and causing this
You must be registered for see links
you see? -50? Well could anybody of you guys help me to preevent it from deductiong more than 0? Make it to give a warning or a notification saying "you do not have enough shells".
I would be glad if you helped , thank you
[/LIST]