UBB.x Developers Network    Forums  Hop To Forum Categories  Mods & Workarounds    Jury rigged login/welcome box.
Go
New
Find
Notify
Tools
Reply
  
Jury rigged login/welcome box.
 Login/Join
 
Junior Member
Posted
I did something I thought was kinda a neat on my site's homepage. A login/welcome box on my home page that checks a visitors infopop cookie to see if they are logged in or not. If they are logged in it displays a Welcome Username message and if not displays a login box that redirects back to the home page. Note I just swiped infopop's stuff to do this, I didnt program it myself. Im fairly certain it will only work on infopop hosted sites.

I put this in the head section of my webpage...
<script id="siteGlobalsJS" type="text/javascript">
        // set globals localised for site
        var site_id_cookie = 'site_XXXXXXXXX'; // this is the unique site login info cookie
        </script>
<script id="constructorJS" type="text/javascript" src="/infopop/jscript/constructor.js"></script>


You need to replace XXXXXXXXX with your site id, you can view source on your boards main page to see what it should be.

In the body area I put this:

<table width="98%" border="1">
    <tr> 
      <td id="gs_login_text"> 
        <form method="POST" action="http://yoururl.com/6/ubb.x" name="LOGIN">
          <p>Username: 
            <input maxlength="40" name="LOGIN_USERNAME" size="13" value="">
          </p>
          <p> Password: 
            <input maxlength="50" name="LOGIN_PASSWORD" size="13" type="password">
            <input type="hidden" name="IS_USING_ENABLE_COOKIES" value="Y">
            <input type="hidden" name="IS_COOKIE_ENABLED" value="Y">
            <input type="hidden" name="IS_ADVANCED_UI_DISABLED">
            <input type="hidden" name="s" value="XXXXXXXXX">
            <input type="hidden" name="ra" value="http://yoururl.com/yourcallingpage.html?s=458609942&amp;ORIGINAL_REFERRER_URL=http%3A%2F%2Fyoururl.com%2Fyourcallingpage.html%3Fs%3D458609942">
            <input type="hidden" name="a" value="LOGIN">
            <input type="hidden" name="x_popup" value="">
            <input name="SUBMIT" type="submit" value="Login">
          </p>
        </form>
      </td>
    </tr>
  </table>
  <script type="text/javascript"><!--  //Logged in? Display name.
          if(gs_cookie.parsed && document.getElementById('gs_login_text') && gs_cookie.u && gs_cookie.u!=''  && gs_cookie.u!=null  ){
            showLoginMsg();
          } 
        function showLoginMsg(){  
            var separator = "»";
            var login_hello_msg = "Hello";
            var logout_msg = "logout";
            logout_msg = logout_msg.link("http://yoururl.com/6/ubb.x?a=lgt&s=XXXXXXXXX"); 
            var msg = separator + ' ' + login_hello_msg + ' ' + gs_cookie.u.replace(/\+/g," ") + ' ' + '[' + logout_msg + ']';
            document.getElementById('gs_login_text').innerHTML = msg;
        }// end fn

        --></script>


You need to change yoururl.com to your website, yourcallingpage.html to the page your locating this on, and XXXXXXXXX with the site id number you got for above.

You can see the resulting login box on the upper right side of this page:
http://www.shining-armor.com/kort_index.shtml

If a member is logged in the login stuff is replaced with

>>Hello Username[logout]

Pete

"Dammit Jim I'm a COBOL Programmer not a Webmaster!"

 
Posts: 1 | Registered: July 23, 2003Reply With QuoteReport This Post
Member
Posted Hide Post
Nice work! Smile
 
Posts: 68 | Location: /6 Masai | Registered: August 31, 2002Reply With QuoteReport This Post
Member
Posted Hide Post
Very Handy. Smile
Thanks.

-----
Joshua Pettit
www.joshuapettit.com
www.threadsdev.com
 
Posts: 30 | Location: Charlotte, NC USA | Registered: May 23, 2003Reply With QuoteReport This Post
#!/usr/bin/eejit
Posted Hide Post
yeah, very nice Smile

Also 458609942 should be changed to the site id Razz

--------------------

My Hacks Page
 
Posts: 48 | Registered: June 06, 2002Reply With QuoteReport This Post
Junior Member
Posted Hide Post
I dont get the SITE ID part?

on my board, the first few lines of my source code are this. So what is my site id? Also, what goes under the form method post action part? http://www.urdomain.com/cgi-bin/ultimatebb.cgi ???
<html ><head>

<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />

<script language="Javascript1.1" type="text/javascript">
<!--

var session_cookie = getCookie('session2452176.1104');
if (session_cookie == null) {
	var session_dt = "0";
	var session_j = "0";
}  else {
	var session_array = session_cookie.split("&");
	var session_dt = session_array[0];
	var session_j = session_array[1];
}
 
Posts: 1 | Registered: September 09, 2003Reply With QuoteReport This Post
Member
Posted Hide Post
This code (and these forums) are for UBB.x. You are using UBB.classic. Hence it wont work.

For UBB.classic assistance, try http://www.ubbdev.com
 
Posts: 68 | Location: /6 Masai | Registered: August 31, 2002Reply With QuoteReport This Post
  Powered by Social Strata  
 

    UBB.x Developers Network    Forums  Hop To Forum Categories  Mods & Workarounds    Jury rigged login/welcome box.


Home | Contact Us
© UBB.x Developers Network. All Rights Reserved.