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 fusion issues


ghost's Avatar
0 0

hi i´m planning a site based on php-fusion, here users can solve some maths and logic, like here users solves hacking pieces. but, i cant set up a point system, i created some sql table called user_points, add point indicator on users profile and infusion panel, but how can i set up rankings e.g. if points are > greater than 200 set rank to "good math solver" etc. if anyone have some know-about in a php-fusion, then please help me! thanks in advance


Mr_Cheese's Avatar
0 1
if($points >= 100 && $points < 200) { echo "Rank 1"; }

ghost's Avatar
0 0

I don't know a lot about PHP-Fusion, but this may help:

Make a new column in fusion_users called 'rank' or something, then on the page that adds points the account, make it select the number of points after it increases them, then use an if statement to edit the rank according to how many points they have.


ghost's Avatar
0 0

thank you very much Mr_Cheese, and can i ask on last question to this topic how can i prevent to user adding points for challenges he is already solved? thx [EDIT]and thanks to mastergamer too ;)[/EDIT]


Mr_Cheese's Avatar
0 1

if($userchallengerow != "complete"){
echo "welldone you have completed the challenge. 5 points been added";
} else {
echo "you have already beaten this challenge";
}

when they complete a challenge, update the challenge row with "complete" for that user.


ghost's Avatar
0 0

Have a table which contains the missions which have been completed.

Then run a query like

markup$res = mysql_query ( "SELECT `missionname` FROM `missions` WHERE `username` = 'username'" ); if ( mysql_result ( $res, 0 ) == "completed" ) doAlreadyCompleted(); else doNotCompleted()

Edit, Whoops, too slow, sorry Mr_Cheese, at least he can see the query though


ghost's Avatar
0 0

ok thx to all for help ;)


richohealey's Avatar
Python Ninja
0 0

just use your current thread!

I'll change the title to represent the multitude of topics


ghost's Avatar
0 0

im confused how do i change this to work with my site


ghost's Avatar
0 0

so i have another problem… when i´m not looged in and i´ve try to access members.php i get this error: Notice: Undefined variable: rows in D:\files\progs\EasyPHP 2.0b1\www\fusion\members.php on line 56 so i´ve checked members.php line 56 and it looks good for me, here it is: if ($rows > 20) echo "<div align='center' style='margin-top:5px;'>".makePageNav($rowstart,20,$rows,3,FUSION_SELF."?sortby=$sortby&")."\n</div>\n"; so i dont know what is wrong, when i am logged in, there is no problem, does anyone know what can i do with this? so this is second problem: i have on my page new design, bud i cant get rid of green frame, here is an image: http://img96.imageshack.us/img96/3246/screenshot1352007104123ba0.jpg you can look on it, there can be viewed that frame, and php error too. how can write rank to the database? eg. when user points are 1000, write into database fusion_user table user_rank something like: "Best math solver" etc.. thanks in advance for help


ghost's Avatar
0 0

i used to get loads of Undefined variable errors when i was using easyPHP, use XAMPP instead :)


ghost's Avatar
0 0

yeah i´m getting this errors too, but in new version, 2.0 beta i think, is count of errors reduced.. but still having probs with this so i will try XAMPP thx for recommendation ;)


ghost's Avatar
0 0

also using, error_reporting(0); should get rid of the errors


ghost's Avatar
0 0

so i have external file called ranking.php and in my profile i have include "ranking.php"; code is here:

if($points &gt;= 100) {
dbquerry(&quot;UPDATE &quot;.$db_prefix.&quot;users SET user_rank = &#39;0&#39; WHERE &quot;.$db_prefix.&quot;users.user_id=&#39;$lookup&#39;&quot;);
}```
so this code gathering user points... if the points are &gt; thans 100, update the rank to &quot;noob&quot; but its not working what is wrong on this code? it have been called everywhere where i am displaying user rank but as i say, its not working, where i must fix it? thx
also thx to V1P3R ;)

spyware's Avatar
Banned
0 0

dancuc wrote: so i have external file called ranking.php and in my profile i have include "ranking.php"; code is here:

if($points &gt;= 100) {
dbquerry(&quot;UPDATE &quot;.$db_prefix.&quot;users SET user_rank = &#39;0&#39; WHERE &quot;.$db_prefix.&quot;users.user_id=&#39;$lookup&#39;&quot;);
}```
so this code gathering user points... if the points are &gt; thans 100, update the rank to &quot;noob&quot; but its not working what is wrong on this code? it have been called everywhere where i am displaying user rank but as i say, its not working, where i must fix it? thx
also thx to V1P3R ;)

Dbquery? What function is that?

ghost's Avatar
0 0

eh… sry i dont have much experiences in MySQL using with php. so can you tell me the right syntax? thx [EDIT]i´ve tryed this:

dbquerry(&quot;UPDATE &quot;.$db_prefix.&quot;users SET user_rank = &#39;0&#39; WHERE &quot;.$db_prefix.&quot;users.user_id=&#39;$lookup&#39;&quot;);
}
$points = dbquery(&quot;SELECT user_points FROM &quot;.$db_prefix.&quot;users WHERE user_id=&#39;$lookup&#39;&quot;);
if($points &gt;= 100) {
upToNoob();
}```
but it doesnt work too..
[/EDIT]

ghost's Avatar
0 0

It is 'dbquery'

10 CP's for kaksii


ghost's Avatar
0 0

ok thx i got it


spyware's Avatar
Banned
0 0

Oh wait, it's a php-fusion only function. Retarded system anyway. You did mispell it though.


ghost's Avatar
0 0

V1P3R wrote: also using, error_reporting(0); should get rid of the errors

Dude, seriously. That just doesn't show errors, doesn't stop them existing.

I use error_reporting ( E_ALL ); until there are none on the dev server. I only hide them on the real thing