HTTP_SERVER_VARS

 
Post new topic   Reply to topic    Aprelium Forum Index -> PHP
View previous topic :: View next topic  
Author Message
egoo
-


Joined: 22 Jan 2008
Posts: 16

PostPosted: Thu Jun 19, 2008 10:01 am    Post subject: HTTP_SERVER_VARS Reply with quote

Hi,
I'm using PHP Designer 2007 ver.5.4 ,but when I'm writing the PHP script below:
<?php
//create short variable name
$DOCUMENT_ROOT = $HTTP_SERVER_VARS['DOCUMENT_ROOT'];//PHP Notice : Undefined HTTP_SERVER_VARS
$orders= file("$DOCUMENT_ROOT/../orders/orders.txt");

$number_of_orders = count($orders);
if ($number_of_orders == 0)
{
echo '<p><strong>No orders pending.
Please try again later.</strong></p>';
}
for ($i=0; $i<$number_of_orders; $i++)
{
echo $orders[$i].'<br />';
}
?>
Please correct the script ,so that the PHP Notice doesn't appear never more. Thank you in advance
Back to top View user's profile Send private message
DonQuichote
-


Joined: 24 Dec 2006
Posts: 68
Location: The Netherlands

PostPosted: Thu Jun 19, 2008 11:51 am    Post subject: Reply with quote

$HTTP_SERVER_VARS is deprecated for quite some time now. The better version is called $_SERVER. You can, however, still set the old superglobals in PHP.INI.
Back to top View user's profile Send private message
egoo
-


Joined: 22 Jan 2008
Posts: 16

PostPosted: Thu Jun 19, 2008 1:23 pm    Post subject: HTTP_SERVER_VARS Reply with quote

Well, but it is appear another PHP Notice:
<?php
//create short variable name

$DOCUMENT_ROOT = $_SERVER['DOCUMENT_ROOT'];//PHP Notice:undefined index : DOCUMENT_ROOT
$orders= file("$DOCUMENT_ROOT/../orders/orders.txt");

$number_of_orders = count($orders);
if ($number_of_orders == 0)
{
echo '<p><strong>No orders pending.
Please try again later.</strong></p>';
}
for ($i=0; $i<$number_of_orders; $i++)
{
echo $orders[$i].'<br />';
}
?>
Back to top View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> PHP All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB phpBB Group