0

Please help me.

I got this error while uploading in Server. I developed this code in windows based. But the deployed server is Linux Server. In windows server i didn't get this session error.

Here is my code:

<?php session_start();
require_once('l2t_connect.php');
if($_GET['action'] == "send")
{
	if(isset($_REQUEST['btnSend']))
	 {
		$key=substr($_SESSION['key'],0,5);
      		$number = $_REQUEST['number'];
		if($number!=$key)
	  	{
         	 	$message = "Please enter the correct Code!";
	    	}
     }
}
<?php } ?>

Thank you in advance!!!!!!

2
Contributors
3
Replies
5
Views
8 Years
Discussion Span
Last Post by cwarn23
0

That last line would have been a real bug. Try the following:

<?php session_start();
require_once('l2t_connect.php');
if($_GET['action'] == "send")
{
if(isset($_REQUEST['btnSend']))
    {
    $key=substr($_SESSION['key'],0,5);
    $number = $_REQUEST['number'];
    if($number!=$key)
        {
        $message = "Please enter the correct Code!";
        }
    }
}

Also make sure l2t_connect.php does not contain session_start(). Good luck.

0

Thank you for your reply.
But the Same error comes again. This is my Actual coding.

<?php session_start();
require_once('l2t_connect.php');
if($_GET['action'] == "send")
{
 if(isset($_REQUEST['btnSend']))
 {
  $key=substr($_SESSION['key'],0,5);
  $number = $_REQUEST['number'];
  if($number!=$key)
  {
    $message = "Please enter the correct Code!";
  }
  else
  {
      $sqlAdd="INSERT INTO l2t_enquiry (name, email, conno, comment, is_answered, is_deleted)
      VALUES
      (  '".$_POST['enq_name']."', 
         '".$_POST['emailid']."',
         '".$_POST['conno']."',
         '".$_POST['comments']."',
         'true',
         'true')";
      $resultAdd = mysql_query($sqlAdd);
  }
 }
}
?>
0

Perhaps php short tags might make a difference. Below is an example and I fixed a mysql bug at the same time.

<? session_start();
require_once('l2t_connect.php');
if($_GET['action'] == "send")
{
if(isset($_REQUEST['btnSend']))
{
$key=substr($_SESSION['key'],0,5);
$number = $_REQUEST['number'];
if($number!=$key)
{
$message = "Please enter the correct Code!";
}
else
{
$sqlAdd="INSERT INTO l2t_enquiry (name, email, conno, comment, is_answered, is_deleted) VALUES ( '".
mysql_real_escape_string($_POST['enq_name'])."', '".mysql_real_escape_string($_POST['emailid']).
"', '".mysql_real_escape_string($_POST['conno'])."', '".mysql_real_escape_string($_POST['comments']).
"', 'true', 'true')";
$resultAdd = mysql_query($sqlAdd);
}
}
}
?>

If that doesn't work then make sure there are no spaces/tabs before the <? as that will also cause an error. Also please use code tags like I have above as it make the code so much more readable.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.