cluce Posted May 8, 2007 Share Posted May 8, 2007 I am trying to display a message "invalid username/ password combination" on my registration page but I get nothing. Can someone tell me what's wrong with my code. on logon page I have...... } else { //redirect back to login form if not authorized $_SESSION['error'] = "invalid username and/or password combination"; header("Location: registration.html"); exit; and registration page I have <?php echo ($_SESSION['error']) ?> Quote Link to comment https://forums.phpfreaks.com/topic/50495-solved-i-am-trying-to-display-a-message-invalid-username-password-combination-on-my/ Share on other sites More sharing options...
taith Posted May 8, 2007 Share Posted May 8, 2007 print_r($_SESSION); is the value even getting into session? if no, you prolly havent @session_start();ed yet... Quote Link to comment https://forums.phpfreaks.com/topic/50495-solved-i-am-trying-to-display-a-message-invalid-username-password-combination-on-my/#findComment-248080 Share on other sites More sharing options...
trq Posted May 8, 2007 Share Posted May 8, 2007 <?php session_start(); echo ($_SESSION['error']) ?> Quote Link to comment https://forums.phpfreaks.com/topic/50495-solved-i-am-trying-to-display-a-message-invalid-username-password-combination-on-my/#findComment-248083 Share on other sites More sharing options...
r-it Posted May 8, 2007 Share Posted May 8, 2007 and another thing, don't forget to save the registration as .php instead of the .html you currently have there Quote Link to comment https://forums.phpfreaks.com/topic/50495-solved-i-am-trying-to-display-a-message-invalid-username-password-combination-on-my/#findComment-248084 Share on other sites More sharing options...
cluce Posted May 8, 2007 Author Share Posted May 8, 2007 Ok I did a start also on my registration page but I get this.......... Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\wamp\www\registration.php: in C:\wamp\www\registration.php on line 93 invalid username and/or password combination Quote Link to comment https://forums.phpfreaks.com/topic/50495-solved-i-am-trying-to-display-a-message-invalid-username-password-combination-on-my/#findComment-248092 Share on other sites More sharing options...
taith Posted May 8, 2007 Share Posted May 8, 2007 session_start(); must be at the absolute top of your pages... Quote Link to comment https://forums.phpfreaks.com/topic/50495-solved-i-am-trying-to-display-a-message-invalid-username-password-combination-on-my/#findComment-248095 Share on other sites More sharing options...
trq Posted May 8, 2007 Share Posted May 8, 2007 session_start() must be called prior to any output to the browser. This includes whitespace and html. Quote Link to comment https://forums.phpfreaks.com/topic/50495-solved-i-am-trying-to-display-a-message-invalid-username-password-combination-on-my/#findComment-248096 Share on other sites More sharing options...
cluce Posted May 8, 2007 Author Share Posted May 8, 2007 OK I did that nu it still gives me the header message............ <?php session_start(); ?> <!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"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <!-- TemplateBeginEditable name="doctitle" --> <title>Careers</title> <!-- TemplateEndEditable --> <style type="text/css"> <!-- body { background-image: url(images/bg_tile.gif); } .style8 {font-size: 12px} a:visited { color: #000000; text-decoration: none; } a:hover { color: #FF6600; background-color: #999999; text-decoration: underline; } a:link { color: #000000; text-decoration: none; } a:active { color: #FF6600; text-decoration: none; } .style12 {font-size: 14px} .style14 {color: #FF0000} .style15 {font-family: "Times New Roman", Times, serif; font-size: 14px; color: #FF0000; } .style16 { font-size: 18px; font-family: "Times New Roman", Times, serif; font-weight: bold; } --> </style> <!-- TemplateBeginEditable name="head" --><!-- TemplateEndEditable --> <script language="JavaScript" src="../mm_menu.js"></script> </head> <div align="center"> <table width="852" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <th width="852" height="85" colspan="2" align="left" valign="middle" background="images/BG1.png" bgcolor="#CCCCCC" scope="col"><div align="center"> <p><img src="images/reagman_L.gif" alt="Reagan logo" width="99" height="98" /><img name="ReaganPower" src="images/Reagan Power.gif" width="581" height="59" border="0" id="ReaganPower" alt="Reagan logo" /><img src="images/reagman_R.gif" alt="Reagan logo" width="99" height="98" /></p> </div> <div align="center"></div></th> </tr> <tr> <td colspan="2" align="left" valign="top" bgcolor="#FFFFFF"><p> </p> <blockquote> <p align="center" class="style16">Registration Form </p> <?php echo ($_SESSION['error']) ?> <p align="center" class="style15">If you are a first time user, you must register </p> </blockquote> <script type="text/javascript" language="JavaScript"> <!-- function BothFieldsIdentical() { var one = document.form1.password.value; var another = document.form1.confirmpassword.value; if(one != another) { alert("Passwords must be identical."); return false; } } //--> </script> <form id="form1" name="form1" method="post" action="insert.php"> <blockquote> <blockquote> <blockquote> <p align="center" class="style12">Fields marked with <span class="style14">*</span> are required. </p> </blockquote> </blockquote> </blockquote> <table width="426" border="0" align="center" cellpadding="1" cellspacing="1"> <tr> <td width="165"><div align="left">Username</div></td> <td width="278"><input name="username" type="text" id="username" size="30" /> <span class="style14">*</span></td> </tr> <tr> <td>Password</td> <td><input name="password" type="password" id="password" size="30" /> <span class="style14">*</span></td> </tr> <tr> <td>Confirm Password </td> <td><input name="confirmpassword" type="password" id="confirmpassword" size="30" /> <span class="style14"> *</span></td> </tr> <tr> <td>First Name: </td> <td><input name="firstname" type="text" id="firstname" size="30" /> <span class="style14">*</span></td> </tr> <tr> <td><div align="left">Middle:</div></td> <td><input name="middle" type="text" id="middle" size="30" /></td> </tr> <tr> <td><div align="left">Last Name: </div></td> <td><input name="lastname" type="text" id="lastname" size="30" /> <span class="style14">*</span></td> </tr> <tr> <td><div align="left">Address:</div></td> <td><input name="address" type="text" id="address" size="30" /> <span class="style14">*</span></td> </tr> <tr> <td><div align="left">City:</div></td> <td><input name="city" type="text" id="city" size="30" /> <span class="style14">*</span></td> </tr> <tr> <td><div align="left">State:</div></td> <td><input name="state" type="text" id="state" size="30" /> <span class="style14">*</span></td> </tr> <tr> <td><div align="left">Zip:</div></td> <td><input name="zip" type="text" id="zip" size="30" /> <span class="style14">*</span></td> </tr> <tr> <td><div align="left">Phone number:</div></td> <td><input name="phone" type="text" id="phone" size="30" /> <span class="style14">*</span></td> </tr> <tr> <td><div align="left">Alternate Phone number: </div></td> <td><input name="alternate" type="text" id="alternate" size="30" /></td> </tr> <tr> <td><div align="left">Email:</div></td> <td><input name="email" type="text" id="email" size="30" /> <span class="style14">*</span></td> </tr> <tr> <td><div align="left">Company:</div></td> <td><input name="company" type="text" id="company" size="30" /></td> </tr> </table> <blockquote> <blockquote> <blockquote> <blockquote> <blockquote> <p align="left"> </p> </blockquote> </blockquote> </blockquote> </blockquote> <p align="center"> <input name="Submit" type="submit" onclick="return BothFieldsIdentical();" value="Submit" /> <input type="reset" name="Submit2" value="Reset" /></p> <p align="center"> </p> </blockquote> </form> </td> </tr> <tr> <td colspan="2" background="images/BG1.png" bgcolor="#CCCCCC"><div align="center"><span class="style8"><strong>Reagan Equipment Co., Inc.</strong><br /> Toll free: 800.264.7767<br /> Email: <a href="mailto:info@reaganpower.com">info@reaganpower.com</a></span></div></td> </tr> <tr> <td colspan="2" background="images/BG1.png" bgcolor="#CCCCCC"><div align="center"> <p class="style8">Copyright © 2007<br /> <a href="http://www.point2pointhosting.com/" class="style12"> Hosted by point2point</a></p> </div></td> </tr> </table> </div> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/50495-solved-i-am-trying-to-display-a-message-invalid-username-password-combination-on-my/#findComment-248103 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.