Undefined index: [Problem Solved]
Posted: Tue Dec 05, 2006 11:38 am
feyd | Please use
and here's is the index.php that will supposed to recognized the sessions from the login script.
anybody have some idea please help
thanx in advanced..
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
hello guys,
i wonder what goes wrong with my code which involved sessions.. and received the following message bellow.
[quote]Notice: Undefined index: [b]some message line whatever # here[/b]
The search identifier had errors.[/quote]
here's my LogIn script that will then process to the index.php page...Code: Select all
<?php
require("../modules/config.php");
include("../modules/modlib.php");
if($_POST['cmdLog']) // On POST execute statments.
{
$user = escval($_POST['per_user']);
$seek = "SELECT usr FROM user_mas WHERE usr = '$user'";
$flag = mysql_query($seek) or die('Problem:'.mysql_error());
$getusr = mysql_fetch_array($flag);
$pass = encrypt_pass($_POST['per_pass']);
if(strcmp($user, $getusr['usr'])){
echo '<script type="text/javascript">
alert("Invalid User or Password!")
window.location.href = "login.html"
</script>';
die();
}else{
$seek = "SELECT user_mas.id_mas, user_mas.usr, user_mas.auth, user_dtl.nme FROM user_mas, user_dtl
WHERE user_mas.usr = '$user' AND user_mas.psw = '$pass' AND user_mas.id_mas = user_dtl.id_dtl";
$flag = mysql_query($seek) or die('Problem: '.mysql_error());
$getrow = mysql_fetch_array($flag);
if(mysql_num_rows($flag) == 1){
// Process if true
session_start();
$_SESSION['ses_id'] = genid($_SESSION['ses_id']);
$_SESSION['usr_id'] = $getrow['id_mas'];
$_SESSION['usr_op'] = $getrow['auth'];
header('Location: ../index.php');
}else{
echo '<script type="text/javascript">
alert("Invalid User or Password!")
window.location.href = "login.html"
</script>';
die();
}
}
}// End POST statements.
?>Code: Select all
<!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" />
<title>SuperBalita Content Management System v1.0</title>
<script type="text/javascript" src="modules/jscript.js"><!-- //--></script>
<script type="text/javascript">
<!--
function validateForm(form) {
if(isChosen(form.mnuLocation, 'Location')){
if(isChosen(form.mnuSection, 'Section')){
if(isNotEmpty(form.fldTitle, 'Title')){
if(isNotEmpty(form.fldContent, 'Description')){
return true;
}
}
}
}
return false;
}
//-->
</script>
<link href="default.css" rel="stylesheet" type="text/css" />
</head>
<body>
<?php
session_start();
$_SESSION['ses_id'];
$_SESSION['usr_id'];
$_SESSION['usr_op'];
if(!isset($_GET['ses_id'])){
die("The search identifier ".$_GET['ses_id']." had errors.");
}
if(!isset($_GET['usr_id'])){
die("The search identifier " . $_GET['usr_id'] . " had errors.");
}
if(!isset($_GET['usr_op'])){
die("The search identifier " . $_GET['usr_op'] . " had errors.");
}
?>
<div id="wrap">
<div id="divSet">
<div class="detail">
<div id="user">SignOut: <b><a href="admin/log_off.php">User Level 1</a></b> - <a href="#">View Profile</a></div>
<div id="date">
<script language="JavaScript" type="text/javascript">dT();</script>
</div>
</div>
<div style="clear: both;">
<div class="lefColm">
<p class="ctrl"><a href="#?url_id=">Gateway</a> | <a href="#">Layout Mananger</a> | <a href="#">Archieve Manager</a> </p>
</div>
<div class="ritColm">
<p class="ctrl"><a href="#">User Manager</a> | <a href="#">Database Panel</a> | <a href="#">Data Overview</a></p>
</div>
</div>
<div style="background-color: #666699; clear: both;">
<div style="padding: 1px 2px;">
<p class="ctrl"><a href="modules/mod_write.php" target="contentFRM">Add Article</a> |<a href="#">View Article</a> </p>
</div>
</div>
<div style="background-color:#CCCC99; padding: 10px; clear: both;" align="center">
<!-- Module Goes Here -->
<?php include('modules/mod_write.php'); ?>
<?php //include('modules/iframe.html'); ?>
<!-- End Module -->
</div>
</div>
</div>
</body>
</html>thanx in advanced..
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]