the_oliver Posted April 16, 2007 Share Posted April 16, 2007 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 More sharing options...
pocobueno1388 Posted April 16, 2007 Share Posted April 16, 2007 First of all, what are the errors you are getting? Link to comment https://forums.phpfreaks.com/topic/47317-solved-wheres-the-error/#findComment-230817 Share on other sites More sharing options...
Dragen Posted April 16, 2007 Share Posted April 16, 2007 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? Link to comment https://forums.phpfreaks.com/topic/47317-solved-wheres-the-error/#findComment-230820 Share on other sites More sharing options...
the_oliver Posted April 16, 2007 Author Share Posted April 16, 2007 Parse error: parse error in /blaa/parts/client_fault_report.php on line whatever bothtimes. Link to comment https://forums.phpfreaks.com/topic/47317-solved-wheres-the-error/#findComment-230821 Share on other sites More sharing options...
maxic0 Posted April 16, 2007 Share Posted April 16, 2007 on line whatever? what line is it lol? Link to comment https://forums.phpfreaks.com/topic/47317-solved-wheres-the-error/#findComment-230826 Share on other sites More sharing options...
the_oliver Posted April 16, 2007 Author Share Posted April 16, 2007 for the first problem it is the print " .... line. for the second problem it is the line affter the ?> Thanks! Link to comment https://forums.phpfreaks.com/topic/47317-solved-wheres-the-error/#findComment-230828 Share on other sites More sharing options...
Dragen Posted April 16, 2007 Share Posted April 16, 2007 have you checked for any unclosed statements? Link to comment https://forums.phpfreaks.com/topic/47317-solved-wheres-the-error/#findComment-230834 Share on other sites More sharing options...
the_oliver Posted April 16, 2007 Author Share Posted April 16, 2007 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>"); } ?> Link to comment https://forums.phpfreaks.com/topic/47317-solved-wheres-the-error/#findComment-230836 Share on other sites More sharing options...
Dragen Posted April 16, 2007 Share Posted April 16, 2007 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 { } Link to comment https://forums.phpfreaks.com/topic/47317-solved-wheres-the-error/#findComment-230839 Share on other sites More sharing options...
kenrbnsn Posted April 16, 2007 Share Posted April 16, 2007 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 Link to comment https://forums.phpfreaks.com/topic/47317-solved-wheres-the-error/#findComment-230841 Share on other sites More sharing options...
the_oliver Posted April 16, 2007 Author Share Posted April 16, 2007 Thanks. }} was an increadbly stupid mistake!! And echo point fixed the other! Ta! Link to comment https://forums.phpfreaks.com/topic/47317-solved-wheres-the-error/#findComment-230844 Share on other sites More sharing options...
Dragen Posted April 16, 2007 Share Posted April 16, 2007 yeah, sometimes it just takes a fresh look at it to realise the little mistakes! Link to comment https://forums.phpfreaks.com/topic/47317-solved-wheres-the-error/#findComment-230845 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.