Click to See Complete Forum and Search --> : Desperatly seeking help!!!


unwise
03-28-2003, 10:09 AM
I want to know how I can make something, like the code below, only show up if the user is not logged in to my forums. I know it's possible to do with images cuz when not logged in you see "register" and "login" button, but when logged in, you don't. Is what I'm asking possible?

Here's the code I want to show up only when the user is not logged in.

<script language="JavaScript" type="text/javascript">
<!--
var msg = ""; // set as global variable

msg += "<table border=\"0\" width=\"91%\" cellspacing=\"0\" align=\"center\" cellpadding=\"0\" class=\"bordercolor\" style=\"position: relative; bottom: 14px;\">";
msg += "<tr>";
msg += "<td>";
msg += "<table cellpadding=\"4\" cellspacing=\"1\" border=\"0\" width=\"100%\">";
msg += "<tr>";
msg += "<td class=\"titlebg\" align=\"center\">";
msg += "<font class=\"text1\" size=\"2\">";
msg += "<b>Quick Forum Login</b>";
msg += "</font>";
msg += "</td>";
msg += "</tr>";
msg += "<tr>";
msg += "<td class=\"windowbg2\" valign=\"middle\" align=\"center\" height=\"60\">";
msg += "<FORM name=form action=\"http://name.hyperboards.com/index.cgi?action=login2\" method=post>";
msg += "<FONT size=1><B>Username:</B>";
msg += "<INPUT tabIndex=1 name=username> <a href=\"http://name.hyperboards.com/index.cgi?action=register\"><font size=\"1\">Need to register? | </font></a> ";
msg += "<B>Password:</B>";
msg += "<INPUT tabIndex=2 type=password name=passwrd> <a href=\"http://name.hyperboards.com/index.cgi?action=reminder\"><font size=\"1\">Forgot password?</font></a>";
msg += "<input type=hidden name=\"cookielength\" size=4 maxlength=\"4\" value=\"9999999999\" tabindex=\"3\">";
msg += "<input type=hidden name=\"cookieneverexp\" tabindex=\"4\" value=\"1\" checked>";
msg += "<INPUT accessKey=l tabIndex=5 type=submit value=Login></FONT></FORM>";
msg += "</td>";
msg += "</tr>";
msg += "</table>";
msg += "</td>";
msg += "</tr>";
msg += "</table>";
msg += "";
// -->
</script> Thanks a ton in advance!

DaiWelsh
03-28-2003, 10:15 AM
It depends how your forum works, but you may be able to check whether the appropriate cookie exists and either show it or not. However this sounds like something better handled on the server-side if possible.

unwise
03-28-2003, 10:23 AM
I can't get access to the server because it is a remotely hosted message board. hosted by hyperboards.com to be exact. Would there be a way to set it up so if, let's say, there were a certain bit of text displaying on the page, like "please login", my code will show, but if the text "please login" were not there, it wouldn't show? would it be easier with the html version?

<table border="0" width="91%" cellspacing="0" align="center" cellpadding="0" class="bordercolor" style="position: relative; bottom: 14px;">
<tr>
<td>
<table cellpadding="4" cellspacing="1" border="0" width="100%">
<tr>
<td class="titlebg" align="center">
<font class="text1" size="2">
<b>Quick Forum Login</b>
</font>
</td>
</tr>
<tr>
<td class="windowbg2" valign="middle" align="center" height="60">
<FORM name=form action="http://name.hyperboards.com/index.cgi?action=login2" method=post>
<FONT size=1><B>Username:</B>
<INPUT tabIndex=1 name=username> <a href="http://name.hyperboards.com/index.cgi?action=register"><font size="1">Need to register? | </font></a>
<B>Password:</B>
<INPUT tabIndex=2 type=password name=passwrd> <a href="http://name.hyperboards.com/index.cgi?action=reminder"><font size="1">Forgot password?</font></a>
<input type=hidden name="cookielength" size=4 maxlength="4" value="9999999999" tabindex="3">
<input type=hidden name="cookieneverexp" tabindex="4" value="1" checked>
<INPUT accessKey=l tabIndex=5 type=submit value=Login></FONT></FORM>
</td>
</tr>
</table>
</td>
</tr>
</table>

unwise
03-28-2003, 10:45 AM
Sorry for the double post but I'm wondering if I do something using an "if" line that basically says if the "Please login" text or the "login image" is showing then it would write the script using the line "document.write(msg);"? How would I write something like that, if possible that is. You must forgive the amount of questions I have, I am just a beginner at this stuff lol.