z1haze Posted December 4, 2008 Share Posted December 4, 2008 im trying to make a login bar for vbulletin on my main homepage.. i've got it to work.. you login, it logs into the fourms and redirects back to the home page.. that all works perfectly.. but but im trying to do is make my new login bar on my home page change when users get logged in.. change from the login and password boxes to welcome, username blah blah.. i've been doing some reading and i think im suppoed to be putting these codes somewhere <?php if (is_user_logged_in()){ ?> This will display that the user is logged in <?php } else { ?> This will display when the user isn't logged in <?php } ?> but im obviously not doing it right because every single time i even put that <?php in there when i save and upload.. and refresh.. its just a blank white page... amd i going in the right direction or not here? i will poste the login info bar that i have on my home page for my forums <form action="./FORUM/login.php?do=login" method="post" onsubmit="md5hash(vb_login_password, vb_login_md5password, vb_login_md5password_utf, $show[nopasswordempty])"> <input type="hidden" name="do" value="login" /> <input type="hidden" name="url" value="./FORUM" /> <input type="hidden" name="vb_login_md5password" /> <input type="hidden" name="vb_login_md5password_utf" /> <input type="hidden" name="s" value="$session[sessionhash]" /> <strong>User Login</strong> <input type="text" name="vb_login_username" id="login" tabindex="1" class="form" accesskey="u" value="username" onfocus="this.value=''"/> <input type="password" name="vb_login_password" id="password" tabindex="1" class="form" value="password" onfocus="this.value=''"/> <input type="submit" name="login" id="submit" tabindex="1" value="" accesskey="s" class="login_button" /> <input type="checkbox" name="cookieuser" value="1" id="cb_cookieuser" tabindex="1" /> Remember me? <a href="index.php?page=register">Register</a> | <a href="index.php?page=forgot">Lost Password</a> </form> thanks for the help Quote Link to comment Share on other sites More sharing options...
trq Posted December 4, 2008 Share Posted December 4, 2008 Can we at least see your attempts? Thats just html and javscript by the looks, accepting this line.... <input type="hidden" name="s" value="$session[sessionhash]" /> which just doesn't make much sense with the rest of the code. Quote Link to comment Share on other sites More sharing options...
z1haze Posted December 5, 2008 Author Share Posted December 5, 2008 i dont understand what you are asking of me.. all i know is what i told you... all i know is that the login menu that i placed on my home page of my website, works to log into my vbulletin forums.. which is my goal.. but i want that login screen to act the same as the login screen in the forums, as it changes from the boxes, to a "welcome username" message upon login Quote Link to comment Share on other sites More sharing options...
ardyandkari Posted December 5, 2008 Share Posted December 5, 2008 fyi...is_user_logged_in() is not a php function. you may need to include the php file that has that function in it... Quote Link to comment Share on other sites More sharing options...
z1haze Posted December 5, 2008 Author Share Posted December 5, 2008 i do have a file that is suppoed to make it work.. but i still dont see how to do it.. this is my problems.. Add the following 6 lines right at the top of every page that you want to have access control on your website. ***It is ESSENTIAL that there is NO spaces or anything else before these lines.*** Note that they must be .php pages, not .html Note that you will have to modify the path in lines 4 and 5 to suit your site before you upload. <?php $curdir = getcwd (); chdir('/path/to/your/forums'); require_once('/path/to/your/forums/global.php'); chdir ($curdir); ?> I do not know how to edit line 5... what is that?? i mean i can count and like five is that chdir ($curdir); right? is that something i need to edit? Also it says to place it at the top of the page... welll i placed that at the top of my index page.. then uploaded.. and all i got when i refreshed was a blank page?? what did i do wrong? Where exactly at the top of the page does it go? After this you have your <HTML> and <BODY> tags and the rest of your web page. Where you want to have your login box place this block of code. <?php require_once('/path/to/your/login_inc2.php'); ?> Is it possible to use the existing layout of how I have my buttons already on my page?? my site is http://newsite.knightsofkarbala.com And lastly... You will need to edit the file login_inc.php You need to edit line 3 $forumpath = "http://www.yoursite.com/forums/"; Change this address to suit your site. Upload this file to your website, and ensure that the path you entered in part 1 points to it. Where do i upload this file too?? and what does he mean ensure what points to what? Im sorry that I do not understand this Im learning slowly, but I've done a lot of graphic work to this site and I need to get this straightened out before I can use the site.. Quote Link to comment Share on other sites More sharing options...
ardyandkari Posted December 5, 2008 Share Posted December 5, 2008 Gets the current working directory. Changes PHP's current directory. php.net is a very good resource if you get stuck on a command. <?php $curdir = getcwd (); chdir('/path/to/your/forums'); require_once('/path/to/your/forums/global.php'); chdir ($curdir); ?> I do not know how to edit line 5... what is that?? i mean i can count and like five is that chdir ($curdir); right? is that something i need to edit? the way that i see this (i may be wrong, so someone please verify) is $curdir is your current directory. you chdir() (change directory) to wherever your forums directory is. then you require_once() a file from that directory and chdir() (change directory) back to the main directory. you will want to change lines where you have a directory structure <</path/to/your/forums>> when there is a $whatever in a script, that is a variable. in this case, dont change the line that states chdir ($curdir);. that will screw things up for you. $curdir is already set. ---------------------------------------------------- Also it says to place it at the top of the page... welll i placed that at the top of my index page.. then uploaded.. and all i got when i refreshed was a blank page?? what did i do wrong? Where exactly at the top of the page does it go? it has an error since there is no /path/to/your/forums. it will probably be something like /user/web/html/forums or something...that is what you need to change. ------------------------------------------------------ After this you have your <HTML> and <BODY> tags and the rest of your web page. Where you want to have your login box place this block of code. <?php require_once('/path/to/your/login_inc2.php'); ?> Is it possible to use the existing layout of how I have my buttons already on my page?? my site is http://newsite.knightsofkarbala.com i am sure that it is, but without seeing the login scripts for both pages, there is nothing that we can do here... --------------------------------------------------- And lastly... You will need to edit the file login_inc.php You need to edit line 3 $forumpath = "http://www.yoursite.com/forums/"; Change this address to suit your site. Upload this file to your website, and ensure that the path you entered in part 1 points to it. Where do i upload this file too?? and what does he mean ensure what points to what? not sure what part 1 is...you have nothing labeled with "Part 1"...and i dont see anything referencing login_inc.php sorry... Quote Link to comment Share on other sites More sharing options...
z1haze Posted December 6, 2008 Author Share Posted December 6, 2008 hey sorry.. i will mkae a new post will all necessary information once i get my swtuff together.. thanks a lot Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.