jskoland Posted January 30, 2007 Share Posted January 30, 2007 First I am very new to PHP. So this question is going to be very simple for you genius people out there. I have a simple login script. basically all I want is for someone to enter a password then continue on to the next page. BUT, when I go to the login in page and I enter the correct password, I go to the page I want but so does my login page. After I login I don't want the login page to follow me. How can I exit that and call my next page.Thanks in advance Quote Link to comment https://forums.phpfreaks.com/topic/36255-login-script-help-please/ Share on other sites More sharing options...
HuggieBear Posted January 30, 2007 Share Posted January 30, 2007 I don't know what you mean by "My login page follows me". Maybe you could post some code for us.RegardsHuggie Quote Link to comment https://forums.phpfreaks.com/topic/36255-login-script-help-please/#findComment-172378 Share on other sites More sharing options...
jskoland Posted January 30, 2007 Author Share Posted January 30, 2007 [code]<?phpinclude "open_session.php";if(!isset($mainfile)) include ("mainfile.php");include "config.php";// Define your password$password = "mypassword";if ( $_POST['txtPassword'] != $password) {?><h1>Login</h1><form name="form" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> <p><label for="txtpassword">Password:</label> <br /><input type="password" title="Enter your password" name="txtPassword" /></p> <p><input type="submit" name="Submit" value="Login" /></p></form><?php}else {?><?phpheader("location: mod.php?mod=newsletter&op=viewnewsletter&newsletterid=2");break;}?> [/code] Quote Link to comment https://forums.phpfreaks.com/topic/36255-login-script-help-please/#findComment-172389 Share on other sites More sharing options...
HuggieBear Posted January 30, 2007 Share Posted January 30, 2007 OK, there doesn't look like there's anything wrong with that code.Can you post the code for mod.php as that's likely what's causing the problem.RegardsHuggie Quote Link to comment https://forums.phpfreaks.com/topic/36255-login-script-help-please/#findComment-172395 Share on other sites More sharing options...
jskoland Posted January 30, 2007 Author Share Posted January 30, 2007 [code]<?phpinclude("./mod/$mod/index.php");?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/36255-login-script-help-please/#findComment-172400 Share on other sites More sharing options...
TEENFRONT Posted January 30, 2007 Share Posted January 30, 2007 i dont think u can include like that... but i may be wrong. Quote Link to comment https://forums.phpfreaks.com/topic/36255-login-script-help-please/#findComment-172409 Share on other sites More sharing options...
Jessica Posted January 30, 2007 Share Posted January 30, 2007 "i dont think u can include like that."Of course you can.Can you show us a live example? "I don't know what you mean by "My login page follows me". I still don't know either.Where is the processing for this form? It goes to itself, but doesn't do anything with the post data? Quote Link to comment https://forums.phpfreaks.com/topic/36255-login-script-help-please/#findComment-172410 Share on other sites More sharing options...
TEENFRONT Posted January 30, 2007 Share Posted January 30, 2007 OhI have always included like this include('/home/account/public_html/dir/file.php'); , always thought the ./ was always a html thang. Nevermind eh! Quote Link to comment https://forums.phpfreaks.com/topic/36255-login-script-help-please/#findComment-172414 Share on other sites More sharing options...
jskoland Posted January 30, 2007 Author Share Posted January 30, 2007 ok I will try to explain myself a little better.I go to my login in page and in the top left corner I have Login: and a password box under that to enter in my password and a submit button. Once I enter my password and click the submit button, I then get redirected to http://www.mydomain.com/mod.php?mod=newsletter?op=viewnewsletter&newsletterid=2/ through the header command in my login page. BUT, I also still see the Login text and the password box and submit button still in the left hand corner of my screen. Quote Link to comment https://forums.phpfreaks.com/topic/36255-login-script-help-please/#findComment-172419 Share on other sites More sharing options...
JasonLewis Posted January 30, 2007 Share Posted January 30, 2007 register a session then around that box check if the session is set, if it is, dont display the box. Quote Link to comment https://forums.phpfreaks.com/topic/36255-login-script-help-please/#findComment-172421 Share on other sites More sharing options...
Jessica Posted January 30, 2007 Share Posted January 30, 2007 IIRC, ./ means the root directory. I've never seen that in HTML.you'll need to store the username in the session, then before printing the HTML form, check if the username is in the session. If it is, print it out, if not, print the form. Quote Link to comment https://forums.phpfreaks.com/topic/36255-login-script-help-please/#findComment-172422 Share on other sites More sharing options...
jskoland Posted January 30, 2007 Author Share Posted January 30, 2007 excuse my ignorance, but don't what you guys mean by your last statements. I am very new to this.Thanks Quote Link to comment https://forums.phpfreaks.com/topic/36255-login-script-help-please/#findComment-172431 Share on other sites More sharing options...
jskoland Posted January 30, 2007 Author Share Posted January 30, 2007 I would think that there has to be something else going on since the rest of my pages work great. There has got to be something that says with successful login go here and not to include the page that I was just at. When I look at the source code after the redirection. I see the HTML code at the very top of the code then the rest of the code follows. Some how I need to stop that from happening. Quote Link to comment https://forums.phpfreaks.com/topic/36255-login-script-help-please/#findComment-172475 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.