php-general Digest 6 Jan 2006 08:48:59 -0000 Issue 3890

Topics (messages 228222 through 228251):

Re: Timezone and DST
        228222 by: Mike Tuller
        228224 by: Mark Steudel
        228226 by: Mike Tuller
        228230 by: Chris Boget

[X-PHP] [PHP] help register domain name
        228223 by: tedd

complex arrays
        228225 by: Sjef Janssen
        228234 by: Sjef Janssen

set variable to go outside scope
        228227 by: Mike Tuller
        228228 by: Jay Blanchard
        228231 by: Mike Tuller
        228233 by: Jay Blanchard
        228236 by: Mike Tuller

Re: Very high speed session management -- help me test
        228229 by: Mark

Set variable outside of scope (redo)
        228232 by: Mike Tuller
        228237 by: Aaron Koning
        228238 by: Al
        228239 by: comex

XML Session serializer announcement and call for testers
        228235 by: Mark

Re: help register domain name
        228240 by: Mark Charette

Pages Expiring
        228241 by: Ben Miller
        228247 by: Gustav Wiberg

printing keys and values of array
        228242 by: Ahmed Abdel-Aliem
        228243 by: Zareef Ahmed
        228244 by: Brady Mitchell
        228246 by: Jim Moseby

Re: Newbie question: need to transfer directory contents fr om my local machine 
to my website
        228245 by: Jon Westcot

how to find the system tmp folder
        228248 by: Samuel DeVore
        228249 by: Travis Doherty

Re: How to: Search web for specific file type?
        228250 by: David Robley

Re: Setting cookie for two domains.
        228251 by: Jochem Maas

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [email protected]


----------------------------------------------------------------------
--- Begin Message --- Are you just displaying the time, or is this for submission in a database?


On Jan 5, 2006, at 12:50 PM, Mark Steudel wrote:

Hi All,

I've got a little problem where our servers are in PST but the customer operates in Hawaii (-10 GMT). I believe I can just get the time for them by
doing something like

date("d H i", strtotime('now -2 hours') );

But here's the catch, how should I deal with day light savings ( DST) . In
hawaii they don't observer DST, but in Washington State we do.

We're on php 4.x so I can't use the  date_default_timezone_set
<http://us2.php.net/manual/en/function.date-default-timezone- set.php> that
was added in PHP 5

Thanks, Mark

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



--- End Message ---
--- Begin Message ---
Im just using it to set defaults on a QuickForm date element. 

-----Original Message-----
From: Mike Tuller [mailto:[EMAIL PROTECTED] 
Sent: Thursday, January 05, 2006 11:02 AM
To: Mark Steudel
Cc: [email protected]
Subject: Re: [PHP] Timezone and DST

Are you just displaying the time, or is this for submission in a database?


On Jan 5, 2006, at 12:50 PM, Mark Steudel wrote:

> Hi All,
>
> I've got a little problem where our servers are in PST but the 
> customer operates in Hawaii (-10 GMT). I believe I can just get the 
> time for them by doing something like
>
> date("d H i", strtotime('now -2 hours') );
>
> But here's the catch, how should I deal with day light savings ( DST) 
> . In hawaii they don't observer DST, but in Washington State we do.
>
> We're on php 4.x so I can't use the  date_default_timezone_set
> <http://us2.php.net/manual/en/function.date-default-timezone-
> set.php>  that
> was added in PHP 5
>
> Thanks, Mark
>
> --
> PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: 
> http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message ---
I hate doing this, but you could use Javascript to use the date and time set
on the clients computer. You can't control how they have it set though.


On 1/5/06 1:13 PM, "Mark Steudel" <[EMAIL PROTECTED]> wrote:

> Im just using it to set defaults on a QuickForm date element.
> 
> -----Original Message-----
> From: Mike Tuller [mailto:[EMAIL PROTECTED]
> Sent: Thursday, January 05, 2006 11:02 AM
> To: Mark Steudel
> Cc: [email protected]
> Subject: Re: [PHP] Timezone and DST
> 
> Are you just displaying the time, or is this for submission in a database?
> 
> 
> On Jan 5, 2006, at 12:50 PM, Mark Steudel wrote:
> 
>> Hi All,
>> 
>> I've got a little problem where our servers are in PST but the
>> customer operates in Hawaii (-10 GMT). I believe I can just get the
>> time for them by doing something like
>> 
>> date("d H i", strtotime('now -2 hours') );
>> 
>> But here's the catch, how should I deal with day light savings ( DST)
>> . In hawaii they don't observer DST, but in Washington State we do.
>> 
>> We're on php 4.x so I can't use the  date_default_timezone_set
>> <http://us2.php.net/manual/en/function.date-default-timezone-
>> set.php>  that
>> was added in PHP 5
>> 
>> Thanks, Mark
>> 
>> --
>> PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:
>> http://www.php.net/unsub.php
>> 
>> 

--- End Message ---
--- Begin Message ---
I've got a little problem where our servers are in PST but the customer operates in Hawaii (-10 GMT). I believe I can just get the time for them by doing something like
date("d H i", strtotime('now -2 hours') );
But here's the catch, how should I deal with day light savings ( DST) . In hawaii they don't observer DST, but in Washington State we do.

You can use date( 'I' ) to determine whether or not your server is
currently in DST and subtract the appropriate number of hours
accordingly...

thnx,
Chris

--- End Message ---
--- Begin Message ---

Is there also a prize for those who STILL think that everyone uses the same font so their ASCII artwork will display as intended?

:-)

tedd


This person should be awarded with some great prize :) Great topic.

-snip-

--
        *** phpgurru.com [A php resource provider] ***

        \\\|///
      \\  - -  //
       (  @ @  )       PHP is too logical for my brain
+---oOOo-(_)-oOOo------------------------------------------+
|                Mian Shafiq ur Rehman
|                phpgurru.com [A php resource provider]
|                107 B, New Town, Multan Road
|                Lahore Pakistan
|
| Mobile:        0300 423 9385
|
|   ooo0         http://www.phpgurru.com
|  (    )   0ooo E-Mail: [EMAIL PROTECTED]
+---\  (----(   )------------------------------------------+
      \_)    ) /
             (_/

--
--------------------------------------------------------------------------------
http://sperling.com/

--- End Message ---
--- Begin Message ---
Hallo there,
I try to put a number of variables in an array as follows:
input boxes gather info. This info is language dependent, so the info is put
into an array vke with indexes NL and EN. The POST variable gives this array
back. Then I want to add a variable to this array, 'gebruikt' (=used) with
possible values J or N.

The script looks something like so:

<?php

session_start();


if ($_POST['vkePlus'])
{
 $waarden[] = array('gebruikt'=>'J',$_POST['vke']);
 foreach ($waarden as $i=>$w)
 {
  if (is_array($w))
  {
   foreach($w as $iw=>$ww)
   {
    if (is_array($iw))
    {
//What happening here???
    }
    else
    {
     echo stripslashes($iw) . ": " . stripslashes($ww) . "<br/>";
    }
   }
  }
  else
  {
   echo stripslashes($i) . ": " . stripslashes($w) . "<br/>";
  }
 }
}


print ("<h1>Test</h1>\n");
print ("<form method=\"post\" action=\"" . $_SERVER['PHP_SELF'] . "\">\n");
print ("<input type=\"text\" size=\"10\" name=\"vke[NL]\" value=\"" .
$vke[NL] . "\">\n");
print ("<input type=\"text\" size=\"10\" name=\"vke[EN]\" value=\"" .
$vke[EN] . "\">\n");
print ("<input type=\"submit\" name=\"vkePlus\" value=\"GoGo\">\n");
print ("</form>\n");
?>

I have problems reading the contents of the arrays. Especially reading the
second array seems impossible.
After all this I want to add the contents of the array to a Session variable
to keep it in furthwer steps (of a wizard).

I hope any of you can 'make chocolat' of this.... ;-))
Thanks!!
Sjef

p.s. I use php 4.

--- End Message ---
--- Begin Message ---
Oeps, it's already complex to explain this.
The array that needs to be created and read is looking like this

$vArray = array('uses'=>'J', $_POST['vke']);

Maybe that will clear up thing a (tiny) bit).
Thanks again,
Sjef

""Sjef Janssen"" <[EMAIL PROTECTED]> schreef in bericht 
news:[EMAIL PROTECTED]
> Hallo there,
> I try to put a number of variables in an array as follows:
> input boxes gather info. This info is language dependent, so the info is 
> put
> into an array vke with indexes NL and EN. The POST variable gives this 
> array
> back. Then I want to add a variable to this array, 'gebruikt' (=used) with
> possible values J or N.
>
> The script looks something like so:
>
> <?php
>
> session_start();
>
>
> if ($_POST['vkePlus'])
> {
> $waarden[] = array('gebruikt'=>'J',$_POST['vke']);
> foreach ($waarden as $i=>$w)
> {
>  if (is_array($w))
>  {
>   foreach($w as $iw=>$ww)
>   {
>    if (is_array($iw))
>    {
> //What happening here???
>    }
>    else
>    {
>     echo stripslashes($iw) . ": " . stripslashes($ww) . "<br/>";
>    }
>   }
>  }
>  else
>  {
>   echo stripslashes($i) . ": " . stripslashes($w) . "<br/>";
>  }
> }
> }
>
>
> print ("<h1>Test</h1>\n");
> print ("<form method=\"post\" action=\"" . $_SERVER['PHP_SELF'] . 
> "\">\n");
> print ("<input type=\"text\" size=\"10\" name=\"vke[NL]\" value=\"" .
> $vke[NL] . "\">\n");
> print ("<input type=\"text\" size=\"10\" name=\"vke[EN]\" value=\"" .
> $vke[EN] . "\">\n");
> print ("<input type=\"submit\" name=\"vkePlus\" value=\"GoGo\">\n");
> print ("</form>\n");
> ?>
>
> I have problems reading the contents of the arrays. Especially reading the
> second array seems impossible.
> After all this I want to add the contents of the array to a Session 
> variable
> to keep it in furthwer steps (of a wizard).
>
> I hope any of you can 'make chocolat' of this.... ;-))
> Thanks!!
> Sjef
>
> p.s. I use php 4. 

--- End Message ---
--- Begin Message --- I have a table listing items in a database, and have a delete button next to each item, and I want to be able to click on the delete and delete only that record in the database and then reload the page where it would display the updated information. Here is part of the code I have.

                echo "</table>";
                
                echo "
                <br />
<form action=".$_SERVER['PHP_SELF']." method=\"post\" name= \"addrange\">
                        <table class=\"nolist\">
                                <tr>
                                        <td>Add Range: $row[id]</td>
<td><input type=\"text\" name=\"name\" size=\"53\" tabindex=\"9 \" /></td> <td align=\"right\"><input type=\"submit\" name=\"addRange\" value=\"Add Range\" /></td>
                                </tr>

                        </table>
                </form>";

                        
                        
}
elseif (isset($_POST['deleteRange']))
{
        
        $query = "delete from district.ip_range where id = $row[id]";
                                
        mysql_query($query, $link) or die (mysql_error());
        
        echo "Record ".$row[id]." has beed deleted.";
                                
}


They key I am using to find the record I want to delete is the the $row[id], but that is out of the scope of where the variable is set. Is there a way to set a variable so that it goes outside the scope?
--- End Message ---
--- Begin Message ---
[snip]
They key I am using to find the record I want to delete is the the  
$row[id], but that is out of the scope of where the variable is set.  
Is there a way to set a variable so that it goes outside the scope?
[/snip]

What do you mean by "out of the scope of where the variable is set"? If the
$row[id] is data in the database (which it should be) it is not a scope
issue at all.

--- End Message ---
--- Begin Message --- The list listing is in an if/elseif statement where if something is set, display the table that has the data, and elseif you click on the delete button, you would delete the data in the row of the table that is is the if statement. One part of the data is in the if scope, and the other is in the elseif scope.

I hope that makes sense.


On Jan 5, 2006, at 1:28 PM, Jay Blanchard wrote:

[snip]
They key I am using to find the record I want to delete is the the
$row[id], but that is out of the scope of where the variable is set.
Is there a way to set a variable so that it goes outside the scope?
[/snip]

What do you mean by "out of the scope of where the variable is set"? If the $row[id] is data in the database (which it should be) it is not a scope
issue at all.


--- End Message ---
--- Begin Message ---
[snip]
The list listing is in an if/elseif statement where if something is  
set, display the table that has the data, and elseif you click on the  
delete button, you would delete the data in the row of the table that  
is is the if statement. One part of the data is in the if scope, and  
the other is in the elseif scope.

I hope that makes sense.
[/snip]

Nope.

Are you asking if the following $row[id]'s are in the same scope?

if($foo){
   $row[id];
}elseif($bar){
   $row[id];
}

If so, the answer is yes.

--- End Message ---
--- Begin Message ---
It's more like this:

if
{
        $x=1;
        echo $x;
}
elseif
{
        echo $x;
}

On Jan 5, 2006, at 1:51 PM, Jay Blanchard wrote:

[snip]
The list listing is in an if/elseif statement where if something is
set, display the table that has the data, and elseif you click on the
delete button, you would delete the data in the row of the table that
is is the if statement. One part of the data is in the if scope, and
the other is in the elseif scope.

I hope that makes sense.
[/snip]

Nope.

Are you asking if the following $row[id]'s are in the same scope?

if($foo){
   $row[id];
}elseif($bar){
   $row[id];
}

If so, the answer is yes.


--- End Message ---
--- Begin Message ---
Jochem Maas wrote:

> hi Mark,
> 
> Mark wrote:
>> I have a program called MCache, it used to be MSession. I'm trying to get
> 
> why 'Cache' - its a session handler right? (I think the name is a little
> confusing, but maybe its just me - I have been adding cache mechanisms
> to a site for the last month or so!)

Because it is more of a cache, I envision using it to cache PHP objects
independent of sessions. Think of how you'd implement a poll site. MCache
is designed to handle concurrency and provide some limited atomic numeric
functions.

> 
> is this better than using the 'files' session handler and setting the
> session save path to a tmpfs filesystem (in effect a RAM disk) in a
> signle server env.?

This is not really intended for a single server site, but could provide
some benefit as a way of abstracting file or SQL session storage.
> 
> 
>> the word out and get some testers.
>> 
>> The server itself is GPL, the PHP extension is under the PHP license. I
>> will be checking it in to the PHP main CVS repository when I'm pretty
>> sure that it will play nice.
>> 
>> The server can be accessed via CVS from www.mohawksoft.org.
>> 
>> If you have any questions please feel free to ask.
>>

--- End Message ---
--- Begin Message ---
Excuse the last post, I didn't have all the code it there.

I have a table listing items in a database, and have a delete button
next to each item, and I want to be able to click on the delete and
delete only that record in the database and then reload the page
where it would display the updated information. Here is part of the
code I have.

        // list elements one by one until there are no more in the database
        while ( $row=mysql_fetch_array($result2) )
        {
                if ($row[range] != "")
                {
                        echo "
                        <form action=".$_SERVER['PHP_SELF']." method=\"post\" 
name=
\"deleteRange\">
                        <tr class=\"trlist\">
                                <td>$row[id]</td>
                                <td>$row[range]</td>
                                <td align=\"right\"><input type=\"submit\" 
name=\"deleteRange\"
value=\"Delete\" /></td>
                        </tr>
                        </form>
                ";
                }
        }
                echo "</table>";
                
                echo "
                <br />
                <form action=".$_SERVER['PHP_SELF']." method=\"post\" name=
\"addrange\">
                        <table class=\"nolist\">
                                <tr>
                                        <td>Add Range: $row[id]</td>
                                        <td><input type=\"text\" name=\"name\" 
size=\"53\" tabindex=\"9
\" /></td>
                                        <td align=\"right\"><input type=\"submit\" 
name=\"addRange\"
value=\"Add Range\" /></td>
                                </tr>

                        </table>
                </form>";

                        
                        
}
elseif (isset($_POST['deleteRange']))
{
        
        $query = "delete from district.ip_range where id = $row[id]";
                                
        mysql_query($query, $link) or die (mysql_error());
        
        echo "Record ".$row[id]." has beed deleted.";
                                
}

They key I am using to find the record I want to delete is the the
$row[id], but that is out of the scope of where the variable is set.
Is there a way to set a variable so that it goes outside the scope?

--- End Message ---
--- Begin Message ---
Generally, scope is fairly loose in PHP. If $row is set by
mysql_fetch_array(...) it should carry throughout your script as it is,
unless modified. Try commenting out non-relavant pieces of the code and
var_dump(...)ing the $row variable at the start and throughout the script.

Aaron


On 1/5/06, Mike Tuller <[EMAIL PROTECTED]> wrote:
>
> Excuse the last post, I didn't have all the code it there.
>
> I have a table listing items in a database, and have a delete button
> next to each item, and I want to be able to click on the delete and
> delete only that record in the database and then reload the page
> where it would display the updated information. Here is part of the
> code I have.
>
>         // list elements one by one until there are no more in the
> database
>         while ( $row=mysql_fetch_array($result2) )
>         {
>                 if ($row[range] != "")
>                 {
>                         echo "
>                         <form action=".$_SERVER['PHP_SELF']."
> method=\"post\" name=
> \"deleteRange\">
>                         <tr class=\"trlist\">
>                                 <td>$row[id]</td>
>                                 <td>$row[range]</td>
>                                 <td align=\"right\"><input type=\"submit\"
> name=\"deleteRange\"
> value=\"Delete\" /></td>
>                         </tr>
>                         </form>
>                 ";
>                 }
>         }
>                 echo "</table>";
>
>                 echo "
>                 <br />
>                 <form action=".$_SERVER['PHP_SELF']." method=\"post\"
> name=
> \"addrange\">
>                         <table class=\"nolist\">
>                                 <tr>
>                                         <td>Add Range: $row[id]</td>
>                                         <td><input type=\"text\"
> name=\"name\" size=\"53\" tabindex=\"9
> \" /></td>
>                                         <td align=\"right\"><input
> type=\"submit\" name=\"addRange\"
> value=\"Add Range\" /></td>
>                                 </tr>
>
>                         </table>
>                 </form>";
>
>
>
> }
> elseif (isset($_POST['deleteRange']))
> {
>
>         $query = "delete from district.ip_range where id = $row[id]";
>
>         mysql_query($query, $link) or die (mysql_error());
>
>         echo "Record ".$row[id]." has beed deleted.";
>
> }
>
> They key I am using to find the record I want to delete is the the
> $row[id], but that is out of the scope of where the variable is set.
> Is there a way to set a variable so that it goes outside the scope?
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message ---
Mike Tuller wrote:
Excuse the last post, I didn't have all the code it there.

I have a table listing items in a database, and have a delete button
next to each item, and I want to be able to click on the delete and
delete only that record in the database and then reload the page
where it would display the updated information. Here is part of the
code I have.

    // list elements one by one until there are no more in the database
    while ( $row=mysql_fetch_array($result2) )
    {
        if ($row[range] != "")
        {
            echo "
            <form action=".$_SERVER['PHP_SELF']." method=\"post\" name=
\"deleteRange\">
            <tr class=\"trlist\">
                <td>$row[id]</td>
                <td>$row[range]</td>
<td align=\"right\"><input type=\"submit\" name=\"deleteRange\"
value=\"Delete\" /></td>
            </tr>
            </form>
        ";
        }
    }
        echo "</table>";
echo "
        <br />
        <form action=".$_SERVER['PHP_SELF']." method=\"post\" name=
\"addrange\">
            <table class=\"nolist\">
                <tr>
                    <td>Add Range: $row[id]</td>
<td><input type=\"text\" name=\"name\" size=\"53\" tabindex=\"9
\" /></td>
<td align=\"right\"><input type=\"submit\" name=\"addRange\"
value=\"Add Range\" /></td>
                </tr>

            </table>
        </form>";

}
elseif (isset($_POST['deleteRange']))
{
$query = "delete from district.ip_range where id = $row[id]"; mysql_query($query, $link) or die (mysql_error()); echo "Record ".$row[id]." has beed deleted."; }

They key I am using to find the record I want to delete is the the
$row[id], but that is out of the scope of where the variable is set.
Is there a way to set a variable so that it goes outside the scope?

You have a lot of detail for folks to analyze just to give you an answer.

If I get the gist of your question, here is the genesis of an approach.

Put something like this in your loop that generates the table rows. The checkbox can be anywhere in the row that looks good.

echo "<input type=\"checkbox\" name=\"row$i\" value=\"$value\">"; 
$i++;

Then when you process your $_POST, you'll see all the $_POST[rowx] {"x" is the 
row number} that were checked by the user.

--- End Message ---
--- Begin Message ---
> >         if ($row[range] != "")
This should be $row['range'], not $row[range], although it doesn't
make a difference unless you define a constant named range.


Your problem isn't actually scope, it's that your PHP script is being
called twice.  Once to show the form, once to submit it.  The second
time, your script doesn't have any of the things you set the first
time.

<input type=\"hidden\" name=\"id\" value=\"$row[id]\" />

If you put that in your delete form, you could use $_POST['id'] to get
the proper id.

--- End Message ---
--- Begin Message ---
One of the problems I have had with the PHP session system is that it does
not use a readily usable text format for serializing data. This makes using
session data outside of PHP virtually impossible.

I looked at the WDDX extension and was not too impressed: it was way too
verbose and didn't use variable names as task. It used the data type as a
tag and the variable name as a tag attribute.

XMLDBX uses the variable name as a tag as long as the variable name is valid
within an XML tag. It uses attributes to declare the variable type and meta
information. XMLDBX also tries to conserve space in its format by using
single tag elements, i.e. "<VARNAME t='n' v='100' />" instead of 
"<VARNAME type="int">100</VARNAME>." Both are parsable by expat.

The intent of XMLDBX is to use a documented serialize format within a
database like PostgreSQL and use functions to extract specific elements.
For instance:

select XMLDBX_Extract(pgcolumn, 'varname') from pgtable;
or
select XMLDBX_Extract(pgcolumn, 'class.subclass.varname') from pgtable;

Anyone interested?

The extension is at www.mohawksoft.org under "CVS Access"

--- End Message ---
--- Begin Message ---
Al wrote:

John Nichel wrote:

n.g. wrote:

hi,
i want to register a domain name through NetworkSolutions.com,
but it require a credit card which i dont have to pay the bill.

if you have a credit card, i can transfer to your account, and then
you please regiter the domain using my info.

or if you have any other ways to do so.

p.s. i live in P.R.China. please make sure i can send money to you.

anybody would like to help me ?


Now this takes the prize of most off topic post of the year.

Does this mean you are not going to send him your credit card number.

Hell, for someone that ballsy, I'll register the domain name for free ...

--- End Message ---
--- Begin Message ---
When using forms with PHP sessions, hitting the back button results in
WARNING: Page has Expired

I am wondering if there is a work around for this so that it (IE, in this
case) resubmits the form information and displays the previous page.

Any ideas?

--- End Message ---
--- Begin Message ---
Hi there!

Yes, actually there is a "dirty" solution to this.

You can use javascript to skip certain pages in historylist.
window.document.replace('page1.php');
window.document.location = 'page2.php';
window.document.location.replace('page3.php');

The only page that would exist in the history list is now page2.php (and this means if you hit the back button, the only page that will display in this case would be page2.php) In your case you could goto the page with form with a window.document.location.replace('formpage.php') - statement..

Hope this was helpful! :-)

/G
http://www.varupiraten.se/

----- Original Message ----- From: "Ben Miller" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Friday, January 06, 2006 1:40 AM
Subject: [PHP] Pages Expiring


When using forms with PHP sessions, hitting the back button results in
WARNING: Page has Expired

I am wondering if there is a work around for this so that it (IE, in this
case) resubmits the form information and displays the previous page.

Any ideas?

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--- End Message ---
--- Begin Message ---
Hi
i need some help with printing an array, i would like to print the
keys and the values of them
example :

if i have an array like that

------------------------
[EXTENDED] => Array
                        (
                            [RTCode] => CASE395
                            [ManuPartNum] => 1BRA1ACFB
                            [Colour] => WHITE
                            [Compatibility] => (ATX/E ATX)
                            [PowerSupply] => YES
                            [PowerSupplySize] => redundant 337W2
                            [ExtDriveBays] => 3 x 5.25 1 x 3.5
                            [IntDriveBays] => 6 x 5.25
                            [USBPortsFront] => no
                            [FirewirePortsFront] => no
                            [AudioPortsFront] => no
                            [CaseFan] => 8cm FAN2  12cm FAN1  P/S2
                            [NumCaseFans] => 5
                            [FreeCaseFanPoints] => No
                            [Material] => Stainless steel
                            [Window] => No
                            [Packaging] => Retail
                            [Warranty] => 24 months for the PSU
                            [BoxContents] => Manual
                            [CartonHeight] => 735mm
                            [CartonWidth] => 285mm
                            [CartonDepth] => 585mm
                            [ItemsPerCarton] => 1
                            [CartonWeight] => 1.6kg
                            [EAN] =>
                            [BoxWeight] =>
                            [ItemHeight] =>
                            [ItemWidth] =>
                            [ItemDepth] =>
                        )
------------------------
and i like to print it this way
------------------------
RTCode:CASE395
ManuPartNum] :1BRA1ACFB
Colour] :WHITE
Compatibility :(ATX/E ATX)
PowerSupply :YES
PowerSupplySize:redundant 337W2
ExtDriveBays:3 x 5.25 1 x 3.5
IntDriveBays:6 x 5.25
USBPortsFront:no
FirewirePortsFront:no
AudioPortsFront:no
CaseFan:8cm FAN2  12cm FAN1  P/S2
NumCaseFans:5
FreeCaseFanPoints] => No
Material :Stainless steel
Window :No
Packaging:Retail
Warranty:24 months for the PSU
BoxContents:Manual
CartonHeight:735mm
CartonWidth:285mm
CartonDepth:585mm
ItemsPerCarton:1
CartonWeight:1.6kg
EAN:
BoxWeight:
ItemHeight:
ItemWidth:
ItemDepth:
------------------------
can anyone tell me plz how to do that ?
any help would be appreciated

thanks in advance

--
Ahmed Abdel-Aliem
Web Developer
www.SafariStudio.net
+20101108551
registered Linux user number 382789

--- End Message ---
--- Begin Message ---
read  about  "foreach"  function. 


Zareef Ahmd

----- Original Message ----- 
From: "Ahmed Abdel-Aliem" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Thursday, January 05, 2006 7:58 PM
Subject: [PHP] printing keys and values of array


Hi
i need some help with printing an array, i would like to print the
keys and the values of them
example :

if i have an array like that

------------------------
[EXTENDED] => Array
                        (
                            [RTCode] => CASE395
                            [ManuPartNum] => 1BRA1ACFB
                            [Colour] => WHITE
                            [Compatibility] => (ATX/E ATX)
                            [PowerSupply] => YES
                            [PowerSupplySize] => redundant 337W2
                            [ExtDriveBays] => 3 x 5.25 1 x 3.5
                            [IntDriveBays] => 6 x 5.25
                            [USBPortsFront] => no
                            [FirewirePortsFront] => no
                            [AudioPortsFront] => no
                            [CaseFan] => 8cm FAN2  12cm FAN1  P/S2
                            [NumCaseFans] => 5
                            [FreeCaseFanPoints] => No
                            [Material] => Stainless steel
                            [Window] => No
                            [Packaging] => Retail
                            [Warranty] => 24 months for the PSU
                            [BoxContents] => Manual
                            [CartonHeight] => 735mm
                            [CartonWidth] => 285mm
                            [CartonDepth] => 585mm
                            [ItemsPerCarton] => 1
                            [CartonWeight] => 1.6kg
                            [EAN] =>
                            [BoxWeight] =>
                            [ItemHeight] =>
                            [ItemWidth] =>
                            [ItemDepth] =>
                        )
------------------------
and i like to print it this way
------------------------
RTCode:CASE395
ManuPartNum] :1BRA1ACFB
Colour] :WHITE
Compatibility :(ATX/E ATX)
PowerSupply :YES
PowerSupplySize:redundant 337W2
ExtDriveBays:3 x 5.25 1 x 3.5
IntDriveBays:6 x 5.25
USBPortsFront:no
FirewirePortsFront:no
AudioPortsFront:no
CaseFan:8cm FAN2  12cm FAN1  P/S2
NumCaseFans:5
FreeCaseFanPoints] => No
Material :Stainless steel
Window :No
Packaging:Retail
Warranty:24 months for the PSU
BoxContents:Manual
CartonHeight:735mm
CartonWidth:285mm
CartonDepth:585mm
ItemsPerCarton:1
CartonWeight:1.6kg
EAN:
BoxWeight:
ItemHeight:
ItemWidth:
ItemDepth:
------------------------
can anyone tell me plz how to do that ?
any help would be appreciated

thanks in advance

--
Ahmed Abdel-Aliem
Web Developer
www.SafariStudio.net
+20101108551
registered Linux user number 382789

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




====================================================
PHP Expert Consultancy in Development  http://www.indiaphp.com
Yahoo! : consultant_php MSN : [EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
> -----Original Message-----
> i need some help with printing an array, i would like to 
> print the keys and the values of them example :

I use the dump_array posted by "examancer" at the following address:
http://www.phpbuilder.com/board/showthread.php?t=10213508 when
debugging, it should work well for you.

Brady

--- End Message ---
--- Begin Message ---
Ahmed Abdel-Aliem wrote:

...
------------------------
and i like to print it this way
------------------------
RTCode:CASE395
...

foreach($array as $key=>$value){echo $key.':'.$value;}

JM

--- End Message ---
--- Begin Message ---
Jochem:

    My most sincere apologies for not replying to your questions.  I've been
suffering with a rather dibilitating head cold the last few days and somehow
glossed over your questions.

> 1. what is the local machine?

    Just my local workstation.

> 2. where does the DB live? (is it a different machine?)

    Yes, the database -- in MySQL -- lives on a different server.

> 3. do you need reporting/information about the local machine
> inspection anywhere other than the local machine?

    No, I only need it locally.  At least, for right now.

> 4. will there be more than one local machine?

    No.  The only place the data will originate FROM will be my local
machine.  The data are simply directory entries of PDF or CHM files.

> 5. why do you want to do this?

    For starters, I'm trying to cull out duplicates.  Some are easily found
by comparing file sizes and then looking at the file names.  But, some of
the files are damaged, so I need to actually open the files to ensure they
open without error before deciding which ones to delete.  It seemed to me
that it would be easier to open the files from a web browser than from
another, scratch-built application.

    The larger question though, is, "Why use PHP for this?"  Because I'm
trying to learn more about how to use PHP, and because, once the data have
been combed through and duplicates have been culled, I'd like to make the
data available to a few friends who would like to see the list of files that
I've amassed (currently around 12,600, with approximately 3000 known
duplicates).  Those able to view the data would not be able to update the
data at all -- the form to do the update would have been password protected.

    What I think I'll do now is create the update routines locally, then
export the data, upload the data to the server, and import it into a copy of
the database.  Yeah, it means more work on my part, but that's okay.  The
updates after I finally get the initial data clean will be somewhat
infrequent.

    Thanks again for your input and suggestions.

    Sincerely,

        Jon

--- End Message ---
--- Begin Message ---
How does one find the system temp folder? from php? in a platform
independant way

--- End Message ---
--- Begin Message ---
Samuel DeVore wrote:

>How does one find the system temp folder? from php? in a platform
>independant way
>
>  
>
This should help:
http://www.php.net/manual/en/function.tempnam.php

It does return the name of the temp file created (or FALSE), which could
be parsed to get the temp directory as PHP best sees fit.

Travis

--- End Message ---
--- Begin Message ---
Michael Hulse wrote:

> Hello,
> 
> Just curious if anyone could give me some google
> keywords/links/suggestions/tips/comments/feedback on a good place to
> start for writing a search engine script.
> 
> I think I might have a good idea for a specific type of search engine.
> Basically it would crawl web and index links to a specific type of
> file... really simple. Obviously making the results searchable is a
> must.
> 
> Not sure where to start though.

Don't re-invent the wheel? http://www.mnogosearch.org/ can be restricted by
filetype; I'd imagine that others such as htdig would be similarly
configurable.




Cheers
-- 
David Robley

Shin: A device for finding furniture in the dark.

--- End Message ---
--- Begin Message ---
that is some nice out-of-the-box thinking Mark!

Mark wrote:
Shafiq Rehman wrote:


Hi,

How can I register a session or cookie for two domains. I want to maintain
logged user's state when he goes from one domain to other domain.

Example
Suppose a user is logged in on domain1.com. A cookie is set and user is
authenticated from database on the basis of that cookie. When he goes from
domain1.com to domain2.com, I want he remains loggedin on domain2.com. I
do not want any query string. Is it possible by playing with cookie or
session settings?

Please advise if anybody has faced such problem.


I have been giving this problem some more thought and I think I have an
answer for you. My previous response was pretty invasive if you don't have
full control or knowledge of the web session code.

Assuming you index by some session ID, and that ID can be shared across
sites.

You make a graphical bug or link.

On both servers you create a PHP file that accepts a URL parameter, sets a
cookie, and displays an image. Something like:


mylogo.php

<?
        $sid = $_GET['phpsession'];
        setcookie ("PHPSESSID", $sid);
        # Now redirect to some image, either open it or set redirect flag
?>


Now in BOTH websites, render an image on your page as:

site 1:
<img
src="http://www.site2.org/mylogo.php?phpsession=hddfewfelkfjewlkewflkjlkweweio";>

site 2:
<img
src="http://www.site1.org/mylogo.php?phpsession=hddfewfelkfjewlkewflkjlkweweio";>


This way, you pass the cookie to both sites.


--- End Message ---

Reply via email to