php-general Digest 9 Jun 2002 02:12:14 -0000 Issue 1394

Topics (messages 101274 through 101305):

Reading from a dir.
        101274 by: Steven Mallett
        101275 by: Sqlcoders.com Programming Dept
        101276 by: Stuart Dallas

What are pros and cons of the Apache module verses cgi version?
        101277 by: Al
        101291 by: Miguel Cruz

Removing ^M
        101278 by: Michael Hall
        101279 by: Sqlcoders.com Programming Dept
        101290 by: Miguel Cruz
        101292 by: Chris Knipe
        101294 by: Miguel Cruz
        101295 by: Chris Knipe
        101298 by: Dave Raven
        101301 by: Steve Buehler

Include + $Variables Help
        101280 by: Steven
        101282 by: Nick Wilson
        101283 by: Olexandr Vynnychenko
        101302 by: Steven
        101303 by: Steven

Re: PHP 4.0.6 file upload problems?
        101281 by: Bogdan Stancescu

Making code execute on fatal error?
        101284 by: Leif K-Brooks
        101286 by: Dan Hardiker
        101289 by: Leif K-Brooks

Re: Warning: Too many connections in xxx on line xx
        101285 by: John Holmes
        101293 by: Dan Morris

Re: ssl security question
        101287 by: Daniel Grace

Re: Search a flat file.
        101288 by: Daniel Grace

Re: e-commerce example
        101296 by: David Freeman

mysql_connect()
        101297 by: Jason Soza
        101299 by: John Holmes

PEAR Benchmark & other benchmark techniques??
        101300 by: Gerard Samuel

how to test if rewrite rule is working
        101304 by: Nicole Lallande

Re: Suggestions for getting started with poll app.
        101305 by: webmaster.tececo.com

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 ---
Is there another way to read the files from a directory?

I tried the following:

foreach (glob("*.txt") as $filename) {
     echo "$filename size " . filesize($filename) . "\n";
}

but get an error whether safe mode is on or off.

I'm just learning as you might guess.

--
Steve Mallett  http://OSDir.com - Stable, Open Source Apps
[EMAIL PROTECTED] | [EMAIL PROTECTED]
http://open5ource.net <personal> | With new, all powerful, blogging 
action!

--- End Message ---
--- Begin Message ---
Try...

<?
  //$dirname should contain the directory name including it's full path...
  $handle=opendir($dirname);
  while ($file = readdir($handle)){
    echo("$file is located in the $dirname directory");
  }
?>

HTH,
Dw.

Sqlcoders.com Dynamic data driven web solutions 
----- Original Message ----- 
From: "Steven Mallett" <[EMAIL PROTECTED]>
To: "php-general" <[EMAIL PROTECTED]>
Sent: June 08 2002 07:23 AM
Subject: [PHP] Reading from a dir.


> Is there another way to read the files from a directory?
> 
> I tried the following:
> 
> foreach (glob("*.txt") as $filename) {
>      echo "$filename size " . filesize($filename) . "\n";
> }
> 
> but get an error whether safe mode is on or off.
> 
> I'm just learning as you might guess.
> 
> --
> Steve Mallett  http://OSDir.com - Stable, Open Source Apps
> [EMAIL PROTECTED] | [EMAIL PROTECTED]
> http://open5ource.net <personal> | With new, all powerful, blogging 
> action!
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

--- End Message ---
--- Begin Message ---
On Saturday, June 8, 2002 at 3:23:01 PM, you wrote:

> Is there another way to read the files from a directory?

http://www.php.net/readdir

-- 
Stuart

--- End Message ---
--- Begin Message ---
I notice that some webhosts offer the apache module and some the cgi.

On the surface, the cgi version appears to be a lot of extra hassle.

Thanks....

--- End Message ---
--- Begin Message ---
On Sat, 8 Jun 2002, Al wrote:
> I notice that some webhosts offer the apache module and some the cgi.
> 
> On the surface, the cgi version appears to be a lot of extra hassle.

The Apache module runs faster and has smoother integration with the web 
server.

The CGI version allows you to run in different uid contexts, so that users
on a shared/multiuser system can be prevented from seeing and messing with
each other's files.

There are scads of differences, but these seem to be the most salient for 
most people.

miguel

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


I am trying remove ^M characters (some kind of newline character) from an
HTML file. I've tried all sorts of ereg_replace and sed possibilities
but the
things just won't go away. Does anyone have a way of removing such
characters?

TIA 

Mick



--- End Message ---
--- Begin Message ---
You could replace if by ASCII code (^M is actually a representation of ASCII
013, the CR character, thanks to
http://www.mindspring.com/~jc1/serial/Resources/ASCII.html for the ASCII
lookup table.).

This should fix it (untested)

<?

$chrnumber = 13; //this is the ascii code for ^M

$nicestring = str_replace(chr($chrnumber),"(removed M was
here)",$badstring);

echo($nicestring);

?>

where $nicestring is the output,
$chrnumber contains the ascii code for ^M,
and the input (original) string is $badstring.




Sqlcoders.com Dynamic data driven web solutions
----- Original Message -----
From: "Michael Hall" <[EMAIL PROTECTED]>
To: "PHP List" <[EMAIL PROTECTED]>
Sent: June 08 2002 05:40 PM
Subject: [PHP] Removing ^M


>
>
> I am trying remove ^M characters (some kind of newline character) from an
> HTML file. I've tried all sorts of ereg_replace and sed possibilities
> but the
> things just won't go away. Does anyone have a way of removing such
> characters?
>
> TIA
>
> Mick
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message ---
On Sun, 9 Jun 2002, Michael Hall wrote:
> I am trying remove ^M characters (some kind of newline character) from
> an HTML file. I've tried all sorts of ereg_replace and sed possibilities
> but the things just won't go away. Does anyone have a way of removing
> such characters?

  $str = str_replace("\r", '', $str);

miguel

--- End Message ---
--- Begin Message ---
Perl apparently also works very nice for this

open (FILE, "filename"):
open (NEWFILE, "filename);

WHILE (<FILE>) {
  chomp;
  print NEWFILE $_
}

close (FILE);
close(NEWFILE);

this should take care of ^M
Kind Regards,

Chris Knipe
MegaLAN Corporate Networking Services
Tel: +27 21 854 7064
Cell: +27 72 434 7582

----- Original Message ----- 
From: "Michael Hall" <[EMAIL PROTECTED]>
To: "PHP List" <[EMAIL PROTECTED]>
Sent: Sunday, June 09, 2002 2:40 AM
Subject: [PHP] Removing ^M


> 
> 
> I am trying remove ^M characters (some kind of newline character) from an
> HTML file. I've tried all sorts of ereg_replace and sed possibilities
> but the
> things just won't go away. Does anyone have a way of removing such
> characters?
> 
> TIA 
> 
> Mick
> 
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

--- End Message ---
--- Begin Message ---
'chomp' removes the end-of-line character(s) from its input, which is 
different from doing an EOL conversion (which is what the OP was after). 
The result of the below perl would be to concatenate all lines together as 
one.

miguel

On Sat, 8 Jun 2002, Chris Knipe wrote:
> Perl apparently also works very nice for this
> 
> open (FILE, "filename"):
> open (NEWFILE, "filename);
> 
> WHILE (<FILE>) {
>   chomp;
>   print NEWFILE $_
> }
> 
> close (FILE);
> close(NEWFILE);
> 
> this should take care of ^M
> Kind Regards,
> 
> Chris Knipe
> MegaLAN Corporate Networking Services
> Tel: +27 21 854 7064
> Cell: +27 72 434 7582
> 
> ----- Original Message ----- 
> From: "Michael Hall" <[EMAIL PROTECTED]>
> To: "PHP List" <[EMAIL PROTECTED]>
> Sent: Sunday, June 09, 2002 2:40 AM
> Subject: [PHP] Removing ^M
> 
> 
> > 
> > 
> > I am trying remove ^M characters (some kind of newline character) from an
> > HTML file. I've tried all sorts of ereg_replace and sed possibilities
> > but the
> > things just won't go away. Does anyone have a way of removing such
> > characters?
> > 
> > TIA 
> > 
> > Mick
> > 
> > 
> > 
> > 
> > -- 
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> > 
> > 
> 
> 
> 

--- End Message ---
--- Begin Message ---
print NEWFILE $_ . "\n";

Then :P

This isn't a perl list, it's off topic.  Just thought it might help if I
added this to the pool.... Let's rather not go into a in depth discussion
about it... I'm no perl guru either.


Kind Regards,

Chris Knipe
MegaLAN Corporate Networking Services
Tel: +27 21 854 7064
Cell: +27 72 434 7582

----- Original Message -----
From: "Miguel Cruz" <[EMAIL PROTECTED]>
To: "Chris Knipe" <[EMAIL PROTECTED]>
Cc: "PHP List" <[EMAIL PROTECTED]>
Sent: Saturday, June 08, 2002 7:51 PM
Subject: Re: [PHP] Removing ^M


> 'chomp' removes the end-of-line character(s) from its input, which is
> different from doing an EOL conversion (which is what the OP was after).
> The result of the below perl would be to concatenate all lines together as
> one.
>
> miguel
>
> On Sat, 8 Jun 2002, Chris Knipe wrote:
> > Perl apparently also works very nice for this
> >
> > open (FILE, "filename"):
> > open (NEWFILE, "filename);
> >
> > WHILE (<FILE>) {
> >   chomp;
> >   print NEWFILE $_
> > }
> >
> > close (FILE);
> > close(NEWFILE);
> >
> > this should take care of ^M
> > Kind Regards,
> >
> > Chris Knipe
> > MegaLAN Corporate Networking Services
> > Tel: +27 21 854 7064
> > Cell: +27 72 434 7582
> >
> > ----- Original Message -----
> > From: "Michael Hall" <[EMAIL PROTECTED]>
> > To: "PHP List" <[EMAIL PROTECTED]>
> > Sent: Sunday, June 09, 2002 2:40 AM
> > Subject: [PHP] Removing ^M
> >
> >
> > >
> > >
> > > I am trying remove ^M characters (some kind of newline character) from
an
> > > HTML file. I've tried all sorts of ereg_replace and sed possibilities
> > > but the
> > > things just won't go away. Does anyone have a way of removing such
> > > characters?
> > >
> > > TIA
> > >
> > > Mick
> > >
> > >
> > >
> > >
> > > --
> > > 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
>
>

--- End Message ---
--- Begin Message ---
why not just run
    tr -d "\r" htmlfile.htm


----- Original Message ----- 
From: "Michael Hall" <[EMAIL PROTECTED]>
To: "PHP List" <[EMAIL PROTECTED]>
Sent: Sunday, June 09, 2002 2:40 AM
Subject: [PHP] Removing ^M


> 
> 
> I am trying remove ^M characters (some kind of newline character) from an
> HTML file. I've tried all sorts of ereg_replace and sed possibilities
> but the
> things just won't go away. Does anyone have a way of removing such
> characters?
> 
> TIA 
> 
> Mick
> 
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

--- End Message ---
--- Begin Message ---
I get this when running that command:
tr: only one string may be given when deleting without squeezing repeats


I looked at the tr man pages and it didn't help much.  I also tried using 
'\r' and `\r` and just \r , but always get the same result.

Steve

At 11:07 PM 6/8/2002 +0200, you wrote:
>why not just run
>     tr -d "\r" htmlfile.htm
>
>
>----- Original Message -----
>From: "Michael Hall" <[EMAIL PROTECTED]>
>To: "PHP List" <[EMAIL PROTECTED]>
>Sent: Sunday, June 09, 2002 2:40 AM
>Subject: [PHP] Removing ^M
>
>
> >
> >
> > I am trying remove ^M characters (some kind of newline character) from an
> > HTML file. I've tried all sorts of ereg_replace and sed possibilities
> > but the
> > things just won't go away. Does anyone have a way of removing such
> > characters?
> >
> > TIA
> >
> > Mick
> >
> >
> >
> >
> > --
> > 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
>
>
>--
>This message has been scanned for viruses and
>dangerous content by MailScanner, and is
>believed to be clean.
>ow3


--- End Message ---
--- Begin Message ---
Here's my problem:

I'm trying to make a simple publication of 30+ articles, using PHP but not
MySQL.

There are basically three components:
     - a table of contents (contents.html)
     - an article template (article.php)
     - and then 30+ text files.

The idea I was going for was to make dynamic links in contents.html that
would pass a variable to article.php. The article page then uses that
variable in an include( ). Does this make sense? I.e.-

## contents.html
<a href="article.php?auth=name">Text Link</a>

## article.php
# The link above would then pass the $auth variable as 'name', right?
# Is that enough?
<?php include("$auth.txt"); ?>
# I then assume this would result in it trying to include 'name.txt',
# but instead there is always a nasty error about the .txt part.
# I should probably ask, is passing variables inside an include allowed?

If I'm wrong, or I'm just missing something that needs to be added, please
let me know. I'm sooo new at this that I know I'm doing something wrong and
it is probably very simple. Any help would be greatly appreciated!

Thanks in advance.

SB


--- End Message ---
--- Begin Message ---
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


* and then Steven declared....
> # Is that enough?
> <?php include("$auth.txt"); ?>
> # I then assume this would result in it trying to include 'name.txt',
> # but instead there is always a nasty error about the .txt part.
> # I should probably ask, is passing variables inside an include allowed?
> 
> If I'm wrong, or I'm just missing something that needs to be added, please
> let me know. I'm sooo new at this that I know I'm doing something wrong and
> it is probably very simple. Any help would be greatly appreciated!


Can you show an example of name.txt and the error you get?

I'm guessing but I reckon name.txt should be re written as name.php and
work like this:

<?
// name.php

$text=<<<EOF

<p> some nice aritcles text marked up here</p>

EOF;
?>

and then in articles.php you should just print $text to where you want
it.

- -- 
Nick Wilson     //  www.explodingnet.com



-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)

iD8DBQE9Ah/3HpvrrTa6L5oRAk+iAKCx1lmVO6ZTuzyvyKDYxROcwzK9IgCfaTPS
qtvhmbP4oWg85jueAtfMOIM=
=Bdlq
-----END PGP SIGNATURE-----
--- End Message ---
--- Begin Message ---
Hello Steven,

Saturday, June 08, 2002, 5:40:40 PM, you wrote:

S> Here's my problem:

S> I'm trying to make a simple publication of 30+ articles, using PHP but not
S> MySQL.

S> There are basically three components:
S>      - a table of contents (contents.html)
S>      - an article template (article.php)
S>      - and then 30+ text files.

S> The idea I was going for was to make dynamic links in contents.html that
S> would pass a variable to article.php. The article page then uses that
S> variable in an include( ). Does this make sense? I.e.-

S> ## contents.html
S> <a href="article.php?auth=name">Text Link</a>

S> ## article.php
S> # The link above would then pass the $auth variable as 'name', right?
S> # Is that enough?
S> <?php include("$auth.txt"); ?>
S> # I then assume this would result in it trying to include 'name.txt',
S> # but instead there is always a nasty error about the .txt part.
S> # I should probably ask, is passing variables inside an include allowed?

S> If I'm wrong, or I'm just missing something that needs to be added, please
S> let me know. I'm sooo new at this that I know I'm doing something wrong and
S> it is probably very simple. Any help would be greatly appreciated!

What a nasty error? And did you try the following

<?php include($_GET['auth'].".txt");?> ?

-- 
Best regards,
 Olexandr                            mailto:[EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
Problem resolved!

I replaced     <?php include("$auth=name"); ?>     with
<?php include($_GET['auth'].".txt"); ?>     in article.php

Worked exactly as I was trying for.

Thanks for the help!

Best regards,
Steven


--- End Message ---
--- Begin Message ---
Oops, typo:
>> <?php include("$auth=name"); ?>  ...
is suppose to read <?php include("$auth.txt"); ?>

Also for reference, the error was:
Warning: Failed opening '.txt' for inclusion (include_path='.;c:\php4\pear')
in c:\server\www\article.php on line 9


--- End Message ---
--- Begin Message ---
Thanks for taking the time to answer. As I said, there is no problem 
with the code in either OPT or in phpMyAdmin - there is a problem with 
PHP and I was hoping someone on this list bounced into the same kind of 
problem.

Bogdan

Edward Marczak wrote:

>On 6/7/02 11:43 AM, "Bogdan Stancescu" <[EMAIL PROTECTED]> wrote:
>
>  
>
>>One of the users of OPT has major problems uploading files to the system and I
>>have absolutely no clue why that is. His PHP version is 4.0.6 on Linux.
>>Quoting his description of the problem:
>>
>>"In fact, now it doesn't even report an error. It just takes some time
>>(about 30 seconds) trying to upload, I guess. The progress bar in the
>>bottom of MSIE 6.0 shows it doing something, but then it 'finishes',
>>while still showing the page with the 'Add a new document' form."
>>
>>I know, your first thought is that OPT has a problem - but here's
>>another report from the same user when I directed him to alter some
>>stuff in a MySQL database:
>>
>>"By pasting it into the 'query' window in phpMyAdmin, but I was
>>surprised by the result. Instead of an error or successful result from
>>phpMyAdmin, I got a browser error from MSIE: 'This page cannot be
>>displayed'"
>>
>>I have absolutely no idea why this happens - when he sent the first
>>report, I started thinking it may have been some php.ini setting
>>regarding uploads, but I was completely confused by the second report.
>>
>>Did anyone encounter this? Is it a PHP bug? Is it a setting?
>>    
>>
>
>Well, you could post the code you're trying....but as I found out recently
>while learning this, if a file is bigger than max file size, $_FILES['name']
>will have 'none' and $_FILES['size'] will be 0.  (I thinks that's
>$HTTP_POST_FILES under 4.0.6).  Check that....Otherwise, we need more info
>about what 'is not working'. (Not sure what query you're checking in
>phpMyAdmin...)
>  
>



--- End Message ---
--- Begin Message ---
I want to make all fatal errors trigger an error file to be include, the 
file to exit, and the error never t be displayed.  Is there any way to 
do this without access to php.ini?

--- End Message ---
--- Begin Message ---
> I want to make all fatal errors trigger an error file to be include,
> the  file to exit, and the error never t be displayed.  Is there any
> way to  do this without access to php.ini?

Implement your own error handler. There is a load of documentation in the
manual.

-- 
Dan Hardiker [[EMAIL PROTECTED]]
ADAM Software & Systems Engineer
First Creative Ltd


--- End Message ---
--- Begin Message ---
Thanks.  I am trying, but it refuses to work.   Can you help?  My code is:
function error_handler ($code, $str) {
if(($errno == FATAL) && (    error_reporting() != 0)){
//include the error file
exit;
}
}
set_error_handler("error_handler");
//set_error_handler returns false.  When I test it, the default error is 
displayed.
Dan Hardiker wrote:

>>I want to make all fatal errors trigger an error file to be include,
>>the  file to exit, and the error never t be displayed.  Is there any
>>way to  do this without access to php.ini?
>>    
>>
>
>Implement your own error handler. There is a load of documentation in the
>manual.
>
>  
>

--- End Message ---
--- Begin Message ---
It's nothing to do with PHP. Raise your max_connections in your MySQL
configuration file...

---John Holmes...

> -----Original Message-----
> From: Dan Morris [mailto:[EMAIL PROTECTED]]
> Sent: Saturday, June 08, 2002 4:54 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Warning: Too many connections in xxx on line xx
> 
> Is there anyway to get rid of this message:
> 
> Warning: Too many connections in xxx on line xx
> 
> line xx is a connection to a mysql database.
> 
> In PHP.ini I have:
> 
> [MySQL]
> ; Allow or prevent persistent links.
> mysql.allow_persistent = On
> 
> ; Maximum number of persistent links.  -1 means no limit.
> mysql.max_persistent = -1
> 
> ; Maximum number of links (persistent + non-persistent).  -1 means no
> limit.
> mysql.max_links = -1
> 
> Can anyone suggest what I can do to get rid of this error? I am
running on
> a
> Dell PowerEdge 350 with the max of 1GB of memory running RH7.2, php
4.1.1,
> and mysql 3.23.49a.
> 
> Thanks.
> 
> Dan
> 
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---
--- Begin Message ---
The error message is coming from the connect line in:

function MOpen() {
        global $db_address, $db_username, $db_password, $link;
        $link = mysql_connect($db_address,$db_username,$db_password);
}



"Nick Wilson" <[EMAIL PROTECTED]> wrote in message
news:<[EMAIL PROTECTED]>...
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
>
> * and then Dan Morris declared....
> > Is there anyway to get rid of this message:
> >
> > Warning: Too many connections in xxx on line xx
>
> Can you show the code that connects?
>
> - --
> Nick Wilson     //  www.explodingnet.com
>
>
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.0.6 (GNU/Linux)
>
> iD8DBQE9AdECHpvrrTa6L5oRAmUkAJ0S/N7E8ifYqP4bm6mb38wWoZqJ+gCfRPVp
> dxNJezvEs5aav5Yw814axIE=
> =QH6x
> -----END PGP SIGNATURE-----

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

"Jan grafström" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I have made a file wich start a session and set a session variable if user
> and pass are verifyed.
> Than I use the session variable to protect all other userfiles.
>
>
> To run the file I enter:
> http://myserver.com/start.php3?user=xxxxx&pass=yyyyyy
>
> What is the differans using SSL and enter the same url?
> If a hacker sniff the ssl-string can he send that string and start the
file
> anyway?

SSL connections are inherently encrypted. The encryption is done in such a
manner that makes a 'record/playback' attack impossible, as the key used to
encrypt things with changes. I don't recall the exact specifics right
off-hand but any good resource on SSL will explain it.

SSL is completely encrypted, right down to everything sent over the wire. If
someone was sniffing they'd just see a bunch of random garbage that would do
them very little use.

However, displaying the username and password as part of the URL (GET
method) is a security risk in the sense that many browsers will keep it in
their history and thus someone with access to the history can determine
their username/password. POST would really be a better method to use here in
this case.

-- Daniel Grace


--- End Message ---
--- Begin Message ---
Be warned that explode won't work as expected if any of your fields contain
colons, though it doesn't look like it'll be an issue in this sort of case.

"Gaylen Fraley" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Use the explode() function based on the colon.  Then parse the 2nd array
> element for the username that you want.  If matched, display all elements
in
> that array row.  Conversely you could use the implode() to reassemble the
> array row.
>
[...]
>
> "Tom Ray" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > I want to be able to search a flat file line by line looking for data
> > such as a username then display all the information in that line. Is
> > there some way to search the following format:
> >
> > record1:username:info:info:info
> > record2:username:info:info:info
> > record3:username:info:info:info
> >




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

 > I'm looking for  e-commerce example (PHP+MySQL) so I don't 
 > start from zero and save some time.

You could try searching for "php mysql commerce" on any of the
following:

www.google.com

www.freshmeat.net

www.hotscripts.com

Where you'd probably find what you're looking for.

CYA, Dave


--- End Message ---
--- Begin Message ---
I posted this to the MySQL list as well, but haven't gotten an answer so
far. Just wonderin gif it may be a PHP problem I'm looking at. Anyway, this
is the text of the message I posted to MySQL, with a few edits:

I don't know if this is more of a PHP thing or a MySQL user issue that I'm
having trouble with.

I have this code:

/* Connecting, selecting database */
$link = mysql_connect()
        or die("Could not connect:" . mysql_error());
        mysql_select_db("my_database") or die("Could not select database");

I've gone through the MySQL manual step-by-step on how to remove the
anonymous user (I'm using Win32) and add a password for the root user, then
create other users. I also have read the PHP manual concerning the
mysql_connect() function and use it accordingly, mysql_connect("host",
"user", "pass")

The problem is, when I put anything in the mysql_connect() function, I get:
Access denied for user: 'user@host' (Using password: YES)

Where user is whatever user I'm trying to connect with (have tried many) and
host is my server - I've tried both localhost (which gives me "server not
found") and the actual hostname of my computer, which gives me the access
denied.

The weird thing is, this works with -just- mysql_connect(), and the
user/pass combos I'm using I use just fine to maintain and update the
database, i.e. these are known good user/pass combos.

Any idea what's happening?

Jason Soza

--- End Message ---
--- Begin Message ---
This is just a MySQL problem. You've got something messed up or set
incorrectly in your MySQL.user table. 

In the MySQL database, look at the user table. SELECT * FROM user. Look
at the Host and User columns. If you want to connect as root from the
same machine, only, then there should be only one row in there. Host
should be localhost, user should be root.

Can you send me a cut and paste of the Host and User columns of your
MySQL.user table? Just those two columns. It should be easy to figure
out without seeing them, though.... For example, my user table has only
these entries:

| Host      | User    |
+----------+----------+
| localhost | root    |
| localhost | 447sig  |
| localhost | user    |
| localhost | geeklog |

If you're trying to eliminate anonymous access, then there shouldn't be
any blank user entries. If you're trying to limit access to the same
machine, then there shouldn't be any % signs in the host column.

Have you read over the GRANT command in the MySQL manual? How did you
set up these users?

---John Holmes...

> -----Original Message-----
> From: Jason Soza [mailto:[EMAIL PROTECTED]]
> Sent: Saturday, June 08, 2002 5:04 PM
> To: PHP-General Mailing List
> Subject: [PHP] mysql_connect()
> 
> I posted this to the MySQL list as well, but haven't gotten an answer
so
> far. Just wonderin gif it may be a PHP problem I'm looking at. Anyway,
> this
> is the text of the message I posted to MySQL, with a few edits:
> 
> I don't know if this is more of a PHP thing or a MySQL user issue that
I'm
> having trouble with.
> 
> I have this code:
> 
> /* Connecting, selecting database */
> $link = mysql_connect()
>       or die("Could not connect:" . mysql_error());
>       mysql_select_db("my_database") or die("Could not select
database");
> 
> I've gone through the MySQL manual step-by-step on how to remove the
> anonymous user (I'm using Win32) and add a password for the root user,
> then
> create other users. I also have read the PHP manual concerning the
> mysql_connect() function and use it accordingly, mysql_connect("host",
> "user", "pass")
> 
> The problem is, when I put anything in the mysql_connect() function, I
> get:
> Access denied for user: 'user@host' (Using password: YES)
> 
> Where user is whatever user I'm trying to connect with (have tried
many)
> and
> host is my server - I've tried both localhost (which gives me "server
not
> found") and the actual hostname of my computer, which gives me the
access
> denied.
> 
> The weird thing is, this works with -just- mysql_connect(), and the
> user/pass combos I'm using I use just fine to maintain and update the
> database, i.e. these are known good user/pass combos.
> 
> Any idea what's happening?
> 
> Jason Soza
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php


--- End Message ---
--- Begin Message ---
Im looking for ways to benchmark my script.
I read on O'Reilly that I could use PEAR, and I tried it a few weeks ago 
when I was running php 4.1.2.
Today I upgraded to php 4.2.1 and when I try to include the benchmark 
the script is unable to find the PEAR benchmark class.|

include_once("Benchmark/Timer.php");|
Warning: Failed opening 'Benchmark/Timer.php' for inclusion 
(include_path='.:/usr/local/lib/php')

Also on a side note, I dont know much about benchmarking utilities, but 
what else is out there for windows/bsd??
Thanks

-- 
Gerard Samuel
http://www.trini0.org:81/
http://dev.trini0.org:81/


--- End Message ---
--- Begin Message ---
I have created the following htaccess file using rewrite rules  for the 
purpose of having search engine friendly files created from my dynamic 
files.  

RewriteEngine On
RewriteRule ^index-(.*),(.*)\.html$ index.php?section=$1&page=$2
RewriteRule ^nav-(.*),(.*)\.html$ nav.php?section=$1&page=$2

How do I test to see if this is working from a search engine robot 
standpoint?  I don't see anything in my log files and I don't see that 
the URI in the address bar has changed.  Am I doing something wrong?

TIA,

Nicole

-- 
########################
Nicole Lallande
[EMAIL PROTECTED]
760.753.6766
########################


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

----- Original Message -----
From: "Nick Wilson" <
[EMAIL PROTECTED]>
To: <
[EMAIL PROTECTED]>
Sent: Sunday, June 09, 2002 12:15 AM
Subject: Re: [PHP] Suggestions for getting started with poll app.



* and then
[EMAIL PROTECTED] declared....
> I want to build my own poll(The ones availble from sites such as
hotscripts.com are not quite what I need)

I did one recently for a client. You could have a look at it and see if
it fits your needs... I've commented it for someone else so it should be
quite easy to modify (see attached)
--
Nick Wilson     // 
www.explodingnet.com




--- End Message ---

Reply via email to