1

I'm new in PHP.While doing my 1st project.I got two errors.This my code:

<?
session_start();
if(!session_is_registered(username)){
header("location:logindo.php");
}
?>
<table width="300" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<form name="form1" method="post" action="show.php">
<td>
<table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#777777">
<tr>
<td colspan="3"><strong>Enter the Student ID</strong></td>
</tr>
<tr>
<td width="110">Student ID:</td>
<td width="6"></td>
<td width="294"><input name="sb_id" type="text" id="sb_id"></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td><input type="submit" name="Submit" value="Show"></td>
</tr>
</table>
</td>
</form>
</tr>
</table>

When i go this page it show two error:

Notice: Use of undefined constant username - assumed 'username' in D:\xampp\htdocs\vss\showinfo.php on line 3

Deprecated: Function session_is_registered() is deprecated in D:\xampp\htdocs\vss\showinfo.php on line 3

Why this is showing and how can remove this.

Thanks in advance.

Yasir Adnan
  • 29
  • 1
  • 3

1 Answers1

1

Replace Line 3 with:

if(!isset($_SESSION['username'])){
Lawrence Cherone
  • 46,049
  • 7
  • 62
  • 106