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 21 Nov 2003 01:00:11 -0000 Issue 2427

php-general-digest-helplists.php.net
Date: Thu Nov 20 2003 - 19:00:11 CST


php-general Digest 21 Nov 2003 01:00:11 -0000 Issue 2427

Topics (messages 170406 through 170508):

Re: PHP-Only Polling Script?
        170406 by: Jay Blanchard
        170408 by: John Nichel
        170432 by: Rob Adams
        170434 by: Dan Joseph
        170435 by: John Nichel

Re: date question
        170407 by: John Nichel
        170423 by: Ahbaid Gaffoor

Re: $query works but i still get a returned error
        170409 by: John W. Holmes
        170410 by: PAUL FERRIE

Re: $_REQUEST non populated
        170411 by: Andrea Pinnisi

Re: Why is the php loop, 'for()', so slow????
        170412 by: Scott Fletcher
        170414 by: Scott Fletcher
        170421 by: Wouter van Vliet
        170490 by: Eugene Lee

Re: Installing Turck MMcache on win
        170413 by: Veress Berci
        170428 by: Curt Zirzow

Re: retrieving ENUM description from MySQL
        170415 by: Jeff McKeon

echo or print
        170416 by: Jay Fitzgerald
        170422 by: Tom Rogers
        170455 by: John W. Holmes
        170465 by: Johnson, Kirk
        170470 by: Burhan Khalid
        170491 by: Eugene Lee

date from weeknumber
        170417 by: Fredrik
        170420 by: Marco Tabini

Is there a way to use the strpos() for next string...
        170418 by: Scott Fletcher
        170424 by: Ford, Mike [LSS]
        170449 by: Scott Fletcher
        170457 by: Kelly Hallman
        170458 by: Ford, Mike [LSS]
        170493 by: Scott Fletcher
        170494 by: Scott Fletcher
        170495 by: Kelly Hallman

Re: Prefilled forms(solved)
        170419 by: Veress Berci

Session vars not echoing?
        170425 by: Jas
        170438 by: pete M
        170451 by: Jas
        170456 by: John W. Holmes

Using JavaScript variables in PHP
        170426 by: Mike Knittel
        170430 by: Mike Migurski
        170431 by: John Nichel

XML Parsing....
        170427 by: Scott Fletcher

Re: IE 6 mangling posted code
        170429 by: Pablo Gosse

Avoiding duplicate orders?
        170433 by: J J
        170436 by: Sophie Mattoug
        170439 by: pete M
        170441 by: Marek Kilimajer

Re: PHP Encoders
        170437 by: R. Rajesh Jeba Anbiah
        170447 by: Ryan A
        170487 by: Michael

Two-way on-the-fly encryption
        170440 by: Ray
        170443 by: Chris W. Parker
        170450 by: Ray
        170459 by: Chris W. Parker
        170460 by: Jason Wong
        170477 by: Ray

LAMP jobs
        170442 by: Susan Ator

On-the-fly encryption
        170444 by: Ray
        170446 by: Chris W. Parker

Re: file_exists on Windows problem
        170445 by: Chris Williams

Usort an array.
        170448 by: Vincent M.
        170453 by: pete M
        170454 by: Jay Frumkin

Remote computer name?
        170452 by: Jas
        170461 by: John Nichel
        170467 by: Mike Migurski
        170472 by: Jas
        170476 by: John Nichel
        170479 by: Jason Wong
        170481 by: John Nichel
        170486 by: Jason Wong

PHP LDAP attributes question
        170462 by: Cory Hicks

Javascript question
        170463 by: Robin Kopetzky
        170464 by: Jason Wong
        170466 by: Robin Kopetzky
        170468 by: Mike Migurski
        170469 by: Jay Blanchard
        170471 by: John Nichel
        170473 by: John Nichel
        170474 by: Jason Wong
        170475 by: Jay Blanchard
        170478 by: John Nichel
        170480 by: Aaron Gould
        170483 by: Brent Baisley

array_search
        170482 by: Jake McHenry
        170484 by: Jay Blanchard
        170485 by: Jake McHenry
        170488 by: Jake McHenry
        170489 by: Kelly Hallman
        170497 by: John W. Holmes

SQLite
        170492 by: Bronislav Klučka

Curious about something....
        170496 by: Dan Joseph
        170499 by: John W. Holmes
        170501 by: Mike Migurski
        170502 by: Vail, Warren

Mulitple selects from form drop down box
        170498 by: Jeff McKeon
        170500 by: John W. Holmes

Zip Code Locator / Radius Search
        170503 by: Becoming Digital
        170504 by: Marco Tabini
        170505 by: Manuel Lemos
        170506 by: Becoming Digital
        170507 by: Becoming Digital

passthru gives error in httpd/error_log
        170508 by: Jesper Hansen

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:


[snip]
Can anyone recommend a good, simple PHP-only polling script?
[/snip]

I found this by using Google

http://www.pscode.com/vb/scripts/ShowCode.asp?txtCodeId=267&lngWId=8

http://www.google.com/search?hl=en&ie=UTF-8&oe=UTF-8&q=PHP+voting+script

attached mail follows:


Jay Blanchard wrote:
> [snip]
> Can anyone recommend a good, simple PHP-only polling script?
> [/snip]
>
> I found this by using Google
>
> http://www.pscode.com/vb/scripts/ShowCode.asp?txtCodeId=267&lngWId=8
>
> http://www.google.com/search?hl=en&ie=UTF-8&oe=UTF-8&q=PHP+voting+script
>

I keep hearing about this 'Google' thing. I really must check that
place out one day. ;)

For premade scripts, there's always here too...

http://www.phpresourceindex.com

--
By-Tor.com
It's all about the Rush
http://www.by-tor.com

attached mail follows:


"John Nichel" <jnichelby-tor.com> wrote in message
news:3FBCC141.6080400by-tor.com...
> For premade scripts, there's always here too...
>
> http://www.phpresourceindex.com
>

Is this page a joke? When I go there, I get this message:

<error>
Active Server Pages error 'ASP 0241'
CreateObject Exception

/Default.asp

The CreateObject of '(null)' caused exception C0000005.
</error>

  -- Rob

attached mail follows:


Hi,

> Is this page a joke? When I go there, I get this message:
>
> <error>
> Active Server Pages error 'ASP 0241'
> CreateObject Exception
>
> /Default.asp
>
> The CreateObject of '(null)' caused exception C0000005.
> </error>

        Looks ok to me, except last I remmeber, ASP gave you a line number it
crashed on. Myabe ASP.NET doesn't. I've never actually seen ASP.NET report
errors to the browser..

-Dan Joseph

attached mail follows:


Rob Adams wrote:
> "John Nichel" <jnichelby-tor.com> wrote in message
> news:3FBCC141.6080400by-tor.com...
>
>>For premade scripts, there's always here too...
>>
>>http://www.phpresourceindex.com
>>
>
>
> Is this page a joke? When I go there, I get this message:
>

Nope, no joke...just not thinking while I type....

http://php.resourceindex.com/

--
By-Tor.com
It's all about the Rush
http://www.by-tor.com

attached mail follows:


Martin Cameron wrote:
> $ndays=14;
>
> function get_next_dates($ndays)
> {
> $today=date("m-d-Y",mktime(0,0,0,date("m"),date("d"),date("Y")));
>
> $forward_date=date("m-d-Y",mktime(0,0,0,date("m"),date("d")+$few_days,date("Y")));
> print "<h1>$today === $few_days === $forward_date</h1>";
> for($i=0;$i<$ndays;$i++)
> {
>
> $new_days_array[]=date("m-d-Y",mktime(0,0,0,date("m"),date("d")+$i,date("Y")));
> }
> return($new_days_array);
> }
>
>

What's the question?

--
By-Tor.com
It's all about the Rush
http://www.by-tor.com

attached mail follows:


Beautiful,

many thanks

Ahbaid.

Martin Cameron wrote:

>$ndays=14;
>
>function get_next_dates($ndays)
>{
> $today=date("m-d-Y",mktime(0,0,0,date("m"),date("d"),date("Y")));
>
>$forward_date=date("m-d-Y",mktime(0,0,0,date("m"),date("d")+$few_days,date("Y")));
> print "<h1>$today === $few_days === $forward_date</h1>";
> for($i=0;$i<$ndays;$i++)
> {
>
>$new_days_array[]=date("m-d-Y",mktime(0,0,0,date("m"),date("d")+$i,date("Y")));
> }
> return($new_days_array);
>}
>
>
>
>

attached mail follows:


PAUL FERRIE wrote:

> I am not sure what the problem is here. The script runs and deletes the
> relevent row but still returns "DATA from albums loaded
> row id 658 did not get sent
> Error deleting row!
> Warning: Cannot modify header information - headers already sent by (output
> started at /home/pferrie/public_html/vinrev/adm/deleteid.php:2) in
> /home/pferrie/public_html/vinrev/adm/deleteid.php on line 21

You get this error because you echo display messages and errors before
trying to do a header() redirect. You can't have any output before header().

> "
> <?
> if (isset($_GET['tablename'])) {
> echo "DATA from <b>{$_GET['tablename']}</b> loaded<br>";
> } else {
> echo "<i>$tablename</i> did not get sent<br>";
> }
> if (isset($_GET['id'])) {

Take a look at your form again, you're using POST.
if(isset($_POST['id'])) {

> echo "row id= <b>{$_GET['id']}</b><br>";
> } else {
> echo "row id <i>$id</i> did not get sent<br>";

But you must have register_globals still on because $id is set with the
same value as $_POST['id']...

> }
>
>
> include("connection.php");
> $query = mysql_query("DELETE FROM $tablename WHERE id= $id")or die("<br>ther

and that's why this query works, because $id is the correct value.

> was an error<br> tablename:= $tablename<br>
> row id:= $id");
> if(!mysql_query($query)) {
> echo"Error deleting row!");
> }
> Header("Location: delete.php?success=$success");
>
> ?>
>
>
> I am php newbie and might be missing the obviuos

Might be missing the obvious, too. ;)

--
---John Holmes...

Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals – www.phparch.com

attached mail follows:


So your saying i should be using POST rather than GET?

"John W. Holmes" <holmes072000charter.net> wrote in message
news:3FBCC031.5090109charter.net...
> PAUL FERRIE wrote:
>
> > I am not sure what the problem is here. The script runs and deletes the
> > relevent row but still returns "DATA from albums loaded
> > row id 658 did not get sent
> > Error deleting row!
> > Warning: Cannot modify header information - headers already sent by
(output
> > started at /home/pferrie/public_html/vinrev/adm/deleteid.php:2) in
> > /home/pferrie/public_html/vinrev/adm/deleteid.php on line 21
>
> You get this error because you echo display messages and errors before
> trying to do a header() redirect. You can't have any output before
header().
>
> > "
> > <?
> > if (isset($_GET['tablename'])) {
> > echo "DATA from <b>{$_GET['tablename']}</b> loaded<br>";
> > } else {
> > echo "<i>$tablename</i> did not get sent<br>";
> > }
> > if (isset($_GET['id'])) {
>
> Take a look at your form again, you're using POST.
> if(isset($_POST['id'])) {
>
> > echo "row id= <b>{$_GET['id']}</b><br>";
> > } else {
> > echo "row id <i>$id</i> did not get sent<br>";
>
> But you must have register_globals still on because $id is set with the
> same value as $_POST['id']...
>
> > }
> >
> >
> > include("connection.php");
> > $query = mysql_query("DELETE FROM $tablename WHERE id= $id")or
die("<br>ther
>
> and that's why this query works, because $id is the correct value.
>
> > was an error<br> tablename:= $tablename<br>
> > row id:= $id");
> > if(!mysql_query($query)) {
> > echo"Error deleting row!");
> > }
> > Header("Location: delete.php?success=$success");
> >
> > ?>
> >
> >
> > I am php newbie and might be missing the obviuos
>
> Might be missing the obvious, too. ;)
>
> --
> ---John Holmes...
>
> Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
>
> php|architect: The Magazine for PHP Professionals – www.phparch.com

attached mail follows:


Marek Kilimajer ha scritto:

> variables_order - usualy set to EGPCS

It's already EGPCS, I'm waiting more info from the system administrator
of that server.
Is there any enviroment variable that may help to solve this problem? I
don't want to post the entire phpinfo :-)

Thanks

Andrea

attached mail follows:


Well, should have make one long string to the $res_str variable a lot
shorter. :-)

It turned out that the for() loop isn't the slow part when you mentioned
about substr(). I tried out the while() loop and it is pretty much the same
when the loop take over 5 minutes. So, it now seem to have to do with
substr() function. Yea, I'm not sure what hte best substitute of it would
be. In other branches off of this posting, someone said about using the
strpos(). I'm willing to give this a try but I have problem with this
because I have two "<!CDATA[[***]]>" tags in it and I want to use both, not
just first one.

Scott

"Chris W. Parker" <cparkerswatgear.com> wrote in message
news:001BD19C96E6E64E8750D72C2EA0ECEE4477E3ati-ex-01.ati.local...
Scott Fletcher <mailto:scottabcoa.com>
    on Wednesday, November 19, 2003 1:12 PM said:

> function CBC_XML_BreakUp(&$strResponse_XML, &$strResponse_HTML)
>
> {

[snip]

Wow I didn't think you were going to post your whole program. :0

1. Are you sure the for() loop is the slow part?

2. As someone already suggested, calculating the sizeof() outside of the
loop should help a lot. Another enhancement is changing your for() to
while(). (This is a small enhancement but makes a bigger difference as
your iterations increase.)

REGULAR for() loop construct:

$iMax = 99;

for($iCnt = 0; $iCnt < $iMax; $iCnt++)
{
}

OPTIMIZED:

$iMax = 99;
$iCnt = -1;

while(++$iCnt < $iMax)
{
}

Like I said it's only slightly faster, but might make a difference
depending on your number of iterations.

3. I think what may be slowing you down is your substr() calls. Maybe
there is a substitute function that is faster? (I don't have any ideas
unfortunately.)

Let us know if you figure something out.

HTH,
Chris.
--
Don't like reformatting your Outlook replies? Now there's relief!
http://home.in.tum.de/~jain/software/outlook-quotefix/

attached mail follows:


I can give the strpos() a shot but I seem to have problem with getting the
strpos() to give me two seperate "<!CDATA[[****]]>" tags instead of just hte
first one only...

Scott

"Curt Zirzow" <php-generalzirzow.dyndns.org> wrote in message
news:20031120010624.GW1542bagend.shire...
>
> Scott,
>
> Please dont post 500+ lines of stuff to the list. You only
> needed to post the relevent code relevent to the subject at hand.
>
> * Thus wrote Scott Fletcher (scottabcoa.com):
> >
> > for ($i=1;$i<strlen($res_str);$i++)
> >
> > {
> >
> > if (substr($res_str, $i, 9) == "<![CDATA[")
>
> You should really use strpos() instead of looking for this in php, it
> will increase the performance of your script.
>
>
> Curt
> --
> "My PHP key is worn out"
>
> PHP List stats since 1997:
> http://zirzow.dyndns.org/html/mlists/

attached mail follows:


As a substitute for substr, you might want to give a regex a chance.. have
no clue if it's faster, but it might just be.

        /^.{2}(.{0,8})/

would be your regex if you want to start at offset THREE and take out a MAX
EIGHT char string (remove the 0 and get ONLY EIGHT char strings). Not sure
if PHP sets $1, $2, .. vars, else give the optional third "Matches" param to
preg_match();

Wouter

> -----Oorspronkelijk bericht-----
> Van: Scott Fletcher [mailto:scottabcoa.com]
> Verzonden: donderdag 20 november 2003 15:44
> Aan: php-generallists.php.net
> Onderwerp: Re: [PHP] Why is the php loop, 'for()', so slow????
>
>
> Well, should have make one long string to the $res_str variable a lot
> shorter. :-)
>
> It turned out that the for() loop isn't the slow part when you mentioned
> about substr(). I tried out the while() loop and it is pretty
> much the same
> when the loop take over 5 minutes. So, it now seem to have to do with
> substr() function. Yea, I'm not sure what hte best substitute of it would
> be. In other branches off of this posting, someone said about using the
> strpos(). I'm willing to give this a try but I have problem with this
> because I have two "<!CDATA[[***]]>" tags in it and I want to use
> both, not
> just first one.
>
> Scott
>
> "Chris W. Parker" <cparkerswatgear.com> wrote in message
> news:001BD19C96E6E64E8750D72C2EA0ECEE4477E3ati-ex-01.ati.local...
> Scott Fletcher <mailto:scottabcoa.com>
> on Wednesday, November 19, 2003 1:12 PM said:
>
> > function CBC_XML_BreakUp(&$strResponse_XML, &$strResponse_HTML)
> >
> > {
>
> [snip]
>
> Wow I didn't think you were going to post your whole program. :0
>
> 1. Are you sure the for() loop is the slow part?
>
> 2. As someone already suggested, calculating the sizeof() outside of the
> loop should help a lot. Another enhancement is changing your for() to
> while(). (This is a small enhancement but makes a bigger difference as
> your iterations increase.)
>
> REGULAR for() loop construct:
>
> $iMax = 99;
>
> for($iCnt = 0; $iCnt < $iMax; $iCnt++)
> {
> }
>
> OPTIMIZED:
>
> $iMax = 99;
> $iCnt = -1;
>
> while(++$iCnt < $iMax)
> {
> }
>
> Like I said it's only slightly faster, but might make a difference
> depending on your number of iterations.
>
> 3. I think what may be slowing you down is your substr() calls. Maybe
> there is a substitute function that is faster? (I don't have any ideas
> unfortunately.)
>
>
> Let us know if you figure something out.
>
> HTH,
> Chris.
> --
> Don't like reformatting your Outlook replies? Now there's relief!
> http://home.in.tum.de/~jain/software/outlook-quotefix/
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

attached mail follows:


On Thu, Nov 20, 2003 at 09:45:45AM -0500, Scott Fletcher wrote:
:
: I can give the strpos() a shot but I seem to have problem with getting the
: strpos() to give me two seperate "<!CDATA[[****]]>" tags instead of just hte
: first one only...

Use the offset parameter:

        <?php

        $haystack = 'To be or not to be.';
        $needle = 'be';
        $needlesize = strlen($needle);
        $pos = 0;
        while (($pos = strpos($haystack, $needle, $pos)) !== false)
        {
                echo '$pos = '.$pos."\n";
                $pos += $needlesize;
        }

        ?>

attached mail follows:


Hello

Curt wrote:
>php has to run as a mod in order to have mmcache run. Make a php
I knew this from the start. So I configured Apache (i think i did it right)
to run php as module.
I had an "httpd.conf.runphpasmodule" file, and I had renamed it to
httpd.conf

>page with the output of phpinfo(). It will tell you if its running
>in module mode or cgi and also wich php.ini you need to modify.

I did it, but I can't see any relevant info on it.
(I'm total newbie)
Where exactly should I look on the phpinfo page if it's running as cgi or
mod?

Maybe i haven't put mmcache info to the right place in php.ini.
It looks like this:

;Windows extensions
.
.[snip]
.
;extension=php_snmp.dll
;extension=php_sockets.dll
;extension=php_sybase_ct.dll
;extension=php_xslt.dll
;extension=php_yaz.dll
;extension=php_zlib.dll
zend_extension_ts="C:\apache\php\extensions\mmcache.dll"
mmcache.shm_size="16"
mmcache.cache_dir="c:\tmp\mmcache"
mmcache.enable="1"
mmcache.optimizer="1"
mmcache.check_mtime="1"
mmcache.debug="0"
mmcache.filter=""
mmcache.shm_max="0"
mmcache.shm_ttl="0"
mmcache.shm_prune_period="0"
mmcache.shm_only="0"
mmcache.compress="1"

Maybe I should change "zend_extension_ts" to "extension?"
No. I tried it.

attached mail follows:


* Thus wrote Veress Berci (veress_bercihotmail.com):
> Hello
>
> Curt wrote:
> >php has to run as a mod in order to have mmcache run. Make a php
> I knew this from the start. So I configured Apache (i think i did it right)
> to run php as module.
> I had an "httpd.conf.runphpasmodule" file, and I had renamed it to
> httpd.conf
>
> >page with the output of phpinfo(). It will tell you if its running
> >in module mode or cgi and also wich php.ini you need to modify.
>
> I did it, but I can't see any relevant info on it.
> (I'm total newbie)
> Where exactly should I look on the phpinfo page if it's running as cgi or
> mod?

The column in the very first part that says: Server API
It will say something like IIS Version if its a module or CGI
gateway if its a cgi.

>
> Maybe i haven't put mmcache info to the right place in php.ini.
> It looks like this:
>
> ;Windows extensions
> .
> .[snip]
> .
> ;extension=php_snmp.dll
> ;extension=php_sockets.dll
> ;extension=php_sybase_ct.dll
> ;extension=php_xslt.dll
> ;extension=php_yaz.dll
> ;extension=php_zlib.dll
> zend_extension_ts="C:\apache\php\extensions\mmcache.dll"
>
> Maybe I should change "zend_extension_ts" to "extension?"
> No. I tried it.

hmm.. yea that might be the problem, i've never seen a
zend_extension_ts.

Curt
--
"My PHP key is worn out"

  PHP List stats since 1997:
    http://zirzow.dyndns.org/html/mlists/

attached mail follows:


Here's an example of how to get the ENUM into a drop down list in a web
form. I use it all the time..

[code]
/*
Get_Enum : Retreives the "enum" options from an "enum" type field in a
MySql Database
*/
 
function Get_enum($table,$field,$db,$link) {

mysql_select_db($db,$link);
$result = mysql_query("show columns from $table like '$field'", $link);
$query_data = mysql_fetch_array($result);

if(eregi("('.*')", $query_data["Type"], $match)) {
        $enum_str = ereg_replace("'", "", $match[1]);
        $enum_options = explode(',', $enum_str);
}

array_push($enum_options, $query_data["Default"]);
return $enum_options;
}

//Note: db_connect() (not shown) is a function created to make a
database connection...

<form>
<select size="1" name="category" style="border-style: solid;
border-width: 1; padding: 1">
<?php
                $link_id = db_connect(dbhost,dbname,dbuser,dbpass);
                $array =
Get_enum("tablename","Fieldname",$dbname,$link_id);
                foreach($array as $var) echo "<option
value='$var'>$var</option>";
?>
            </select>
</form>
[code]

Hope this helps...

Jeff

> -----Original Message-----
> From: Alan Lord [mailto:lord_alanhotmail.com]
> Sent: Wednesday, November 19, 2003 12:12 PM
> To: php-generallists.php.net
> Subject: [PHP] retrieving ENUM description from MySQL
>
>
> Hi all,
>
> This is a bit wierd so don't flame please.
>
> Imagine a database table, field defined as ENUM with a list
> of allowed types such as "Mr", "Mrs", "Miss", "Dr", "Prof",
> etc - you get the idea.
>
> I've read the MySQL manual and by using
>
> SHOW COLUMNS FROM "table_name" LIKE "enum_column_name";
>
> I can get a result.
>
> But the string of ENUMs is not an array. It is returned as a
> string with all types in one string.
>
> Anyone got any ideas about how to retrieve it in a better way
> - else I'll need to start exploding the string...
>
> Thanks in advance
>
> Al
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

attached mail follows:


when should i use echo ' '; vs. print ' ';

================================================
Jay Fitzgerald, Design Director
- Certified Professional Webmaster (CPW-A)
- Certified Professional Web Designer (CPWDS-A)
- Certified Professional Web Developer (CPWDV-A)
- Certified E-Commerce Manager (CECM-A)
- Certified Small Business Web Consultant (CWCSB-A)

Bayou Internet - http://www.bayou.com
Toll Free: 888.30.BAYOU (22968)
Vox: 318.338.2034 / Fax: 318.338.2506
E-Mail: jayfitzbayou.com
ICQ: 38823829 / AIM: bayoujf / MSN: bayoujf / Yahoo: bayoujf
================================================

attached mail follows:


Hi,

Friday, November 21, 2003, 12:37:50 AM, you wrote:
JF> when should i use echo ' '; vs. print ' ';

JF> ================================================
JF> Jay Fitzgerald, Design Director
JF> - Certified Professional Webmaster (CPW-A)
JF> - Certified Professional Web Designer (CPWDS-A)
JF> - Certified Professional Web Developer (CPWDV-A)
JF> - Certified E-Commerce Manager (CECM-A)
JF> - Certified Small Business Web Consultant (CWCSB-A)

JF> Bayou Internet - http://www.bayou.com
JF> Toll Free: 888.30.BAYOU (22968)
JF> Vox: 318.338.2034 / Fax: 318.338.2506
JF> E-Mail: jayfitzbayou.com
JF> ICQ: 38823829 / AIM: bayoujf / MSN: bayoujf / Yahoo: bayoujf
JF> ================================================

There is no real difference in common usage, print returns true always so you
can use it in weird situations otherwise echo is a tiny bit faster.
You can do stuff like this

if(isset($_GET['name'] && print('DEBUG: received name set to '.$_GET['name']."<br>\n")){
  //normal processing here
}

--
regards,
Tom

attached mail follows:


Jay Fitzgerald wrote:

> when should i use echo ' '; vs. print ' ';

You should always use echo. It'll make a significant performance
increase in your scripts as it's only four letters instead of five.

--
---John Holmes...

Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals – www.phparch.com

attached mail follows:


> when should i use echo ' '; vs. print ' ';

Here's a link listed in the manual at
http://www.php.net/manual/en/function.print.php

http://www.faqts.com/knowledge_base/view.phtml/aid/1/fid/40

Kirk

attached mail follows:


Tom Rogers wrote:

> Hi,
>
> Friday, November 21, 2003, 12:37:50 AM, you wrote:
> JF> when should i use echo ' '; vs. print ' ';
>
>
> JF> ================================================
> JF> Jay Fitzgerald, Design Director
> JF> - Certified Professional Webmaster (CPW-A)
> JF> - Certified Professional Web Designer (CPWDS-A)
> JF> - Certified Professional Web Developer (CPWDV-A)
> JF> - Certified E-Commerce Manager (CECM-A)
> JF> - Certified Small Business Web Consultant (CWCSB-A)
>
> JF> Bayou Internet - http://www.bayou.com
> JF> Toll Free: 888.30.BAYOU (22968)
> JF> Vox: 318.338.2034 / Fax: 318.338.2506
> JF> E-Mail: jayfitzbayou.com
> JF> ICQ: 38823829 / AIM: bayoujf / MSN: bayoujf / Yahoo: bayoujf
> JF> ================================================

Jay, can you please reduce your signature? Because it leads to
unnecessary fluff when people don't trim posts.

Tom, please trim your replies. We don't need to see the same signature
twice (especially if its as grand as Jay's).

Where is that newbie email?
--
Burhan Khalid
phplist[at]meidomus[dot]com
http://www.meidomus.com
-----------------------
"Documentation is like sex: when it is good,
  it is very, very good; and when it is bad,
  it is better than nothing."

attached mail follows:


On Thu, Nov 20, 2003 at 12:36:42PM -0500, John W. Holmes wrote:
:
: Jay Fitzgerald wrote:
: >
: >when should i use echo ' '; vs. print ' ';
:
: You should always use echo. It'll make a significant performance
: increase in your scripts as it's only four letters instead of five.

<p class="tonue-in-cheek">

Also, the letter 'e' is smaller than 'p', so ASCII-based function
lookups will be faster as well.

</p>

attached mail follows:


Hi

I want to get the last date in a week.
Is there anybody who know how i can do this.

something like this:

function date getDateFromWeek( $week, $year){
    ...
    ...
    return date;
}

 - Petter

attached mail follows:


Hey--

Maybe this will help:

http://www.phparch.com/mailinglists/msg.php?a=557061

Cheers,

Marco

Fredrik wrote:
> Hi
>
> I want to get the last date in a week.
> Is there anybody who know how i can do this.
>
> something like this:
>
> function date getDateFromWeek( $week, $year){
> ...
> ...
> return date;
> }
>
>
> - Petter
>

attached mail follows:


Hi Everyone!

    Is there a way to get the strpos() to find the next needle in the
haystack instead of just the 1st one only? (Where the 1st needle is the
same string as the next needle)...

Thanks,
 Scott

attached mail follows:


On 20 November 2003 14:53, Scott Fletcher wrote:

> Hi Everyone!
>
> Is there a way to get the strpos() to find the next needle in
> the haystack instead of just the 1st one only? (Where the 1st
> needle is the same string as the next needle)...

Look at the optional 3rd parameter to strpos().

Cheers!

Mike

---------------------------------------------------------------------
Mike Ford, Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS, LS6 3QS, United Kingdom
Email: m.fordleedsmet.ac.uk
Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211

attached mail follows:


How exactly does the 3rd parameter option work. I tried this but it doesn't
work, so I don't know how exactly does it work... There isn't detail
information on the php.net website...

--snip--
   $XML_Start = (strpos($res_str,"<![CDATA[",1)+9);
   $HTML_Start = (strpos($res_str,"<![CDATA[",2)+9);
   $HTML_End = strpos($res_str,"]]>",1);
   $XML_End = strpos($res_str,"]]>",2);
--snip--

Scott

"Mike Ford" <M.Fordlmu.ac.uk> wrote in message
news:841D90E489448A4F804E1D1B95768BF7D462B2lis-exchange3.lmu.ac.uk...
> On 20 November 2003 14:53, Scott Fletcher wrote:
>
> > Hi Everyone!
> >
> > Is there a way to get the strpos() to find the next needle in
> > the haystack instead of just the 1st one only? (Where the 1st
> > needle is the same string as the next needle)...
>
> Look at the optional 3rd parameter to strpos().
>
> Cheers!
>
> Mike
>
> ---------------------------------------------------------------------
> Mike Ford, Electronic Information Services Adviser,
> Learning Support Services, Learning & Information Services,
> JG125, James Graham Building, Leeds Metropolitan University,
> Beckett Park, LEEDS, LS6 3QS, United Kingdom
> Email: m.fordleedsmet.ac.uk
> Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211

attached mail follows:


On Thu, 20 Nov 2003, Scott Fletcher wrote:
> How exactly does the 3rd parameter option work. I tried this but it
> doesn't work, so I don't know how exactly does it work... There isn't
> detail information on the php.net website...

"The optional offset parameter allows you to specify which character in
haystack to start searching. The position returned is still relative to
the the beginning of haystack."

So if you are trying to find subsequent occurrences of the string, you'd
need to make the offset be greater than the last character you checked, or
you're going to keep getting the first occurrence.

> $XML_Start = (strpos($res_str,"<![CDATA[",1)+9);
> $HTML_Start = (strpos($res_str,"<![CDATA[",2)+9);
> $HTML_End = strpos($res_str,"]]>",1);
> $XML_End = strpos($res_str,"]]>",2);

If you're just trying to pull one bit of data out of a file, you might
want to look into regex for this purpose. If you're actually trying to
write a parser, I think you might do well to read up on how other parsers
work (like, using a stack). Anyway, don't do that, use an existing XML
parser.. unless you are on a learning quest.. then, by all means!

--
Kelly Hallman
//Ultrafancy/

attached mail follows:


On 20 November 2003 17:39, Scott Fletcher wrote:

> How exactly does the 3rd parameter option work. I tried this
> but it doesn't
> work, so I don't know how exactly does it work... There isn't detail
> information on the php.net website...
>
> --snip--
> $XML_Start = (strpos($res_str,"<![CDATA[",1)+9);
> $HTML_Start = (strpos($res_str,"<![CDATA[",2)+9);
> $HTML_End = strpos($res_str,"]]>",1);
> $XML_End = strpos($res_str,"]]>",2);
> --snip--

The manual is perfectly clear -- the third parameter is the offset within the string of where to start searching, not an occurrence number or any other way of counting. And the return value of strpos() is also an offset within the string. So, assuming your CDATA segments are nested (which the above seems to imply), then:

> $XML_Start = strpos($res_str, "<![CDATA[") + 9;
> $HTML_Start = strpos($res_str,"<![CDATA[", $XML_Start) + 9;
> $HTML_End = strpos($res_str, "]]>", $HTML_Start);
> $XML_End = strpos($res_str, "]]>", $HTML_End+3);

If they're not nested, then the search order would need to be different (you need to look for substrings in the order in which they occur in the string as a whole) but the principle is exactly the same.

Cheers!

Mike

---------------------------------------------------------------------
Mike Ford, Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS, LS6 3QS, United Kingdom
Email: m.fordleedsmet.ac.uk
Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211

attached mail follows:


Yea, the manual is clear but honestly, don't know what the offset really
meant since there is no definition or explaination of how the offset work.
All I know the definition of the offset is 'To balance each other out'.
Like a weighting scale where one weight is more than other and I would need
to add a bit of a weight to the lightest part to offset the other. So, I
knew that is not what the manual meant so don't know how exactly does it
work since there's no explanation or example of it.

But now I understand when I saw your example, so I'll tweak the coding.
I'll also have to customize the codes to check to see if the HTML's CDATA is
returned or not as well as the XML's CDATA is returned or not. Oh boy!

Thanks,
 Scott

"Mike Ford" <M.Fordlmu.ac.uk> wrote in message
news:841D90E489448A4F804E1D1B95768BF7D462B3lis-exchange3.lmu.ac.uk...
> On 20 November 2003 17:39, Scott Fletcher wrote:
>
> > How exactly does the 3rd parameter option work. I tried this
> > but it doesn't
> > work, so I don't know how exactly does it work... There isn't detail
> > information on the php.net website...
> >
> > --snip--
> > $XML_Start = (strpos($res_str,"<![CDATA[",1)+9);
> > $HTML_Start = (strpos($res_str,"<![CDATA[",2)+9);
> > $HTML_End = strpos($res_str,"]]>",1);
> > $XML_End = strpos($res_str,"]]>",2);
> > --snip--
>
> The manual is perfectly clear -- the third parameter is the offset within
the string of where to start searching, not an occurrence number or any
other way of counting. And the return value of strpos() is also an offset
within the string. So, assuming your CDATA segments are nested (which the
above seems to imply), then:
>
> > $XML_Start = strpos($res_str, "<![CDATA[") + 9;
> > $HTML_Start = strpos($res_str,"<![CDATA[", $XML_Start) + 9;
> > $HTML_End = strpos($res_str, "]]>", $HTML_Start);
> > $XML_End = strpos($res_str, "]]>", $HTML_End+3);
>
> If they're not nested, then the search order would need to be different
(you need to look for substrings in the order in which they occur in the
string as a whole) but the principle is exactly the same.
>
> Cheers!
>
> Mike
>
> ---------------------------------------------------------------------
> Mike Ford, Electronic Information Services Adviser,
> Learning Support Services, Learning & Information Services,
> JG125, James Graham Building, Leeds Metropolitan University,
> Beckett Park, LEEDS, LS6 3QS, United Kingdom
> Email: m.fordleedsmet.ac.uk
> Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211

attached mail follows:


I'll try. I haven't got the PHP XML Parser to work, I think it is because
the XML stuffs I receive is not a true XML, some of them don't have a
closing tag either because one tag have actual data as an attribute inside
one tag. It is kind of frustrating to on not knowing what XML Parser will
work.

Scott

"Kelly Hallman" <khallmanultrafancy.com> wrote in message
news:Pine.LNX.4.44.0311200936000.21943-100000clove.wrack.org...
> On Thu, 20 Nov 2003, Scott Fletcher wrote:
> > How exactly does the 3rd parameter option work. I tried this but it
> > doesn't work, so I don't know how exactly does it work... There isn't
> > detail information on the php.net website...
>
> "The optional offset parameter allows you to specify which character in
> haystack to start searching. The position returned is still relative to
> the the beginning of haystack."
>
> So if you are trying to find subsequent occurrences of the string, you'd
> need to make the offset be greater than the last character you checked, or
> you're going to keep getting the first occurrence.
>
> > $XML_Start = (strpos($res_str,"<![CDATA[",1)+9);
> > $HTML_Start = (strpos($res_str,"<![CDATA[",2)+9);
> > $HTML_End = strpos($res_str,"]]>",1);
> > $XML_End = strpos($res_str,"]]>",2);
>
> If you're just trying to pull one bit of data out of a file, you might
> want to look into regex for this purpose. If you're actually trying to
> write a parser, I think you might do well to read up on how other parsers
> work (like, using a stack). Anyway, don't do that, use an existing XML
> parser.. unless you are on a learning quest.. then, by all means!
>
> --
> Kelly Hallman
> //Ultrafancy/

attached mail follows:


On Thu, 20 Nov 2003, Scott Fletcher wrote:
> > Anyway, don't do that, use an existing XML parser..
>
> I'll try. I haven't got the PHP XML Parser to work, I think it is
> because the XML stuffs I receive is not a true XML, some of them don't
> have a closing tag either because one tag have actual data as an
> attribute inside one tag. It is kind of frustrating to on not knowing
> what XML Parser will work.

I was only suggesting that rather than try to perfect your own parser,
you'd be better off spending that time getting comfortable with something
that already exists for this purpose. There is too much debugging,
testing, optimization and research required to build one that is adequate,
and many already exist that probably exceed any home-brew solution.

I have not done too much XML parsing in PHP yet, but you might look to
PEAR for help with this. I've briefly experimented with the various PEAR
XML packages, like XML_Tree and XML_Parser. Take a look:
http://pear.php.net/packages.php?catpid=22&catname=XML

If you're dealing with poorly formed XML then you've got another problem
if you're trying to actually parse it. To simply pull one or two values
out of the file, a regex still might be the quickest/dirtiest..

If you do want to move forward testing parsers and stuff, make yourself a
valid XML file to test with, so that is not the issue...worry about fixing
malformed XML later with the provider or through an intermediate filter..

--
Kelly Hallman
//Ultrafancy/

attached mail follows:


> -----Oorspronkelijk bericht-----
> Van: Eugene Lee [mailto:list-php-1fsck.net]
>
> On Thu, Nov 20, 2003 at 11:22:02AM +0200, Veress Berci wrote:
> :
> : Scuse me, if I write some totally dumb thing.
> : I am quite new to PHP and programming, and maybe I'm not understanding
> : the question, but:
> :
> : What if you assign a value to every form field like this:
> :
> : <input type="text" name="something" value="<?php echo $something; ?>">
> :
> : or - safer, with register_globals off:
> :
> : <input type="text" name="something" value="<?php echo
> $_POST['something'];
> : ?>">
>
> Actually, you can do one more thing:
>
> <input type="text" name="something" value="<?php echo
> htmlentities($_POST['something']); ?>">
>
> : Again, please apologize, if i'm stupid.
>
> Ummm, what is the question? :-)

I didn't try to ask a question, i tried to answer one:

b b wrote:

> Problem:
> I am running apache/php server. If I populate a form,
> send it and then click back I see a blank form.
>
> Solution:
> I had some prefilled form elements where I set the
> value of such form element. For example I had
> input type = "hidden" VALUE="whatever" ... at the
> beginning of the form.
>
> when I took that hidden variable out and had it at
> the end of the form after all the other elements I the
> problem was solved. Actually any element with its
> value preset should go to the end of the form. In that
> case when I hit back my form was prefilled the way I
> submitted it.

I was triing to find a solution to this question:
What can I do, if I don't want my form to be blank if I click the Back
button?

attached mail follows:


Not sure why this is happening but I think it has something to do with
an include statement...
[Server environment]
Apache/2.0.47 (Unix) DAV/2 PHP/4.3.3
register_globals On On
report_memleaks On On
safe_mode Off Off
safe_mode_exec_dir no value no value
Session Support enabled

[Script registering vars - sessions.php]
/* Format Date & Time */
$hour = (date("H:i:s"));
$day = (date("d"));
$date = (date("F $day, Y"));
/* Register vars */
$_SESSION['date'] = $date;

[Main script - index.php]
require 'scripts/sessions.php';

echo $_SESSION['date']; //This is not showing up in browser?

Any help is appreciated...
Jas

attached mail follows:


need to issue a

session_start()

at top of page

Pete

Jas wrote:
> Not sure why this is happening but I think it has something to do with
> an include statement...
> [Server environment]
> Apache/2.0.47 (Unix) DAV/2 PHP/4.3.3
> register_globals On On
> report_memleaks On On
> safe_mode Off Off
> safe_mode_exec_dir no value no value
> Session Support enabled
>
> [Script registering vars - sessions.php]
> /* Format Date & Time */
> $hour = (date("H:i:s"));
> $day = (date("d"));
> $date = (date("F $day, Y"));
> /* Register vars */
> $_SESSION['date'] = $date;
>
> [Main script - index.php]

session_start()

> require 'scripts/sessions.php';
>
> echo $_SESSION['date']; //This is not showing up in browser?
>
> Any help is appreciated...
> Jas
>

attached mail follows:


Yeah I did that, sorry I just didn't note it in the snippit.. and it is
now working with the $_SESSION function, i just had to restart the
browser to clear the cache after updating the code.
jas

Pete M wrote:
> need to issue a
>
> session_start()
>
> at top of page
>
> Pete
>
> Jas wrote:
>
>> Not sure why this is happening but I think it has something to do with
>> an include statement...
>> [Server environment]
>> Apache/2.0.47 (Unix) DAV/2 PHP/4.3.3
>> register_globals On On
>> report_memleaks On On
>> safe_mode Off Off
>> safe_mode_exec_dir no value no value
>> Session Support enabled
>>
>> [Script registering vars - sessions.php]
>> /* Format Date & Time */
>> $hour = (date("H:i:s"));
>> $day = (date("d"));
>> $date = (date("F $day, Y"));
>> /* Register vars */
>> $_SESSION['date'] = $date;
>>
>> [Main script - index.php]
>
>
> session_start()
>
>> require 'scripts/sessions.php';
>>
>> echo $_SESSION['date']; //This is not showing up in browser?
>>
>> Any help is appreciated...
>> Jas
>>

attached mail follows:


Jas wrote:

> [Script registering vars - sessions.php]
> /* Format Date & Time */
> $hour = (date("H:i:s"));
> $day = (date("d"));
> $date = (date("F $day, Y"));

Don't you mean
$data = date('F d, Y');

I don't see why you're calculating $day and then putting it in date().

> /* Register vars */
> $_SESSION['date'] = $date;
>
> [Main script - index.php]
> require 'scripts/sessions.php';
>
> echo $_SESSION['date']; //This is not showing up in browser?

I do not see session_start() anywhere...

--
---John Holmes...

Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals – www.phparch.com

attached mail follows:


How does one go about using a JavaScript variable with PHP code. I have a
function in JavaScript that takes a single input parameter (ID). I want to
use this ID variable as the value on the where clause of a database query.

Example: "select * from somedatabase where field=ID"

Can this be done, and if so how? I have been unable to figure this out.

attached mail follows:


>How does one go about using a JavaScript variable with PHP code. I have
>a function in JavaScript that takes a single input parameter (ID). I
>want to use this ID variable as the value on the where clause of a
>database query.
>
>Example: "select * from somedatabase where field=ID"
>
>Can this be done, and if so how? I have been unable to figure this out.

Not unless you include the javascript variable in a subsequent GET or POST
request to the server - once your browser renders an HTTP response, PHP's
involvement is long finished.

---------------------------------------------------------------------
michal migurski- contact info and pgp key:
sf/ca http://mike.teczno.com/contact.html

attached mail follows:


Mike Knittel wrote:
> How does one go about using a JavaScript variable with PHP code. I have a
> function in JavaScript that takes a single input parameter (ID). I want to
> use this ID variable as the value on the where clause of a database query.
>
> Example: "select * from somedatabase where field=ID"
>
> Can this be done, and if so how? I have been unable to figure this out.
>

Not unless you send a request to the server (reload the page, go to
another page, etc.). php runs server side, JavaScript runs client side.

--
By-Tor.com
It's all about the Rush
http://www.by-tor.com

attached mail follows:


Hi Everyone!

    I'm having a little trouble understanding how exactly to use the XML
parser. I haven't found the right settings to set up the XML Parser's
option because of no definition of the encoding setting in the XML tags I
received. So, I'll post the script here and hope to get some feedback on
this...

--snip--
         $data = "<REPORT_RESPONSE>";
             //Lots of XML tags goes here but is taken out for shorter
scripting....
         $data = " <![CDATA[<?xml version="1.0" encoding="UTF-8"?>";
             //Lots of other XML tags goes here but is taken out for shorter
scripting....
         $data = " <![CDATA[***HTML CODES GOES HERE****]]>";
             //Lots of other XML tags goes here but is taken out for shorter
scripting....
         $data = " ]]>";
             //Lots of other XML tags goes here but is taken out for shorter
scripting....
         $data .= "</REPORT_RESPONSE>";

         $parser = xml_parser_create('ISO-8859-1');
         xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
         xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
         xml_parse_into_struct($parser, $data, $vals, $index);
         xml_parser_free($parser);
--snip--

    The problem here is that I have like two different XML encoding
format....

Thanks,
 Scott

attached mail follows:


David Strencsev wrote:
> You may play with these functions:
>
> addslashes();
> stripslashes();
> htmlentities();
> html_entity_decode();
>

Thanks for your help manu and david. I'm going to attempt converting
the html characters and see if that works, but something also makes me
think this might be a server configuration issue.

The reason I say this is that I've run into this error on my machine,
but when I try it on our academic web server it works fine, and when I
ran a test on my system administrator's machine it worked fine as well.

Now, some time ago I ran into a problem with the uploading of images on
my machine, in that during the upload process the image was somehow
being mangled and the uploaded copy was always a few K larger than the
original, and no longer a valid file. I ran the test on my system
administrator's machine and it was fine.

These two things make me think it's something in the way my server is
configured. I'm pretty new to Linux, so I have absolutely no idea what
it might be and will be posting to some Linux and Apache forums to see
if I can pinpoint it.

In the meantime I will try converting the characters before they're
displayed in the textarea for editing and before they're submitted to
the db.

Thanks again guys.

Cheers,
Pablo

attached mail follows:


What is the simplest way to avoid duplicate order
entry on a form? Some people aren't patient enough to
wait for the SSL/credit card processing and will click
the submit button two, three, or more times causing
duplicate orders.

Is there a quick way to disable the submit button at
least in javascript? Better yet, something quick and
easy that could be done server-side without a lot of
programming like cookies, database flags, etc?

I've thought of a few things (like hidden variables
with an order ID or cookies/flags) but this really
should be a quick fix since it's not a big problem on
the site.

Thanks in advance for any tips or techniques!

__________________________________
Do you Yahoo!?
Free Pop-Up Blocker - Get it now
http://companion.yahoo.com/

attached mail follows:


The way I do is, on the result page, to create a variable (for example
$done) and I put to into the session. So if this variable already
exists, I don't re-execute the form treatment code.

Hope this helps

--
Cordialement,
---------------------------
Sophie Mattoug
Développement web dynamique
sophiemattoug.net
---------------------------

J J wrote:

>What is the simplest way to avoid duplicate order
>entry on a form? Some people aren't patient enough to
>wait for the SSL/credit card processing and will click
>the submit button two, three, or more times causing
>duplicate orders.
>
>Is there a quick way to disable the submit button at
>least in javascript? Better yet, something quick and
>easy that could be done server-side without a lot of
>programming like cookies, database flags, etc?
>
>I've thought of a few things (like hidden variables
>with an order ID or cookies/flags) but this really
>should be a quick fix since it's not a big problem on
>the site.
>
>Thanks in advance for any tips or techniques!
>
>__________________________________
>Do you Yahoo!?
>Free Pop-Up Blocker - Get it now
>http://companion.yahoo.com/
>

attached mail follows:


psuedo code

session_start()

if (incoming POST and $_SESSION['in_database'] != 1)
{
        insert to DB
        $_SESSION['in_database'] = 1
}

pete

J J wrote:

> What is the simplest way to avoid duplicate order
> entry on a form? Some people aren't patient enough to
> wait for the SSL/credit card processing and will click
> the submit button two, three, or more times causing
> duplicate orders.
>
> Is there a quick way to disable the submit button at
> least in javascript? Better yet, something quick and
> easy that could be done server-side without a lot of
> programming like cookies, database flags, etc?
>
> I've thought of a few things (like hidden variables
> with an order ID or cookies/flags) but this really
> should be a quick fix since it's not a big problem on
> the site.
>
> Thanks in advance for any tips or techniques!
>
> __________________________________
> Do you Yahoo!?
> Free Pop-Up Blocker - Get it now
> http://companion.yahoo.com/

attached mail follows:


J J wrote:

> What is the simplest way to avoid duplicate order
> entry on a form? Some people aren't patient enough to
> wait for the SSL/credit card processing and will click
> the submit button two, three, or more times causing
> duplicate orders.
>
> Is there a quick way to disable the submit button at
> least in javascript?

<form .... onsubmit="this.submitButton.disabled = true;">

If you have any javascript form checks, disable the button just before
returning true from the onsubmit handler.

> Better yet, something quick and
> easy that could be done server-side without a lot of
> programming like cookies, database flags, etc?
>
> I've thought of a few things (like hidden variables
> with an order ID or cookies/flags) but this really
> should be a quick fix since it's not a big problem on
> the site.
>
> Thanks in advance for any tips or techniques!

attached mail follows:


Jerry <eagleflyer2lycos.com> wrote in message news:<cthkrv0aj0h0cu04g592rr6bhqfdn29kpk4ax.com>...
> Hi there !
>
> I am curretly looking for suitbale solutions for encoding PHP scripts
> after developing a couple of comercial applications in PHP.
>
> Has anybody made any experience with several encoders like IONCUBE,
> SOURCEGUARDIAN, ZEND, etc... so far?

     Did you try http://pobs.mywalhalla.net/ ?

---
 "One who mix sports and patriotism is a barbarian"
Email: rrjanbiah-at-Y!com

attached mail follows:


Hi,
POBs is really good, but I have had some weird problems when encoding large
files, especially if you take out the line breaks in the options.
Another problem with POBS is that you can have your "config.php" file not
encoded with the rest of the files, since it changes your variables (eg
$email becomes something like $2d4g3a5sd) your $email variable is not
recognised in the rest of the program/s, which is quite a pain in the ass
explaining to a customer who just bought your software to enter the $email
variable in $2d4g3a5sd and their $blah variable in $234sdhk23 etc etc

I personally prefer CodeSecure from securecents.com at only 49$ but then,
i'm biased :-)

Cheers,
-Ryan

> Did you try http://pobs.mywalhalla.net/ ?

> > Hi there !
> >
> > I am curretly looking for suitbale solutions for encoding PHP scripts
> > after developing a couple of comercial applications in PHP.
> >
> > Has anybody made any experience with several encoders like IONCUBE,
> > SOURCEGUARDIAN, ZEND, etc... so far?
>
> Did you try http://pobs.mywalhalla.net/ ?
>
> ---
> "One who mix sports and patriotism is a barbarian"
> Email: rrjanbiah-at-Y!com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>

attached mail follows:


I like POB too but it's an obsfuscator. To fix your $email problem just do
a search for $2d4g3a5sd and change them all to $email.

An encoder would be Ioncube or Turck's mmcache but the server needs to be
installed with their software to run the encoded scripts. POB doesn't need
anything installed to run.

-----Original Message-----
From: Ryan A [mailto:ryancoinpass.com]
Sent: November 20, 2003 12:29 PM
To: R. Rajesh Jeba Anbiah
Cc: php-generallists.php.net
Subject: Re: [PHP] Re: PHP Encoders

Hi,
POBs is really good, but I have had some weird problems when encoding large
files, especially if you take out the line breaks in the options.
Another problem with POBS is that you can have your "config.php" file not
encoded with the rest of the files, since it changes your variables (eg
$email becomes something like $2d4g3a5sd) your $email variable is not
recognised in the rest of the program/s, which is quite a pain in the ass
explaining to a customer who just bought your software to enter the $email
variable in $2d4g3a5sd and their $blah variable in $234sdhk23 etc etc

I personally prefer CodeSecure from securecents.com at only 49$ but then,
i'm biased :-)

Cheers,
-Ryan

> Did you try http://pobs.mywalhalla.net/ ?

> > Hi there !
> >
> > I am curretly looking for suitbale solutions for encoding PHP scripts
> > after developing a couple of comercial applications in PHP.
> >
> > Has anybody made any experience with several encoders like IONCUBE,
> > SOURCEGUARDIAN, ZEND, etc... so far?
>
> Did you try http://pobs.mywalhalla.net/ ?
>
> ---
> "One who mix sports and patriotism is a barbarian"
> Email: rrjanbiah-at-Y!com
>
> --
> 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:


I want to do two-way encryption on a file coming through the web server. In
this context, I would want to generate a public and private key, encrypt the
file stream (i.e., don't want to write the unencrypted file to disk first
and then encrypt it; I want to encrypt the stream as it comes in) with the
public, send the private to the recipient, and then destroy both keys on my
end.

When the file was accessed and the private key was provided, I would want to
stream the unencrypted file out without ever writing the unencrypted file to
disk.

Any ideas on how to accomplish this within the PHP construct?

Thanks!

attached mail follows:


Ray <mailto:cantaberryyahoo.com>
    on Thursday, November 20, 2003 5:29 AM said:

> Any ideas on how to accomplish this within the PHP construct?

Instead of reinventing the wheel you can just use HTTPS.

Chris.
--
Don't like reformatting your Outlook replies? Now there's relief!
http://home.in.tum.de/~jain/software/outlook-quotefix/

attached mail follows:


Chris,

I thought of that and I do plan on implementing it on the way in and out.
However, to meet HIPA and other business requirements, the data can not
exist at any point in time on my system in unencrypted form. I do not want
to be able to view it and I do not want to know what is there.

Any other suggestions?

Thanks!

PS, sorry about the multiple posts. First time posting and the moderating
system confused me. ;)

attached mail follows:


Ray <mailto:cantaberryyahoo.com>
    on Thursday, November 20, 2003 9:32 AM said:

> I thought of that and I do plan on implementing it on the way in and
> out. However, to meet HIPA and other business requirements, the data
> can not exist at any point in time on my system in unencrypted form.
> I do not want to be able to view it and I do not want to know what is
> there.
>
> Any other suggestions?

Hmm... That's quite a different thing and unless I read your original
post wrong I don't think this part was mentioned. But in any case a few
questions.

1. When you say "on my system in unencrypted form" do you indeed mean
you want data that can be encrypted and then unencrypted as opposed to a
hash like md5() that cannot be reversed? (I only ask this because a lot
times people use them synonymously when they should not.)

2. This isn't a question really but I spoke with my friend google (maybe
you two have met?) and he said this
"http://www.tonymarston.net/php-mysql/encryption.html".

hth,
Chris.
--
Don't like reformatting your Outlook replies? Now there's relief!
http://home.in.tum.de/~jain/software/outlook-quotefix/

attached mail follows:


On Friday 21 November 2003 01:31, Ray wrote:

> I thought of that and I do plan on implementing it on the way in and out.
> However, to meet HIPA and other business requirements, the data can not
> exist at any point in time on my system in unencrypted form. I do not want
> to be able to view it and I do not want to know what is there.

To be pedantic, the data *has* to exist on your system in an unencrypted form
albeit for as long as it takes for you to encrypt it and then remove the
unencrypted data.

> Any other suggestions?

manual > Mcrypt Encryption Functions

--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
You shouldn't wallow in self-pity. But it's OK to put your feet in it
and swish them around a little.
                -- Guindon
*/

attached mail follows:


1. When you say "on my system in unencrypted form" do you indeed mean you
want data that can be encrypted and then unencrypted as opposed to a hash
like md5() that cannot be reversed? (I only ask this because a lot
times people use them synonymously when they should not.)

Yes, two way, like PKI. Honestly, I'd like to be able to encrypt the stream
as it comes in and decrypt it on the way out. I'd rather not know or have
access to, at any time, what's being transfered...

2. This isn't a question really but I spoke with my friend google (maybe you
two have met?) and he said this
"http://www.tonymarston.net/php-mysql/encryption.html".

Haha, Yes, I've heard of him. And yes, I did consult but didn't stumble
across this link. Reading it now.

attached mail follows:


It seems like this question came up before. Is there a resource for people
looking for jobs working with open source products (LAMP specifically)?

Thanks,

susan

attached mail follows:


I want to do two-way encryption on a file coming through the web server. In
this context, I would want to generate a public and private key, encrypt the
file stream (i.e., don't want to write the unencrypted file to disk first
and then encrypt it; I want to encrypt the stream as it comes in) with the
public, send the private to the recipient, and then destroy both keys on my
end.

When the file was accessed and the private key was provided, I would want to
stream the unencrypted file out without ever writing the unencrypted file to
disk.

Any ideas on how to accomplish this within the PHP construct?

Thanks!

attached mail follows:


Ray <mailto:cantaberryyahoo.com>
    on Wednesday, November 19, 2003 9:44 AM said:

> Any ideas on how to accomplish this within the PHP construct?

You already posted this question and I've already responded to it. Check
the old thread.

attached mail follows:


Thanks, that worked

"David Strencsev" <phisysnetscape.net> wrote in message
news:20031120121718.94851.qmailpb1.pair.com...
> If you're using NTFS file system... please make sure that the PHP's
temporay
> UPLOAD directory and SESSIONDATA directory are set with the correct
> permissions.
> I mean that the user IUSR_YOURCOMPUTER has write permissions in these
> directories.
>
> Hope it will help
>
> - David Strencsev

attached mail follows:


Hello,

I have an array like that:
$return[0]["photo"] = monuments_000001.jpg
$return[1]["photo"] = monuments_000000.jpg
$return[2]["photo"] = monuments_000003.jpg
$return[3]["photo"] = monuments_000002.jpg
$return[4]["photo"] = monuments_000004.jpg

If I use the sort function:
sort($return) ;
I get:
$return[0]["photo"] = monuments_000000.jpg
$return[1]["photo"] = monuments_000001.jpg
$return[2]["photo"] = monuments_000002.jpg
$return[3]["photo"] = monuments_000003.jpg
$return[4]["photo"] = monuments_000004.jpg

Fine, but I'd like this result too:
$return[0]["photo"] = monuments_000004.jpg
$return[1]["photo"] = monuments_000003.jpg
$return[2]["photo"] = monuments_000002.jpg
$return[3]["photo"] = monuments_000001.jpg
$return[4]["photo"] = monuments_000000.jpg

And usort does not work, which function should I use ?

Thanks,
Vincent.

attached mail follows:


array_reverse()

Vincent M. wrote:

> Hello,
>
> I have an array like that:
> $return[0]["photo"] = monuments_000001.jpg
> $return[1]["photo"] = monuments_000000.jpg
> $return[2]["photo"] = monuments_000003.jpg
> $return[3]["photo"] = monuments_000002.jpg
> $return[4]["photo"] = monuments_000004.jpg
>
> If I use the sort function:
> sort($return) ;
> I get:
> $return[0]["photo"] = monuments_000000.jpg
> $return[1]["photo"] = monuments_000001.jpg
> $return[2]["photo"] = monuments_000002.jpg
> $return[3]["photo"] = monuments_000003.jpg
> $return[4]["photo"] = monuments_000004.jpg
>
> Fine, but I'd like this result too:
> $return[0]["photo"] = monuments_000004.jpg
> $return[1]["photo"] = monuments_000003.jpg
> $return[2]["photo"] = monuments_000002.jpg
> $return[3]["photo"] = monuments_000001.jpg
> $return[4]["photo"] = monuments_000000.jpg
>
> And usort does not work, which function should I use ?
>
> Thanks,
> Vincent.

attached mail follows:


Try using rsort()

Jay

attached mail follows:


I am at a loss here but doesn't $_SERVER['HTTP_HOST'] return the remote
computer name?

[Snippit used]
$ipaddy = $_SERVER['REMOTE_ADDR'];
$host = $_SERVER['HTTP_HOST']; // as of now it is getting the name of
the server (i.e. localhost, 168.2.2.1)

jas

attached mail follows:


Jas wrote:
> I am at a loss here but doesn't $_SERVER['HTTP_HOST'] return the remote
> computer name?
>
> [Snippit used]
> $ipaddy = $_SERVER['REMOTE_ADDR'];
> $host = $_SERVER['HTTP_HOST']; // as of now it is getting the name of
> the server (i.e. localhost, 168.2.2.1)
>
> jas

HTTP_HOST returns the name (or ip) of the machine on which php is
running. REMOTE_ADDR will return the ip of the client accessing the
document.

--
By-Tor.com
It's all about the Rush
http://www.by-tor.com

attached mail follows:


>> [Snippit used]
>> $ipaddy = $_SERVER['REMOTE_ADDR'];
>> $host = $_SERVER['HTTP_HOST']; // as of now it is getting the name of
>> the server (i.e. localhost, 168.2.2.1)
>>
>> jas
>
>HTTP_HOST returns the name (or ip) of the machine on which php is
>running. REMOTE_ADDR will return the ip of the client accessing the
>document.

More specifically, HTTP_HOST returns the hostname used in the current
request - this may change depending on virtual host settings and relies
upon the Host: header in the request. SERVER_NAME returns the name of the
machine on which php is running, and (afaik) is /not/ dependent on the
virtual host used. The two values are frequently the same.

---------------------------------------------------------------------
michal migurski- contact info and pgp key:
sf/ca http://mike.teczno.com/contact.html

attached mail follows:


So in that case there isn't a $_SERVER function to gather the remote
computer name?
Jas
John Nichel wrote:

> Jas wrote:
>
>> I am at a loss here but doesn't $_SERVER['HTTP_HOST'] return the
>> remote computer name?
>>
>> [Snippit used]
>> $ipaddy = $_SERVER['REMOTE_ADDR'];
>> $host = $_SERVER['HTTP_HOST']; // as of now it is getting the name of
>> the server (i.e. localhost, 168.2.2.1)
>>
>> jas
>
>
> HTTP_HOST returns the name (or ip) of the machine on which php is
> running. REMOTE_ADDR will return the ip of the client accessing the
> document.
>

--
Jason Gerfen
Student Computing Group
Marriott Library
University of Utah
(801) 585-9810
jason.Gerfenscl.utah.edu

"I'm not a robot like you. I don't like having disks crammed into me... unless they're Oreos, and then only in the mouth." ~Phillip J. Fry

attached mail follows:


Jason Gerfen wrote:
> John Nichel wrote:
>
>> Jas wrote:
>>
>>> I am at a loss here but doesn't $_SERVER['HTTP_HOST'] return the
>>> remote computer name?
>>>
>>> [Snippit used]
>>> $ipaddy = $_SERVER['REMOTE_ADDR'];
>>> $host = $_SERVER['HTTP_HOST']; // as of now it is getting the name of
>>> the server (i.e. localhost, 168.2.2.1)
>>>
>>> jas
>>
>>
>>
>> HTTP_HOST returns the name (or ip) of the machine on which php is
>> running. REMOTE_ADDR will return the ip of the client accessing the
>> document.
>>
>
>
> So in that case there isn't a $_SERVER function to gather the remote
> computer name?
> Jas

To the best of my knowledge, unless you're running php on a Windoze
machine, with domain authenticated Windoze clients, no.

--
By-Tor.com
It's all about the Rush
http://www.by-tor.com

attached mail follows:


On Friday 21 November 2003 02:59, Jason Gerfen wrote:
> So in that case there isn't a $_SERVER function to gather the remote
> computer name?

1) print_r($_SERVER) to see what is available
2) it may be available if you have set your webserver to do DNS lookups. But
because it is expensive (ie takes quite a while to do in comparison to simply
serving the webpage) it is usually disabled
3) you can always use gethostbyaddr($_SERVER['REMOTE_ADDR']) whenever it is
needed. But do note that $_SERVER['REMOTE_ADDR'] is not a wholly reliable
indicator of who your client is.

--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
Be valiant, but not too venturous.
Let thy attire be comely, but not costly.
                -- John Lyly
*/

attached mail follows:


Jason Wong wrote:
<snip>
> 3) you can always use gethostbyaddr($_SERVER['REMOTE_ADDR']) whenever it is
> needed. But do note that $_SERVER['REMOTE_ADDR'] is not a wholly reliable
> indicator of who your client is.

Right...it doesn't return the machine name for any of my client machines
(didn't expect it too on the DHCP boxes, but thought it might on the two
static boxes). For the two static machines, it returns the Charter
(cable connection) and BellSouth (DSL connection) names, not my actual
machine name...gateway (returns cable-68-114-97-96.sli.la.charter.com)
 for the Charter connection and web01 (returns
adsl-068-209-144-233.sip.msy.bellsouth.net) for the BellSouth.

--
By-Tor.com
It's all about the Rush
http://www.by-tor.com

attached mail follows:


On Friday 21 November 2003 03:33, John Nichel wrote:

> Right...it doesn't return the machine name for any of my client machines
> (didn't expect it too on the DHCP boxes, but thought it might on the two
> static boxes). For the two static machines, it returns the Charter
> (cable connection) and BellSouth (DSL connection) names, not my actual
> machine name...gateway (returns cable-68-114-97-96.sli.la.charter.com)
> for the Charter connection and web01 (returns
> adsl-068-209-144-233.sip.msy.bellsouth.net) for the BellSouth.

By "remote computer name" I was assuming the OP meant the DNS name.

--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
There are more old drunkards than old doctors.
*/

attached mail follows:


Hello,

I am having trouble returning attributes from an LDAP dir and was
curious if anyone had experienced similar issues. I am able to retrieve
the attributes in the $nds_stuff fine. However, once I add an attribute
to the array, I can get the last attribute in the array, but not the one
that comes before. For example, this returns usertier2, but not
usertier. If I switch the order, I can get the last one, but not the one
that comes before?

Here is my code:

$filter="(|(cn=" . $login_name . "*))";

//Attributes to get from NDS
$nds_stuff = array("cn", "sn", "fullname", "usertier");

//doesn't work as expected
//returns usertier2, but usertier is empty
//$nds_stuff = array("cn", "sn", "fullname", "usertier","usertier2");

//Search for a specified filter on the directory with the scope of
LDAP_SCOPE_SUBTREE
$results=ldap_search($ldap, $dn, $filter, $nds_stuff);
                
$info = ldap_get_entries($ldap, $results);
                        
//This loops Through the array
for ($i=0; $i < $info["count"]; $i++)
{
                
//Declare the LDAP results as session variables
$valid_user = strtolower($info[$i]["cn"][0]);
$user_tier = $info[$i]["usertier"][0];
$user_tier2 = $info[$i]["usertier2"][0];
$user_fullname = $info[$i]["fullname"][0];
                                        
} //Close LDAP login array loop

ldap_close($ldap);

Any suggestions?

Cory
                
--
Cory Hicks <chickstri-intl.com>
TRI International

attached mail follows:


I know this may be off-topic but I've got a problem that I do not know how
to work around...

I'm displaying a <SELECT> list and the problem is getting the value back
after an 'onChange' event. Code is like this:

<HTML>
  <HEAD>
    <SCRIPT LANGUAGE="JAVASCRIPT">
    <!--
    function jump()
    {
        document.buttons.submit();
    }
    -->
    </SCRIPT>
  </HEAD>
  <BODY BGCOLOR="#FFFAB4" LEFTMARGIN="0" TOPMARGIN="0">
    <FORM NAME="buttons" TARGET="buttons" ACTION="buttons.php" METHOD="get">
    <INPUT TYPE="hidden" NAME="pass" VALUE="1">
    <CENTER>State</CENTER>
    <CENTER>
      <SELECT onChange="jump()">
        <OPTION NAME="state_name" VALUE="Colorado">Colorado</OPTION>
        <OPTION NAME="state_name" VALUE="New Mexico">New Mexico</OPTION>
      </SELECT>
    </CENTER>
    </FORM>
  <BODY>
</HTML>

I need to get the "state_name" back but all I get in the $_GET['state_name']
array is an empty value. Any clue as to why this won't work??

I don't want to use a 'Submit' b