...

View Full Version : Getting No error reporting only Blank Screen



jeddi
01-21-2012, 11:08 AM
Hi

I am running PHP version 5.3.2

My script starts off with picking up a variable using GET and displaying
it on the screen then exits.

I get NOTHING !!!

Now there maybe something wrong in the script after the exit, so maybe it is not compiling, but if that is the case WHY am I not getting the error reporting ?

I used to get the errors but I think the php was updated and now I just get blank screen !

I thought the ini_set ("display_errors", "1"); error_reporting(E_ALL); would force error reporting ( over riding whatever the php.ini file says

NO ?

Here is the full script


<?php
/*
* activate.php
*
*
*
*/

if(session_id() == ''){session_start();}

// Turn ON the error display

ini_set ("display_errors", "1");
error_reporting(E_ALL);

// require_once("my_functions.php");

$mail_prog = $_SERVER['DOCUMENT_ROOT']."/send_email.php";

$the_key = $_GET["a"];

echo "<br>The_key: $the_key <br> Client_no:$client_no<br><br>";
exit();

$sql = "SELECT client_no,gift_key FROM gifts where gift_id = '$the_key'";
$result = mysql_query($sql) or die("could not execute FIND CLIENT query.". mysql_error());
$num = mysql_num_rows($result);

if ($num == 0 ) { // if the client does not exist

$the_text = "For some strange reason your user id is not registered on the system.<br>
<br>
If you require assistance, <br>
please send an email to administration <br>
via the <a href=\"/contact.php\">contact page</a>.
<br><br>
Or If you have another email account - just try again :)";
} // endif
else{ // If the gift is found
$gift_key = "{$row['gift_key']}";
$client_no = "{$row['client_no']}";

echo "<br>$gift_key: Gift_key <br> Client_no:$client_no<br><br>";
exit();
$the_text = "Congratulations -- You're in !
<br><br>
Here is your Plugin code:
<br><br>
<div class=\"plugin\">
<pre>
&lt;div style="width:240px"&rt;&lt;center&rt;
&lt;span style="font-size:14px; color:red; font-weight: bold;"&rt;Get Your Free Download NOW!&lt;/span&rt;
&lt;br&rt;&lt;br&rt;
&lt;form name="regis" action ='http://expressresponse.net/sys/lead_gen.php' method = 'POST'&rt;
&lt;span&rt;&lt;input type='hidden' name = 'xrkey' value = "&lt;?php echo $gift_key ?&rt;" &rt;&lt;/span&rt;
&lt;span&rt;Name:&lt;/span&rt;
&lt;span&rt;&lt;INPUT name="x_name" value= '' size="20" maxlength size="30" type="text"&rt;&lt;/span&rt;
&lt;br&rt;&lt;br&rt;
&lt;span&rt;Email:&nbsp;&lt;/span&rt;
&lt;span&rt;&lt;INPUT name="x_email" value= '' size="20" maxlength size="60" type="text"&rt;&lt;/span&rt;
&lt;br&rt;&lt;br&rt;
&lt;input type="submit" value="Click Here"&rt;
&lt;/form&rt;&lt;/center&rt;&lt;/div&rt;
</pre>
</div>
<br><br>
You can use the plugin script immediately to build for list,<br>
or you can login and add outgoing messages from your Control Panel.<br>
<br><br>
<a href=\"/login_fm.php\">Now Login</a>.
<br><br>
<br><br>";

$sql = "UPDATE clients set confirm = 'y' WHERE client_id = '$client_no'";
$result = mysql_query($sql) or die("could not execute UPDATE CLIENT-CONFIRM query.". mysql_error());
} // end else
require_once("a_head.php");
?>
<h1><center><i>Get Building Your List Now!</i></center></h1>

<h3>Welcome to the fastest easiest way to build you list.</h3>
<p>
<?php echo "$the_text"; ?>
<br><br>
</p>

<?php
require_once("footer.php");
?>



The script is called with:
http://www.expressresponse.net/activate.php?a=3



Would really appreciate help as it is affecting all my script writing.

PS As I said there is probably an error in the script where I am trying to have some HTML displayed on the screen. But that should maybe be another thread ;)

Thanks


.

djm0219
01-21-2012, 01:41 PM
You didn't escape all of your double quotes in the $the_text variable in your else clause as you did elsewhere.



$the_text = "Congratulations -- You're in !
<br><br>
Here is your Plugin code:
<br><br>
<div class=\"plugin\">
<pre>
&lt;div style=\"width:240px\"&rt;&lt;center&rt;
&lt;span style=\"font-size:14px; color:red; font-weight: bold;\"&rt;Get Your Free Download NOW!&lt;/span&rt;
&lt;br&rt;&lt;br&rt;
&lt;form name=\"regis\" action ='http://expressresponse.net/sys/lead_gen.php' method = 'POST'&rt;
&lt;span&rt;&lt;input type='hidden' name = 'xrkey' value = \"&lt;?php echo $gift_key ?&rt;\" &rt;&lt;/span&rt;
&lt;span&rt;Name:&lt;/span&rt;
&lt;span&rt;&lt;INPUT name=\"x_name\" value= '' size=\"20\" maxlength size=\"30\" type=\"text\"&rt;&lt;/span&rt;
&lt;br&rt;&lt;br&rt;
&lt;span&rt;Email:&nbsp;&lt;/span&rt;
&lt;span&rt;&lt;INPUT name=\"x_email\" value= '' size=\"20\" maxlength size=\"60\" type=\"text\"&rt;&lt;/span&rt;
&lt;br&rt;&lt;br&rt;
&lt;input type=\"submit\" value=\"Click Here\"&rt;
&lt;/form&rt;&lt;/center&rt;&lt;/div&rt;
</pre>
</div>
<br><br>
You can use the plugin script immediately to build for list,<br>
or you can login and add outgoing messages from your Control Panel.<br>
<br><br>
<a href=\"/login_fm.php\">Now Login</a>.
<br><br>
<br><br>";

jeddi
01-21-2012, 03:04 PM
Thanks,

I will escape them.

(actually can I use single quotes instead ?)


BUT why am I not getting any error displayed on my screen ?

It looks like this is not working:


ini_set ("display_errors", "1");
error_reporting(E_ALL);


.

JAY6390
01-21-2012, 03:10 PM
I'm pretty sure that code wouldn't run (the ini set and error reporting that is) because the script is invalid, therefore it doesn't run any statements. You are best using a php.ini file in your document root if your hosting allows them, or use .htaccess to do the same thing. Check out this page (http://perishablepress.com/press/2008/01/14/advanced-php-error-handling-via-htaccess/) for advice on this

litebearer
01-21-2012, 05:25 PM
aside...

isn't this...


exit(); /* YOU ARE CAUSING SCRIPT TO END HERE */
$the_text = "Congratulations -- You're in !

causing $the_text NOT to be processed???

jeddi
01-21-2012, 08:37 PM
Thanks for all your advice.

I have got it working properly now.

Just one question ...

Instead of escaping all those double quotes, most of them can be
single quotes can't they ?

JAY6390
01-21-2012, 08:43 PM
While there's no specific reason not to, personally I think you are better using double quotes rather than single quotes for tag properties. Instead, why not try Heredoc syntax (http://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc) instead

$the_text = <<<EOF
Congratulations -- You're in !
<br><br>
Here is your Plugin code:
<br><br>
<div class="plugin">
<pre>
&lt;div style="width:240px"&rt;&lt;center&rt;
&lt;span style="font-size:14px; color:red; font-weight: bold;"&rt;Get Your Free Download NOW!&lt;/span&rt;
&lt;br&rt;&lt;br&rt;
&lt;form name="regis" action ='http://expressresponse.net/sys/lead_gen.php' method = 'POST'&rt;
&lt;span&rt;&lt;input type='hidden' name = 'xrkey' value = "&lt;?php echo $gift_key ?&rt;" &rt;&lt;/span&rt;
&lt;span&rt;Name:&lt;/span&rt;
&lt;span&rt;&lt;INPUT name="x_name" value= '' size="20" maxlength size="30" type="text"&rt;&lt;/span&rt;
&lt;br&rt;&lt;br&rt;
&lt;span&rt;Email:&nbsp;&lt;/span&rt;
&lt;span&rt;&lt;INPUT name="x_email" value= '' size="20" maxlength size="60" type="text"&rt;&lt;/span&rt;
&lt;br&rt;&lt;br&rt;
&lt;input type="submit" value="Click Here"&rt;
&lt;/form&rt;&lt;/center&rt;&lt;/div&rt;
</pre>
</div>
<br><br>
You can use the plugin script immediately to build for list,<br>
or you can login and add outgoing messages from your Control Panel.<br>
<br><br>
<a href="/login_fm.php">Now Login</a>.
<br><br>
<br><br>
EOF;

_Aerospace_Eng_
01-21-2012, 08:45 PM
Yes they can be but you have to be consistent. If you use double quotes to start the string then use single quotes within if you don't want to escape them, same goes for starting with single quotes, make sure to use double quotes within your string. Note however that if you want variables to be parsed in a string e.g.


$somevar = "test";
echo "The value of somevar is $somevar"; // yields The value of somevar is test

Then you need to use double quotes. This

$somevar = "test";
echo 'The value of somevar is $somevar"; // yields The value of somevar is

Will not work. If you started with single quotes and wanted variables to be parsed to you need to concat them e.g.


$somevar = "test";
echo 'The value of somevar is '.$somevar.' and it is concatenated'; // yields The value of somevar is test and it is concatenated.

The same can be used for double quotes too e.g.

echo "The value of somevar is ".$somevar." and it is concatenated";
It takes a bit longer to parse but it isn't noticeable. The heredoc syntax can be useful as well.

felgall
01-22-2012, 02:09 AM
Another alternative where you have a large block of HTML to output is to wrap it inside of

?>
<p>Regular HTML content</p>
<?php



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum