![]() |
VB Login on a Non-VB Page vB3 RC3
This is a simple modification to do, and adds a lot of value to your homepage.
Notes: 1. This script can occassionally have conflicts with other javascripts. Test before you deploy. 2. If you use and include to put the file on your page, be sure that the chdir and the require for global.php is in the head of the main document. 3. It is assumed that you are using a php page, and that you have already got connectivity with your database. The code: At the top of the document, before the <html> or <head> tags (edit to provide the path for your particular installation): PHP Code:
PHP Code:
Before requesting support, please check the following: 1. Make sure you have the path to your forum in the chdir. If you haven't done this, you will get a "can't include" error. 2. Make sure you have the chdir in the main document. If it isn't you will get a "can't modify header" error. 3. If those don't resolve the issue, try putting the login in a separate file, with no other code. If it works there, then you will know that you have a conflict with one of the scripts on the page you are trying to add the login to. I can't help you if you've got a conflict with another script. |
One suggestion, if you chdir at the top of the program to include something, you should also chdir back to the original location so you don't disrupt any relative includes further down the code.
PHP Code:
|
Quote:
You will need to have fun in there to work out how to get to your vars. |
hmmmmmm...... Just a sugestion. Insted of writing out all the form code i think vbulletin has a make_login() or somthing like that function. But they way you did it offers more flex to it so, either way has its ups and downs.
|
What about if the page is html. I know your hack is for .php, but is it possible to use on html pages? Or should the html page be converted to .php? And if so, isn't that done just by adding the <?php tag?
|
Using <? just tells the server that PHP code is coming. It's still PHP, which is a server side thing. HTML is user side.
|
My server has php. My index is html. I use vb as a forum. I'd like to use some form of vb logon on the front page which is not related to vb at all.
|
The page needs to be php. That means it has to have a .php extension. If you're running vB on the same server, you have php installed.
If the page has an html extension, it will not be processed by the server. |
Hehe, Apok has already seen this, to bad he never told me.
Anyway. What if I want to use this on a remote server/site. Should I include the remote database information above the chdir? And then use a URL to those files on the remote server? Or change it to connect to the server, and use the absolute path to the files? Or is it as simple as doing require('http://www.pathtoremoteserver.com/forums/global.php'); |
Quote:
I would also like to know how to do this but mine is on the same server |
the code works great but when i enter my login details, if the page changes to the "thanks for logging in" page and then back to the page that has the login forms. Is there anyway to say get it to not go to the thanks for loggin in page and then rather than just displaying the login boxed display the users avatar who just logged in?
thanks |
Set the value in the form for Forceredirect to 0 and it will not show the thank you for logging in. To get the avatar displayed, you'd need to take a look at what is available in bbuserinfo[] or figure out how to add the avatar stuff from you postbit template.
|
Is it at all possible to have the users avatar show up?
|
i did the direction and i am getting this error message:
Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in /home/exasko/public_html/forum_tester/test.php on line 13 line 13 is.. if ($bbuserinfo['userid']!=0) { got any ideas what's wrong |
redirect doesnt work for me.
|
Quote:
|
I got this to work, but it takes me back to where I put the login form. I want it to log me in an take me into the forums. How do I do that?
I already have this setup with VB2.3, and it works great. It's set so that when you go back to the index.php page of my site (not the forums), it shows: "Welcome back, [name] New Threads: New Posts: New PM's Logout" How can I do that with this hack? Having the login form/welcome box on a non-vb page is somewhat of a lifeline for my site, my members rely on it a lot so I really need to get this working, any suggestions? Any help would be appreciated. Thanks. |
So maybe somebody has putt it in a pop-up box - has somebody?
Could it be remade so I could use it in a HTML pure page, maybe with JS? |
Quote:
|
This is working great. ;) Is there anyway to add some code where once a user is logged in they'll see content based on what user group they're in?
For example ALL members would see "Link1 Link2 Link3" but then only Admins/Mods or the user group you choose can see "Link4 Link5 Link6".... |
'
Warning: main(): open_basedir restriction in effect. File(/forums/global.php) is not within the allowed path(s): (/home/indeathw:/usr/lib/php:/usr/local/lib/php:/tmp) in /home/indeathw/public_html/indextest.php on line 2 Warning: main(/forums/global.php): failed to open stream: Operation not permitted in /home/indeathw/public_html/indextest.php on line 2 Fatal error: main(): Failed opening required '/forums/global.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/indeathw/public_html/indextest.php on line 2' on RC4...any ideas????:ermm: |
I downloaded this hack, work great! I only need some more stuff when the member is logged in. Like the avatar image, new pms, last visited? I know there are codes for this, but can someone help me get these?
Thanks! |
please some hack to login in ASP page..but i other webserver, diferent that forum server.
|
hmmm I put the code on my index.htm on IIS 6 and it is just working fine, no need to rename it to .php (the .htm file is XHTML 1.1 compliant, but I don't think this affects the php code to working or non-working).... do I need to have index.php on Apache or it won't work?!?
|
yeap, not need .php but you have the forum and website in the same SERVER.
I have one computer for my board, and another for my Forum... |
This seems to work great for me so far, but I have a question...
Can someone explain what is happening in the first piece of code? Just what does it mean and what is it doing? Thanks. :) |
Okay, I finally got this hack to work with my PHPnuke 7.1. There's still 1 problem remaining. It logs in and returns to the main page, however the message does not change to "Welcome username", it always shows the login form....I made it into a phpnuke block, so it is in its' own file. The login is successful, but there is no welcome page.
PHP Code:
|
Quote:
So, why is this line of javascript needed to login? <script type='text/javascript' src='/forum/clientscript/vbulletin_md5.js'></script> Thanks. |
Thats the line that calls the java file
|
bump!
|
Is it ok with Gold?
|
How do you do this if your forum is on a different url then your main site?
Example: Like I have www.mysite.com and then I have www.myforums.com. How can I do it like this? |
Quote:
|
After testing this some more, I tried it on a blank page with just this code and I still get javascript errors (error message at the bottom left corner of my browser). Is it just me, or is anyone else having this problem? Could it be vbulletin's code that doesn't go well on external pages??
|
Finally i managed to get this code working on my server, people can login from the home, but im getting a syntax error on line 12 which is the following.
<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> any info how to solve the problem. thanks. |
Never mind about the above, i already fix that.
Also if u want to display last login and time after if ($bbuserinfo['userid']!=0) { $username=$bbuserinfo['username']; Add the following. $lastvisitdate=$pmbox['lastvisitdate']; $lastvisittime=$pmbox['lastvisittime']; It should look like if ($bbuserinfo['userid']!=0) { $username=$bbuserinfo['username']; $lastvisitdate=$pmbox['lastvisitdate']; $lastvisittime=$pmbox['lastvisittime']; cheers. |
To fix the errors in the bottom of the screen you need to get rid of
Code:
onfocus='if (this.value == 'username') this.value = '';' / Code:
<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> |
Quote:
|
Quote:
|
I get this when I try to go to my website
Parse error: parse error in /home/wvgl/www/index.php on line 9 |
All times are GMT. The time now is 11:39 AM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|