vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Displaying username/login fields on non-vB page? (https://vborg.vbsupport.ru/showthread.php?t=22192)

MarkB 07-07-2001 10:55 AM

Hiyis :)

I want to be able to have a message such as 'Welcome, username on a non-vB page (ie, the rest of my site!), if the user is registered and has the cookie present (obviously), or if the user isn't logged in or registered, show the login boxes/registration link...

Is this possible? My main site uses PHPNuke, but I'm guessing if I coded in a require for whatever vB files I needed, it'd ref the vB database for the username etc......?

I'm not a PHP/SQL guru, so please excuse my ignorance if this is a simple thing to do:p

Thanks :)

Mark

MarkB 07-08-2001 09:26 PM

Anyone? :(

Rostor 07-13-2001 10:58 AM

Hi Mark .... well I wait with you for a response if there is one :)

DEMOLiTiON 07-13-2001 01:52 PM

PHP Code:

<?

require("./global.php");

if ($bbuserinfo['userid']!=0) {
$username=$bbuserinfo['username'];
  
echo"Welcome back, <b>$username</b>";

}

?>


mam14 07-13-2001 02:05 PM

That's it?

DEMOLiTiON 07-13-2001 02:38 PM

Quote:

Originally posted by mam14
That's it?
yep

GameCrash 07-13-2001 02:59 PM

If you want to geht the loginform, you have to change the code a bit:

PHP Code:

<?

require("./global.php");

if ($bbuserinfo['userid']!=0) {
$username=$bbuserinfo['username'];
  
echo"Welcome back, <b>$username</b>";

} else {

?>

[Loginform here]

<?

}

?>

You can simply insert the loginform from the index.php I think...

Rostor 07-13-2001 04:39 PM

Thx you for fast response ... but it doesn't works to me :confused: :confused:

Gives error on the global.php

DEMOLiTiON 07-13-2001 04:54 PM

Quote:

Originally posted by Rostor
Thx you for fast response ... but it doesn't works to me :confused: :confused:

Gives error on the global.php

You have to create a new file e.g. test.php and put the code in there.

Rostor 07-13-2001 05:18 PM

Yes I ' v created a new file and then copied your code.

Then i modified this:

require("forum/global.php");

and test it.

This is the result:
Warning: Undefined variable: REQUEST_URI in C:\Inetpub\wwwroot\swzone.it\forum\global.php on line 33

Warning: Undefined variable: QUERY_STRING in C:\Inetpub\wwwroot\swzone.it\forum\global.php on line 41

Warning: Undefined index: HTTP_POST_VARS in C:\Inetpub\wwwroot\swzone.it\forum\global.php on line 58

Warning: Undefined index: action in C:\Inetpub\wwwroot\swzone.it\forum\global.php on line 58

Warning: Undefined index: action in C:\Inetpub\wwwroot\swzone.it\forum\global.php on line 61

Fatal error: Failed opening required './admin/config.php' (include_path='') in C:\Inetpub\wwwroot\swzone.it\forum\global.php on line 66

My server (I host directly) is an IIS5 with Php 4.0.6
Thx for your interest :)

MarkB 07-13-2001 09:08 PM

I've no luck either - manage to get the login boxes showing, and had the login redirect back to the main page, but it would still show the boxes, not the welcome message :confused:

I shall keep trying - thanks for the assistance everyone :)

Stasik 07-14-2001 12:38 PM

was the login procedure sucessfull?

mferrell 07-23-2001 11:49 PM

I've tried this and get this message:

Warning: Failed opening './admin/config.php3' for inclusion (include_path='') in ./bulletinboard/global.php3 on line 66

Fatal error: Failed opening required './admin/config.php3' (include_path='') in ./bulletinboard/global.php3 on line 66

I've tried included the global.php3 on other pages in the past with no luck because of the config.php3 problem. Anyone have an idea on how to solve this?

Thanks,
-Matt

Ruth 07-23-2001 11:53 PM

i had the same problem :(

mferrell 07-23-2001 11:58 PM

Did you find a solution? This has prevented me from using any hacks that require the global.php3.

Ruth 07-24-2001 12:03 AM

no i couldnt find a solution, i'll try to keep at it,
for any script that uses global.php3 try renaming global.php3 to another name and link to it when needed...this saves you the hassle.

RobAC 07-24-2001 12:08 AM

Quote:

Originally posted by GameCrash
If you want to geht the loginform, you have to change the code a bit:

When you say login form, do you mean the username and password boxes? I've installed the code above on my home page and it works since it recognizes me, but if I log out of the forums and return to the home page, there is nothing there. I'd like to be able to have users log in from the main home page of my site.

mferrell 07-24-2001 12:14 AM

Yeah, that's basically what I'm trying to do. I'm trying to have non-vb pages say, "Welcome, username" if you're logged in. If not, I want it to show the login boxes.

However, when I try to require global.php3 on a non-vb page, I get a parse error that it can't find the config.php3 referenced in the global.php3 file. I'm totally stuck.

RobAC 07-24-2001 12:26 AM

I'll work on this in a little while and see what I can come up with.

-Rob

RobAC 07-24-2001 05:43 AM

Here it is: http://vbulletin.com/forum/showthrea...593#post143593

mferrell 07-26-2001 01:24 AM

No matter what I try, I get this damn message:

Warning: Failed opening './admin/config.php3' for inclusion (include_path='') in ./bulletinboard/global.php3 on line 66

jvv 07-26-2001 07:55 AM

Try going to that line and change the path to your full path.
ie. change ./admin/config.php to /home/username/public_html/bb/admin/config.php or whatever it is on your server. That worked for me.

mferrell 07-26-2001 01:27 PM

Awesome ... thanks!

mferrell 07-27-2001 12:16 AM

This is driving me nuts! I stopped the warning message about the config.php, but now I'm getting something about the headers already being sent.

I use a template system to build my pages (one centrally located file with the header and footer). I'm trying to add your hack as an include on this template file. This is the newest warning I'm getting:

Warning: Cannot add header information - headers already sent by (output started at include/template.inc:143) in /htdocs/bulletinboard/admin/functions.php3 on line 1187

Is there a way to put the <? require("global.php3"); ?> at the top of my template, and then use your hack later as an include on the page? When I try this I get the login boxes and they work fine (I can log onto the forum), but I never see the welcome message.

Any guidance?

Thanks.

mferrell 07-28-2001 03:23 AM

This is an addition to my post above.

I have two functions called my_siteTop and my_siteBottom, which draw the header and footer for every one of my pages on my site. I believe this is the root of my problem with getting the global.php and login script to work correctly.

Here's what it looks like now:

<?
$path= "c:/nusphere/apache/htdocs";
$baseref= "http://localhost/";

require("$path/bulletinboard/global.php3");
function my_siteTop (
$page= "",
$title= "",
$description= "",
$keywords= "",
$author= "",
$baseref= "http://localhost/",
$path= "/www/webdirectorylocation"
)
{
global $path;
global $baseref;
include("$path/include/site_top.php3");
}

function my_siteBottom (
$path= "/www/webdirectorylocation"
)
{
global $path;
include("$path/include/site_bottom.php3");
}
?>

mferrell 07-28-2001 02:27 PM

Got it working.

ohspot 04-09-2003 10:33 AM

I get the same message about headers already being sent, anyone come up with a fix for this?

Thanks
Sean

M4g!k 06-29-2003 06:54 AM

So......can someone please fill out what we need to put on our sites?

I still dont know.

CR- 07-15-2003 07:39 AM

Sorry to bring up an old thread, but can someone go to www.dumbfounded.net and see what I want to do; I basically want to do the same general idea of this, but the login boxes are at the bottom of the site; I want the welcome guest or $username to be up in the top bar where the day/date is, except aligned to the left side. Can anyone help me out?

Thanks.

CR- 07-15-2003 08:23 AM

also is the require suppose to be a path to the global.php file or the config.php because when i did it as the global.php I was getting errors, even with the full path, but when I did the full path of config.php I didn't get errors, but nothing showed up at all.

CR- 07-16-2003 02:25 AM

Warning: main(./config.php): failed to open stream: No such file or directory in /home/dumbfoun/public_html/board/admin/global.php on line 96

<p align="left"><b><font color="#FFFFFF" face="Tahoma" size="2">
<?

require("/home/dumbfoun/public_html/board/admin/global.php");

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

echo"Welcome back, <b>$username</b>";

}

?>
</p>

p align="right">
<table border="0" cellpadding="0" cellspacing="0">
<form action="/home/dumbfoun/public_html/board/admin/member.php" method="post">
<tr>
<td nowrap><font face="verdana,arial,helvetica" size="1" color="white"><b>Not cookied?</b><br>Login with usernam
e and password:</font>
</td>
</tr><tr>
<td nowrap><input type="hidden" name="s" value="769c1aabe4f6207720ccfac822020d95">
<input type="hidden" name="action" value="login">
<input type="text" class="bginput" name="username" size="7">
<input type="password" class="bginput" name="password" size="7">
<input type="submit" class="bginput" value="Login!"></td>
</tr>
</form>
</table>
</p>

that's what i have so far and i'm getting the error that's listed above. you can see what i mean by going to www.dumbfounded.net - the php will be in the top bar, the login is below. I'm stuck now and don't know what to do. *shrugs*

d3nnis 07-16-2003 02:48 AM

Quote:

Today at 12:25 PM CR- said this in Post #31
Warning: main(./config.php): failed to open stream: No such file or directory in /home/dumbfoun/public_html/board/admin/global.php on line 96

<p align="left"><b><font color="#FFFFFF" face="Tahoma" size="2">
<?

require("/home/dumbfoun/public_html/board/admin/global.php");

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

echo"Welcome back, <b>$username</b>";

}

?>
</p>

p align="right">
<table border="0" cellpadding="0" cellspacing="0">
<form action="/home/dumbfoun/public_html/board/admin/member.php" method="post">
<tr>
<td nowrap><font face="verdana,arial,helvetica" size="1" color="white"><b>Not cookied?</b><br>Login with usernam
e and password:</font>
</td>
</tr><tr>
<td nowrap><input type="hidden" name="s" value="769c1aabe4f6207720ccfac822020d95">
<input type="hidden" name="action" value="login">
<input type="text" class="bginput" name="username" size="7">
<input type="password" class="bginput" name="password" size="7">
<input type="submit" class="bginput" value="Login!"></td>
</tr>
</form>
</table>
</p>

that's what i have so far and i'm getting the error that's listed above. you can see what i mean by going to www.dumbfounded.net - the php will be in the top bar, the login is below. I'm stuck now and don't know what to do. *shrugs*



think your config.php is missing

CR- 07-16-2003 02:58 AM

there's a config in /board/admin/config.php

CR- 07-18-2003 07:40 AM

No one eh? Bleh.. :(

MamiRavi 07-18-2003 05:26 PM

try filling in your exact path..

CR- 07-18-2003 06:07 PM

look at my code...the full path is there.

CR- 07-19-2003 10:21 PM

This is what I have now:

PHP Code:

<?
require("/home/dumbfoun/public_html/board/global.php");
echo "<font color=\"#FFFFFF\" face=\"Tahoma\" size=\"2\">\n";
if($bbuserinfo['userid']!=0) {
$username = $bbuserinfo['username'];
$ided =1;
echo "Welcome, $username";
}
else {
echo "Welcome, Guest";
}

echo "</td><td width=50% align=right>";
echo "<p align=right><font color=\"#FFFFFF\" face=\"Tahoma\" size=\"2\">\n";
echo "<nobr>";
echo date("l, M d Y");
echo "</nobr>";
?>

and

PHP Code:

<?
if(!$ided) {
echo "<p align=\"right\">";
echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">";
echo "<form action=\"/board/admin/member.php\" method=\"post\">";
echo "<tr>";
echo "<td nowrap><font face=\"verdana,arial,helvetica\" size=\"1\" color=\"white\"><b>Not cookied?</b><br>Login with username and password:</font>";
echo "</td>";
echo "</tr><tr>";
echo "<td nowrap><input type=\"hidden\" name=\"s\" value=\"769c1aabe4f6207720ccfac822020d95\">";
echo "<input type=\"hidden\" name=\"action\" value=\"login\">";
echo "<input type=\"text\" class=\"bginput\" name=\"username\" size=\"7\">";
echo "<input type=\"password\" class=\"bginput\" name=\"password\" size=\"7\">";
echo "<input type=\"submit\" class=\"bginput\" value=\"Login!\"></td>";
echo "</tr>";
echo "</form>";
echo "</table>";
echo "</p>";

}
?>

I get Warning: Cannot modify header information - headers already sent by (output started at /home/dumbfoun/public_html/index.php:6) in /home/dumbfoun/public_html/board/admin/functions.php on line 1652

Can anyone help? :/ I've already read https://vborg.vbsupport.ru/showthrea...threadid=47126 - it doesn't really help me distinguish a problem in the least... - all of that code is imbedded in my html in my index.php of my main site btw.

CR- 07-20-2003 06:51 AM

I got this working...for anyone else who does this in the future just put your require line up at the very top of the file and everything will work.

J.

gt3400 07-24-2003 04:14 PM

Did anyone get this figured out yet?


All times are GMT. The time now is 02:45 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
  • Page Generation 0.01192 seconds
  • Memory Usage 1,822KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (4)bbcode_php_printable
  • (4)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (39)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete