Deoctor Posted January 19, 2010 Share Posted January 19, 2010 Hai i am writing this code and the cookies which i am setting are not working in this one.. can some one tell me why is it not working <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "[url=http://www.w3.org/TR/html4/strict.dtd]http://www.w3.org/TR/html4/strict.dtd[/url]"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title> Support Ticket System</title> <link rel="stylesheet" href="./styles/main.css" media="screen"> <link rel="stylesheet" href="./styles/colors.css" media="screen"> </head> <body> <div id="container"> <div id="header"> <a id="logo" href="login.php" title="Ninestars Support Center"><img src="./images/logo2.jpg" border=0 alt="Ninestars Support Center"></a> <p><span><b>NINESTARS</b> SUPPORT TICKET</span> SYSTEM</p> </div> <div id="content"> <div id="index"> <h1>Welcome to the support center</h1> <p class="big">In order to streamline support requests and better serve you, we utilize a support ticket system. Every support request is assigned a unique ticket number which you can use to track the progress and responses online. For your reference we provide complete archives and history of all your support requests. A valid email address is required.</p> <hr /> <br /> <div class="rcol"> <img src="./images/ticket_status_icon.jpg" width="48" height="48" align="left" style="padding-bottom:150px;"> <h3>Enter login details</h3>Please enter the email id and password which has been shared to you. <br /><br /> <form class="status_form" action="login.php" method="post"> <fieldset> <label>Email:</label> <input type="text" name="lemail"> </fieldset> <fieldset> <label>Password#:</label> <input type="text" name="lpwd"> </fieldset> <fieldset> <label> </label> <input type="submit" name="login" class="button2" value="Login"> </fieldset> </form> </div> <div class="clear"></div> <br /> </div> <br /> <div style="clear:both"></div> </div> <div id="footer">Copyright © <a href="[url=http://www.ninestars.in]http://www.ninestars.in[/url]">Ninestars</a>. All rights reserved</div> </body> </html> <?php if(isset($_POST['login'])) { error_reporting(off); include("db/access.php"); $uname=$_POST['lemail']; $pwd=$_POST['lpwd']; $query=mysql_query("select first_nm from client_details where email='$uname' and pwd='$pwd'") or die(mysql_error()); $result=mysql_result($query,0); if($result!='') { echo "hai ".$uname."<br>"; setcookie("user", "chaitanya", time()+3600); echo "Welcome " . $_COOKIE["user"] . "!<br/>"; //echo "<META HTTP-EQUIV=\"Refresh\" CONTENT=\"1; URL=open.php\">"; } else { echo ("<table><td bgcolor=orange width=100%><font face=Verdana, Arial, Helvetica, sans-serif size=2><b><center>You have entered a wrong username or password</center></b></font></td></table>"); //echo "<center><b>You have entered a wrong username or password</b></center>"; //echo "<META HTTP-EQUIV=\"Refresh\" CONTENT=\"1; URL=login.php\">"; } } ?> Quote Link to comment Share on other sites More sharing options...
btherl Posted January 19, 2010 Share Posted January 19, 2010 Take a look at this thread on header errors The main point is you must either buffer your output (as the very first action in the script, before any output) or set your cookies before producing any output. Quote Link to comment Share on other sites More sharing options...
Deoctor Posted January 19, 2010 Author Share Posted January 19, 2010 thnk u for the reply.. i figured it out.. 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.