ms_dos10 Posted December 22, 2006 Share Posted December 22, 2006 I have problem with session , anyone can help me to fixed it . Am working package called Xampp for Windows Version 1.4.16 .everything is good till i face this problem with session . When am trying to log in from admincp.php to student_list.php it redirect to same page admincp.php . I'm wrote code when that happen means user wrote user name and password wrong .If someone have solve or face problem like this till me can do . Because that very important me to know , i don't want to get like that again .Maybe problem with my php.ini or any setting of php . Ask me I'll check and tell what the value i have . Here my to page admincp.php and student_list.php . <?phpob_start();session_start();if(isset($_POST['submit'])){ $name = $_POST['user']; $pws = $_POST['pws']; $sql ="SELECT * FROM tbl_student WHERE name ='".$name."'and pws='".$pws."'"; include("includes/config.php"); $result = mysql_query($sql); if(mysql_num_rows($result) == 1) { $_SESSION['sessref']; header("location:student_list.php"); exit(); } else { session_destroy(); header("loaction:admincp.php"); exit(); }}ob_end_flush();?><html><head><link href = "includes/admin.css" type = "text/css" rel = "stylesheet"><title>Admin Panel</title></head><body valign="top"><br><br><table width="600" align="center" border="1"><form name="frm" method="post" action=""><tr> <th colspan="2" align="center">Admin Panel</th></tr><tr> <th colspan="2" align="center">Admin Panel Student For Project</th></tr><tr> <td align="right">Admin Name:</td> <td align="left"><input type="text" name="user" value=""/></td></tr><tr> <td align = right>Admin Password:</td> <td align="left"><input type="password" name="pws" value=""/></td></tr><tr> <td align="right"><input type="submit" name="submit" value="Login" onclick="return checkdata()"/></td> <td align="left"><input type="reset" name="reset" value="Clear"/></td></tr></form></table><table width="600" align="center" border="0"><tr> <td align="left"><a href="add_student.php">Registration</a></td></tr><table></body></html> student_list.php <?phpsession_start();if(!isset($_SESSION['sessref'])){ session_destroy(); header("location:admincp.php"); exit();}if(isset($_GET['msg'])){ $msg = $_GET['msg']; echo"<br><br>"; echo "<center><font color=\"red\" size=3>".$msg."</font></center>";}?><html><head><link href = "includes/admin.css" type = "text/css" rel = "stylesheet"><title>Student List</title></head><body valign = top><table width = 600 align = center border = 1><tr> <th colspan = 6 align = center>List of Student</th></tr><tr> <td align = center>S.No.</td> <td align = center>Student Name</td> <td align = center>S.Image</td> <td align = center>S.E-mail</td> <td align = center>Action</td></tr><?include("includes/config.php");$result = mysql_query("select * from tbl_student");if(mysql_num_rows($result)== 0){ echo "<td colspan=\"6\" align=\"center\"><font size=\"3\">"."*** No Data In My DataBase ***"."</font></td>\n";}$i = 1;while($row = mysql_fetch_row($result)){ echo "<tr>\n"; echo "<td align = center>".$i++."</td>\n"; echo "<td align = center>".$row[1]."</td>\n"; echo "<td align = center><img src=".$row[3]." width = 150 height = 80></td>\n"; echo "<td align = center>".$row[4]."</td>\n"; echo "<td align = center>\n"; echo "<a href = check_pin_code.php?id=".$row[0].">Edit</a> \n"; echo "<a href = check_pin_del.php?id=".$row[0].">Delete</a>\n"; echo "</tr>\n";}?></table></body></html> Link to comment Share on other sites More sharing options...
ms_dos10 Posted December 24, 2006 Author Share Posted December 24, 2006 no answer why? Link to comment Share on other sites More sharing options...
Lakshmi Posted December 25, 2006 Share Posted December 25, 2006 HiU didn't assign any value to ur session variableThis is ur code: $_SESSION['sessref'];u can assign username to ur session variablelike $_SESSION['sessref']=$user;i thought this is the problem.plz try with...RegardsLakshmi Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now