hey fellas.. im a newbie to web development but quite familiar with web programming languages.. i have created a page with username and password field at the right top of the page.. what i want is that it should be removed after user authentication.. for authentication im using php and mysql..... here is a sample of what i am doing... http://59.177.115.68/ the above website works in the following way index.html [username,password] --> login.php (authentication from databse) --> login.html what i want is that the username and password fields are to be removed after the authentication is done from all pages... help appreciated.. thanks in advance..
If your modding a CMS like wordpress and don't want to interfere with it's core coding, a quick and dirty method can be achieved with css, #login { display:none; } Code (markup): just make a id css hook on the login credentials html and add code to your default .css file. ROOFIS
First I would name each file with a php extension (index.php, about.php, etc). At the top of each page (before any spaces or output of any text) I'd put session_start(); to enable sessions and use the $_SESSION array to keep track of whether or not the user is logged in. Then on login.php: <?php session_start(); $_SESSION['loggedIn'] = 0; $user = $_POST['user']; $pass = $_POST['pass']; // Code to check for valid login // If valid user, set $_SESSION['loggedIn'] = 1; $_SESSION['loggedIn'] = 1; header("Location: where-ever.php"); ?> PHP: Then for your other pages: <?php session_start(); ?> <html> <body> <!-- whatever HTML --> <?php if (!$_SESSION['loggedIn']) { ?> <!-- code for your login box --> <?php } ?> </body> </html> PHP: Something similar to that should work.
thanks guys... ill get back after applying bolt the solutions i got... n be back with some other questions too....
kbduvall's come up with a nifty solution which I think will work but if you where just interested in not displaying usernames on top of each page then display:none; added to your default .css file will do the trick. Reason is clients browser will make a call to the css file to phrase the html elements on every page of your site. further reading: w3schools.com/css/css_display_visibility example for DP (if you have firebug for firefox): from DP's css file for welcomelink from page source, <link rel="stylesheet" type="text/css" href="http://c.dpstatic.com/css.php?styleid=1&langid=1&d=1327657622&td=ltr&sheet=toolsmenu.css,postlist.css,showthread.css,postbit.css,options.css,attachment.css,poll.css,lightbox.css" /> .toplinks ul.isuser li.welcomelink { clear: left; display: [B][COLOR="#FF0000"]none[/COLOR][/B]; #changed from display:block; float: right; padding: 3px 4px; } .toplinks ul.isuser li.logoutlink { top: 0; } .toplinks ul.isuser li a { color: #FFFFFF; display: [B][COLOR="#FF0000"]none[/COLOR][/B]; #changed from display:block; font-weight: bold; padding: 3px 4px; } Code (markup): produces: -edit- I should of mentioned that this would need to be added as part of a login check as kbduvall mentioned. for http://59.177.115.68/ css hook which is usr_login <?php if (isset($_SESSION["loggedIn"])) { echo '<style> #usr_login{ display: none; } </style>'; } ?> PHP: