Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.

PHP Help with this code please!


ghost's Avatar
0 0

Ok, so i have code that (in a phpfusion page) update a users sql field called user_points with the points i specify them to have… and its this..

$result = dbquery('update '.$db_prefix.'users set user_points=user_points+25 where user_id='.$userdata['user_id'].' limit 1;');
?>```

What i'm wondering is... if theres a way to only allow each phpfusion user to hit this code once... for example, they complete a challenge... make it to this page, it tells them their points are updated and they are. is there a way to stop them from refreshing the page and having it update they're points multiple times, a kind of block by the username in phpfusion????

thank you to anyone that helps me.

ghost's Avatar
0 0

make another sql field that is a boolean declaring whether or not they have completed it. first select it from the table, then if its == true, then dont insert the points, otherwise, insert the points, and update the boolean making it true.


ghost's Avatar
0 0

could not of said it better. Let us know how it works out.

(and I hope you're not running an HBH-a-like)


ghost's Avatar
0 0

but a boolean would be simple… if it werent for multiple challenges… there will be a bunch of challenges is the problem… so what do you suggest now??

and its not a hbh-a-like … its its own identity… because technically i would call this a hackthissite-a-like or vice versa, so whats to say one website cant be similar to another? thats what makes websites better is pure competition… i plan not to challenge this site anyway, moreso teach my friends general web hacking. i'm just doing this to have fun! :)


ghost's Avatar
0 0

ok… nevermind, i'll do a boolean for each challenge… but i'm wondering, whats the php syntax to check if a booleans true, and then output code if it is?


ghost's Avatar
0 0

Umm..isn't it just an if-then statement?


ghost's Avatar
0 0

Ponguile wrote: Umm..isn't it just an if-then statement?

well… if the boolean is true {} else {} so yes… but idk how to declare if a boolean is true… like the php code to determine if a given table rows boolean is true for a given user in phpfusion…