OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
php-general Digest 7 Jun 2006 17:25:42 -0000 Issue 4172

php-general-digest-helplists.php.net
Date: Wed Jun 07 2006 - 12:25:42 CDT


php-general Digest 7 Jun 2006 17:25:42 -0000 Issue 4172

Topics (messages 237530 through 237565):

Problem with form
        237530 by: Rodrigo de Oliveira Costa
        237531 by: Robert Cummings

HTTP ERRORS Boolean
        237532 by: Rodrigo de Oliveira Costa
        237536 by: Rabin Vincent
        237541 by: Barry

Re: Getting totals
        237533 by: Rabin Vincent
        237534 by: Rob W.
        237535 by: Rabin Vincent

how to compare value between 2 arrays
        237537 by: weetat
        237538 by: Chris
        237539 by: Peter Lauri

Re: Replacing text of a DOM text node
        237540 by: Frank Arensmeier
        237546 by: Rob Richards
        237548 by: Frank Arensmeier
        237555 by: tedd

File downloads
        237542 by: kartikay malhotra
        237543 by: Barry
        237558 by: tedd

HTML mailing list
        237544 by: Barry

ADODB store session to database
        237545 by: weetat
        237552 by: Chris

Control GET data ( not php related )
        237547 by: Thomas Munz

Re: When is "z" != "z" ?
        237549 by: tedd

Re: If value is odd or not
        237550 by: Dimiter Ivanov

Re: How do I make a HTML tree for a set of nodes?
        237551 by: Niels

better way to create custom text file from query results?
        237553 by: Ben Liu
        237554 by: Chris
        237556 by: tedd
        237557 by: Ben Liu
        237559 by: Ben Liu

Re: Pear DB and memcached
        237560 by: Ruben Rubio Rey

Cant work HTML echo loop
        237561 by: Rodrigo de Oliveira Costa
        237562 by: Rodrigo de Oliveira Costa

generating/transforming HTML so that it 'works' in a flash file
        237563 by: Jochem Maas
        237565 by: Martin Alterisio

Introductory message
        237564 by: JF Simard

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscribelists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscribelists.php.net

To post to the list, e-mail:
        php-generallists.php.net

----------------------------------------------------------------------

attached mail follows:


Guys I'm getting the following problem:

I have a form that asks for one variable that goes into the input box,
this box is named chapter, and the box is in a form that is submited
to another php, and this php should receive this variable and I should
be abble to access it thru $chapter, but when I try to use the
variable $chapter I get the following error:

Notice: Undefined variable: chapter in c:\arquivos de
programas\easyphp1-8\www\teste.php on line 6

This variable is concatenated into a string and is used to retrieve a
certain page from a domain, if I initialize the variable in the second
php script it goes ok, but if I try to use the one that should be
passed thru the form I get the error above. Does anybody know what I'm
doing wrong?

The second script is bellow so you can understand my problem thank you guys:

<?
//$chapter = 1;
$urlChapter = '/'.$chapter.'/';
$url = "http://www.domain.com/s/2784825"."$urlChapter";
$texto = file("$url");
$result2 = count($texto);
$i = 0;
while ($i < $result2)
{
  echo "$texto[$i]";
  $i++;
}
?>

attached mail follows:


On Wed, 2006-06-07 at 01:14, Rodrigo de Oliveira Costa wrote:
> Guys I'm getting the following problem:
>
> I have a form that asks for one variable that goes into the input box,
> this box is named chapter, and the box is in a form that is submited
> to another php, and this php should receive this variable and I should
> be abble to access it thru $chapter, but when I try to use the
> variable $chapter I get the following error:
>
> Notice: Undefined variable: chapter in c:\arquivos de
> programas\easyphp1-8\www\teste.php on line 6
>
> This variable is concatenated into a string and is used to retrieve a
> certain page from a domain, if I initialize the variable in the second
> php script it goes ok, but if I try to use the one that should be
> passed thru the form I get the error above. Does anybody know what I'm
> doing wrong?
>
> The second script is bellow so you can understand my problem thank you guys:
>
> <?
> //$chapter = 1;
> $urlChapter = '/'.$chapter.'/';
> $url = "http://www.domain.com/s/2784825"."$urlChapter";
> $texto = file("$url");
> $result2 = count($texto);
> $i = 0;
> while ($i < $result2)
> {
> echo "$texto[$i]";
> $i++;
> }
> ?>

You are relying on register_globals being set to on. Instead use the
more secure method of retrieving your submitted data from $_GET or
$_POST (depending on which "method" your form is set to use). You can
also use $_REQUEST if you don't care from whence the data was submitted
(but you should care :).

Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'

attached mail follows:


Guys is there a way that I can call the func file("www.url.com") and
get a result true if there is a page and false if the page doesnt
exists (error 404)? the thing is I'm trying to retrieve a page but I
cant be sure that it exists so I need my script to try to access it
and if it cant access it then he should write something else.

Thanks,
Rodrigo

attached mail follows:


On 6/7/06, Rodrigo de Oliveira Costa <rodrigodorodrigo.com> wrote:
> Guys is there a way that I can call the func file("www.url.com") and
> get a result true if there is a page and false if the page doesnt
> exists (error 404)?

This would work, but will not specifically check for a 404:

$page = file('..');
if (!$page) {
  // does not exist or some other error
}

Rabin

attached mail follows:


Rodrigo de Oliveira Costa schrieb:
> Guys is there a way that I can call the func file("www.url.com") and
> get a result true if there is a page and false if the page doesnt
> exists (error 404)? the thing is I'm trying to retrieve a page but I
> cant be sure that it exists so I need my script to try to access it
> and if it cant access it then he should write something else.
>
> Thanks,
> Rodrigo
Read the comments of file, fopen, filegetcontents.

There might be a function already written i think i saw one there giving
you the error.

Best way to handle would be to go over sockets and catch the
headerinformation.
since 200 is OK and 404 would be GONE and so on.

Barry

--
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

attached mail follows:


On 6/7/06, Rob W. <robfiberuplink.com> wrote:
> I got the fix, strstr didnt work right because it was relaying more than
> just what I was thinking.
>
> Here is the fix.
>
> $value=array(strstr($block, $address));
> foreach ($value as $var) {
> $block_total_ip++;
> }

How can this work? $value will have 1 element no matter what,
so $block_total_ip will always be incremented once. The above
code is equivalent to just:

$block_total_ip++;

Rabin

attached mail follows:


Yeah, it counts how many times block is in $address, so if there's 254 ip's
listed in the database, it will incriment it 254 times and display that.

----- Original Message -----
From: "Rabin Vincent" <rabinrab.in>
To: "Rob W." <robfiberuplink.com>
Cc: <php-generallists.php.net>
Sent: Wednesday, June 07, 2006 2:03 AM
Subject: Re: [PHP] Getting totals

> On 6/7/06, Rob W. <robfiberuplink.com> wrote:
>> I got the fix, strstr didnt work right because it was relaying more than
>> just what I was thinking.
>>
>> Here is the fix.
>>
>> $value=array(strstr($block, $address));
>> foreach ($value as $var) {
>> $block_total_ip++;
>> }
>
> How can this work? $value will have 1 element no matter what,
> so $block_total_ip will always be incremented once. The above
> code is equivalent to just:
>
> $block_total_ip++;
>
> Rabin
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>

attached mail follows:


On 6/7/06, Rob W. <robfiberuplink.com> wrote:
> Yeah, it counts how many times block is in $address, so if there's 254 ip's
> listed in the database, it will incriment it 254 times and display that.

Well, the code snippet you've shown does NOT do any
kind of checking to see if $block is in $address. It simply
increments the counter.

If your script is working properly for you, it must be due
to the way the rest of the script functions.

Rabin

attached mail follows:


Hi all,

  I am using php 4.3.2 in Red hat enterprise.
  Have some issue which need some advice from php experts here.

  I need to compare value between 2 arrays .
  The arrays data are populated by data from the database resultset.
  The database resultset fields are the same type and name.

  for example ,
    serial_no is PK field.

   in resultset 1 , have field serial_no = '123456' country = 'England'
and city = 'London'
   in resultset 2 , have field serial_no = '123456' country = 'England'
and city = 'Manchester

    As you can see , the city value is different between the 2 resultset.
    So i will update status fields in the resultset 1 to 'Update'.If the
same is 'New' ,and so on.

Thanks
-weetat

attached mail follows:


weetat wrote:
> Hi all,
>
> I am using php 4.3.2 in Red hat enterprise.
> Have some issue which need some advice from php experts here.
>
> I need to compare value between 2 arrays .
> The arrays data are populated by data from the database resultset.
> The database resultset fields are the same type and name.
>
> for example ,
> serial_no is PK field.
>
> in resultset 1 , have field serial_no = '123456' country = 'England'
> and city = 'London'
> in resultset 2 , have field serial_no = '123456' country = 'England'
> and city = 'Manchester
>
> As you can see , the city value is different between the 2 resultset.
> So i will update status fields in the resultset 1 to 'Update'.If the
> same is 'New' ,and so on.

http://www.php.net/array_diff will do it for you.

--
Postgresql & php tutorials
http://www.designmagick.com/

attached mail follows:


Weetat,

Can you be clearer, and then I might be able to help. Do you just want to
perform updates towards the database? What is the status field?

/Peter

-----Original Message-----
From: weetat [mailto:weetat.yeocxrus.com]
Sent: Wednesday, June 07, 2006 2:36 PM
To: php-generallists.php.net
Subject: [PHP] how to compare value between 2 arrays

Hi all,

  I am using php 4.3.2 in Red hat enterprise.
  Have some issue which need some advice from php experts here.

  I need to compare value between 2 arrays .
  The arrays data are populated by data from the database resultset.
  The database resultset fields are the same type and name.

  for example ,
    serial_no is PK field.

   in resultset 1 , have field serial_no = '123456' country = 'England'
and city = 'London'
   in resultset 2 , have field serial_no = '123456' country = 'England'
and city = 'Manchester

    As you can see , the city value is different between the 2 resultset.
    So i will update status fields in the resultset 1 to 'Update'.If the
same is 'New' ,and so on.

Thanks
-weetat

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

attached mail follows:


Jochem, thank you for your input!

So, right now I am able to access all text nodes by e.g.

$nodeElement -> parentNode -> childNodes -> item(0); -> returns
Lenght, Width and so on
$nodeElement -> parentNode -> childNodes -> item(1); -> is empty
$nodeElement -> parentNode -> childNodes -> item(2); -> returns mm,
kg ...

and so on. Or is there an easier way? When trying to acces the items by

($nodeElement containing text nodes)

$nodeElemtent -> item(0);

I get the following error message: Call to undefined method
DOMText::item()...

BTW, is there an easy way to get the total amount of items in a
curent node? count ( $nodeElement -> parentNode -> childNodes )
always returns 1. For now the only solution I know of is looping
through the nodeElements (e.g. foreach ( $nodeElement as $value ) and
have a counter inside the loop.

Thank you so far.
/frank

ps. I am desperately looking for some good sites covering the PHP DOM
functions. On www.php.net/dom there are barely some examples. And on
www.zend.com I only found one article with very, very basic examples.
Any ideas/suggestions are more than welcome. ds.

7 jun 2006 kl. 00.54 skrev Jochem Maas:

> Frank Arensmeier wrote:
>> Hello!
>>
>> Basically, I am working on a script that is supposed to convert table
>> data from metric to imperial data. I want to pare XHTML pages
>> (containing up to three different tables) with the PHP DOM
>> functions in
>> order to be able to access and manipulate the tables one by one.
>> Parsing
>> and retrieving table headers and cells is not the problem. The
>> problem
>> right now is how to replace data in the headers.
>>
>> Here is a rather simplified example of a table I want to convert:
>>
>> Header contains: Product | Lenght <br /> mm | Width <br />mm |
>> Weight
>> <br /> kg
>>
>> As you can see, table headers can contain one or more words and a
>> (optional) line break. Currently, I am able to get all headers as
>> a list
>> of nodes from where I can access all headers one by one. But when
>> I try
>> to replace some content like this:
>>
>> # $nodeElement contains the current text node from a header
>
> not all of it - because the 'current' text is actual a series of
> text and xml nodes (each <br /> and the text between being a
> seperate node)
>
>>
>> $str = "some new content";
>> $new_header_element = $doc -> createTextNode ( $str );
>> $nodeElement -> parentNode -> replaceChild ( $new_element,
>> $nodeElement );
>
> you'll need to remove all children of parentNode and then append
> the new node
> (for arguments sake - you could do it another way but the result
> would/should be
> the same) because the contents of the 'Header' (the parentNode) is
> actually a
> set of nodes:
>
> i.e. this:
> Product | Lenght <br /> mm | Width <br />mm | Weight
>
> ammounts to this (pseudo markup):
>
> <textNode/><xmlNode/><textNode/><xmlNode/><textNode/>
>
> and you are currently replacing only the first [text]node
>
> hth
>
>>
>> .. I am able to replace e.g. "Product", "Length" or "Width". I am not
>> able to access / replace anything after the line-break. Why? I have
>> already tested to get to this content with $nodeElement ->
>> childNodes;
>> but this will throw an error.
>>
>> Hopefully, I was able to explain my problem to you... OOP and
>> especially
>> working with the DOM functions are still very new to me, so please be
>> patient with me.
>>
>> If anyone has an idea, I would love to hear about it. Otherwise,
>> there
>> might be someone how can point me to some good on-line
>> documentation /
>> tutorials regarding PHP DOM functions.
>>
>> Thank you and good night.
>> /frank
>>
>> --PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

attached mail follows:


Hi Frank,

Frank Arensmeier wrote:
> Jochem, thank you for your input!
>
> So, right now I am able to access all text nodes by e.g.
>
> $nodeElement -> parentNode -> childNodes -> item(0); -> returns Lenght,
> Width and so on
> $nodeElement -> parentNode -> childNodes -> item(1); -> is empty
> $nodeElement -> parentNode -> childNodes -> item(2); -> returns mm,
kg ...
>
> and so on. Or is there an easier way? When trying to acces the items by
>
> ($nodeElement containing text nodes)
>
> $nodeElemtent -> item(0);
>
> I get the following error message: Call to undefined method
> DOMText::item()...

Only a nodelist and namenodemap has the item() method.

You could also do something like the following - note that manually
walking the tree is much faster than iterating a nodelist - (there are
also many different variations of this code depending upon what you need
to do with the subtree):

$node = $nodeElement->parentNode->firstChild;
while ($node) {
    /* only process text or element nodes here */
    if ($node->nodeType == XML_TEXT_NODE) {
       $node->nodeValue = 'New text content'; /* modify text content */
    } else if ($node->nodeType == XML_ELEMENT_NODE) {
       /* node is element - process its subtree or move on i.e.: */
       if ($node->hasChildNodes()) {
          foreach ($node->childNodes AS $child) {
             /* process child nodes here */
          }
       }
    }
    $node = $node->nextSibling;
}

>
> BTW, is there an easy way to get the total amount of items in a curent
> node? count ( $nodeElement -> parentNode -> childNodes ) always returns
> 1. For now the only solution I know of is looping through the
> nodeElements (e.g. foreach ( $nodeElement as $value ) and have a counter
> inside the loop.

$count = $nodeElement->parentNode->childNodes->length;
This property is only available from a nodelist or namednodemap.

>
> Thank you so far.
> /frank
>
> ps. I am desperately looking for some good sites covering the PHP DOM
> functions. On www.php.net/dom there are barely some examples. And on
> www.zend.com I only found one article with very, very basic examples.
> Any ideas/suggestions are more than welcome. ds.

You can pretty much search for examples from any DOM implementation
since its a standard (not too difficult to go from one language to
another when using DOM). For PHP specific ones, there are a number of
tests in the CVS repository that demonstrate much of the functionality:
http://cvs.php.net/viewcvs.cgi/php-src/ext/dom/tests/
One particular test that uses a good amount of the API (though the basic
functions) is dom001.phpt:
http://cvs.php.net/viewcvs.cgi/php-src/ext/dom/tests/dom001.phpt?view=markup&rev=1.4

Rob

--
rrichardsctindustries.net
author of Pro PHP XML and Web Services from Apress

attached mail follows:


Hello Rob.

Thank you very much indeed! Since this DOM thing is very new to me
(well, maybe not the DOM concept but working with DOM function in
PHP), I appreciate especially the links you provided.

Right now I am able to loop through all text nodes, replace certain
characters and mark a column for translation so to say. And this is
pretty much everything I needed to know in order to go on. One
problem I definitely see coming up will be dealing with headers that
have attributes like colspan or rowspan. But that's another story.

/frank

7 jun 2006 kl. 12.26 skrev Rob Richards:

> Hi Frank,
>
> Frank Arensmeier wrote:
> > Jochem, thank you for your input!
> >
> > So, right now I am able to access all text nodes by e.g.
> >
> > $nodeElement -> parentNode -> childNodes -> item(0); -> returns
> Lenght,
> > Width and so on
> > $nodeElement -> parentNode -> childNodes -> item(1); -> is empty
> > $nodeElement -> parentNode -> childNodes -> item(2); -> returns
> mm, kg ...
> >
> > and so on. Or is there an easier way? When trying to acces the
> items by
> >
> > ($nodeElement containing text nodes)
> >
> > $nodeElemtent -> item(0);
> >
> > I get the following error message: Call to undefined method
> > DOMText::item()...
>
> Only a nodelist and namenodemap has the item() method.
>
> You could also do something like the following - note that manually
> walking the tree is much faster than iterating a nodelist - (there
> are also many different variations of this code depending upon what
> you need to do with the subtree):
>
> $node = $nodeElement->parentNode->firstChild;
> while ($node) {
> /* only process text or element nodes here */
> if ($node->nodeType == XML_TEXT_NODE) {
> $node->nodeValue = 'New text content'; /* modify text content */
> } else if ($node->nodeType == XML_ELEMENT_NODE) {
> /* node is element - process its subtree or move on i.e.: */
> if ($node->hasChildNodes()) {
> foreach ($node->childNodes AS $child) {
> /* process child nodes here */
> }
> }
> }
> $node = $node->nextSibling;
> }
>
> >
> > BTW, is there an easy way to get the total amount of items in a
> curent
> > node? count ( $nodeElement -> parentNode -> childNodes ) always
> returns
> > 1. For now the only solution I know of is looping through the
> > nodeElements (e.g. foreach ( $nodeElement as $value ) and have a
> counter
> > inside the loop.
>
> $count = $nodeElement->parentNode->childNodes->length;
> This property is only available from a nodelist or namednodemap.
>
> >
> > Thank you so far.
> > /frank
> >
> > ps. I am desperately looking for some good sites covering the PHP
> DOM
> > functions. On www.php.net/dom there are barely some examples. And on
> > www.zend.com I only found one article with very, very basic
> examples.
> > Any ideas/suggestions are more than welcome. ds.
>
> You can pretty much search for examples from any DOM implementation
> since its a standard (not too difficult to go from one language to
> another when using DOM). For PHP specific ones, there are a number
> of tests in the CVS repository that demonstrate much of the
> functionality:
> http://cvs.php.net/viewcvs.cgi/php-src/ext/dom/tests/
> One particular test that uses a good amount of the API (though the
> basic functions) is dom001.phpt:
> http://cvs.php.net/viewcvs.cgi/php-src/ext/dom/tests/dom001.phpt?
> view=markup&rev=1.4
>
> Rob
>
> --
> rrichardsctindustries.net
> author of Pro PHP XML and Web Services from Apress
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

attached mail follows:


>BTW, is there an easy way to get the total amount of items in a curent node? count ( $nodeElement -> parentNode -> childNodes ) always returns 1. For now the only solution I know of is looping through the nodeElements (e.g. foreach ( $nodeElement as $value ) and have a counter inside the loop.

The way I did this (unfortunately in another language) was to write a recursive function that traveled to the end counting along the way and then returned the count.

hth's

tedd
--
------------------------------------------------------------------------------------
http://sperling.com http://ancientstones.com http://earthstones.com

attached mail follows:


Dear All,

I have a HTTP server + MySQL database. Everytime a file is requested for
download, my PHP script loads the content from the database into a temporary
file (on the server). I then pass a URL to the client, with a link to this
file. The client can thus download the file at any time.

However, I can foresee many problems with this approach. One is, when to
delete the temporary file? Also with more than one client, this approach
would have to be refined. Security is also an issue: One user may read
another's files.

Can anyone kindly give me an alternative approach?

I reiterate, I cannot supply static URLs as the downloadable file is
generated on-demand.

Thanks & Regards
KM

attached mail follows:


kartikay malhotra schrieb:
> Dear All,
>
> I have a HTTP server + MySQL database. Everytime a file is requested for
> download, my PHP script loads the content from the database into a
> temporary
> file (on the server). I then pass a URL to the client, with a link to this
> file. The client can thus download the file at any time.
>
> However, I can foresee many problems with this approach. One is, when to
> delete the temporary file? Also with more than one client, this approach
> would have to be refined. Security is also an issue: One user may read
> another's files.
>
> Can anyone kindly give me an alternative approach?
>
> I reiterate, I cannot supply static URLs as the downloadable file is
> generated on-demand.
>
> Thanks & Regards
> KM
>
Code a page that passes the appropriate headers for the file to the user
and passthrough the file to the user.
That way no file is been generated and therefore nothing can be stolen.

I would do it like that

--
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

attached mail follows:


At 8:42 AM +0000 6/7/06, kartikay malhotra wrote:
>Dear All,
>
>I have a HTTP server + MySQL database. Everytime a file is requested for
>download, my PHP script loads the content from the database into a temporary
>file (on the server). I then pass a URL to the client, with a link to this
>file. The client can thus download the file at any time.
>
>However, I can foresee many problems with this approach. One is, when to
>delete the temporary file? Also with more than one client, this approach
>would have to be refined. Security is also an issue: One user may read
>another's files.
>
>Can anyone kindly give me an alternative approach?
>
>I reiterate, I cannot supply static URLs as the downloadable file is
>generated on-demand.
>
>Thanks & Regards
>KM

KM:

Thinking off the top of my head (not always the best for me) -- why not give the user a static url AND a key?

The static url would have a php program sitting there waiting for a user to come along and provide the correct key. After which, your program would then create the file (in a random named folder); provide the user with a link; and clean-up after he's done.

That way you have the control over what's happening. The key approach handles security and when to clean-up.

hth's

tedd
--
------------------------------------------------------------------------------------
http://sperling.com http://ancientstones.com http://earthstones.com

attached mail follows:


Anyone know any good HTML mailing list?

Sorry for OT but google don't give me any good lists, and probably
somone here has a list which is good :)

My Problem:
I want to use "mailto:" in one of my pages but i have to use umlauts
(&uuml;).
Thunderbird just works fine and is displaying me the bodytext as it
should. But Outlook express isn't working.
It looks like it encodes it to URL like internally.
Hexadezimal numbers with a leading %

Any help or a mailing list would be nice :)

Thanks

Barry
--
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

attached mail follows:


Hi all ,

   I am having problem in store session in the database . Below is the
example code from code.

The issue is that the code run ok , however the expireref fields is not
updated in the sessions table, below is the sessions schema :

CREATE TABLE `sessions` (
   `sesskey` varchar(32) NOT NULL default '',
   `expiry` int(11) unsigned NOT NULL default '0',
   `expireref` varchar(64) default '',
   `data` longtext,
   PRIMARY KEY (`sesskey`),
   KEY `expiry` (`expiry`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 |

Anybody have ideas why all fields are updated except expireref field ?

<?php

function NotifyExpire($ref,$key)
{
        print "<p><b>Notify Expiring=$ref, sessionkey=$key</b></p>";
}

         $ADODB_SESSION_DRIVER='mysql';
        $ADODB_SESSION_CONNECT='....';
        $ADODB_SESSION_USER ='....';
        $ADODB_SESSION_PWD ='....';
        $ADODB_SESSION_DB ='....';

        $ADODB_SESS_DEBUG = 99;
         session_start();
         $userdata = new User();
         $_SESSION['USER_NAME'] = $userdata->getUsername();
        $ADODB_SESSION_EXPIRE_NOTIFY =array('USER_NAME','NotifyExpire');

        ob_start();
        include('./library/adodb/session/adodb-cryptsession.php');

        adodb_session_regenerate_id();

        $_SESSION['MONKEY'] = array('1','abc',44.41);
        if (!isset($_GET['nochange'])) $_SESSION['AVAR'] += 1;

?>

attached mail follows:


On 6/7/06, weetat <weetat.yeocxrus.com> wrote:
> Hi all ,
>
> I am having problem in store session in the database . Below is the
> example code from code.

Ask the adodb guys.

http://adodb.sourceforge.net/#mail

--
Postgresql & php tutorials
http://www.designmagick.com/

attached mail follows:


Thats not PHP related. Its normal HTML/JS

2 Ways:

1) Make form to use 1 field:;

<form method="GET" action="file.php" >
<input name="name" type="text" />
</form

2) Use JS to manipulate the target url dynamicaly

on Wednesday 07 June 2006 21:20, Steffen Mazanek wrote:
> Hello,
>
> I want to provide two input text fields lastname and firstname and if the
> user pushes the submit button the generated url should be
> ...?name=firstname_lastname.
>
> Is this possible and how?
>
> Thank you for helping a php newbie.
>
> Steffen Mazanek

attached mail follows:


At 11:45 PM -0400 6/6/06, Robert Cummings wrote:
>On Tue, 2006-06-06 at 22:53, Rasmus Lerdorf wrote:
>> Richard Lynch wrote:
>>
>> Or we try to do something a bit more creative which always runs the risk
>> of surprising people. In this case "a2"++ becomes "a3" and "c9"++
>> becomes "d0". If we have a character that doesn't infer any sort of
>> logical sequence, like "&" then the ++ does nothing. So "&"++ stays at
>> "&". However "&3" becomes "&4" and "&b"++ becomes "&c". "99z"++
>> becomes "100a" and
>
>Funky stuff.
>
>> "1z9z9z"++ becomes "2a0a0a" and yes, of course "z"++
>
>Good thing Tedd didn't come across the above one by accident *lol*.
>
>Cheers,
>Rob.

Well... now that you mentioned it.... :-)

Good discussion all.

Thanks for everyone's input, learned a lot -- and hopefully didn't annoy too many.

tedd
--
------------------------------------------------------------------------------------
http://sperling.com http://ancientstones.com http://earthstones.com

attached mail follows:


On 6/5/06, Adam Zey <azeynit.ca> wrote:
> Let's make it even more compact and confusing :)
>
> echo "$variable is ".($variable % 2 ?'even':'odd')."<br />\n";
>
> I'm not sure if you can nuke the whitespace in the modulus area or not.
>

Yes you can,in php whitespaces inside expressions does not have
special meaning.

 echo "$variable is ".($variable%2?'even':'odd')."<br />\n";

attached mail follows:


Hi,

On Tuesday 06 June 2006 21:05, Jochem Maas wrote:

[snip]
> I might be late to the party but have you thought of trying the YAHOO UI
> lib (treeview widget) it even allows you to dynamically load subbranches
> as they are expanded (AJAX lovelyness):
>
> http://developer.yahoo.com/yui/treeview/
>
Thanks, that's a nice library. But it is really what I'm looking for, and it
has many features I won't be using.

> I have used (and extended) the treeview code with great success (ok so I'm
> biased ;-) - if nothing else the guys at YAHOO have done a great job in
> showing how one can use prototyping (more or less the javascript
> equivalent to classes) to build [very] robust javascript libraries.
>
> <testament to="YAHOO JS Lib being rather good">
> I have made the YAHOO javascript lib(s) part of my core [reusable] js
> codebase - the only downside is that its a bit embarrassing hwo the YAHOO
> stuff has made alot of my own js code redundant :-P
> <testament>
There are just sooo many libraries and code snippets and paradigms these
days...

> <disclaimer>I have nothing to do with YAHOO apart from occasionally
> harassing one of their system architects (sorry Rasmus) about things not
> related to YAHOO</disclaimer>
Hands off Rasmus! He's a good guy!

Thank you for your answer,
Niels

attached mail follows:


Hello All,

I've written a clunky script that presents a form to a user with 30
checkboxes on it to match 30 fields in a table. The user checks off
each field they want to appear in a text file produced by the script.
The script I wrote captures each checkbox response to a separate
variable:

$fieldname1=$_POST['fieldname1'];
$fieldname2=$_POST['fieldname2'];

etc...

I then build a custom query based on those variables using 30 logic
statements like such:

if ($fieldname1) $query .="fieldname1, ";
if ($fieldname2) $query .="fieldname2, ";

etc...

I then query the DB and iterate over the results, shoving the data
into an output variable like this (again 30 logic statements):

if ($fieldname1) $output.="$row[fieldname1]\t";
if ($fieldname2) $output.="$row[fieldname2]\t";

then I print the contents of $output to a text file.

It seems that there has to be a better way of doing this. Can the
$_POST superglobal be manipulated in this way:

foreach ($_POST as $fieldname) ?

Thanks for any help and guidance.

- Ben

attached mail follows:


On 6/7/06, Ben Liu <blzabub8gmail.com> wrote:
> Hello All,

<snip>

> It seems that there has to be a better way of doing this. Can the
> $_POST superglobal be manipulated in this way:
>
> foreach ($_POST as $fieldname) ?

Yes, that will work.

If in doubt give something a try. :)

--
Postgresql & php tutorials
http://www.designmagick.com/

attached mail follows:


At 8:21 AM -0400 6/7/06, Ben Liu wrote:
>Hello All,
>
>I've written a clunky script that presents a form to a user with 30 checkboxes on it to match 30 fields in a table. The user checks off each field they want to appear in a text file produced by the script. The script I wrote captures each checkbox response to a separate variable:
>
>$fieldname1=$_POST['fieldname1'];
>$fieldname2=$_POST['fieldname2'];
>
>etc...
>
>I then build a custom query based on those variables using 30 logic statements like such:
>
>if ($fieldname1) $query .="fieldname1, ";
>if ($fieldname2) $query .="fieldname2, ";
>
>etc...
>
>I then query the DB and iterate over the results, shoving the data into an output variable like this (again 30 logic statements):
>
>if ($fieldname1) $output.="$row[fieldname1]\t";
>if ($fieldname2) $output.="$row[fieldname2]\t";
>
>then I print the contents of $output to a text file.
>
>It seems that there has to be a better way of doing this.

Ben:

What you did doesn't look bad to me. If you understand it, it's obvious, and it works...

But, if it was my code, I might take steps one and two and combine them, and run the process through a loop, like so:

for ($i = 1; $<=30; $I)
   {
   if ($_POST['$i']) $query .="$i, ";
   }

And then assemble the data the same way.

for ($i = 1; $<=30; $I)
   {
   if ($i) $output.="$row[$i]\t";
   }

This is written on the fly, so it may not work as I expect, but I'm sure you get the idea.

hth's

tedd
--
------------------------------------------------------------------------------------
http://sperling.com http://ancientstones.com http://earthstones.com

attached mail follows:


I guess I was just "talking the problem out." :-)
Writing that post helped me think of iterating through $_POST. Now
I've come to this problem:

Before I did this and it works:

while ($row=mysql_fetch_array($result)) {
        if ($fieldname1) $output.="$row[fieldname1]\t";
        if ($fieldname2) $output.="$row[fieldname2]\t";
}

Trying to tighten up as discussed with this, but doesn't work:

while ($row=mysql_fetch_array($result)) {
        foreach ($_POST as $key => $data)
                if ($data) {$output.="$row[" . $key . "]\t";
                } // foreach
} // end while $row

The above throws a "Parse error: parse error, expecting `T_STRING' or
`T_VARIABLE' or `T_NUM_STRING' in...." error.

This substitution:

if ($data) {$output.="$row[$key]\t";

eliminates the aforementioned error, but does not produce the desired
results.

On Jun 7, 2006, at 8:26 AM, chris smith wrote:
>
> If in doubt give something a try. :)
>

attached mail follows:


Nevermind, got it to work with this:

        while ($row=mysql_fetch_array($result)) {
                foreach ($_POST as $key => $data) {
                        if ($data) $output.="$row[$key]\t";
                } // foreach $_POST
        }// while $row

Had a poorly positioned statement throwing off the data output.

Thanks for all suggestions...
--Ben

attached mail follows:


Ben Ramsey wrote:

> On 6/6/06 9:55 AM, Ruben Rubio Rey wrote:
>
>> Im having a trouble using memcached with pear db.
>>
>> When im using memcache to store and retrieve an string, all works fine.
>> When Im using memcache to store a pear db resulset, it does not work!!
>>
>> This retrieves data but pear::db does not understand it.
>> I really dont know
>
>
> This is because $db->query returns a resource, which is a reference to
> the data and not the data itself.
>
> For example, let's say you're using the MySQL driver for PEAR::DB,
> then when you call $db->query(), it uses mysql_query(). This function
> will return a resource. When you store the resource to the memcache
> server and then later retrieve it, it no longer maintains its
> reference to the data.
>
> If you want to store the data to the cache, I suggest you use getAll()
> to retrieve an array of data and then store that to the memcache server:
>
> $db->setFetchMode(DB_FETCHMODE_ASSOC);
> $data =& $db->getAll($sSQL);
> memcache_set($MEMCACHE_STR, MD5($sSQL), $data, 0, 10);
>
> Now, your result set is stored properly on the memcache server.

Seems its working. Thaks a lot!

attached mail follows:


Hi guys Im here again, now I got this problem with a loop. The script
is at the end of the message so you guys can review it. Now to the
problem: I have a script that go to a site and try to access an url
like www.domain.com/story/variable/ it should do the following:

Try to open the page if it doesnt exist return false for the boolean check,

If not should echo the page and add to the variable to be like:

www.domain.com/story/1/
www.domain.com/story/2/
www.domain.com/story/3/
etc...

I'm trying to echo all the pages in one html adding it after echoing
it. It just return some strange values like "z" or a pund signal...

Anyone off you guys up to the task?

Thanks a lot...
Rodrigo

attached mail follows:


i guys Im here again, now I got this problem with a loop. The script
is at the end of the message so you guys can review it. Now to the
problem: I have a script that go to a site and try to access an url
like www.domain.com/story/variable/ it should do the following:

Try to open the page if it doesnt exist return false for the boolean check,

If not should echo the page and add to the variable to be like:

www.domain.com/story/1/
www.domain.com/story/2/
www.domain.com/story/3/
etc...

I'm trying to echo all the pages in one html adding it after echoing
it. It just return some strange values like "z" or a pund signal...

Anyone off you guys up to the task?

Thanks a lot...
Rodrigo

<?

$urlChapter = 1;//'/'.$_POST["chapter"].'/';

$urlStory = '/s/'.$_POST["story"];

$urlMain = "http://www.domain.com";

$url = "$urlMain"."$urlStory"."$urlChapter";

$texto = file("$url");

$result2 = count($texto);

$i = 0;

while ($i < $result2)
{
  echo "$texto[$i]";
  $i++;

}

while (fopen("http://www.domain.com/s/$urlStory/$urlChapter/","r")!=null)
{

    $pega = fopen("$urlMain"."$urlStory"."$urlChapter","r");

        $pega = strip_tags($pega, '<p></p><br>');

    echo "$pega";

    $urlChapter++;

}

?>

attached mail follows:


hi people,

I've been STFW till I'm blue in the face (so lack of oxygen might be
problem atm) but can't find any [decent] info on generating/transforming existing
HTML so thats it's compatible with the subset of tags that are supported
by Flash (apparently Flash has the ability to show something that resembles
HTML in certain visual controls - I don't flash, I'm just responsible for
supplying XML feeds that the flash site/file in question can consume).

so the question does any know of a reliable resource on this subject and/or
some code nugget that is capable of generating/transforming (x)HTML into
the cruft that Flash is capable of displaying?

any feedback is welcome (apart from 'STFW' - I'm already doing that :-P)

rgds,
Jochem

ps - my server side stuff is all php (so I need to have an HTML 'converter'
written in php too [preferably]) before someone hits me with the 'what does
this has to do with php' response.

attached mail follows:


2006/6/7, Jochem Maas <jochemiamjochem.com>:
>
> hi people,
>
> I've been STFW till I'm blue in the face (so lack of oxygen might be
> problem atm) but can't find any [decent] info on generating/transforming
> existing
> HTML so thats it's compatible with the subset of tags that are supported
> by Flash (apparently Flash has the ability to show something that
> resembles
> HTML in certain visual controls - I don't flash, I'm just responsible for
> supplying XML feeds that the flash site/file in question can consume).
>
> so the question does any know of a reliable resource on this subject
> and/or
> some code nugget that is capable of generating/transforming (x)HTML into
> the cruft that Flash is capable of displaying?
>
> any feedback is welcome (apart from 'STFW' - I'm already doing that :-P)
>
> rgds,
> Jochem
>
> ps - my server side stuff is all php (so I need to have an HTML
> 'converter'
> written in php too [preferably]) before someone hits me with the 'what
> does
> this has to do with php' response.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Have you read the following?
http://livedocs.macromedia.com/flash/mx2004/main_7_2/00001027.html
http://livedocs.macromedia.com/flash/mx2004/main_7_2/00001014.html

attached mail follows:


Date: Wed, 07 Jun 2006 12:45:45 -0400
From: JF Simard <jfnetdiver.net>
To: php-generallists.php.net
Message-id: <optasbijxanyzeigjfs>
MIME-version: 1.0
Content-type: text/plain; format=flowed; delsp=yes; charset=iso-8859-15
Content-transfer-encoding: 7BIT
Subject: Introductory message

Hi all,

I am attempting to send my first post to the list. Been reading and using
PHP with passion for the past year on our website and want to learn more
and more, and contribute if I can.

--
JF Simard
   creative + code + logistics //
   Feed your eyes - http://netdiver.net/


  • application/pkcs7-signature attachment: smime.p7s

  • application/pkcs7-signature attachment: smime.p7s

  • application/pkcs7-signature attachment: smime.p7s