php-general Digest 8 Jun 2006 05:56:53 -0000 Issue 4173

Topics (messages 237566 through 237588):

question on getting PDO to output final assembled query from prepared 
statements?
        237566 by: Rick Harding

Re: Introductory message
        237567 by: Jay Blanchard
        237581 by: Ligaya Turmelle

question on getting PDO to output final assembled query from the prepared 
statements
        237568 by: Rick Harding

file( ) function
        237569 by: Mayank Maheshwary
        237570 by: Rabin Vincent
        237571 by: João Cândido de Souza Neto
        237572 by: Mayank Maheshwary
        237585 by: David Robley

php sessions and Google
        237573 by: tedd
        237583 by: Chris
        237586 by: tedd
        237587 by: Chris

SSL support for pgsql module in Windows binary distribution
        237574 by: Peter Kuma
        237578 by: M. Sokolewicz

odbc remote
        237575 by: Benjamin Adams
        237577 by: Peter Kuma
        237579 by: Warren Vail

Re: generating/transforming HTML so that it 'works' in a flash file
        237576 by: Jochem Maas

file from database work local, but not on server
        237580 by: Peter Lauri
        237584 by: Chris

Re: Getting totals
        237582 by: Rafael

Pear Pager
        237588 by: weetat

Administrivia:

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

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

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


----------------------------------------------------------------------
--- Begin Message --- I am working on some code that I am moving to use PDO in order to play with it a bit. I used to use ADODB, but want to try out the performance of using PDO and just skipping some of the portability of the db code. The one thing I find myself missing is the ADODB debug and sql values where you can get out the last query executed (with $dbh->sql) and a dump of queries as they are executed (with $dhb- >debug = true). Can anyone suggest how I can get this functionality into my code with PDO? I want to be able to just set a debug flag in a config file for the project and get a dump of all SQL queries executed output to the page as it loads. I'm not sure what the best method to extend/wrap PDO calls to do this as I don't see any way in the PDO functionality to do it now.

Thanks for the tips/help

Rick

--- End Message ---
--- Begin Message ---
[snip]
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.
[/snip]

Your attempt was successful, some suggested reading;

http://zirzow.dyndns.org/php-general/NEWBIE

--- End Message ---
--- Begin Message ---
Jay Blanchard wrote:
[snip]
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.
[/snip]

Your attempt was successful, some suggested reading;

http://zirzow.dyndns.org/php-general/NEWBIE

Thought we were going to add the "Security" subsection to the "Where to Find More Information" section of the NEWBIE email. Wasn't it supposed to include a link to the manuals security area as well as the phpsec site?

--

life is a game... so have fun.

--- End Message ---
--- Begin Message --- I am working on some code that I am moving to use PDO in order to play with it a bit. I used to use ADODB, but want to try out the performance of using PDO and just skipping some of the portability of the db code. The one thing I find myself missing is the ADODB debug and sql values where you can get out the last query executed (with $dbh->sql) and a dump of queries as they are executed (with $dhb- >debug = true). Can anyone suggest how I can get this functionality into my code with PDO? I want to be able to just set a debug flag in a config file for the project and get a dump of all SQL queries executed output to the page as it loads. I'm not sure what the best method to extend/wrap PDO calls to do this as I don't see any way in the PDO functionality to do it now.

Thanks for the tips/help

Rick

--- End Message ---
--- Begin Message ---
Hi,

I am facing some trouble with the file( ) function. I understand that it
returns the contents of the file in an array. Also, I am able to print the
lines using the echo function. However, whenever I try to compare the
contents of an array using strcmp, or ==, the page simply keeps 'loading',
instead of printing results.

The following is the code that I try:

$name = $_POST["filename"];
$lines = file($name);
$i = 0;
$len = sizeof($lines);
//echo $i;
while($i < $len) {
 //echo $lines[$i];
 $temp = $lines[$i];
 $temp = trim($temp);
 //echo $temp;
 if($temp1 == '--------------------------------------') {
   echo $i;
   return $i;
 }
 else
   $i++;
}

I think that the way the lines of the file are stored in the array may be
the problem, but I do not know what I am supposed to change. Any help would
be appreciated.

Thanks.

MM.

--- End Message ---
--- Begin Message ---
On 6/8/06, Mayank Maheshwary <[EMAIL PROTECTED]> wrote:
$name = $_POST["filename"];
$lines = file($name);
$i = 0;
$len = sizeof($lines);
//echo $i;
while($i < $len) {
  //echo $lines[$i];
  $temp = $lines[$i];
  $temp = trim($temp);
  //echo $temp;
  if($temp1 == '--------------------------------------') {

This should be $temp, shoudn't it?

    echo $i;
    return $i;
  }
  else
    $i++;
}

Rabin

--- End Message ---
--- Begin Message ---
""Rabin Vincent"" <[EMAIL PROTECTED]> escreveu na mensagem 
news:[EMAIL PROTECTED]
> On 6/8/06, Mayank Maheshwary <[EMAIL PROTECTED]> wrote:
>> $name = $_POST["filename"];
>> $lines = file($name);
>> $i = 0;
>> $len = sizeof($lines);
>> //echo $i;
>> while($i < $len) {
>>   //echo $lines[$i];
>>   $temp = $lines[$i];
>>   $temp = trim($temp);
>>   //echo $temp;
>>   if($temp1 == '--------------------------------------') {
>
> This should be $temp, shoudn't it?
>
>>     echo $i;
>>     return $i;
>>   }
>>   else
 Else here´s putting you in loop.
>>     $i++;
>> }
>
> Rabin 

--- End Message ---
--- Begin Message ---
Yes, that is actually $temp, not $temp1. However, my problem still remains
the same.

Several lines in the file contain the exact same string as the one I am
comparing. I need their positions in the array so that I can operate on
other lines in the file. That is why I am using file( ) instead of other
file reader functions.

Thanks.

MM.



> $name = $_POST["filename"];
> $lines = file($name);
> $i = 0;
> $len = sizeof($lines);
> //echo $i;
> while($i < $len) {
>   //echo $lines[$i];
>   $temp = $lines[$i];
>   $temp = trim($temp);
>   //echo $temp;
>   if($temp1 == '--------------------------------------') {

This should be $temp, shoudn't it?

>     echo $i;
>     return $i;
>   }
>   else
>     $i++;
> }


--- End Message ---
--- Begin Message ---
Mayank Maheshwary wrote:

> Hi,
> 
> I am facing some trouble with the file( ) function. I understand that it
> returns the contents of the file in an array. Also, I am able to print the
> lines using the echo function. However, whenever I try to compare the
> contents of an array using strcmp, or ==, the page simply keeps 'loading',
> instead of printing results.
> 
> The following is the code that I try:
> 
> $name = $_POST["filename"];
> $lines = file($name);
> $i = 0;
> $len = sizeof($lines);
> //echo $i;
> while($i < $len) {
>   //echo $lines[$i];
>   $temp = $lines[$i];
>   $temp = trim($temp);
>   //echo $temp;
>   if($temp1 == '--------------------------------------') {
>     echo $i;
>     return $i;
>   }
>   else
>     $i++;
> }
> 
> I think that the way the lines of the file are stored in the array may be
> the problem, but I do not know what I am supposed to change. Any help
> would be appreciated.
> 
> Thanks.
> 
> MM.

You seem to be aware of the fact that each line of the file is loaded into
an arry element with the newline still attached as you are using trim() to
clear white space from the start/end of the array element. For a second
test, maybe do a strlen on the array element and see if that tells you
anything.



Cheers
-- 
David Robley

Memory is a thing we forget with.
Today is Prickle-Prickle, the 13rd day of Confusion in the YOLD 3172. 

--- End Message ---
--- Begin Message ---
Hi gang:

I've read that php sessions can create problems for Google bots. For example, 
the following was taken from a Google "Web Master Help" Center:

-- Quote --
Allow search bots to crawl your sites without session IDs or arguments that 
track their path through the site. These techniques are useful for tracking 
individual user behavior, but the access pattern of bots is entirely different. 
Using these techniques may result in incomplete indexing of your site, as bots 
may not be able to eliminate URLs that look different but actually point to the 
same page.
-- Un-quote --

<http://www.google.com/support/webmasters/bin/answer.py?answer=35770>

I've also seen a comment here:

http://www.weberdev.com/get_example-3431.html

But, I'm not following what's happening.

Can someone shed some light on this for me? How can one do sessions and make 
Google bots happy?

Thanks in advance for any comments or suggestions.

tedd

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

--- End Message ---
--- Begin Message ---
tedd wrote:
Hi gang:

I've read that php sessions can create problems for Google bots. For example, the 
following was taken from a Google "Web Master Help" Center:

-- Quote --
Allow search bots to crawl your sites without session IDs or arguments that 
track their path through the site. These techniques are useful for tracking 
individual user behavior, but the access pattern of bots is entirely different. 
Using these techniques may result in incomplete indexing of your site, as bots 
may not be able to eliminate URLs that look different but actually point to the 
same page.
-- Un-quote --

<http://www.google.com/support/webmasters/bin/answer.py?answer=35770>

I've also seen a comment here:

http://www.weberdev.com/get_example-3431.html

But, I'm not following what's happening.

Can someone shed some light on this for me? How can one do sessions and make 
Google bots happy?

use_trans_sid (I think) will append the sessionid to all pages, so instead of:

/page.php

it will become

/page.php?PHPSESSID=xxxxx

much the same as if you do:

<?php
echo '/page.php?' . SID;
?>

Bots don't like that, so where possible turn use_trans_sid off (check manual about when/how you can do this).

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

--- End Message ---
--- Begin Message ---
At 10:56 AM +1000 6/8/06, Chris wrote:
>tedd wrote:
>>Hi gang:
>>
>>I've read that php sessions can create problems for Google bots. For example, 
>>the following was taken from a Google "Web Master Help" Center:
>>
>>-- Quote --
>>Allow search bots to crawl your sites without session IDs or arguments that 
>>track their path through the site. These techniques are useful for tracking 
>>individual user behavior, but the access pattern of bots is entirely 
>>different. Using these techniques may result in incomplete indexing of your 
>>site, as bots may not be able to eliminate URLs that look different but 
>>actually point to the same page.
>>-- Un-quote --
>>
>><http://www.google.com/support/webmasters/bin/answer.py?answer=35770>
>>
>>I've also seen a comment here:
>>
>>http://www.weberdev.com/get_example-3431.html
>>
>>But, I'm not following what's happening.
>>
>>Can someone shed some light on this for me? How can one do sessions and make 
>>Google bots happy?
>
>use_trans_sid (I think) will append the sessionid to all pages, so instead of:
>
>/page.php
>
>it will become
>
>/page.php?PHPSESSID=xxxxx
>
>much the same as if you do:
>
><?php
>echo '/page.php?' . SID;
>?>
>
>Bots don't like that, so where possible turn use_trans_sid off (check manual 
>about when/how you can do this).
>

Chris:

Thanks -- after your lead, I found that my site's session.use_trans_sid was 
turned off by default.

So, it wasn't the problem I thought it might have been.

Thanks again.

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

--- End Message ---
--- Begin Message ---
tedd wrote:
At 10:56 AM +1000 6/8/06, Chris wrote:
tedd wrote:
Hi gang:

I've read that php sessions can create problems for Google bots. For example, the 
following was taken from a Google "Web Master Help" Center:

-- Quote --
Allow search bots to crawl your sites without session IDs or arguments that 
track their path through the site. These techniques are useful for tracking 
individual user behavior, but the access pattern of bots is entirely different. 
Using these techniques may result in incomplete indexing of your site, as bots 
may not be able to eliminate URLs that look different but actually point to the 
same page.
-- Un-quote --

<http://www.google.com/support/webmasters/bin/answer.py?answer=35770>

I've also seen a comment here:

http://www.weberdev.com/get_example-3431.html

But, I'm not following what's happening.

Can someone shed some light on this for me? How can one do sessions and make 
Google bots happy?
use_trans_sid (I think) will append the sessionid to all pages, so instead of:

/page.php

it will become

/page.php?PHPSESSID=xxxxx

much the same as if you do:

<?php
echo '/page.php?' . SID;
?>

Bots don't like that, so where possible turn use_trans_sid off (check manual 
about when/how you can do this).


Chris:

Thanks -- after your lead, I found that my site's session.use_trans_sid was 
turned off by default.

So, it wasn't the problem I thought it might have been.

So your page urls don't automatically append the session id to the end? I might have the wrong variable name so if you're still seeing them, I obviously have it wrong...

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

--- End Message ---
--- Begin Message ---
Hi
Is there any reason why SSL support for pgsql module is disabled by
default in binary distribution for Windows (PHP 5.1.4 zip package)?
I thing it'd be very useful if this feauture were compiled in.

I sent this question to php-windows a few days ago with no response.

Regards
Peter Kuma

--- End Message ---
--- Begin Message ---
Peter Kuma wrote:
Hi
Is there any reason why SSL support for pgsql module is disabled by
default in binary distribution for Windows (PHP 5.1.4 zip package)?
I thing it'd be very useful if this feauture were compiled in.

I sent this question to php-windows a few days ago with no response.

Regards
Peter Kuma

probably because it relies on openssl which is disabled by default (and built as shared), as such you wouldn't be able to use pgsql if openssl was disabled... well, that's my first guess anyway... I don't really know.

- tul

--- End Message ---
--- Begin Message ---
how do I do a remote connection for odbc?
Everything that I see is on the local machine.
Can you do an odbc to a remote database?


Benjamin Adams / Lord of the Root / Ambrosia Software, Inc. -- http:// www.AmbrosiaSW.com
--- End Message ---
--- Begin Message ---
Benjamin Adams wrote:
> how do I do a remote connection for odbc?
> Everything that I see is on the local machine.
> Can you do an odbc to a remote database?
As far as I know ODBC can be used only locally. Although some kind of
forwarding utilities might exist. Maybe it could be accomplished by
windows sharing (eg if your database is MS Access).
Peter Kuma

--- End Message ---
--- Begin Message ---
I use odbc to connect to mainframe databases, and they are definitely remote
from my web server, and to access the mainframe database, the mainframe
needed to support tcp/ip on the database end and I needed a special driver
on the ODBC end.  Perhaps the odbc driver routine is the key (check your
odbc manager utility, if you have one, and try adding the datasource,
looking for host name provisions). 

Hope this helps,

Warren Vail

-----Original Message-----
From: Peter Kuma [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, June 07, 2006 2:51 PM
To: [email protected]
Subject: [PHP] Re: odbc remote

Benjamin Adams wrote:
> how do I do a remote connection for odbc?
> Everything that I see is on the local machine.
> Can you do an odbc to a remote database?
As far as I know ODBC can be used only locally. Although some kind of
forwarding utilities might exist. Maybe it could be accomplished by windows
sharing (eg if your database is MS Access).
Peter Kuma

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

--- End Message ---
--- Begin Message ---
Martin Alterisio wrote:
> 2006/6/7, Jochem Maas <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>>:
> 

...

>     --
>     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

yes I found those already and read them (but thanks for pointing them out):

1. I'm trying to find something flash version agnostic so my XML output
routines can be reused by different flash files (made by different people,
with different reqs, etc)

2. the apparent lack of tag support is a major bummer when trying to
map fullblown (x)HTML to something flash will display sensibly... writing a
fullblown robust converter from scratch is something I don't really have the
time for (and the gains are not really worth it) - I mean where do you start
when TABLE is not even supported :-/

rather a downer all in all - I guess I have to start tweaking tinyMCE to
only produce the bare minimum of markup, seems like the path of least 
resistance.

> 

--- End Message ---
--- Begin Message ---
Best group member,

This code works fine on my local machine:

$Query = sprintf("SELECT * FROM filestorage WHERE id=%s LIMIT 1",
$_GET['fileid']);
$Result = mysql_query($Query);
if (mysql_num_rows ($Result)>0) {
  $Row = @mysql_fetch_array ($Result);
  $file_type = $Row["filetype"];
  $file = $Row["filedata"];
  header ("Content-type: $file_type");
  header("Content-Disposition: attachment;
filename=fil".substr($Row['filename'], strrpos($Row['filename'], '.')));
'.')).'"
  print $file;
}

But when I run it on my server it does not start the download, and the file
name is the location of the script instead of what I state as file name.

Is this a server issue? I run Linux server with Plesk. Is there anyone with
the same problems?

Best regards,
Peter Lauri

--- End Message ---
--- Begin Message ---
Peter Lauri wrote:
Best group member,

This code works fine on my local machine:

$Query = sprintf("SELECT * FROM filestorage WHERE id=%s LIMIT 1",
$_GET['fileid']);
$Result = mysql_query($Query);
if (mysql_num_rows ($Result)>0) {
  $Row = @mysql_fetch_array ($Result);
  $file_type = $Row["filetype"];
  $file = $Row["filedata"];
  header ("Content-type: $file_type");
  header("Content-Disposition: attachment;
filename=fil".substr($Row['filename'], strrpos($Row['filename'], '.')));
'.')).'"
  print $file;
}

But when I run it on my server it does not start the download, and the file
name is the location of the script instead of what I state as file name.


The first thing you should do is read this site:

http://www.phpsec.org

I could pass all sorts of bad things to $_GET['fileid'] and it will ruin your database.

At least make it:

(int)$_GET['fileid'];

so if it's non-numeric, it will get converted to 0.

Can we assume the database is exactly the same and it's not that $row['filename'] has the wrong data in it?

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

--- End Message ---
--- Begin Message --- I really doubt you need to use strstr() here, since it will return a string (_if_ the 'needle' is found in the 'haystack')[1], I guess you're looking for strpos() or something similar.

Now, you said that you have this IPs on your database, so why don't you count the IPs directly on your database? If the examples you gave are real and the first 3 segments of each IP are the same, then you could group your records, clasify and count them. For example, if you were using MySQL, you can count them with something like

  SELECT
    SUBSTRING(ip, 1, 11) AS ip
    COUNT(1) AS counter
  FROM table
  GROUP BY ip
  ORDER BY ip ASC
*NOT tested

which should give you something like
  ip          | counter
 -------------+---------
  192.168.100 |       1
  192.168.101 |       2
      ···     |   ···
  192.168.110 |      11

[1] http://php.net/strstr

Rob W. wrote:
Sorry for the miss understanding, That's the way the viarable will look, i'm putting it in as a viariable.

if (strstr($block,$address)) {
 $inc++;
}

----- Original Message ----- From: "Richard Lynch" <[EMAIL PROTECTED]>
To: "Rob W." <[EMAIL PROTECTED]>
Sent: Tuesday, June 06, 2006 8:58 PM
Subject: Re: [PHP] Getting totals



Put quotes or apostrophes on the strings...
if (strstr('192.168.100','192.168.100.10')) {

On Tue, June 6, 2006 8:46 pm, Rob W. wrote:

if (strstr(192.168.100,192.168.100.10)) {
  $inc++;
}
echo "$inc";

That returns nothing. What am i still doing wrong?

----- Original Message -----
From: "Rabin Vincent" <[EMAIL PROTECTED]>
To: "Rob W." <[EMAIL PROTECTED]>
Cc: <[email protected]>
Sent: Tuesday, June 06, 2006 1:36 PM
Subject: Re: [PHP] Getting totals


On 6/6/06, Rob W. <[EMAIL PROTECTED]> wrote:

So far what I have gotten is a stristr match but it's not working
correctly. I have a variable that basically weed's out the last
digits of
the ip it's self from help previously

So my code so far is:

if (stristr($block,$address)) {
   $count_ip++;
}


You've got the parameters mixed up. strstr is (haystack,
needle) so you need strstr($address, $block). php.net/stristr.
--
Atentamente / Sincerely,
J. Rafael Salazar Magaña

--- End Message ---
--- Begin Message ---
Hi all ,

  Thanks all in this newsgroup for your help.

  I have question regarding PEAR Pager .

  The PEAR pager is working ok , however , the PEAR Pager always display
  "totalItems:" display and value "1" on my web page.
How to make the "totalItems:" and the value "1" not to display on webpage?

  I am using MYSQL database and PHP 4.3.2

Thanks
-weetat

--- End Message ---

Reply via email to