WapTrick360


Share Your Creativity For Wapka
Home » Wapmaster codes » [Advanced] User website rating code
1. Create a forum name Ratings

2. Goto post create and follow these steps







Put this code in 1st box





<span id="ratingbtn">
<div class="blok">
<div class="menu" style="padding:2%;">
Hello <a href="/user?id=68459" class="super-admin">admin</a>
please rate my website by select star 1-5 Thank You.

<center>
<select id="rating" name="content" onchange="this.form.submit()" required>
    <option value="">Select an option</option>
<option value="5">★★★★★</option>
<option value="4">★★★★☆</option>
<option value="3">★★★☆☆</option>
<option value="2">★★☆☆☆</option>
<option value="1">★☆☆☆☆</option>
  </select></center>
</div></div></span>








and 2nd box

Note - don't forget to change forumid to your

<forumid>27163</forumid>
<title>1758384481 admin</title>
<content></content>





Now goto new script then put this code

Note - don't forget to change forumid to your


fid = 27163

local post_check, post_check_list, post_check_stats = api.post_info({forumid=fid})

post_total = tonumber(post_check_stats['total'])

local param = { 
forumid = fid,
limit = post_total }
local is_ok, list = api.post_info(param)


if is_ok then
   rating = list[0].content
  for i, item in ipairs(list) do
    rating = rating + list[i].content

 end
end

rating = rating/post_total


print("Rate by "..post_total.."people -")
if rating == 5 then
  print('<span class="fa fa-star checked"></span><span class="fa fa-star checked"></span><span class="fa fa-star checked"></span><span class="fa fa-star checked"></span><span class="fa fa-star checked"></span>')
elseif rating >= 4 and rating < 5 then
  print('<span class="fa fa-star checked"></span><span class="fa fa-star checked"></span><span class="fa fa-star checked"></span><span class="fa fa-star checked"></span><span class="fa fa-star"></span>')
elseif rating >= 3 and rating < 4 then
  print('<span class="fa fa-star checked"></span><span class="fa fa-star checked"></span><span class="fa fa-star checked"></span><span class="fa fa-star"></span><span class="fa fa-star"></span>')
elseif rating >= 2 and rating < 3 then
 print('<span class="fa fa-star checked"></span><span class="fa fa-star checked"></span><span class="fa fa-star"></span><span class="fa fa-star"></span><span class="fa fa-star"></span>')
elseif rating >= 1 and rating < 2 then
  print('<span class="fa fa-star checked"></span><span class="fa fa-star"></span><span class="fa fa-star"></span><span class="fa fa-star"></span><span class="fa fa-star"></span>')
else
  print("Invalid rating")
end



Total likes [0]
For comment section please Login Or Registration Here
Recent Comments
There are no comments yet
2025 WapTrick360
Version 2.0