note 82767 added to function.session-start
| From: | mathanbox at hotmail dot com | Date: | Thu, 24 Apr 2008 20:57:16 +0000 |
| Subject: | note 82767 added to function.session-start | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-138752@lists.php.net to get a copy of this message | ||
<?php
session_start();
session_destroy();
$errormsg ='';
include ('./dbcon.php');
?>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>..::Welcome Mathan.info::..</title>
<meta name="keywords" content="" />
<meta name="description" content="" />
<link rel="icon" href="images/logo.ico" type="image/x-icon" />
<link rel="shortcut icon" href="images/logo.ico"
type="image/x-icon" />
<link href="default.css" rel="stylesheet" type="text/css" />
<script language="javascript">
function check()
{
if (document.form1.td_username.value == '' )
{
alert ('username field is empty!');
document.form1.td_username.focus();
return false;
}
if (document.form1.td_pass.value == '' )
{
alert ('password field is empty!');
document.form1.td_pass.focus();
return false;
}
}
</script>
</head>
<body>
<?php
// Get Username and Password sent from form
$td_username=$_POST['td_username'];
$td_pass=$_POST['td_pass'];
$tbl_name='task_user';
if (isset($_POST['Submit']))
{
$sql="SELECT * FROM $tbl_name WHERE uname='$td_username' and
upass='$td_pass'";
$result=mysql_query($sql);
$count = mysql_num_rows($result);
$row = mysql_fetch_row($result);
if ($count !=0)
{
session_start ();
$_SESSION['td_username'] = $td_username;
session_register('td_username');
echo $row[2];
if ($row[2] == 1)
{
header("Location:admin_login.php");
echo $_SESSION['td_username'];
//Go to Admin Page
}
else {
header("Location:user_login.php");
echo 'user';
//Go to User Page
}
}
else
{
$errormsg = "<font color=red><div><img
src='images/error.gif'>Invaild Username or Password</div></font>";
//header("Location:index.php");
//echo "error";
}
}
?>
<div id="header">
<div id="logo">
<p> </p>
<p><img src="images/logo.gif" alt="" width="504"
height="99" /> </p>
</div>
<div id="menu">
<ul>
<li class="active"><a href="index.php" accesskey="1"
title="">Home</a></li>
<li></li><li><a href="#" accesskey="3"
title="">About</a></li>
<li><a href="#" accesskey="4"
title="">Contact</a></li>
</ul>
</div>
</div>
<hr />
<div id="page">
<div id="bg">
<div id="content">
<div class="post" style="padding-top: 57px;">
<h2 class="title">Welcome to mathan.info</h2>
<div class="entry">
<center><strong> <?=$errormsg?></strong></center>
<form id="form1" name="form1" method="post"
action="index.php" >
<p><strong>UserName</strong>
<input type="text" name="td_username" />
</p>
<p><strong>Password</strong>
<input type="password" name="td_pass" />
</p>
à à à à à à <img src="images/login.gif"
alt="Login" width="48" height="48" style="display: block; float:
right" />Ã Ã Ã Ã Ã Ã Ã Ã Ã Ã Ã Ã
<input type="submit" name="Submit" value="Submit"
onMouseOver="style.background='#00BFFF';style.color='white'"
onMouseOut="style.background='';style.color='black'"
onClick="return check()" />
</form>
<pre><font face="Verdana, Arial, Helvetica, sans-serif">admin:
username=admin pass=pass
user: username=user pass=demo
user: username=mak pass=mak
</font></pre>
</div>
</body>
</html>
This my index.php code
if give some error
the error is
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers
already sent (output started at /www/zzl.org/m/a/t/mathan/htdocs/index.php:18) in
/www/zzl.org/m/a/t/mathan/htdocs/index.php on line 56
1
Warning: Cannot modify header information - headers already sent by (output started at
/www/zzl.org/m/a/t/mathan/htdocs/index.php:18) in /www/zzl.org/m/a/t/mathan/htdocs/index.php on line
63
please help friends
----
Server IP: 213.249.64.162
Probable Submitter: 122.164.161.59
----
Manual Page -- http://www.php.net/manual/en/function.session-start.php
Edit -- https://master.php.net/note/edit/82767
Del: integrated -- https://master.php.net/note/delete/82767/integrated
Del: useless -- https://master.php.net/note/delete/82767/useless
Del: bad code -- https://master.php.net/note/delete/82767/bad+code
Del: spam -- https://master.php.net/note/delete/82767/spam
Del: non-english -- https://master.php.net/note/delete/82767/non-english
Del: in docs -- https://master.php.net/note/delete/82767/in+docs
Del: other reasons-- https://master.php.net/note/delete/82767
Reject -- https://master.php.net/note/reject/82767
Search -- https://master.php.net/manage/user-notes.php