Guest User

Untitled

a guest
Jun 7th, 2016
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. <%
  2. //follow2an-bricked
  3.  
  4. //balikin value UID dari session
  5. ResultSet rs3 = st.executeQuery("SELECT * FROM msuser WHERE username = '"+username2+"'");
  6. rs3.next();
  7. String uidsession = rs3.getString("UID");
  8.  
  9.  
  10. //balikin tabel following
  11. ResultSet rs4 = st.executeQuery("SELECT * FROM following WHERE following.followedID='"+userid+"' AND following.followedID='"+uidsession+"'");
  12. rs4.next();
  13.  
  14.  
  15. //validasi tombol
  16.  
  17. if(!session.getAttribute("name").equals(rs2.getString("username")))
  18. //<- bandingin ID profile = id session apa engga. kalo sama ga muncul tombol follownya
  19.  
  20. if(!uidsession.equals(rs4.getString("followID")) && !userid.equals(rs4.getString("followingID")))
  21. //<- bandingin id session = id following di tabel followers ga
  22. //<- bandingin userid page profile = id followed di tabel followers ga
  23. {
  24. %>
  25. <a href="doFollow.jsp?UID=<%=userid%>" class="btn btn-lg btn-primary btn-block" type="submit">Follow</a>
  26. <%
  27. }
  28. else
  29. {
  30. %>
  31. <a href="doUnFollow.jsp?UID=<%=userid%>" class="btn btn-lg btn-primary btn-block" type="submit">Unfollow</a>
  32. <%
  33. }
  34. //follow2an-bricked-end
  35. %>
Advertisement
Add Comment
Please, Sign In to add comment