calmchess Posted June 4, 2010 Share Posted June 4, 2010 as you can see from the code below I've wrapped some html in a display login function......my probelm is when i call the function from the head of the document the html is displayed at the top of the document instead of the proper place........what can i diffrently to fix it?....this is my first attmept to create a login page without tutorial help. <?php session_start();?> <html> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>Hot Model</title> <META name="keywords" content="webcam, webcams, cam, cams, live> <META name="robots" content="index,follow"> <META name="revisit-after" content="10"> <META name="robots" content="all"> <meta name="author" content="calmchess" > <META name="page-topic" content="Hot Live Webcams"> <META name="copyright" content="privatechatnow.com,2010"> <META name="distribution" content="global"> <META name="ABSTRACT" CONTENT="privatechatnow.com - Live video cam and chat"> <META name="rating" content="Mature"> <?php //include("../secure_php/admindatabase.php"); if(isset($_SESSION['rq4GVc'])){ if(isset($_POST['sublogin'])){ $_SESSION['rq4GVc']; return; }else{} }else{ displaylogin(); } ?> <style type="text/css"> <!-- body{ margin: 0; padding:0; text-align:center; } #c-block {width:100%; height:80%;border:1px solid red;} .c-col{width:723px; height:800px; margin-left:auto;margin-right:auto;border:1px solid blue;} #hdr{height:80px; width:100%; margin:0;border:1px solid green;} .ftr{ width:100%;height:35px; border-top:1px solid black;text-align:center;} .cenbox{width:200px;height:70px;margin-left:auto;margin-right:auto;margin-top:170px;border:1px solid purple;} --> </style> </head> <body> <div id ="hdr"></div> <div id="c-block"> <div class="c-col"> <?php function displaylogin(){ ?> <div class="cenbox"> <form action="" method="POST"> <table align="left" border="0" cellspacing="0" cellpadding="3"> <tr><td>Username:</td><td><input type="text" name="user" maxlength="30"></td></tr> <tr><td>Password:</td><td><input type="password" name="pass" maxlength="30"></td></tr> <tr><td colspan="2" class="aliright"><input type="submit" name="sublogin" value="Login"></td></tr> </table> </form> </div> <? } ?> </div> <div class="ftr" ><a href="">Privacy</a> | <a href="">Advertise with us</a> | <a href="">About us</a> |  <a href="" >Contact Us</a> | <a href="">Help</a> <div><a href ="">18 U.S.C. 2257 Information Record Keeping Requirements Compliance Statement</a></div> <div><small>Copyright © 2010--2010 privatechatnow.com. All Rights Reserved.</small></div></div> </div> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/203915-first-login-script-attempt-assitance-plz/ Share on other sites More sharing options...
sKunKbad Posted June 4, 2010 Share Posted June 4, 2010 In the head you could set a variable like $do_login = 1; and then in the body you could check if it is set: if(isset($do_login)) { display_login(); } Quote Link to comment https://forums.phpfreaks.com/topic/203915-first-login-script-attempt-assitance-plz/#findComment-1068000 Share on other sites More sharing options...
calmchess Posted June 4, 2010 Author Share Posted June 4, 2010 I was able to make it work by wrappeing the body tags and everything in between in the displaylogin() function after that i was able to do all my authentication codeing in the head......hopefully this stops all header errors......at any rate i did it ! i wrote login script withouth a tutorial ......although i used techniques i learned from other login scripts. Quote Link to comment https://forums.phpfreaks.com/topic/203915-first-login-script-attempt-assitance-plz/#findComment-1068005 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.