My name is Dennis, currently im doing my final year project for a system called " Records Management System" I'm using xampplite localhost phpmyadmin as my database SQL server.
i face a problem in my system that shown a message:

"Warning: Unknown: Your script possibly relies on a session side-effect which existed until PHP 4.2.3. Please be advised that the session extension does not consider global variables as a source of data, unless register_globals is enabled. You can disable this functionality and this warning by setting session.bug_compat_42 or session.bug_compat_warn to off, respectively. in Unknown on line 0"

How can i solve this problem or disable this message ? Urgent !
Hope to get ur reply soon. Thank you very much :)

I think you are using OLDER version of PHP server. In older version of php, session is used by session_register() function. So I think either you change your php server or use session_register() function to implement your code.
For reference
http://www.php.net/manual/en/function.session-register.php

If this not solve your problem then let me know. I will be happy to help you.

Thank you so much mahavir, actually i'm just a beginner to PHP. so need to ask u again.
This is my coding:
<?php
session_start();
$Sname = $_SESSION[Sname];
require_once('./includes/db.php');
?>
So u mean using session_register(); instead of session_start(); ?

I have searched and I think in PHP 4.2.0 and onwards, register_globals directive defaults to off so your code should work.
So don't change your code. If you let me see your code, may be i help you.

You could also enable your 'register_globals' in your 'php.ini' file at your server.

Can you show me the step how to enable my register_globals ? really embarrassing to show my code here, the coding is quite messy...
My code is shown below:

staff.php

<?php
    session_start();
    require_once('./includes/db.php');
$query  = "select * from staff where Sname='$Sname'";
$result = mysql_query($query) or die('Error, query failed '. mysql_error());
$row=mysql_fetch_array($result);

    ?>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <link type="text/css" href="menu.css" rel="stylesheet" />
    <script type="text/javascript" src="jquery.js"></script>

<br/>
<br/>
<br/>
<BODY background="BG/old1.jpg" >


    <tr>
    <td>
    <center>
<?php

echo "<strong>Welcome </strong>";
    print_r ($_SESSION[Sname]);
echo date(", l, jS F Y");
?><br/>
</center>
<div align="Left">
<marquee><font size="4"><b>Windmill Mobile Phone Records Management System</marquee>
</font>
<div id="menu">
        <ul class="menu">
            <li><a href="bregis.php" ><span>Buyer Registration</span></a>
            <li><a href="#" class="parent"><span>Search</span></a>
            <div><ul>
            <li><a href="searchrp.php" ><span>Purchase Order</span></a>
            <li><a href="search.php" ><span> Buyer</span></a>
            </ul></div>
            </li>
            <li><a href="searchby.php" ><span>Edit/Delete Buyer </span></a>
            <li><a href="#" class="parent"><span>Mobile Phone Category</span></a>
            <div><ul>
                    <li><a href="apple.php" ><span>Apple</span></a>
                    <li><a href="bb.php" ><span>BlackBerry</span></a>
                    <li><a href="nokia.php" ><span>Nokia</span></a>
                    <li><a href="samsung.php"><span>Samsung</span></a></li>
                    </ul></div>
            </li>
            <li class="last"><a href="logout.php"><span>Logout</span></a></li>
            </li>


        </ul>
    </div>

apple.php

<?php
    session_start();
    require_once('./includes/db.php');
    $Sname = $_SESSION[Sname];

$query  = "select * from staff where Sname='$Sname'";
$result = mysql_query($query) or die('Error, query failed '. mysql_error());
$row=mysql_fetch_array($result);

$sql  = "select * from upload ";
$result1 = mysql_query($query) or die('Error, query failed '. mysql_error());
$row1=mysql_fetch_array($result1);
?>



<center>
<BODY background="BG/Gray.jpg" >
<?php

    echo "<strong>Welcome </strong>";
    print_r ($_SESSION[Sname]);
?>

    <br/>
<a href="index.php"> Logout</a><br/>   
<a href="staff.php"> Main Menu</a>
    <br/>
    <br/>

    <h3>Apple Models: </h3>

<marquee><img src="images/apple.jpg" border="0" > </marquee>   
  <hr noshade color="#FFFFF0">                    



    <table width="95%" border="1" cellpadding="2" cellspacing="0" bordercolor="black">
      <tr align="center" bordercolor="whitesmoke" bgcolor="#E0E0E0" class="Tracking_title">
        <td width="10%" bgcolor="#A1A1A1" class="headerbg">Model</td>
        <td width="15%"  class="headerbg">Size</td>
        <td width="18%" class="headerbg">Function</td>
         <td width="15%" class="headerbg">Talk_Time</td>
       <td width="10%" class="headerbg">Price</td>
         <td width="14%" class="headerbg">Photo</td>
           <td width="15%" class="headerbg">Purchase</td>
         </tr>




<?php


require_once('./includes/db.php');
$query  = "SELECT MID, Size, Func, TT, Price, Photo FROM apple ";

    $result = mysql_query($query) or die('Error, query failed '. mysql_error());

    while($row=mysql_fetch_array($result))
    {
?>
 <tr align="center" bordercolor="whitesmoke">
          <td align="center">
            <?php echo $row['MID'];?>
          </a>
          </td>

          <td align="center">
            <?php echo $row['Size'];?>
          </td>

           <td align="center">
            <?php echo $row['Func'];?>       
          </td>
           <td align="center">
            <?php echo $row['TT'];?>     
          </td>

           <td align="center">
            <?php echo $row['Price'];?>      
          </td>

          <td align="center" bgcolor="white">
            <img src="uploads/apple/<?php echo $row['Photo']; ?>" 
          </td>

           <td align="center">
            <a href="aaddpur.php?MID=<?php echo $row[MID]?>">Purchase</a>
            </td>
        </tr>
         <?php
                 }
                ?>

aaddpur.php

<?php
session_start();
$Sname = $_SESSION[Sname];
require_once('./includes/db.php');

$MID=$_GET['MID'];
$query  = "select * from apple where MID='$MID'";
$result = mysql_query($query) or die('Error, query failed '. mysql_error());
$row=mysql_fetch_array($result);
?>
<!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">

    <center> 
<br/>
<br/>
<br/>
<BODY background="BG/Gray.jpg" >

    <tr>
    <td>
<?php
    echo "<strong>Welcome </strong>";
    print_r ($_SESSION[Sname]);
?><br/>

<a href="nokia.php"> Back</a><br/> 
<a href="staff.php"> Main Menu</a>
<h3> Purchase Form </h3>
<br/>
    <?php


                $check = "SELECT Sname, Bname, MID, Quantity, Date FROM po";            
                $result = mysql_query($check);


    $_SESSION[MID]= $_POST[MID];
    $_SESSION[Bname]= $_POST[Bname];
    $_SESSION[Quantity]= $_POST[Quantity];
    $_SESSION[Date]= $_POST[Date];

    ?>  

<table>
<form method="post" action="addpurchase.php">    
<tr><td>Model:</td><td> <?php echo $row[MID]?> <br/></td></tr>
<tr><td><input type = 'hidden' value = <?php echo $MID;?> name ='MID'/></td></tr>
<tr><td>Staff Name:</td><td><input type = 'text' value = <?php echo $Sname; ?>  name = 'Sname' /><br/></td></tr>
<tr><td>Buyer Name:</td><td><input type="text" name="Bname"/><br/></td></tr>
<tr><td>Quantity:</td><td><input type="text" name="Quantity"/><br/></td></tr>
<tr><td>Date:</td><td><input type="text" name="Date"/><br/></td></tr>


<br/>
<tr><td><input type="submit" value="Purchase" /></td></tr>
</form>
</table>

addpurchase.php

<?php
    session_start();
    require_once('includes/db.php');


    $error = false;
    $Bname = '';
    $MID = $_POST[MID];
    $Sname = $_POST[Sname];
    $Stock = '';
    $Quantity = '';
    $Date = '';



if(!empty($_POST['Bname']))
    {       
        $Bname = $_POST['Bname'];
    }
    else
    {
        echo 'Please fill in the Buyer Name';
        $error = true;
    }



    if(!empty($_POST['Quantity']))
    {       
        $Quantity = $_POST['Quantity'];
    }
    else
    {
        echo 'Please fill in the Quantity';
        $error = true;
    }

    if(!empty($_POST['Date']))
    {   
        $date_error = false;


        $Date = $_POST['Date'];
        list($day, $month, $year) = split('-', $_POST['Date']);

        if($day <= 31 && $day >0)
        $day = intval($day);
        else
        $date_error = true;

        if($month <= 12 && $month > 0)
        $month = intval($month);
        else
        $date_error = true;

        $year = intval($year) ? intval($year) : 0;

        if($date_error || $year == 0)
        {
            echo "Date error. Please follow the exact format: dd-mm-yy.";
            $error = true;
        }
    }
    else
    {
        echo 'Please fill in the Date';
        $error = true;
    }





if(!$error)
    {

        //convert raw password into hash form
        $Password = md5($Password);

        //232434343password232434343
        //time as salt for the activation hash
        $activation = md5(time() . $password);

        $sql = "INSERT INTO po (Bname, Sname, MID, Quantity, Date ) 
                VALUES('$Bname', '$Sname', '$MID', '$Quantity', '$Date' )";


            $result = mysql_query($sql);        
        {
            echo "Add Purchase sucessfully! click to the Main Page.";           
            //send email with activation code and link
        }
            }





{
    //
}
?>
<input type = 'hidden' value = <?php echo $row[Sname]?> name ='Sname'/>
<a href="staff.php">Main Page</a>
<BODY background="BG/Gray.jpg" >

Thanks :)

Sorry to tell you, your code works fine in my system.
I am using php5

You can change 'register_globals' in your server.

Open the server control
In 'configuration' TAB open PHP->php.ini
search for word 'register_globals'
You can change the value

register_globals = off
register_globals = on

After change anything on php.ini, you have to restart the server.

Mahavir, finally my problem solved when i change the register_globals = On. really thank you so much, appreciate :)

@Windmill: If you're query has been resolved please mark the post as solved. Thanks.

Ya, i just searching how to mark this post as solved. Can u teach me how to mark ? thanks :)

Click the (Mark Solved) Link at the top of the page in the PHP discussion thread bar.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.