[PHP] Re: confirm subscribe to php-general@lists.php.net

2004-02-24 Thread David Robley
In article 
[EMAIL PROTECTED], 
[EMAIL PROTECTED] says...
  Hi! This is the ezmlm program. I'm managing the
  [EMAIL PROTECTED] mailing list.
 
  I'm working for my owner, who can be reached
  at [EMAIL PROTECTED]
 
  To confirm that you would like
 
 [EMAIL PROTECTED]
 
  added to the php-general mailing list, please send
  an empty reply to this address:
 
 [EMAIL PROTECTED]

How embarrassing :-)

-- 
Quod subigo farinam

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet?

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



RE: [PHP] PHP Alternative to IFRAME?

2004-02-24 Thread Jason Merrique
You could do it this way:

Put the content of the file into a variable:

?php 

$fp = fopen($filename, r);
$content = !-- Insert Start --;
if($fp) {
  while(! feof($fp)) {
$content .= fread($fp, 1024);
  }
}
?

Insert the variable into a div tag:

div id=content

?php
echo $content;
?

/div

Then create a style sheet that defines the properties of the content
DIV:

style type=text/css
!--
#content {
height: 100px;
width: 100px;
float: left
}
--
/style

The above collection of code would include the contents of the specified
file/url into a box to the left of the screen, with any other text
wrapping around it. You could do pretty much what you want with the DIV
though, CSS Rocks :)

Does that answer the question?

Cheers,

Jason

 -Original Message-
 From: Nicole [mailto:[EMAIL PROTECTED] 
 Sent: 23 February 2004 18:26
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP] PHP Alternative to IFRAME?
 
 Your right I was mixing up what I wanted.
 
 What I wanted to know I guess was if I use an include and 
 include a file can I format where that file will display.
 
 So what I have is a little box with some info in it.  I want 
 it to display to the right of the body text and have the body 
 text wrap around it.
 
 Nicole
 
 Richard Davey [EMAIL PROTECTED] wrote in message 
 news:[EMAIL PROTECTED]
  Hello Nicole,
 
  Monday, February 23, 2004, 5:21:11 PM, you wrote:
 
  N Is there a PHP alternative to an IFRAME? Here's what I mean.
 
  No, of course not. PHP is a server-side language. IFRAME's (and 
  anything related to page construction/display) is client-side.
 
  N Is there a way to include a file in my php document that will be
 positioned
  N where I want it, like an IFRAME? I want to have it aligned right 
  N with
 text
  N wrapping around it and I know IFRAME is not compatible with 
  N Netscape browsers.
 
  You're mixing technologies. If Netscape won't display 
 something, there 
  is nothing PHP can do about it. You need to think of another layout 
  technique that it can display.
 
  --
  Best regards,
   Richard Davey
   http://www.phpcommunity.org/wiki/296.html
 
 --
 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



RE: [PHP] beginners question

2004-02-24 Thread Jason Merrique
So you don't want the form data to be encoded in the url?
Something like this would probably do it:

form action=input.php method=post enctype=multipart/form-data
name=form

input name=Stock type=hidden value=$var
input name=button type=submit value=Click to add

/form

That'll just display a button that when pressed will pass $var to
input.php


 -Original Message-
 From: Steve [mailto:[EMAIL PROTECTED] 
 Sent: 24 February 2004 05:16
 To: [EMAIL PROTECTED]
 Subject: [PHP] beginners question
 
 I have this code
 
 $var=$_POST['Stock']; in one page
 
 further down in the code, if certain conditions are met, I 
 want the user to click on a link that will take them to a 
 form to fill in some info. 
 I need to have the data that is in $var passed along to that new url.
 
 So I have
 
 $var=$_POST['Stock']; in one page
 .
 .
 .
 echo 'a href=input.php?StockClick to add/a'
 
 input.php is the form page.  How do I get the Stock from the 
 fisrt page to the second using the ? syntax?
 
 --
 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



[PHP] XML Tool Needed

2004-02-24 Thread Nick Wilson
Hi all, 

I'm looking for a tool that will parse an xml doc into somthing like an
associative array for me. Basically somthing to make life simple when
dealing with Amazon XML docs.

I have been all thru hotscripts and even tried doing it myself but my
time is limited and the tools out there are waay beyond what I
actually need.

Anyone have any recommendations or ideas?

Many thanks...

-- 
Nick W

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



[PHP] Storing Arrays?

2004-02-24 Thread Nick Wilson
Hi all, 

If I wanted to store an array for future use in a MySQL TEXT Column
(dont ask, it's complicated... hehe!) how would I go about it?

I thought of just putting the results of print_r($myarray); into the
text field and using eval() to get at it later... is that the right way
to go?

Many thanks

-- 
Nick W

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



RE: [PHP] RE: Record Counts

2004-02-24 Thread Jay Blanchard
[snip]
I did RTFM...I always RTFM first. That was the example in the F Book!.
Mark Roberts, Roberts Computing Systems
Webmaster Services $29.50/mo

$reccount = @mysql_query(select count(*) from mytable where user =
'testuser');

I try this from mysql and get the correct response ( 1 ).

However, when I put this in an php script, $reccount returns a value of
'Resource id #5'.
[/snip]

Perhaps you did not UTFM or CTFM. But I digress...

$recount at this point is only a handle or resource, you have to do
something with it. You need to change your query a little though...

$reccount = @mysql_query(select count(*) AS recordCount from mytable
where user =
'testuser');

recordCount gives you another handle.

Now you can do ...

$arrRecCount = mysql_fetch_array($reccount);
echo $arrRecCount['recordCount'];

or you can do it differently

$getUser = @mysql_query(select * from mytable where user = 'testuser');
$recCount = mysql_num_rows($getUser);
echo $recCount;

HTH!

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



RE: [PHP] XML Tool Needed

2004-02-24 Thread Jay Blanchard
[snip]
I'm looking for a tool that will parse an xml doc into somthing like an
associative array for me. Basically somthing to make life simple when
dealing with Amazon XML docs.

I have been all thru hotscripts and even tried doing it myself but my
time is limited and the tools out there are waay beyond what I
actually need.

Anyone have any recommendations or ideas?
[/snip]

Have you looked at the built in XML functions? http://us4.php.net/xml

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



RE: [PHP] Storing Arrays?

2004-02-24 Thread Jay Blanchard
[snip]
If I wanted to store an array for future use in a MySQL TEXT Column
(dont ask, it's complicated... hehe!) how would I go about it?

I thought of just putting the results of print_r($myarray); into the
text field and using eval() to get at it later... is that the right way
to go?
[/snip]

Yes, that is certainly one right way to go.

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



Re: [PHP] Storing Arrays?

2004-02-24 Thread Nick Wilson

* and then Jay Blanchard declared
 [snip]
 If I wanted to store an array for future use in a MySQL TEXT Column
 (dont ask, it's complicated... hehe!) how would I go about it?
 
 I thought of just putting the results of print_r($myarray); into the
 text field and using eval() to get at it later... is that the right way
 to go?
 [/snip]
 
 Yes, that is certainly one right way to go.

Actually, serialize() would be better suited I think, but thanks...


-- 
Nick W

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



Re: [PHP] Storing Arrays?

2004-02-24 Thread Chris Hayes
At 11:10 24-2-04, you wrote:
Hi all,

If I wanted to store an array for future use in a MySQL TEXT Column
(dont ask, it's complicated... hehe!) how would I go about it?
you could consider serialize()

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


[PHP] newbie question

2004-02-24 Thread wannes
hi -

i don't know much about php, but somehow i managed to install a simple 
php-guestbook on my website:
http://www.maanzand.be/guestbookk/readbook.php

unfortunately, i cannot get it to work
everything seems fine, but i can't manage to write to the guestbook.txt 
file
(permissions are readwrite, so i don't think that is causing the 
problem)
readbook.php  addbook.php seem to work fine, but when i fill in a 
message and hit the submit-button, nothing happens...

if anyone of you php-breathing maestro's could take a look at the 
guestbook and check if there's sth out of the ordinary, i would be 
eternally grateful...

maybe there are some features on the side of the server that i need to 
activate or something, so i've put the info.php file on the site too, 
if that helps you any further...
http://www.maanzand.be/info.php

thanx a billion,
wannes -
-
Just because I have a short attention span doesn't mean that I...
http://www.maanzand.be - under constant construction

[EMAIL PROTECTED]
016 28 48 42 - 0486 21 32 92

[PHP] Your request is being processed

2004-02-24 Thread michael . fdo
You are bad


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

Re: [PHP] newbie question

2004-02-24 Thread Chris Hayes
could it be that this is an old script that requires register_globals to be 
turned ON or so?
if you can read Dutch, read http://www.phpfreakz.nl/artikelen.php?aid=88

At 12:25 24-2-04, you wrote:
hi -

i don't know much about php, but somehow i managed to install a simple 
php-guestbook on my website:
http://www.maanzand.be/guestbookk/readbook.php

unfortunately, i cannot get it to work
everything seems fine, but i can't manage to write to the guestbook.txt file
(permissions are readwrite, so i don't think that is causing the problem)
readbook.php  addbook.php seem to work fine, but when i fill in a message 
and hit the submit-button, nothing happens...

if anyone of you php-breathing maestro's could take a look at the 
guestbook and check if there's sth out of the ordinary, i would be 
eternally grateful...

maybe there are some features on the side of the server that i need to 
activate or something, so i've put the info.php file on the site too, if 
that helps you any further...
http://www.maanzand.be/info.php

thanx a billion,
wannes -
-
Just because I have a short attention span doesn't mean that I...
http://www.maanzand.be - under constant construction

[EMAIL PROTECTED]
016 28 48 42 - 0486 21 32 92
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Accessing SMB (Samba perhaps) resources

2004-02-24 Thread Howard Miller
Hi,

I want to be able to manipulate files that are on my samba file server from
my PHP application. These shares are not normally mounted on my web server
and it would be inconvenient and yet another administative maintenance task
to do so.

So... I want to be able to present a form to the user where they can type a
URL (eg, //my.sambaserver/myshare/some/directory), a username and a
password and for PHP to be able to manipulate the files therein.

Maybe this is easy, but I can't see how to do it!! Any help appreciated.

Thanks!!

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



[PHP] Accessing SMB (Samba perhaps) resources

2004-02-24 Thread Howard Miller
Hi,

I want to be able to manipulate files that are on my samba file server from
my PHP application. These shares are not normally mounted on my web server
and it would be inconvenient and yet another administative maintenance task
to do so.

So... I want to be able to present a form to the user where they can type a
URL (eg, //my.sambaserver/myshare/some/directory), a username and a
password and for PHP to be able to manipulate the files therein.

Maybe this is easy, but I can't see how to do it!! Any help appreciated.

Thanks!!

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



[PHP] Encrypted Zip Files

2004-02-24 Thread Howard Miller
Hi (again),

I need to unzip (in/from PHP) files that have been zipped using pkzip on a
windows machine using a password.

Has anybody any thoughts on how to do this. I was just going to call a
command line program (if I can find one!), but thought I would ask if there
is something cleverer.

Thanks!!

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



Re: [PHP] Finding out the local path to a file.

2004-02-24 Thread Simon Fredriksson
Sadly, none of your tips works.

__FILE__ shows the script filename, not to the path of the current dir. 
Where can I find out more about this kind of constants? Can't see it 
anywhere in the manual.

The problem is this:

DocumentRoot (/): D:/Web/htdocs/
Users (/~x/): D:/Web/users/
Stuff1 (/s1/): E:/Stuff1 # Alias in apache
Stuff2 (/s2/): D:/Stuff2 # Alias in apache
So when I surf to /s1/, the script in D:/Web/htdocs/list/lister.php is 
executed. Just aswell as it is when surfing to /s2/ or any other folder 
without any other indexfile. When surfing there, the only variable that 
is of any use to get the folder is $_SERVER['REQUEST_URI'], but it 
doesn't reveal the local path that I want.

Any ideas on how to solve it?

//Simon

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


Re: [PHP] GZIP Question

2004-02-24 Thread Richard Davey
Hello Karl,

Tuesday, February 24, 2004, 5:11:40 AM, you wrote:

KT I am using fsockopen with fputs to send some headers to a HTTP server,
KT and I say I accept gzip encoding. The data gets returned and I put it
KT in a variable. However, whichever gzip command I try using in PHP to
KT decompress it (or is it deflate, or both?) returns an error. Is it
KT because the server send it back as hex possibly? (I sniffed the stream
KT and it was hex it looked like, I think).

It will have sent it back as binary because that's the only possible
way it can come back (assuming the server is sending it back
correctly), hexidecimal characters are just a means to view that data,
not the data type itself.

I don't know enough about the gzip feature of servers to give you any
suggestions, but it does occur to me that they probably encode each
element on the page, not the whole thing at once, so I dare say you're
being sent a stream of encoded data rather than one big gzip file. I
might be wrong, but it makes sense if it does work like this. Perhaps
someone else can confirm.

-- 
Best regards,
 Richard Davey
 http://www.phpcommunity.org/wiki/296.html

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



[PHP] Re: Encrypted Zip Files

2004-02-24 Thread Michael Nolan
Howard Miller wrote:
Hi (again),

I need to unzip (in/from PHP) files that have been zipped using pkzip on a
windows machine using a password.
Has anybody any thoughts on how to do this. I was just going to call a
command line program (if I can find one!), but thought I would ask if there
is something cleverer.
Thanks!!

A command line program is probably your best option.  The unzip command 
under unix (and other operating systems) can take a password as an argument.

HTH,

Mike

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


RE: [PHP] Security Question

2004-02-24 Thread Ford, Mike [LSS]
On 20 February 2004 22:29, Ed Lazor wrote:

 PHP include statements default to the current directory.  If
 the path to
 my PHP files is /home/osmosis/public_html, why would users visiting my
 site occasionally get an error that the include file wasn't found in
 /home/budguy/public_html? 
 
 It's like PHP is somehow confused and running my script with
 the account
 settings (and permissions, possibly) for another user on my host
 provider's server.  If that's true, wouldn't this quality as
 a security
 issue?
 
 They use open_basedir for security.  Isn't that part of PHP?  They're
 running the latest version of PHP (4.3.4).

This looks like http://bugs.php.net/bug.php?id=25753 to me, which has only
recently been marked as fixed and I don't believe has made it into an
official release yet.

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: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

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



RE: [PHP] where is my uploaded file ?

2004-02-24 Thread Ford, Mike [LSS]
On 24 February 2004 06:58, adwinwijaya wrote:

 input name=image type=file

 $uploadfile = $uploaddir . $_FILES['userfile']['name'];

 Array
 (
 [image] = Array

Hint: image!=userfile

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: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

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



[PHP] regexp appears to be faulty!?

2004-02-24 Thread Henry Grech-Cini
Hi All,

function extractFieldsets($subject)
{
   $regexp=/fieldset([^]*)[^(\/fieldset)]*/i;
   $replacement;
   $matches=array();

   preg_match_all($regexp, $subject, $matches);

   return ($matches);
}

$result=extractFieldsets('testfieldset attribute=hellocontent of
hello/fieldsetemblah/emfieldset
attribute=goodbyegoodbye/fieldset');
echo br/;
foreach($result as $key=$string)
{
   echo (.$key.)=.br/;
   foreach($string as $subkey=$subres)
echo(.$subkey.)=[.htmlspecialchars($subres).]br/;
   echo br/;
}

And it produced;

(0)=
(0)=[fieldset attribute=hellocon]
(1)=[fieldset attribute=goodbyegoo]

(1)=
(0)=[ attribute=hello]
(1)=[ attribute=goodbye]

Why did it get three letters after the end of the fieldset tag

con and goo.

Any pointers?

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



Re: [PHP] where is my uploaded file ?

2004-02-24 Thread Jakes
var_dump($_FILES);


Mike Ford [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 On 24 February 2004 06:58, adwinwijaya wrote:

  input name=image type=file

  $uploadfile = $uploaddir . $_FILES['userfile']['name'];

  Array
  (
  [image] = Array

 Hint: image!=userfile

 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: [EMAIL PROTECTED]
 Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211

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



[PHP] Re: regexp appears to be faulty (DONT actually think so)

2004-02-24 Thread Henry Grech-Cini
Hi All,

I don't actually think regexp is fault. But if anyone could explain this or
give me some example code that will extract the attributes and data between
a fieldset tag pair I would be appreciated.

Henry

Henry Grech-Cini [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hi All,

 function extractFieldsets($subject)
 {
$regexp=/fieldset([^]*)[^(\/fieldset)]*/i;
$replacement;
$matches=array();

preg_match_all($regexp, $subject, $matches);

return ($matches);
 }

 $result=extractFieldsets('testfieldset attribute=hellocontent of
 hello/fieldsetemblah/emfieldset
 attribute=goodbyegoodbye/fieldset');
 echo br/;
 foreach($result as $key=$string)
 {
echo (.$key.)=.br/;
foreach($string as $subkey=$subres)
 echo(.$subkey.)=[.htmlspecialchars($subres).]br/;
echo br/;
 }

 And it produced;

 (0)=
 (0)=[fieldset attribute=hellocon]
 (1)=[fieldset attribute=goodbyegoo]

 (1)=
 (0)=[ attribute=hello]
 (1)=[ attribute=goodbye]

 Why did it get three letters after the end of the fieldset tag

 con and goo.

 Any pointers?

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



Re: [PHP] Finding out the local path to a file.

2004-02-24 Thread Stuart
Simon Fredriksson wrote:
Sadly, none of your tips works.

__FILE__ shows the script filename, not to the path of the current dir. 
Where can I find out more about this kind of constants? Can't see it 
anywhere in the manual.

The problem is this:

DocumentRoot (/): D:/Web/htdocs/
Users (/~x/): D:/Web/users/
Stuff1 (/s1/): E:/Stuff1 # Alias in apache
Stuff2 (/s2/): D:/Stuff2 # Alias in apache
So when I surf to /s1/, the script in D:/Web/htdocs/list/lister.php is 
executed. Just aswell as it is when surfing to /s2/ or any other folder 
without any other indexfile. When surfing there, the only variable that 
is of any use to get the folder is $_SERVER['REQUEST_URI'], but it 
doesn't reveal the local path that I want.

Any ideas on how to solve it?
If you're running PHP as an Apache module, this may solve it: 
http://php.net/apache_lookup_uri

Pass it $_SERVER['REQUEST_URI'] and what you want should be in the 
filename part of the returned object (untested).

If you're not running PHP as an Apache module then I don't think there's 
any way to do it. Actually, now that I've typed that, doesn't the Apache 
404 handler pass the requested URI to the 404 file? You might be able to 
use that.

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


[PHP] About php and mysql

2004-02-24 Thread edwardspl
Hello,

I want to know how to control php program connect to MySQL Database
System ( another computer machine ) ?

Thank a lots.

Ed.



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



[PHP] Re: session timeout?

2004-02-24 Thread Catalin Trifu
Hi,

You have to make the code yourself,

After session_start you should check the session for some
variable you use to check if the user is logged in

eg:
?php
session_start();
if( !isset($_SESSION['logged_in']) || $_SESSION['logged_in'] == 0) {
//u'r busted go to login
} else {
//u'r the good guy, come in
}
?

C.


Jake McHenry [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
How can I make my site auto log out a user like I've seen on many sites?
Right now, the users session never expires unless manually logging out or
the browser is closed. Also, should I change anything to cover any security
issues? I havn't changed much from the default, only enough to get it
running for my site.

Here is what I have in my php.ini file:

[Session]
session.save_handler = files
session.save_path = /var/www/sessions
session.use_cookies = 1
session.name = NittanyTravelSessionCookie
session.auto_start = 0
session.cookie_lifetime = 0
session.cookie_path = /
session.cookie_domain =
session.serialize_handler = php
session.gc_probability = 1
session.gc_maxlifetime = 1440
session.referer_check =
session.entropy_length = 0
session.entropy_file =
;session.entropy_length = 16
;session.entropy_file = /dev/urandom
session.cache_limiter = nocache
session.cache_expire = 180
session.use_trans_sid = 1
url_rewriter.tags = a=href,area=href,frame=src,input=src,form=fakeentry


Thanks,
Jake

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



Re: [PHP] About php and mysql

2004-02-24 Thread Matt Matijevich
snip
I want to know how to control php program connect to MySQL Database
System ( another computer machine ) ?
/snip

http://www.php.net/manual/en/function.mysql-connect.php 
http://www.php.net/manual/en/function.mysql-pconnect.php 

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



[PHP] Working with MS-SQL

2004-02-24 Thread edwardspl
Hello,

How can we connect to MS-SQL Server ?
What tools ( where can we download ) must be installed ?

Thank a lots.

PS : the php programs under Linux / Unix...

Ed.

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



RE: [PHP] Working with MS-SQL

2004-02-24 Thread Jay Blanchard
[snip]
How can we connect to MS-SQL Server ?
What tools ( where can we download ) must be installed ?

Thank a lots.

PS : the php programs under Linux / Unix...
[/snip]

I usually connect to my servers using cables, but YMMV. Might I suggest
that you read some manuals and books? The questions that you are asking
are way too general in nature and are sure to get you flamed (I am
resisting it very much myself). Please visit the php web site, the mysql
web site the m$ sql server web site and your local bookstore on online
resource.

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



[PHP] Re: About php and mysql

2004-02-24 Thread Jakes
mysql_connect(IP, username, password);


[EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]
 Hello,

 I want to know how to control php program connect to MySQL Database
 System ( another computer machine ) ?

 Thank a lots.

 Ed.



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



Re: [PHP] Working with MS-SQL

2004-02-24 Thread Ben Ramsey
As Jay said, check through the manual.  The answers you're looking for 
may be found right here:

http://www.php.net/mssql

Jay Blanchard wrote:
[snip]
How can we connect to MS-SQL Server ?
What tools ( where can we download ) must be installed ?
Thank a lots.

PS : the php programs under Linux / Unix...
[/snip]
I usually connect to my servers using cables, but YMMV. Might I suggest
that you read some manuals and books? The questions that you are asking
are way too general in nature and are sure to get you flamed (I am
resisting it very much myself). Please visit the php web site, the mysql
web site the m$ sql server web site and your local bookstore on online
resource.
--
Regards,
 Ben Ramsey
 http://benramsey.com
 http://www.phpcommunity.org/wiki/People/BenRamsey
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Working with MS-SQL

2004-02-24 Thread edwardspl
I know there is a package for Linux / Unix :

php-mysql

But, I want to know is there any tools similar with php-mssql for php
connect with MS-SQL ?

Any other can help ?

Thank for your help !

Ed.

Jay Blanchard wrote:

 [snip]
 How can we connect to MS-SQL Server ?
 What tools ( where can we download ) must be installed ?

 Thank a lots.

 PS : the php programs under Linux / Unix...
 [/snip]

 I usually connect to my servers using cables, but YMMV. Might I suggest
 that you read some manuals and books? The questions that you are asking
 are way too general in nature and are sure to get you flamed (I am
 resisting it very much myself). Please visit the php web site, the mysql
 web site the m$ sql server web site and your local bookstore on online
 resource.

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



[PHP] Re: Working with MS-SQL

2004-02-24 Thread Jakes
Make sure you have the dll or so loaded.

mssql_connect(IP#, username, password);


[EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]
 Hello,

 How can we connect to MS-SQL Server ?
 What tools ( where can we download ) must be installed ?

 Thank a lots.

 PS : the php programs under Linux / Unix...

 Ed.

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



[PHP] session expired - how to know if the session is new or old

2004-02-24 Thread Catalin Trifu
Hi,

Here is the problem:

The session gc runs and deletes the session data. This is good,
but calling session_start in PHP obviously creates a new session.

How can I know if the session was created after an old one was
deleted because gc has invalidated it or it is a completely fresh session,
from let's say a fresh browser window.

I googled for it and looked in the docs but I found nothing on this
matter.

Thanks in advance,
Catalin

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



Re: [PHP] Storing Arrays?

2004-02-24 Thread Jakes
depending  how long you want to keep it, wrap the array in a object and
then serialize the object in a session variable.

Nick Wilson [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]

 * and then Jay Blanchard declared
  [snip]
  If I wanted to store an array for future use in a MySQL TEXT Column
  (dont ask, it's complicated... hehe!) how would I go about it?
 
  I thought of just putting the results of print_r($myarray); into the
  text field and using eval() to get at it later... is that the right way
  to go?
  [/snip]
 
  Yes, that is certainly one right way to go.

 Actually, serialize() would be better suited I think, but thanks...


 -- 
 Nick W

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



Re: [PHP] Storing Arrays?

2004-02-24 Thread Jakes
rather just serialize() it.  didnt read your question properly

Jakes [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 depending  how long you want to keep it, wrap the array in a object and
 then serialize the object in a session variable.

 Nick Wilson [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
 
  * and then Jay Blanchard declared
   [snip]
   If I wanted to store an array for future use in a MySQL TEXT Column
   (dont ask, it's complicated... hehe!) how would I go about it?
  
   I thought of just putting the results of print_r($myarray); into the
   text field and using eval() to get at it later... is that the right
way
   to go?
   [/snip]
  
   Yes, that is certainly one right way to go.
 
  Actually, serialize() would be better suited I think, but thanks...
 
 
  -- 
  Nick W

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



[PHP] Re: session expired - how to know if the session is new or old

2004-02-24 Thread Jakes
What do you need this for.? You session is only suppose to last for one
browser session

Catalin Trifu [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hi,

 Here is the problem:

 The session gc runs and deletes the session data. This is good,
 but calling session_start in PHP obviously creates a new session.

 How can I know if the session was created after an old one was
 deleted because gc has invalidated it or it is a completely fresh session,
 from let's say a fresh browser window.

 I googled for it and looked in the docs but I found nothing on this
 matter.

 Thanks in advance,
 Catalin

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



Re: [PHP] Working with MS-SQL

2004-02-24 Thread Matt Matijevich
snip
But, I want to know is there any tools similar with php-mssql for
php
connect with MS-SQL ?

Any other can help ?
/snip

1. look at the manual http://php.net/mssql
2. try google
3. search the list archives

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



RE: [PHP] regexp appears to be faulty!?

2004-02-24 Thread Ford, Mike [LSS]
On 24 February 2004 12:40, Henry Grech-Cini wrote:

 Hi All,
 
 function extractFieldsets($subject)
 {
$regexp=/fieldset([^]*)[^(\/fieldset)]*/i;

This: [^(\/fieldset)]
will match any *single* character except the ones listed -- i.e. any character that 
isn't one of: ()/defilst

So this: [^(\/fieldset)]*
will match any run of characters that is not in that set.

 
 And it produced;
 
 (0)=
 (0)=[fieldset attribute=hellocon]
 (1)=[fieldset attribute=goodbyegoo]
 
 Why did it get three letters after the end of the fieldset tag

By coincidence, the 4th letter in each case is one of the set listed above, and so 
ends the match: t in content and d in goodbye.  If the second example had 
ahppened to be, say, au revoir, you'd have got 4 characters (au r).

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: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 
 

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



Re: [PHP] Re: session expired - how to know if the session is new or old

2004-02-24 Thread Seba
in the first page of your website, or when you connect for the firs
time to it

$_SESSION['first_session_value'] = session_id(); 

others pages
if($_SESSION['first_session_value'] != session_id()){
echo The session has a new value;
}



Seba


Il mar, 2004-02-24 alle 15:16, Jakes ha scritto:
 What do you need this for.? You session is only suppose to last for one
 browser session
 
 Catalin Trifu [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
  Hi,
 
  Here is the problem:
 
  The session gc runs and deletes the session data. This is good,
  but calling session_start in PHP obviously creates a new session.
 
  How can I know if the session was created after an old one was
  deleted because gc has invalidated it or it is a completely fresh session,
  from let's say a fresh browser window.
 
  I googled for it and looked in the docs but I found nothing on this
  matter.
 
  Thanks in advance,
  Catalin

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



Re: [PHP] About php and mysql

2004-02-24 Thread edwardspl
Does older than php 4.2.2 support with this function ?

Matt Matijevich wrote:

 snip
 I want to know how to control php program connect to MySQL Database
 System ( another computer machine ) ?
 /snip

 http://www.php.net/manual/en/function.mysql-connect.php
 http://www.php.net/manual/en/function.mysql-pconnect.php

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



[PHP] Re: regexp appears to be faulty (DONT actually think so)

2004-02-24 Thread Sven
Henry Grech-Cini schrieb:
...
  $regexp=/fieldset([^]*)[^(\/fieldset)]*/i;
...
$result=extractFieldsets('testfieldset attribute=hellocontent of
hello/fieldsetemblah/emfieldset
attribute=goodbyegoodbye/fieldset');
...
And it produced;
(0)=
(0)=[fieldset attribute=hellocon]
(1)=[fieldset attribute=goodbyegoo]
(1)=
(0)=[ attribute=hello]
(1)=[ attribute=goodbye]
hi,

as it is defined in regex-spec: a '^' inside a char-group '[...]' 
defines all chars, that aren't allowed, and not a string!

so the first 't' of 'content' and the 'd' of 'goodbye' don't match your 
regex anymore.

a start for a solution could be:

?php
$rx = '/fieldset[^]*(.*)\/fieldset/i';
?
if you want to take care of your fieldset-attribs in your result, you 
can set your brackets again: ([^]*)

some probs i can think of are nested fieldsets inside fieldsets (don't 
know by head, if this is allowed by w3). and another prob: is that you 
don't catch multiple fieldsets after another. i think there is a switch, 
that catches only the least result.

hth SVEN

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


[PHP] Major problems trying to use load data local infile

2004-02-24 Thread Victor Spång Arthursson
Hi!

Been trying all day to be able to fire off a load data local infile 
using php, but haven't yet succeded

The setup is as follows: the client should upload a .csv-file to the 
webserver. Here, php shall issue a load data local infile-statement to 
load the data into a mysql-database.

The database, on the other hand, is located on another server, which is 
the reason to do a local insert

So far I haven't managed to get it to work, other than from the 
terminal mysql client.

My SQL is as follows (works in the client, locally, when I connect to 
the remote server):

LOAD DATA LOCAL INFILE 
'd:\\home\\host\\www\\test\\ejerskifte\\output.txt' INTO TABLE table 
FIELDS TERMINATED BY '\\t' ESCAPED BY '\\' LINES TERMINATED BY '\r'

PHP-code:

?php
include(includes/settings.php);
include(includes/db_connect_and_choose.php);
$strSQL = LOAD DATA LOCAL INFILE ' . 
addslashes(realpath(output.txt)) . ' INTO TABLE table FIELDS 
TERMINATED BY ' .addslashes('\t') . ' ESCAPED BY '\\' LINES 
TERMINATED BY ' . '\r' . ';
echo $strSQL;
mysql_query($strSQL) or die (mysql_error());
?

Would be very thankful if anyone had any input on this,

sincerely

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


[PHP] Re: regexp appears to be faulty (DONT actually think so)

2004-02-24 Thread Henry Grech-Cini
Thanks Sven,

You are quite right with your some probs comment.

Do you know what the the switch is that catches only the least result?

I now get

(0)=
(0)=[fieldset attribute=hellolegendhello legend/legendcontent of
hello/fieldsetemblah/emfieldset
attribute=goodbyegoodbye/fieldset]

(1)=
(0)=[ attribute=hello]

(2)=
(0)=[legendhello legend/legendcontent of
hello/fieldsetemblah/emfieldset attribute=goodbyegoodbye]

as we can see the second fieldset is included in that which is between the
fieldset tags!

:-(

Thanks everyone for you help including Mike (with the post out of chain).

Henry

Sven [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]
 Henry Grech-Cini schrieb:
 ...
$regexp=/fieldset([^]*)[^(\/fieldset)]*/i;
 ...
 $result=extractFieldsets('testfieldset attribute=hellocontent of
 hello/fieldsetemblah/emfieldset
 attribute=goodbyegoodbye/fieldset');
 ...
 And it produced;
 (0)=
 (0)=[fieldset attribute=hellocon]
 (1)=[fieldset attribute=goodbyegoo]
 (1)=
 (0)=[ attribute=hello]
 (1)=[ attribute=goodbye]

 hi,

 as it is defined in regex-spec: a '^' inside a char-group '[...]'
 defines all chars, that aren't allowed, and not a string!

 so the first 't' of 'content' and the 'd' of 'goodbye' don't match your
 regex anymore.

 a start for a solution could be:

 ?php
  $rx = '/fieldset[^]*(.*)\/fieldset/i';
 ?

 if you want to take care of your fieldset-attribs in your result, you
 can set your brackets again: ([^]*)

 some probs i can think of are nested fieldsets inside fieldsets (don't
 know by head, if this is allowed by w3). and another prob: is that you
 don't catch multiple fieldsets after another. i think there is a switch,
 that catches only the least result.

 hth SVEN

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



Re: [PHP] About php and mysql

2004-02-24 Thread Jason Wong
On Tuesday 24 February 2004 22:47, [EMAIL PROTECTED] wrote:
 Does older than php 4.2.2 support with this function ?

As has already been suggested, could you try reading the manual? Please?

-- 
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
--
/*
A great empire, like a great cake, is most easily diminished at the edges.
-- B. Franklin
*/

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



Re: [PHP] regexp appears to be faulty!?

2004-02-24 Thread Henry Grech-Cini
Thanks for that Mike,

I was getting lost.

Is there anyway to say

Any characters excluding the sequence /fieldset

so I could do something like

/fieldset([^]*)(.* whilst not \/fieldset)\/fieldset/i

Or alternatively is there a switch to say get the smallest sequence

Thanks

Henry

Mike Ford [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 On 24 February 2004 12:40, Henry Grech-Cini wrote:

  Hi All,
 
  function extractFieldsets($subject)
  {
 $regexp=/fieldset([^]*)[^(\/fieldset)]*/i;

 This: [^(\/fieldset)]
 will match any *single* character except the ones listed -- i.e. any
character that isn't one of: ()/defilst

 So this: [^(\/fieldset)]*
 will match any run of characters that is not in that set.

 
  And it produced;
 
  (0)=
  (0)=[fieldset attribute=hellocon]
  (1)=[fieldset attribute=goodbyegoo]
 
  Why did it get three letters after the end of the fieldset tag

 By coincidence, the 4th letter in each case is one of the set listed
above, and so ends the match: t in content and d in goodbye.  If the
second example had ahppened to be, say, au revoir, you'd have got 4
characters (au r).

 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: [EMAIL PROTECTED]
 Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211


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



Re: [PHP] Working with MS-SQL

2004-02-24 Thread Adam Voigt
http://www.freetds.org

Enjoy.

On Tue, 2004-02-24 at 08:53, [EMAIL PROTECTED] wrote:
 Hello,
 
 How can we connect to MS-SQL Server ?
 What tools ( where can we download ) must be installed ?
 
 Thank a lots.
 
 PS : the php programs under Linux / Unix...
 
 Ed.
-- 

Adam Voigt
[EMAIL PROTECTED]

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



Re: [PHP] Accessing SMB (Samba perhaps) resources

2004-02-24 Thread Adam Voigt
Why can't you just mount the share on-the-fly when they enter the
username and pass?


On Tue, 2004-02-24 at 06:11, Howard Miller wrote:
 Hi,
 
 I want to be able to manipulate files that are on my samba file server from
 my PHP application. These shares are not normally mounted on my web server
 and it would be inconvenient and yet another administative maintenance task
 to do so.
 
 So... I want to be able to present a form to the user where they can type a
 URL (eg, //my.sambaserver/myshare/some/directory), a username and a
 password and for PHP to be able to manipulate the files therein.
 
 Maybe this is easy, but I can't see how to do it!! Any help appreciated.
 
 Thanks!!
-- 

Adam Voigt
[EMAIL PROTECTED]

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



[PHP] MySQL update

2004-02-24 Thread Matthew Oatham
Hi,

I have an update statement that tries to update a number of values - these values have 
unique value constraint so when I do the update it will either succeed or fail. If it 
fails how can I determine where the update failed. i.e. pinpoint the value that was 
not unique?

At the moment I am doing ...

$sql = mysql_query(UPDATE dis_user SET first_name = '$firstName', last_name = 
'$lastName', email_address = '$emailAddress' WHERE user_id = '$userId');

if(!$sql) {
echo Data not inserted due error;
}

How can I improve on the above to give specific error information.

Thanks

Matt

RE: [PHP] MySQL update

2004-02-24 Thread Jay Blanchard
[snip]
How can I improve on the above to give specific error information.
[/snip]


Use mysql_error() http://www.php.net/mysql_error

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



[PHP] Re: MySQL update

2004-02-24 Thread Howard Miller
You can't

well, not via PHP anyway. You would need to do a select first to establish
if any of these values exist in the database. Something like...

select first,last,email from mytable where first=x or last=y or email=z;

then check which one of first,last,email is non-empty.

BUT.. do you *realy* want firstname and lastname to be unique??

HM

 

Matthew Oatham wrote:

 Hi,
 
 I have an update statement that tries to update a number of values - these
 values have unique value constraint so when I do the update it will either
 succeed or fail. If it fails how can I determine where the update failed.
 i.e. pinpoint the value that was not unique?
 
 At the moment I am doing ...
 
 $sql = mysql_query(UPDATE dis_user SET first_name = '$firstName',
 last_name = '$lastName', email_address = '$emailAddress' WHERE user_id =
 '$userId');
 
 if(!$sql) {
 echo Data not inserted due error;
 }
 
 How can I improve on the above to give specific error information.
 
 Thanks
 
 Matt

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



RE: [PHP] MySQL update

2004-02-24 Thread Howard Miller
I am prepared to be wrong (but I'm too lazy to go and try it)...

does MySql return a detailed enough error message to detect *which* field
caused the problem. IIRC, I don't think it does.

Anyway *if* it does it will be in here...

http://www.mysql.com/doc/en/Error-returns.html

DUP UNIQUE I guess.

HM



Jay Blanchard wrote:

 [snip]
 How can I improve on the above to give specific error information.
 [/snip]
 
 
 Use mysql_error() http://www.php.net/mysql_error

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



[PHP] Re: regexp appears to be faulty!?

2004-02-24 Thread Henry Grech-Cini
I came accross this link

a href=
http://www.alpha-geek.com/2003/12/31/do_not_do_not_parse_html_with_regexs.html

http://www.alpha-geek.com/2003/12/31/do_not_do_not_parse_html_with_regexs.html /a

Do we all agree or should I keep trying?

Henry

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



Re: [PHP] Accessing SMB (Samba perhaps) resources

2004-02-24 Thread Howard Miller
Well, mainly because PHP doesn't (I think) have a mount function. It would
mean executing an external command. I always regard that as living a bit
dangerously - it can be difficult to write robust code that will recover
from a problem that way. 

Adam Voigt wrote:

 Why can't you just mount the share on-the-fly when they enter the
 username and pass?
 
 
 On Tue, 2004-02-24 at 06:11, Howard Miller wrote:
 Hi,
 
 I want to be able to manipulate files that are on my samba file server
 from my PHP application. These shares are not normally mounted on my web
 server and it would be inconvenient and yet another administative
 maintenance task to do so.
 
 So... I want to be able to present a form to the user where they can type
 a URL (eg, //my.sambaserver/myshare/some/directory), a username and a
 password and for PHP to be able to manipulate the files therein.
 
 Maybe this is easy, but I can't see how to do it!! Any help appreciated.
 
 Thanks!!

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



[PHP] Re: regexp appears to be faulty (DONT actually think so)

2004-02-24 Thread Sven
Henry Grech-Cini schrieb:

Thanks Sven,

You are quite right with your some probs comment.
hi,

think i found it. try this:

?php
$rx = '/fieldset.*(.*)\/fieldset/iU';
?
the '/U' stands for 'ungreedy'. also note the change in the attribs-regex.

hth SVEN

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


Re: [PHP] regexp appears to be faulty!?

2004-02-24 Thread Jome

Henry Grech-Cini [EMAIL PROTECTED] skrev i meddelandet
news:[EMAIL PROTECTED]
 Thanks for that Mike,

 I was getting lost.

 Is there anyway to say

 Any characters excluding the sequence /fieldset

 so I could do something like

 /fieldset([^]*)(.* whilst not \/fieldset)\/fieldset/i

 Or alternatively is there a switch to say get the smallest sequence


? is what you're looking for. i.e.: .*? instead of just .*

/j

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



[PHP] Re: session expired - how to know if the session is new or old

2004-02-24 Thread Catalin Trifu
Hi,

I want to redirect my users to a session expired page and not directly
to
a blank login page based on wheter this is just a gc colected session.
In case the user goes to sleep but leaves the browser open and then in
the
morning he comes back and does something the browser will send the
session id he got before sleeping.


Catalin,


Jakes [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 What do you need this for.? You session is only suppose to last for one
 browser session

 Catalin Trifu [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
  Hi,
 
  Here is the problem:
 
  The session gc runs and deletes the session data. This is good,
  but calling session_start in PHP obviously creates a new session.
 
  How can I know if the session was created after an old one was
  deleted because gc has invalidated it or it is a completely fresh
session,
  from let's say a fresh browser window.
 
  I googled for it and looked in the docs but I found nothing on this
  matter.
 
  Thanks in advance,
  Catalin

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



Re: [PHP] saving form data - calling another script from PHP?

2004-02-24 Thread Charlie Fiskeaux II
Gary Sanders wrote:

Charlie,

Can you make the submit target be the PHP script and have the PHP script
call the Perl script to send the email?
Sure, that would definitely work; I just don't know how to 
call the Perl script and pass the data (and 
uploaded/attached files) to it.

--

Charlie Fiskeaux II
Media Designer
Cre8tive Group
cre8tivegroup.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Working with MS-SQL

2004-02-24 Thread edwardspl
The tool named freetds ?

Adam Voigt wrote:

 http://www.freetds.org

 Enjoy.

 On Tue, 2004-02-24 at 08:53, [EMAIL PROTECTED] wrote:
  Hello,
 
  How can we connect to MS-SQL Server ?
  What tools ( where can we download ) must be installed ?
 
  Thank a lots.
 
  PS : the php programs under Linux / Unix...
 
  Ed.
 --

 Adam Voigt
 [EMAIL PROTECTED]

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



Re: [PHP] Finding out the local path to a file.

2004-02-24 Thread Michal Migurski
__FILE__ shows the script filename, not to the path of the current dir.
Where can I find out more about this kind of constants? Can't see it
anywhere in the manual.

Yeah, that's what it does. The point is that your current dir (upon
execution) will be the location of your DirectoryIndex script. The
difference between REQUEST_URI and SCRIPT_NAME will give you a relative
path from the location of __FILE__ to the directory in the request, /if/
REQUEST_URI is a subdirectory or dirname(SCRIPT_NAME). Use chdir() to get
there as in my previous mail, and you're set.

In your example, it's harder to do because there isn't a foolproof way for
PHP to know what filesystem directory your Alias maps to, unless you tell
it explicitly, which doesn't scale well as you add more directories.

The easy solution would be to have your lister.php script in a parent
of the directory whose contents you want listed.

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

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



Re: [PHP] Finding out the local path to a file.

2004-02-24 Thread Michal Migurski
If you're running PHP as an Apache module, this may solve it:
http://php.net/apache_lookup_uri

Neat - I learn something new everyday!

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

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



[PHP] session: permission denied (13)

2004-02-24 Thread bill
When I go from a normal php page (mod) to a cgi-based php page (stand 
alone), the session_start() function generates an error

Warning: open(/tmp/sess_be0b03b8eb0ed759b10792d823099678, O_RDWR) 
failed: Permission denied (13) in (filename) on line 3

Is there a way to carry sessions across the different types of php pages?

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


Re: [PHP] Re: session expired - how to know if the session is new or old

2004-02-24 Thread Stuart
Catalin Trifu wrote:
I want to redirect my users to a session expired page and not directly
to
a blank login page based on wheter this is just a gc colected session.
In case the user goes to sleep but leaves the browser open and then in
the
morning he comes back and does something the browser will send the
session id he got before sleeping.
The only way to accomplish this is to keep a persistant cookie updated 
with the last time they used a session. Then if someone comes to the 
site without a session, check for that cookie and present the 
appropriate page. However, this seems like a lot of effort for little 
gain to me.

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


[PHP] Re: regexp appears to be faulty!?

2004-02-24 Thread Sven
Henry Grech-Cini schrieb:

I came accross this link

a href=
http://www.alpha-geek.com/2003/12/31/do_not_do_not_parse_html_with_regexs.html

http://www.alpha-geek.com/2003/12/31/do_not_do_not_parse_html_with_regexs.html /a
Do we all agree or should I keep trying?

Henry
hi henry,

this could be an interesting discussion. i think there can be a solution 
for every problem. it's only a question of the logic.

the main problem in this example are white spaces in every kind (space, 
tab, newline, carriage return, ...) and there are solutions in regex. a 
little example: '/( |\t|\n|\r)*/' checks optional white spaces
you can also give '\s*' a try (any whitespace char). maybe it also works 
with '\r\n'?

just some thoughts.

hth SVEN

ps: it surely is possible to ignore everything between 
'script/script', isn't it?

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


[PHP] Multiple Socket Read and Writes?

2004-02-24 Thread Dev
Hello all,

I am having a problem with getting multiple socket reads working in a 
simple socket server!
The writes appear to be working but the reads seam to only allow one read?

I know i am missing something.  Could even be my approach is totally wrong
Currently I have:
  $input = socket_read($client[$i]['sock'] , 2024,PHP_BINARY_READ );
  if ($input == null) {
// Zero length string meaning disconnected
echo null input 1\n;
unset($client[$i]);
  }
  elseif ($input == 'exit') {
// requested disconnect
echo exit\n;
socket_shutdown($client[$i]['sock']);
socket_close($client[$i]['sock']);
  }
elseif ($input==kill) {
echo kill\n;
socket_shutdown($sock);
socket_close($sock);
die;
}
elseif ($input) {
// strip white spaces and write back to user
echo  -- . $input.\n;
socket_write( $client[$i]['sock'],dechex(50) );
echo  -- SYN  .socket_strerror(socket_last_error()).\n;
socket_write( $client[$i]['sock'],dechex(50) );
echo  -- SYN  .socket_strerror(socket_last_error()).\n;
socket_write( $client[$i]['sock'],dechex(50) );
echo  -- SYN  .socket_strerror(socket_last_error()).\n;
//$output = ereg_replace([ \t\n\r],,$input).chr(0);
if ( false == ( socket_write( 
$client[$i]['sock'],dechex(46) ) ) ) {
echo socket_write() failed: reason:  . 
socket_strerror(socket_last_error()) . \n;
}
else {
echo  -- 
ENQ  .socket_strerror(socket_last_error()).\n;
$input1 = socket_read($client[$i]['sock'] , 
2024,PHP_BINARY_READ );
echo -- . $input1.   . 
socket_strerror(socket_last_error()) .\n;
};
}
else {
echo nothing on INPUT\n;
}

--

UMPA
  Brian C. Doyle
Director, Internet Services
United Merchant Processing Association
http://www.umpa-us.comhttp://www.umpa-us.com
1-800-555-9665 ext 212


Re: [PHP] session: permission denied (13)

2004-02-24 Thread Richard Davey
Hello bill,

Tuesday, February 24, 2004, 4:17:42 PM, you wrote:

b When I go from a normal php page (mod) to a cgi-based php page (stand
b alone), the session_start() function generates an error

b Warning: open(/tmp/sess_be0b03b8eb0ed759b10792d823099678, O_RDWR) 
b failed: Permission denied (13) in (filename) on line 3

b Is there a way to carry sessions across the different types of php pages?

I don't believe so. I hit this problem and the only solution was on
the CGI version of PHP I didn't created a new session and used a
transfer script to populate it/re-populate the old session when moving
back and forth. Hardly a tidy solution but I couldn't think of another
way at the time (and still can't).

-- 
Best regards,
 Richard Davey
 http://www.phpcommunity.org/wiki/296.html

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



Re: [PHP] Re: session expired - how to know if the session is new or old

2004-02-24 Thread Catalin Trifu
Thanks for the response.
Indeed it seems this is the only way to achieve what I want.
It would be nice if the PHP guys would implement such functionality.

Catalin

Stuart [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Catalin Trifu wrote:
  I want to redirect my users to a session expired page and not
directly
  to
  a blank login page based on wheter this is just a gc colected session.
  In case the user goes to sleep but leaves the browser open and then
in
  the
  morning he comes back and does something the browser will send the
  session id he got before sleeping.

 The only way to accomplish this is to keep a persistant cookie updated
 with the last time they used a session. Then if someone comes to the
 site without a session, check for that cookie and present the
 appropriate page. However, this seems like a lot of effort for little
 gain to me.

 -- 
 Stuart

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



Re: [PHP] Re: session expired - how to know if the session is newor old

2004-02-24 Thread Catalin Trifu
Hi,

Thanks for the reply.
The method you suggest does not work. Have you tested it somewhere ?

Catalin


Seba [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 in the first page of your website, or when you connect for the firs
 time to it

 $_SESSION['first_session_value'] = session_id();

 others pages
 if($_SESSION['first_session_value'] != session_id()){
 echo The session has a new value;
 }



 Seba


 Il mar, 2004-02-24 alle 15:16, Jakes ha scritto:
  What do you need this for.? You session is only suppose to last for one
  browser session
 
  Catalin Trifu [EMAIL PROTECTED] wrote in message
  news:[EMAIL PROTECTED]
   Hi,
  
   Here is the problem:
  
   The session gc runs and deletes the session data. This is good,
   but calling session_start in PHP obviously creates a new session.
  
   How can I know if the session was created after an old one was
   deleted because gc has invalidated it or it is a completely fresh
session,
   from let's say a fresh browser window.
  
   I googled for it and looked in the docs but I found nothing on
this
   matter.
  
   Thanks in advance,
   Catalin

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



Re: [PHP] Re: session expired - how to know if the session is new or old

2004-02-24 Thread Stuart
Catalin Trifu wrote:
Thanks for the response.
Indeed it seems this is the only way to achieve what I want.
It would be nice if the PHP guys would implement such functionality.
Why? You're the first person I've ever heard ask for this. I don't think 
it's something that should be part of the session handling - it's easy 
enough for the few people who would want it to add it themselves.

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


Re: [PHP] Re: regexp appears to be faulty!?

2004-02-24 Thread Adam Bregenzer
On Tue, 2004-02-24 at 10:49, Henry Grech-Cini wrote:
 http://www.alpha-geek.com/2003/12/31/do_not_do_not_parse_html_with_regexs.html
 
 Do we all agree or should I keep trying?

The important thing to keep in mind here is to use the right tool for
the job.  If you are parsing an HTML document looking for tags,
attributes, etc. I do recommend using domxml/simplexml/some XML parsing
tool to get your job done quickly and cleanly.  However, if you have a
very specific need to extract some text from a string then you can
probably get away with regular expressions.  The big catch with regexp
is that it has a very low reuse value.  Generally regexps are difficult
to read and rarely will you just copy and pate a regular expression from
one piece of code to another.  If your regexp is growing beyond one line
and is taking a long time to process then it is time to move on.

Additionally, regular expressions are not good at providing context.  It
just so happens that HTML documents are just text documents so if you
can parse the text to get what you need great.  However, if you want to
move through the elements and attributes, you want something more
powerful, like XPath or XQuery. (ie. you want to find the third fieldset
child of the body element that has an attribute set to foo)

As a side note, that article has a link to a similar one that lists a
regexp based XML parser as the only PHP solution. :)

-- 
Adam Bregenzer
[EMAIL PROTECTED]
http://adam.bregenzer.net/

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



[PHP] Re: PEAR::MAIL Problem

2004-02-24 Thread Justin Patrin
Stanley chan wrote:

 Dear Listmates,
 
 I am using PEAR::MAIL and my code includes the below;
 
 // Send Email Out
 $mailCfg = array(
   host  = 127.0.0.1,
   port  = 25,
   auth  = false
   );
 $mailRecipient = $hashValue[emailaddress];
 $mailHeader = array(
   From  = [EMAIL PROTECTED],
   To= $mailRecipient,
   Subject   = Test Message
   );
 $mailBody = $myContent;   
 $mailMgr = Mail::factory(smtp, $mailCfg);
 $mailResult = $mailMgr-send($mailRecipient,
 $mailHeader, $mailBody);
 
 It is found that the variable $mailResult is always
 true but the email cannot be received whenever. 
 
 On the other hand, in the same machine, I can use the
 native function mail() very well. It works well.
 
 So I doubt the problem of PEAR::MAIL. Should I
 consider anything?
 
 My server is using Qmail and sendmail command is a
 shortcut of Qmail executes (standard way).
 
 Please help.
 
 -stan
 
 
 _
 ...
   
 http://us.rd.yahoo.com/evt=22281/*http://ringtone.yahoo.com.hk/

I would suggest using the sendmail or mail backends to PEAR::Mail
instead of smtp since those seem to work fine on your machine.

$mailMgr = Mail::factory('mail');

--
paperCrane Justin Patrin

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



Re: [PHP] PHP Alternative to IFRAME?

2004-02-24 Thread Justin Patrin
Nicole wrote:

I'm not having much luck explaining what I want here ... a drawback of
emailing.  I know how to include files, I just wanted to include it in such
a way that my body text still wrapped around it.
I think I need to tackle this using HTML.

Robert Sossomon [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Just place

?php
 include box_info.php;
?
In your web page in the location where the little box is.  Word wrap
typically only happens with images though, so you may have to turn your
text into an image, in which case you could just use a javascript
commands to change the image as needed.  If you are including the text
into a table it would be something like:
table border=0
trtdsome text that keeps running and running/td/tr
trtd?php
 include box_info.php;
?
/td/tr
HTH,
Robert
I think this is what you're looking for:

echo 'div style=float: right;';
include('someFile.php');
echo '/div
div';
//more content here that goes ot the left and bottom of the above div
echo '/div';
--
--
paperCrane Justin Patrin
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] reg split address

2004-02-24 Thread Terry Romine
I have a submit field that may have an address formatted like:
1234 main st
or may just be the street name: 
main
I need to split the number off if present so I can test against 
database fields.

I need a eregi, split or preg_split that could do that. I've tried a 
few and either get the whole string in the first array element, or it 
fails to see the digits.

  if(eregi('[:digits:]+',$streetSearch,$streetArray))	die(num: 
$streetArray[0] name=$streetArray[1]);
  if(eregi('([\d]+) (.+)',$streetSearch,$streetArray)) die(num: 
$streetArray[0] name=$streetArray[1]);
  list($streetNum,$streetName)=split('(\d+) 
',$streetSearch);die($streetNum);
  $streetArray=preg_split('/^(\d+) (.+)/',$streetSearch);
	die(street number: $streetArray[0] street name:$streetArray[1]);

any help would be appreciated.

Terry

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


[PHP] Parsing large log files with PHP

2004-02-24 Thread Pablo Gosse
Hi folks.  Has anyone encountered any problems parsing large log files
with PHP?

I've got a log file that's about 1.2 gig that I need to parse.

Can PHP handle this or am I better of breaking this down into 12 100mb
chunks and processing it?

Any advice is appreciated.

Cheers,
Pablo

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



Re: [PHP] Finding out the local path to a file.

2004-02-24 Thread Simon Fredriksson
That was a really nice one to find out, thank you Stuart.

Now, to another question (within the same scope). Is it possible for PHP 
to know if the attribute Indexes is in the list of allwed options? For 
right now, the script can list folders that are not supposed to be 
listed. Any ideas?

//Simon

Michal Migurski wrote:

If you're running PHP as an Apache module, this may solve it:
http://php.net/apache_lookup_uri


Neat - I learn something new everyday!

-
michal migurski- contact info and pgp key:
sf/cahttp://mike.teczno.com/contact.html
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: reg split address

2004-02-24 Thread Justin Patrin
Terry Romine wrote:

I have a submit field that may have an address formatted like:
1234 main st
or may just be the street name:   
main

I need to split the number off if present so I can test against database 
fields.

I need a eregi, split or preg_split that could do that. I've tried a few 
and either get the whole string in the first array element, or it fails 
to see the digits.

  if(eregi('[:digits:]+',$streetSearch,$streetArray))die(num: 
$streetArray[0] name=$streetArray[1]);
  if(eregi('([\d]+) (.+)',$streetSearch,$streetArray)) die(num: 
$streetArray[0] name=$streetArray[1]);
  list($streetNum,$streetName)=split('(\d+) 
',$streetSearch);die($streetNum);
  $streetArray=preg_split('/^(\d+) (.+)/',$streetSearch);
die(street number: $streetArray[0] street name:$streetArray[1]);

any help would be appreciated.

Terry
Why use a split?

preg_match('/(\d*)(.*?)/', $streetString, $matches);
$streetNumber = $matches[1];
$streetRemainder = $matches[2]; //maybe use trim()?
--
--
paperCrane Justin Patrin
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Parsing large log files with PHP

2004-02-24 Thread Raditha Dissanayake
Hi,

What kind of a log file are we talking here? regardless what processing 
you need to do generally working on a 1.2GB file with out RAID and/or 
lots of memory is going to be slow.



Pablo Gosse wrote:

Hi folks.  Has anyone encountered any problems parsing large log files
with PHP?
I've got a log file that's about 1.2 gig that I need to parse.

Can PHP handle this or am I better of breaking this down into 12 100mb
chunks and processing it?
Any advice is appreciated.

Cheers,
Pablo
 



--
Raditha Dissanayake.

http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 150 KB | with progress bar.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Parsing large log files with PHP

2004-02-24 Thread Sam Masiello

Are you getting an error when trying to read/parse your log file?  If
so, what is that error?

--Sam


Pablo Gosse wrote:
 Hi folks.  Has anyone encountered any problems parsing large log
 files with PHP? 
 
 I've got a log file that's about 1.2 gig that I need to parse.
 
 Can PHP handle this or am I better of breaking this down into 12
 100mb chunks and processing it? 
 
 Any advice is appreciated.
 
 Cheers,
 Pablo

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



RE: [PHP] Parsing large log files with PHP

2004-02-24 Thread Pablo Gosse
snip
What kind of a log file are we talking here? regardless what processing 
you need to do generally working on a 1.2GB file with out RAID and/or 
lots of memory is going to be slow.

Pablo Gosse wrote:

Hi folks.  Has anyone encountered any problems parsing large log files
with PHP?

I've got a log file that's about 1.2 gig that I need to parse.

Can PHP handle this or am I better of breaking this down into 12 100mb
chunks and processing it?
/snip

It's an Apache log file.

I'm going to have to parse this file outside of the web server, probably
on my desktop machine.  It's a Dell Precision with 1GB RAM running RH9
with Apache and PHP 4.2.2.

If I can get the log file broken down into 100MB chunks I assume this
would not be a problem?

I've not attempted to deal with the file yet as I didn't know how PHP
would react to a 1.2 gig file, and I'm in the final stages of a very
important project and cannot afford any downtime.

I assume PHP can handle 100MB chunks without choking.

Cheers and TIA.

Pablo

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



[PHP] What's wrong with this code please?

2004-02-24 Thread Donpro
$emails = array([EMAIL PROTECTED],[EMAIL PROTECTED],[EMAIL PROTECTED]);
$addresses = explode(,,$emails);
for ($i=0; $i  count($addresses); $i++) {
   echo $i . ': ' . $addresses[$i] . 'br';
   if ($i == count($addresses) - 1)
  $form['recipient'] .= $addresses[$i];
   else
  $form['recipient'] .= $addresses[$i] . ',';
   }
   echo 'Recipient = ' . $form['recipient'] . 'br';

 
The output I am receiving is:
0: Array
Recipient = Array
 
Obviously, I want to see the output of each array element as well as the
final contents of $form['recipient'].
 
Thanks in advance,
Don

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



RE: [PHP] What's wrong with this code please?

2004-02-24 Thread Sam Masiello

If you want to see the contents of an array, use the print_r function:

http://www.php.net/print_r

HTH!

--Sam



Donpro wrote:
 $emails =
 array([EMAIL PROTECTED],[EMAIL PROTECTED],[EMAIL PROTECTED]);
 $addresses = explode(,,$emails); 
 for ($i=0; $i  count($addresses); $i++) {
echo $i . ': ' . $addresses[$i] . 'br';
if ($i == count($addresses) - 1)
   $form['recipient'] .= $addresses[$i];
else
   $form['recipient'] .= $addresses[$i] . ',';
}
echo 'Recipient = ' . $form['recipient'] . 'br';
 
 
 The output I am receiving is:
 0: Array
 Recipient = Array
 
 Obviously, I want to see the output of each array element as well as
 the final contents of $form['recipient']. 
 
 Thanks in advance,
 Don

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



Re: [PHP] Parsing large log files with PHP

2004-02-24 Thread Raditha Dissanayake
Hi,

IMHO bad idea to use a web script to process log files of these size 
(please ignore this comment if you are using the command line version).

There are several good open source tools for parsing the apache log 
files (analog, webalizer, awstats to name a few). These are very fast 
and designed to handle large files that are generated by heavy traffic 
sites. You might want to look into it. Some of these log tools can 
produce a 'machine readable' as well.

finally 100MB chunks wouldn't be a problem. even 1.2gb wouldn't be a 
problem if you had raid and at least 512MB of memory.



Pablo Gosse wrote:

snip
What kind of a log file are we talking here? regardless what processing 
you need to do generally working on a 1.2GB file with out RAID and/or 
lots of memory is going to be slow.

Pablo Gosse wrote:

 

Hi folks.  Has anyone encountered any problems parsing large log files
with PHP?
I've got a log file that's about 1.2 gig that I need to parse.

Can PHP handle this or am I better of breaking this down into 12 100mb
chunks and processing it?
   

/snip

It's an Apache log file.

I'm going to have to parse this file outside of the web server, probably
on my desktop machine.  It's a Dell Precision with 1GB RAM running RH9
with Apache and PHP 4.2.2.
If I can get the log file broken down into 100MB chunks I assume this
would not be a problem?
I've not attempted to deal with the file yet as I didn't know how PHP
would react to a 1.2 gig file, and I'm in the final stages of a very
important project and cannot afford any downtime.
I assume PHP can handle 100MB chunks without choking.

Cheers and TIA.

Pablo

 



--
Raditha Dissanayake.

http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 150 KB | with progress bar.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] What's wrong with this code please?

2004-02-24 Thread Adam Bregenzer
On Tue, 2004-02-24 at 12:51, Donpro wrote:
 $emails = array([EMAIL PROTECTED],[EMAIL PROTECTED],[EMAIL PROTECTED]);
 $addresses = explode(,,$emails);
 for ($i=0; $i  count($addresses); $i++) {
echo $i . ': ' . $addresses[$i] . 'br';
if ($i == count($addresses) - 1)
   $form['recipient'] .= $addresses[$i];
else
   $form['recipient'] .= $addresses[$i] . ',';
}
echo 'Recipient = ' . $form['recipient'] . 'br';
 
  
 The output I am receiving is:
 0: Array
 Recipient = Array
  
 Obviously, I want to see the output of each array element as well as the
 final contents of $form['recipient'].

You need to look up how to use explode[1], my guess is you don't want to
use it at all here.  In fact, implode[2] may be exactly what you are
looking for.

Regards,
Adam

[1] http://www.php.net/explode
[2] http://www.php.net/implode

-- 
Adam Bregenzer
[EMAIL PROTECTED]
http://adam.bregenzer.net/

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



Re: [PHP] Multiple Socket Read and Writes?

2004-02-24 Thread Raditha Dissanayake
Hi,
Haven't had enough coffee to look through your code.  But i can tell you 
the number 1 problem with socket reads is 'blocking' what you might want 
to search for is 'non blocking' or 'non blocking reads'

all the best



Dev wrote:

Hello all,

I am having a problem with getting multiple socket reads working in a 
simple socket server!
The writes appear to be working but the reads seam to only allow one 
read?

I know i am missing something.  Could even be my approach is totally 
wrong
Currently I have:

--

UMPA
  Brian C. Doyle
Director, Internet Services
United Merchant Processing Association
http://www.umpa-us.comhttp://www.umpa-us.com
1-800-555-9665 ext 212


--
Raditha Dissanayake.

http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 150 KB | with progress bar.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Parsing large log files with PHP

2004-02-24 Thread Adam Bregenzer
On Tue, 2004-02-24 at 12:39, Pablo Gosse wrote:
 I've got a log file that's about 1.2 gig that I need to parse.
 
 Can PHP handle this or am I better of breaking this down into 12 100mb
 chunks and processing it?

PHP has a very rich set of functions to read in files, it all depends on
what you are doing with the log file and how you read it in.  For
example, if you use the file[1] function it will read the entire log
file into memory, that is probably a bad thing for what you are trying
to do.  However, if you need to access many different parts of the file
frequently and you have the ram go for it.  On the other side of the
spectrum are the C-like functions: fopen[2], fgets[3], fread[4],
fclose[5], et. al.  These will give you a high level of control over how
much of the file you read in at a time.  Lastly, the stream[6] functions
may be a good middle ground for you.

Regards,
Adam

[1] http://www.php.net/file
[2] http://www.php.net/fopen
[3] http://www.php.net/fgets
[4] http://www.php.net/fread
[5] http://www.php.net/fclose
[6] http://www.php.net/stream

-- 
Adam Bregenzer
[EMAIL PROTECTED]
http://adam.bregenzer.net/

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



[PHP] Cybercash Dynamic Module

2004-02-24 Thread Suhas
Hello,

Does any one how to get cybercash dynamically? I have a host which 
allows dl().

Everywhere it is given that I have to recomplie PHP --with cybercah=DIR, 
but I dont have that permission.

One more Question (you can consider as the dumbest question)

If I get the permission to complie PHP with give module, can I just go 
with ./configure --with cybercah=DIR ?
I think it will kill my original install. Is there any way to append the 
configuration as needed? I am sure many of you may have similar situation.

Thanks in advance,

SP

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


RE: [PHP] Parsing large log files with PHP

2004-02-24 Thread Pablo Gosse
snip
IMHO bad idea to use a web script to process log files of these size 
(please ignore this comment if you are using the command line version).
/snip

Yes, this will be a script run from the command line.

snip
There are several good open source tools for parsing the apache log 
files (analog, webalizer, awstats to name a few). These are very fast 
and designed to handle large files that are generated by heavy traffic 
sites. You might want to look into it. Some of these log tools can 
produce a 'machine readable' as well.
/snip

I'm not actually looking for stats in this case.  We had a very strange
occurrence yesterday wherein we had a few reports of porn links
appearing on one of our websites.  So basically I'm going to be looking
for all log entries relating to that one specific section of our site
(which won't be a huge number) and then I will just need to take a look
through them and see if there's anything strange there.

snip
finally 100MB chunks wouldn't be a problem. even 1.2gb wouldn't be a 
problem if you had raid and at least 512MB of memory.
/snip

That's good.  I'm going to be doing this from my workstation so RAID
isn't an option so I guess I'll use split to break the file into 100MB
chunks.

Thanks for your help.

Cheers,
Pablo


Pablo Gosse wrote:

snip
What kind of a log file are we talking here? regardless what processing

you need to do generally working on a 1.2GB file with out RAID and/or 
lots of memory is going to be slow.

Pablo Gosse wrote:

  

Hi folks.  Has anyone encountered any problems parsing large log files
with PHP?

I've got a log file that's about 1.2 gig that I need to parse.

Can PHP handle this or am I better of breaking this down into 12 100mb
chunks and processing it?


/snip

It's an Apache log file.

I'm going to have to parse this file outside of the web server,
probably
on my desktop machine.  It's a Dell Precision with 1GB RAM running RH9
with Apache and PHP 4.2.2.

If I can get the log file broken down into 100MB chunks I assume this
would not be a problem?

I've not attempted to deal with the file yet as I didn't know how PHP
would react to a 1.2 gig file, and I'm in the final stages of a very
important project and cannot afford any downtime.

I assume PHP can handle 100MB chunks without choking.

Cheers and TIA.

Pablo

  



-- 
Raditha Dissanayake.

http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 150 KB | with progress bar.

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



RE: [PHP] What's wrong with this code please?

2004-02-24 Thread Chris W. Parker
Donpro mailto:[EMAIL PROTECTED]
on Tuesday, February 24, 2004 9:52 AM said:

 $emails =
 array([EMAIL PROTECTED],[EMAIL PROTECTED],[EMAIL PROTECTED]);
 $addresses = explode(,,$emails); for ($i=0; $i  count($addresses);
$i++) { echo $i . ': ' . $addresses[$i] . 'br';
if ($i == count($addresses) - 1)
   $form['recipient'] .= $addresses[$i];
else
   $form['recipient'] .= $addresses[$i] . ',';
}
echo 'Recipient = ' . $form['recipient'] . 'br';

why are you exploding an array? $emails is already an array and can
already be accessed via index i.e. $emails[0..n];

and similar to what adam metioned, i don't even know what would happen
when you explode an array so your unexpected results are, well,
expected. ;)

$emails =
array([EMAIL PROTECTED],[EMAIL PROTECTED],[EMAIL PROTECTED]);
$emails_cnt = count($addresses);

for ($i = 0; $i  $emails_cnt; $i++)
{
  echo $i:{$emails[$i]}br;

  if ($i == ($emails_cnt - 1))
  {
$form['recipient'] .= $emails[$i];
  }
  else
  {
$form['recipient'] .= $emails[$i] . ',';
  }
}

echo Recipient = {$form['recipient']}br;


maybe that will work? (untested)


chris.

p.s. from now on don't use the count() function within loops (including
the loop declaration) because it slows things way down (when you count
the same variable over and over). instead do like what i did, count it
ahead of time and then just reference the answer.

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



[PHP] date functions

2004-02-24 Thread Matthew Oatham
Hi,

You might already be fed up with my posts but I'm a complete PHP newbie and find these 
groups are the best way to learn! Anyway I have the database date in the format: 
-mm-dd hh:mm:ss e.g. 2004-02-24 07:57:59 but when in some situations I only want 
to show the user the date in the format dd-mm- what is the correct / best php 
function to use for this purpose ?

Cheers.

Matt

[PHP] Make sure folder is writable

2004-02-24 Thread Matt Palermo
Is there a way to check a folder on the server to make sure a specified
folder has write permissions?  I'm writing an upload script, but I need to
make sure the user gave the destination directory write permissions before I
can copy the files to the new folder.  Anyone got any ideas?

Thanks,

Matt
http://sweetphp.com

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



RE: [PHP] date functions

2004-02-24 Thread Pablo Gosse
snip
You might already be fed up with my posts but I'm a complete PHP newbie
and find these groups are the best way to learn! Anyway I have the
database date in the format: -mm-dd hh:mm:ss e.g. 2004-02-24
07:57:59 but when in some situations I only want to show the user the
date in the format dd-mm- what is the correct / best php function to
use for this purpose ?
/snip

strtotime() in conjunction with date()

http://ca2.php.net/manual/en/ref.datetime.php

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



Re: [PHP] Parsing large log files with PHP

2004-02-24 Thread Raditha Dissanayake

I'm not actually looking for stats in this case.  We had a very strange
occurrence yesterday wherein we had a few reports of porn links
appearing on one of our websites.  So basically I'm going to be looking
for all log entries relating to that one specific section of our site
(which won't be a huge number) and then I will just need to take a look
through them and see if there's anything strange there.
 

Ah in that case grep is your friend.  just type
grep -i 'pornsite' logfile
you don't need php at all.

 



--
Raditha Dissanayake.

http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 150 KB | with progress bar.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] date functions

2004-02-24 Thread Sam Masiello

Depending on your database engine (which you didn't mention in your
post), some allow you to format the date however you want it as you pull
it out of the database in your sql query.  I always find this to be the
easiest way to do it.  That way you don't have to worry about formatting
the data after it has been output from your query.

HTH!

--Sam



Matthew Oatham wrote:
 Hi,
 
 You might already be fed up with my posts but I'm a complete PHP
 newbie and find these groups are the best way to learn! Anyway I have
 the database date in the format: -mm-dd hh:mm:ss e.g. 2004-02-24
 07:57:59 but when in some situations I only want to show the user the
 date in the format dd-mm- what is the correct / best php function
 to use for this purpose ? 
 
 Cheers.
 
 Matt

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



Re: [PHP] Accessing SMB (Samba perhaps) resources

2004-02-24 Thread Adam Voigt
Yes, you would infact have to issue an outside command, and to do so,
you are correct in the fact you would have to write a good amount of
code to check the validity of the string being executed. However, unless
you actually install PHP on the samba server, and run it off that,
there's not really a way to manipulate samba files without
mounting/connecting to the share.


On Tue, 2004-02-24 at 10:54, Howard Miller wrote:
 Well, mainly because PHP doesn't (I think) have a mount function. It would
 mean executing an external command. I always regard that as living a bit
 dangerously - it can be difficult to write robust code that will recover
 from a problem that way. 
 
 Adam Voigt wrote:
 
  Why can't you just mount the share on-the-fly when they enter the
  username and pass?
  
  
  On Tue, 2004-02-24 at 06:11, Howard Miller wrote:
  Hi,
  
  I want to be able to manipulate files that are on my samba file server
  from my PHP application. These shares are not normally mounted on my web
  server and it would be inconvenient and yet another administative
  maintenance task to do so.
  
  So... I want to be able to present a form to the user where they can type
  a URL (eg, //my.sambaserver/myshare/some/directory), a username and a
  password and for PHP to be able to manipulate the files therein.
  
  Maybe this is easy, but I can't see how to do it!! Any help appreciated.
  
  Thanks!!
-- 

Adam Voigt
[EMAIL PROTECTED]

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



[PHP] running php3 files

2004-02-24 Thread Ryan A
Hi,
A small problem, a pal of mine is hosting with a company that has PHP
configured to run only
with the .php extention and not the .php3 extention...

Where will he have to make the changes so that his scripts will run if its
.php or .php3 ?

Thanks,
-Ryan

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



Re: [PHP] running php3 files

2004-02-24 Thread Adam Voigt
Obviously links would have to be changed to point to the .php pages, but
that's easily done with a good text editor. What would be of more
concern is, what is the difference between the old version of PHP your
running, and the version the hosting company is running. I.E., has
function behavior changed, functions removed, built-in library changes,
etc.


On Tue, 2004-02-24 at 13:45, Ryan A wrote:
 Hi,
 A small problem, a pal of mine is hosting with a company that has PHP
 configured to run only
 with the .php extention and not the .php3 extention...
 
 Where will he have to make the changes so that his scripts will run if its
 .php or .php3 ?
 
 Thanks,
 -Ryan
-- 

Adam Voigt
[EMAIL PROTECTED]

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



Re: [PHP] date functions

2004-02-24 Thread Adam Bregenzer
On Tue, 2004-02-24 at 13:29, Matthew Oatham wrote:
 You might already be fed up with my posts but I'm a complete PHP
 newbie and find these groups are the best way to learn! Anyway I have
 the database date in the format: -mm-dd hh:mm:ss e.g. 2004-02-24
 07:57:59 but when in some situations I only want to show the user the
 date in the format dd-mm- what is the correct / best php function
 to use for this purpose ?

You can either use the date functions or regexps, I would recommend the
date functions, they may be a bit slower but they are more flexible and
easier to read:
$timestamp = strtotime('2004-02-24 07:57:59');
$date = date('d-m-Y', $timestamp);

Also, it would be best to try and get the date in a timestamp instead of
a formatted string, check if your database can do this.  If so then you
can skip the strtotime step above.  If you are using MySQL and the date
field is one of the date formats (ie. not char/varchar) take a look at
MySQL's date formatting functions[1].

Regards,
Adam

[1] http://www.mysql.com/doc/en/Date_and_time_functions.html

-- 
Adam Bregenzer
[EMAIL PROTECTED]
http://adam.bregenzer.net/

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



Re: [PHP] running php3 files

2004-02-24 Thread Raditha Dissanayake
In each file that has a link to a file ending with .php3 or use URL 
rewrites.

Ryan A wrote:

Hi,
A small problem, a pal of mine is hosting with a company that has PHP
configured to run only
with the .php extention and not the .php3 extention...
Where will he have to make the changes so that his scripts will run if its
.php or .php3 ?
Thanks,
-Ryan
 



--
Raditha Dissanayake.

http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 150 KB | with progress bar.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: Accessing SMB (Samba perhaps) resources

2004-02-24 Thread Manuel Lemos
Hello,

On 02/24/2004 08:11 AM, Howard Miller wrote:
I want to be able to manipulate files that are on my samba file server from
my PHP application. These shares are not normally mounted on my web server
and it would be inconvenient and yet another administative maintenance task
to do so.
So... I want to be able to present a form to the user where they can type a
URL (eg, //my.sambaserver/myshare/some/directory), a username and a
password and for PHP to be able to manipulate the files therein.
You may want to try this Samba Web client class that does precisely what 
you want:

http://www.phpclasses.org/smbwebclient

--

Regards,
Manuel Lemos
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/
Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


  1   2   >