Announcement

Collapse
No announcement yet.

Logon Box on non vb page

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Logon Box on non vb page

    Hello,

    i hope my english is enough to explain what we are trying to do.

    we are just redesigning a page with about 4000 active users. till now we had a propietary user-sessionhandling. starting to redesign the database the idea was born to reuse the usertables from vbulletin and the session-handling without modifing them.

    we want to provide a logon box (not inside the forum folder) to let users login directly on the mainpage. we are using the vbulletin user-database for other features too, and we dont want to use another session. the user should just one time register and be logged on on the whole page not just on the forum-pages.

    So when we try to include a copy of the global.php to provide the functionality we have to change the include paths to includes/init.php etc. The main problem ist that after 7 paths some functions stop to work. how is it now possible to use the vbulletin session on non vb-templates. anyone tried already to build something simmilar or is there something like a howto?

    here is a short version of the code we are trying to use:

    <?php include("../forum/global.php"); ?>
    <?php if ($bbuserinfo[username] == "Not registred") { ?>
    <div>
    <script type="text/javascript" src="/forum/clientscript/vbulletin_md5.js"></script>
    <form action="/forum/login.php" method="post" onsubmit="md5hash(vb_login_password,vb_login_md5password)">
    <input type="hidden" name="s" value="<? echo "$session[sessionhash]"; ?>" />
    <input type="hidden" name="do" value="login" /> <input type="hidden" name="forceredirect" value="1" />
    <input type="hidden" name="vb_login_md5password" />
    <noscript>Benutzername: </noscript>
    <input type="text" name="vb_login_username" id="navbar_username" size="10" accesskey="u" tabindex="1" value="Benutzername" onfocus="if (this.value == 'Benutzername') this.value = '';" />
    <noscript>Passwort:</noscript>
    <input type="password" name="vb_login_password" size="10" accesskey="p" tabindex="2" />
    <label for="cb_cookieuser_navbar">
    <input type="checkbox" name="cookieuser" value="1" tabindex="3" id="cb_cookieuser_navbar" accesskey="c" checked="checked" /> Remember me?
    </label>
    <input type="submit" value="Anmelden" tabindex="4" title="" accesskey="s" /><a class="menu4" href="/forum/register.php?">[Sign up]</a>
    </form>
    </div>
    <!-- guest user end -->
    <? } else { // Just for members ?>
    <!-- Registred user start -->
    <script type="text/javascript">
    <!--
    function log_out()
    {
    ht = document.getElementsByTagName("html");
    ht[0].style.filter = "progid<img src="images/smilies/biggrin.gif" border="0" alt="">XImageTransform.Microsoft.BasicImage(grayscale=1)";
    if (confirm('Willst du dich wirklich abmelden?'))
    {
    return true;
    }
    else
    {
    ht[0].style.filter = "";
    return false;
    }
    }
    //-->
    </script>
    <div>
    Hello <a class="menu4" href="/forum/usercp.php?"><? echo $bbuserinfo[username]; ?></a> [<a class="menu4" href="/forum/login.php?do=logout" onclick="return log_out()">LogOff</a>]
    <a class="menu4" href="/forum/private.php?">Private Messages</a></td>
    <!-- Registred User End -->
    <? } ?>
    </div>

  • #2
    im keen to find this out as well
    | System 0 |

    Comment


    • #3
      Don't know if this is considered hacking...but...

      this question comes up a lot. You can find an answer at http://www.vbulletin.org/forum/showt...469#post469469
      Mark Cahill
      Reel-Time, the Internet Journal of Saltwater Fly Fishing
      Allthingscahill.com
      Splitcoaststampers.com

      Comment


      • #4
        Originally posted by mcahill
        this question comes up a lot. You can find an answer at http://www.vbulletin.org/forum/showt...469#post469469
        That thread isn't available to me. I'm registered on the .org site and have added my user email as a licensed user. Am I missing anything? I'm really 'keen' on knowing this too

        Comment


        • #5
          The email address at vBulletin.org MUST MATCH your email address here. That was my mistake originally. Then, you have to reply to the auto-mailer activation email before you can see anything.

          Comment


          • #6
            I've got it all right, and it says I'm not privelaged, etc... that msg. Why can't I view it?
            Let the flames begin.

            Comment


            • #7
              If you replied to the automailer verification email, and if you double-checked your email addies here and there (and they match), there should be no reason for your error. Did you re-logon over there AFTER clicking the email link?

              Comment


              • #8
                I can't access it either and I am registered and can access other code on that site....

                Comment


                • #9
                  Looks like the post has been moved somewhere now, as I can't access it using that link either.

                  This code is bit messy but it's the code a have that does what you are looking for on my test server
                  Note you will need to change the chdir values to match where they are located on your server

                  PHP Code:
                  <?php
                  chdir
                  ("../../weirdpixels.com/forum/");  // takes user to the forum - to perform the login process
                  require_once('./global.php'); //include global.php 

                  // added this line to include the user functions which 
                  // has the fetch_avatar_url() function 
                  require_once('./includes/functions_user.php'); //this makes the user avatar work
                  chdir("../../../../"); //returns the  user back to the dir they started in

                  if ($bbuserinfo['userid']!=0) { 
                      
                  $username=$bbuserinfo['username']; 
                       

                      
                  // assign the avatar url to the variable $user_av and check to see if it's empty. 
                      
                  $user_av fetch_avatar_url($bbuserinfo['userid']); 
                      if(
                  $user_av!=''
                         
                  $user_av="$vboptions[bburl]/" $user_av;  // /forum = location of the forums 

                      
                  print("<align='center'><span class='sectionheader'>Welcome back, $username!<br />"); 
                       
                      
                  //if the avatar url is not empty, display it 
                      
                  if($user_av!=''
                          print(
                  "<img src=\"" $user_av "\" vspace=4>"); 
                  } else { 
                  ?> 
                  <form action='http://www.weirdpixels.com/forum/login.php' method='post' onsubmit='md5hash(vb_login_password,vb_login_md5password)'> 
                          <script type='text/javascript' src='http://www.weirdpixels.com/forum/clientscript/vbulletin_md5.js'></script> 
                            
                           <span class="sectionheader">Username:</span> 
                              <input type='text' class='button' name='vb_login_username' id='navbar_username' size='15' accesskey='u' tabindex='1' value='' onfocus='if (this.value == 'username') this.value = '';' /><br /> 
                                
                              <span class="sectionheader">Password:&nbsp;</span> 
                              <input type='password' class='button' name='vb_login_password' size='15' accesskey='p' tabindex='2' /><br /> 
                              <input type='checkbox' name='cookieuser' value='1' tabindex='3' id='cb_cookieuser_navbar' accesskey='c' checked='checked' /><span class='sectionheader'>Remember Me</span><br /> 
                            
                            
                            
                          <input name="submit" type='submit' class='button' accesskey='s' tabindex='4' title='Log In' value='Log In' /> 
                          <input type='hidden' name='do' value='login' /> 
                          <input type='hidden' name='forceredirect' value='1' />              
                          <input type='hidden' name='vb_login_md5password' /> 
                          </form> 
                  <?php



                  ?>
                  http://www.weirdpixels.com/images/buttons/button.gif

                  Comment


                  • #10
                    Can't find a working solution for this task. Is there an update of this code? I try to use it, but always get a blank page...
                    Boris Lifanovsky; administrator of the biggest Russian classical music forum

                    Lifanovsky.com | ForumKlassika.Ru

                    Comment


                    • #11
                      This requires modification to your site. For modification discussions and support please visit our modifications community at http://www.vbulletin.org
                      Kerry-Anne :)

                      Twitter Blog

                      www.peterska2.com www.worldnewszone.com www.popularusenetgroups.com www.superclickers.co.uk www.forumsforchrist.com www.browsergameplanet.com

                      Comment

                      widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
                      Working...
                      X