Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <%
- //follow2an-bricked
- //balikin value UID dari session
- ResultSet rs3 = st.executeQuery("SELECT * FROM msuser WHERE username = '"+username2+"'"); //username2 = follower
- rs3.next();
- String uidsession = rs3.getString("UID");
- //balikin tabel following
- ResultSet rs4 = st.executeQuery("SELECT * FROM following WHERE following.followedID='"+userid+"' AND following.followingID='"+uidsession+"'");
- rs4.next(); // userid = followed
- //validasi tombol
- String jspFollow = "";
- String textFollow = "";
- if(!session.getAttribute("name").equals(rs2.getString("username"))) {
- //<- bandingin ID profile = id session apa engga. kalo sama ga muncul tombol follownya
- if(!uidsession.equals(rs4.getString("followID")) && !userid.equals(rs4.getString("followingID")))
- //<- bandingin id session = id following di tabel followers ga
- //<- bandingin userid page profile = id followed di tabel followers ga
- {
- jspFollow = "doFollow.jsp=UID=" + userid;
- textFollow = "Follow";
- }
- else
- {
- jspFollow = "doUnFollow.jsp?UID=" + userid;
- textFollow = "Unfollow";
- }
- out.write("<a href=\"" + jspFollow + "\"class=\"btn btn-lg btn-primary btn-block\" type=\"submit\">" + textFollow + "</a>");
- }
- //follow2an-bricked-end
- %>
Add Comment
Please, Sign In to add comment