Jump to content

[SOLVED] Where's the error?


the_oliver

Recommended Posts

Hello, a scrip of mine is throughing out two errors i cant see.  First one is on the print line:

 

   if ($num > 0)
                {
                print "<meta http-equiv=\"refresh\" content=\"0;URL=http://www.bla.net/fr.php?rec=true&ses=".echo session_id()."&fail=open_ses\">";
                }

 

and the second is apparently after the ?>

$validationOK=true;
if ($email=="") $validationOK=false;
if (!$validationOK) {
  }
else
  {
  $EmailFrom = "[email protected]";
  $Subject = "fault report.";
  $Body = "Ya De Ya De Ya";
  $Body .= "\n";

  $success = mail($email, $Subject, $Body, "From: <$EmailFrom>");
  }

?>

 

Can someone point out my mistake? Thanks!

Link to comment
https://forums.phpfreaks.com/topic/47317-solved-wheres-the-error/
Share on other sites

I may be wrong but on the first one I think it should be echo $session_id().

   if ($num > 0)
                {
                print "<meta http-equiv=\"refresh\" content=\"0;URL=http://www.blue-emu.net/fr.php?rec=true&ses=".echo $session_id()."&fail=open_ses\">";
                }

 

the second one is probably due to a missed bracket } somewhere...

what are the actual error messages?

Yep. Don't think i have missed one.  Have put the whole contents bellow, just incase it helps.  Thanks!

 

 

<?php

 

include"common.php";

 

$url = Trim(stripslashes($_POST['url']));

$email = Trim(stripslashes($_POST['email']));

$details = Trim(stripslashes($_POST['details']));

$reoccurring = Trim(stripslashes($_POST['reoccurring']));

$username = Trim(stripslashes($_POST['username']));

 

$query = "SELECT status FROM fault_report WHERE submited_from_session='".session_id()."'";

$query2 = "SELECT status FROM fault_report WHERE submited_from_ip='".$_SERVER['REMOTE_ADDR']."'";

$result = pg_query($pg_connection, $query);

$result2 = pg_query($pg_connection, $query2);

 

$num = 0;

 

while($query_data = pg_fetch_array($result))

        {

        if ($query_data["status"] == "open")

                {

                $num_temp = $num;

                $num = $num_temp + 1;

                }

                else

                {

                {

        }

 

while($query_data2 = pg_fetch_array($result2))

        {

        if ($query_data2["status"] == "open")

                {

                $num_temp = $num;

                $num = $num_temp + 1;

                }

                else

                {

                {

        }

 

 

        if ($num > 0)

                {

                print "<meta http-equiv=\"refresh\" content=\"0;URL=http://www.bla.net/fr.php?rec=true&ses=".echo session_id()."&fail=open_ses\">";

                }

                else

                {

                $register = "INSERT INTO fault_report (date_submited,submited_from_ip,submited_from_session,problematic_url,contact_email,details,reoccurring,username)

                            VALUES ('".date("F j, Y, g:i a")."',

                                '".$_SERVER['REMOTE_ADDR']."',

                                '".session_id()."',

                                '".$url."',

                                '".$email."',

                                '".$details."',

                                '".$reoccurring."',

                                '".$username."')";

 

                pg_query($pg_connection, $register);

                print "<meta http-equiv=\"refresh\" content=\"0;URL=http://www.blue-emu.net/fr.php?rec=true&ses=".echo session_id()."&fail=open_ses\">";

                }

 

 

 

//SEND AN EMAIL TO THE FAULT REPORTER.

 

$validationOK=true;

if ($email=="") $validationOK=false;

if (!$validationOK) {

  }

else

  {

  $EmailFrom = "[email protected]";

  $Subject = "fault report.";

  $Body = "Ya De Ya De Ya";

  $Body .= "\n";

 

  $success = mail($email, $Subject, $Body, "From: <$EmailFrom>");

  }

 

?>

okay.. try this:

<?php

include ("common.php");

$url = Trim(stripslashes($_POST['url']));
$email = Trim(stripslashes($_POST['email']));
$details = Trim(stripslashes($_POST['details']));
$reoccurring = Trim(stripslashes($_POST['reoccurring']));
$username = Trim(stripslashes($_POST['username']));

$query = "SELECT status FROM fault_report WHERE submited_from_session='".session_id()."'";
$query2 = "SELECT status FROM fault_report WHERE submited_from_ip='".$_SERVER['REMOTE_ADDR']."'";
$result = pg_query($pg_connection, $query);
$result2 = pg_query($pg_connection, $query2);

$num = 0;

while($query_data = pg_fetch_array($result))
        {
        if ($query_data["status"] == "open")
                {
                $num_temp = $num;
                $num = $num_temp + 1;
                }
                else
                {
                }
        }

while($query_data2 = pg_fetch_array($result2))
        {
        if ($query_data2["status"] == "open")
                {
                $num_temp = $num;
                $num = $num_temp + 1;
                }
                else
                {
                }
        }


        if ($num > 0)
                {
                print "<meta http-equiv=\"refresh\" content=\"0;URL=http://www.bla.net/fr.php?rec=true&ses=".echo session_id()."&fail=open_ses\">";
                }
                else
                {
                $register = "INSERT INTO fault_report (date_submited,submited_from_ip,submited_from_session,problematic_url,contact_email,details,reoccurring,username)
                             VALUES ('".date("F j, Y, g:i a")."',
                                '".$_SERVER['REMOTE_ADDR']."',
                                '".session_id()."',
                                '".$url."',
                                '".$email."',
                                '".$details."',
                                '".$reoccurring."',
                                '".$username."')";

                pg_query($pg_connection, $register);
                print "<meta http-equiv=\"refresh\" content=\"0;URL=http://www.blue-emu.net/fr.php?rec=true&ses=".echo session_id()."&fail=open_ses\">";
                }



//SEND AN EMAIL TO THE FAULT REPORTER.

$validationOK=true;
if ($email=="") $validationOK=false;
if (!$validationOK) {
  }
else
  {
  $EmailFrom = "[email protected]";
  $Subject = "fault report.";
  $Body = "Ya De Ya De Ya";
  $Body .= "\n";

  $success = mail($email, $Subject, $Body, "From: <$EmailFrom>");
  }

?>

note:include (""); should have ().

also, on your else statements you had

{
{

where it should be

{
}

As was said before the first error refers to this line:

<?php
print "<meta http-equiv=\"refresh\" content=\"0;URL=http://www.bla.net/fr.php?rec=true&ses=".echo session_id()."&fail=open_ses\">";
?>

You're already in a "print" statement, you can't have an "echo" within it. I would write it this way:

<?php
print '<meta http-equiv="refresh" content="0;URL=http://www.bla.net/fr.php?rec=true&ses=' . session_id() . '&fail=open_ses">';
?>

 

Ken

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.