[PHP] Re: creating objects by reference?

2002-12-19 Thread Bastian Vogt
Hi,

if you're interested in the future of object handling, I suppose you to
look at this: http://www.zend.com/engine2/ZendEngine-2.0.pdf

Regards,
Bastian


> If you are looking to the future: I don't believe the ability to return
> objects by reference will be an option in Zend Engine 2.
>
> Matt


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




[PHP] problem with sending pages directly from browser

2002-12-19 Thread Kocnár Peter
I have problem with sending pages directly(by Send->Page
by E-mail...) from browser(ie6) with Outlook 2002. It
tells:"The current document type can not be sent as
mail.Would you like to send a Short cut instead?". The
pages use php sessions and it is https with 128 bit
encryption. I found that it is caused by the combination
of https and php session. Is there a solution?
Thanks in advance.
Peter



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




[PHP] Re: repeat region

2002-12-19 Thread John Taylor-Johnston
Jeff or anyone,

Ok, I'll bight. What are you doing with the % and %7 ?


> $idx=1;
> echo()
> while(fetch_rows) {
>   printf("%s, ID);
>   if($idx%7=0) {echo(''}
>   ++$idx;


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




[PHP] Re: repeat region

2002-12-19 Thread Bastian Vogt
>From the manual:
  example: $a % $b
  name: Modulus
  value: Remainder of $a divided by $b.

Not from the manual:
  example2: 47 % 5
  value2: 2

HTH,
Bastian



> Jeff or anyone,
>
> Ok, I'll bight. What are you doing with the % and %7 ?
>
> > $idx=1;
> > echo()
> > while(fetch_rows) {
> >   printf("%s, ID);
> >   if($idx%7=0) {echo(''}
> >   ++$idx;


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




[PHP] speet testing (was URL parsing)

2002-12-19 Thread Sean Burlington
1LT John W. Holmes wrote:


Assuming $url is what you have above:

$tilde = strpos($url,"~");
$slash = strpos($url,"/",$tilde);
$length = $slash - $tilde;

$username = substr($url,$tilde,$length);

Or you can use a regular expression, but the above is probably faster.

preg_match("!(~[^/]*)/!",$url,$match);
or
preg_match("!(~.*)/!U",$url,$match);

In my tests, the first solution (using strpos) was the fastest by 35%.

---John Holmes...




Hi John,
	Ive been very interested to note that you seem to have a very keen idea 
of the relative speed of different functions.

I wonder if you could pass on some pointers for speed testing.

thanks

--

Sean


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



[PHP] display edited field in table

2002-12-19 Thread Lightfirst
I am using Php/MySql and I am trying to display a table and have one of the
fields (answer) editable. What I would like is to have the user edit the
field and then click update. The result-display the table along with the
updated field. What am I doing wrong? He is my code:

















  

  

 "> 

 













-Thanks.




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




[PHP] delete() and unlink()

2002-12-19 Thread @ Nilaab
Hello Everyone,

I'm using a test server on Windows XP. I have the following function (which
I got from the comment notes on php.net) that works wonders when deleting
directories that are not empty on a Windows system. But, I'm a bit confused.
I searched for the delete() function on php.net and it said that delete()
was not a real function, but a dummy manual entry for those who are actually
looking for the unlink() function. So then why does the delete() function
work in my script? I tried using the unlink() function in place of the
delete() function, but unlink() gave me many errors (possibly because of
permissions). Is there an error in the manual or is it just me? Is there a
difference in the two functions? Does the delete() function not care about
permissions as opposed to the unlink() function? This is really bugging me.
Can someone clear the air?

$c_dir = "$DOCUMENT_ROOT/world/admin/backup2";  // current directory

function delete($dir) {
 if (file_exists($dir)) {
umask(0);
chmod($dir,0777);
   if (is_dir($dir)) {
 $handle = opendir($dir);
 while($dirname = readdir($handle)) {
   if ($dirname != "." && $dirname != "..") {
delete($dir."/".$dirname);
   }
 }
closedir($handle);
 rmdir($dir);
   } else {
unlink($dir);
   }
 }
}

delete ($c_dir);


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




[PHP] display edited field in table

2002-12-19 Thread Lightfirst
I am using Php/MySql and I am trying to display a table and have one of the
fields (answer) editable. What I would like is to have the user edit the
field and then click update. The result- display the table along with the
updated field. What am I doing wrong? He is my code:

















  

  

 "> 

 













-Thanks.




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




[PHP] AddType application/x-httpd-source .phps

2002-12-19 Thread Freaky
Hey there,

I'm trying to get .phps served in full color but it doesn't seem to
work.. I added AddType application/x-httpd-php-source .phps right under
the line for the application/x-httpd-php .php and I know the server sees
it because when I browse to myserver/myphpscript.phps netscape says
receiving file of type application/x-httpd-php-source open/save.

Last time I used this feature was several years ago with PHP3. This
function is still in the INSTALL file that came with my PHP 4.2.3 tho'.

Was this function removed or something?

Regards




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




Re: [PHP] delete() and unlink()

2002-12-19 Thread Jason Wong
On Thursday 19 December 2002 17:39, [EMAIL PROTECTED] wrote:
> Hello Everyone,
>
> I'm using a test server on Windows XP. I have the following function (which
> I got from the comment notes on php.net) that works wonders when deleting
> directories that are not empty on a Windows system.

Good.

> But, I'm a bit
> confused. I searched for the delete() function on php.net and it said that
> delete() was not a real function, but a dummy manual entry for those who
> are actually looking for the unlink() function. 

delete() is a dummy entry in the manual so people looking for said function 
will be directed to unlink() which is the correct function to use.

> So then why does the
> delete() function work in my script? 

delete() is undefined in php, that is why you can define your own function 
called delete().

> I tried using the unlink() function in
> place of the delete() function, but unlink() gave me many errors (possibly
> because of permissions).

unlink() can only remove/delete directories that are empty.

> Is there an error in the manual or is it just me?

There's no error in the manual (with regards to this subject). Probably a 
misunderstanding on your part.

> Is there a difference in the two functions? Does the delete() function not
> care about permissions as opposed to the unlink() function? This is really
> bugging me. Can someone clear the air?

The delete() function as defined below is recursive and will automatically go 
inside non-empty directories and empty them first.

> $c_dir = "$DOCUMENT_ROOT/world/admin/backup2";  // current directory
>
> function delete($dir) {
>  if (file_exists($dir)) {
> umask(0);
> chmod($dir,0777);
>if (is_dir($dir)) {
>  $handle = opendir($dir);
>  while($dirname = readdir($handle)) {
>if ($dirname != "." && $dirname != "..") {
> delete($dir."/".$dirname);
>}
>  }
> closedir($handle);
>  rmdir($dir);
>} else {
> unlink($dir);
>}
>  }
> }
>
> delete ($c_dir);

To summarise -- there is no delete() function in php, the delete() function 
you're using is a user-defined function and as such will do whatever you can 
make it do.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
Garbage In -- Gospel Out.
*/


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




Re: [PHP] display edited field in table

2002-12-19 Thread Jason Wong
On Thursday 19 December 2002 17:44, Lightfirst wrote:
> I am using Php/MySql and I am trying to display a table and have one of the
> fields (answer) editable. What I would like is to have the user edit the
> field and then click update. The result- display the table along with the
> updated field. What am I doing wrong? He is my code:

We won't know what you're doing wrong if you don't tell us what the problem 
is. __What happens__ when you run your code? Does the monitor blow up or 
what?

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
Q:  How was Thomas J. Watson buried?
A:  9 edge down.
*/


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




[PHP] Displaying first 20 characters of a comment

2002-12-19 Thread Kevin Meredith
Hi.

I am trying to find out what the best way is to display only the first 20 or
so characters of a comment.  The comments which are entered separately by
users are stored in a MySql database.  I am displaying a list of the last 5
entries on the home page and then linking them to the relevant comments and
details.  However the comments are to long so I want to display only the
first portion, kind of like a intro for users to get an idea and then read
further.

I am not sure if it is best to do it with the select statement or format it
with the PHP.  Either way I am not sure how.

many thanks
Kevin


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




[PHP] sending AND recieving XML

2002-12-19 Thread K.C.P. van Zijl
Hello,

I'm building this web application that has to communicate with some
other web servers. This communication is done by sending and receiving
XML. I discovered I don't have curl support compiled in PHP and was
wondering if there are other ways to send and receive XML? 

 

1. Perhaps I can communicate with curl by using exec (I’ve installed the
curl RPM package)? 

2. Or perhaps “fsockeropen()” could do the job.

 

In both cases I don’t have any experience with any of these 2 functions.
Does anyone have an example for me?

 

Thanks,

Karel




[PHP] JavaScript or browser detection

2002-12-19 Thread Steve Vernon
Hiya,
I know it is probably out there somewhere, but I cannot find out a
script to detect the browser. I have seen it, and I sorta remember how to do
it, but I just can't find it!

I have a script that adds nice features to my webpage, but if JavaScript
is off the site still can be used. Basically the script does not work in
Netscape 4.08 but works above that, so either I could bracket out and check
the code, but in this case I cannot as it is code I am not allowed to alter,
and I include it, it is not in my HTML file.

So I need a way to say in PHP this is a bad web browser for JavaScript,
so ignore this bit of the file.

Thanks,

Steve


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




RE: [PHP] Displaying first 20 characters of a comment

2002-12-19 Thread Quentin Bennett
 

 
 The information contained in this 
email is privileged and confidential and intended for the addressee only. If you 
are not the intended recipient, you are asked to respect that confidentiality 
and not disclose, copy or make use of its contents. If received in error you are 
asked to destroy this email and contact the sender immediately. Your assistance 
is appreciated. 


select left(myfield,20) from mytable;
-Original Message-
From: Kevin Meredith [mailto:[EMAIL PROTECTED]]
Sent: Thursday, 19 December 2002 11:03 p.m.
To: PHP
Subject: [PHP] Displaying first 20 characters of a comment


Hi.

I am trying to find out what the best way is to display only the first 20 or
so characters of a comment.  The comments which are entered separately by
users are stored in a MySql database.  I am displaying a list of the last 5
entries on the home page and then linking them to the relevant comments and
details.  However the comments are to long so I want to display only the
first portion, kind of like a intro for users to get an idea and then read
further.

I am not sure if it is best to do it with the select statement or format it
with the PHP.  Either way I am not sure how.

many thanks
Kevin


-- 
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] *Premature end of script headers

2002-12-19 Thread Alexey Lysenkov
I've found it! It's session thing.
Why? It stops at session_start, and moreover, I overslept this morning. Two
minutes ago it had to be ready, shit!..

I'm sorry.
At the other machine it runs as .exe not as mod, the guy said, version
4.0.5.
I can use only $HTTP_SESSION_VARS array, but I don't know how to get (and
not to set!) the session_id. I cannot think, please help.

-Alex



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




RE: [PHP] sending AND recieving XML

2002-12-19 Thread Quentin Bennett
Hi,

We are doing the exact same thing using a simple HTTP Post - the receiving PHP 
receives the XML, processes it, and sends back an XML answer.

Works great.

Hope this helps.

Quentin

-Original Message-
From: K.C.P. van Zijl [mailto:[EMAIL PROTECTED]]
Sent: Thursday, 19 December 2002 10:52 a.m.
To: [EMAIL PROTECTED]
Subject: [PHP] sending AND recieving XML


Hello,

I'm building this web application that has to communicate with some
other web servers. This communication is done by sending and receiving
XML. I discovered I don't have curl support compiled in PHP and was
wondering if there are other ways to send and receive XML? 

 

1. Perhaps I can communicate with curl by using exec (I've installed the
curl RPM package)? 

2. Or perhaps "fsockeropen()" could do the job.

 

In both cases I don't have any experience with any of these 2 functions.
Does anyone have an example for me?

 

Thanks,

Karel

The information contained in this email is privileged and confidential and
intended for the addressee only. If you are not the intended recipient, you 
are asked to respect that confidentiality and not disclose, copy or make use 
of its contents. If received in error you are asked to destroy this email 
and contact the sender immediately. Your assistance is appreciated.

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




[PHP] sending and recieving XML

2002-12-19 Thread K.C.P. van Zijl
Hello,

 

I'm building this web application that has to communicate with some
other web servers. This communication is done by sending and receiving
XML. I discovered I don't have curl support compiled in PHP and was
wondering if there are other ways to send and receive XML? 

 

1. Perhaps I can communicate with curl by using exec (I’ve installed the
curl RPM package)? 

2. Or perhaps “fsockeropen()” could do the job.

 

In both cases I don’t have any experience with any of these 2 functions.
Does anyone have an example for me?

 

Thanks,

Karel




RE: [PHP] Displaying first 20 characters of a comment

2002-12-19 Thread Jon Haworth
Hi Kevin,

> I am trying to find out what the best way is to display only
> the first 20 or so characters of a comment.  
[...]
> I am not sure if it is best to do it with the select statement 
> or format it with the PHP.  Either way I am not sure how.

If you only want the first 20 characters, and that's all you ever want, it's
probably best to do it with the select statement, because then you're not
spending time and bandwidth getting data you don't need from your database.

"SELECT LEFT(someField, 20) FROM someTable" will get you the first 20
characters.

Of course, you now have a problem with words splitting :-)

You can get around this either by grabbing the whole comment and splitting
it on spaces, or by having a separate "synopsis" field in your database
(this is how I do it).

Cheers
Jon



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




[PHP] Check Uploaded File

2002-12-19 Thread shaun
Hi,

Is it possible to ensure that a user is uploading a jpeg file from a form
and nothing else?

Thanks for your help



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




RE: [PHP] PHP and MySQL queries

2002-12-19 Thread Rich Gray
Does it work if you put quotes around the array keys as follows...

echo $line['idn'];
echo $line['total'];
echo $line['idp'];
echo $line['position'];
echo $line['points'];

Rich

-Original Message-
From: Beauford.2002 [mailto:[EMAIL PROTECTED]]
Sent: 18 December 2002 20:28
To: PHP General
Subject: [PHP] PHP and MySQL queries


Hi,

I am having a real problem with variables in PHP and trying to query my
MySQL database. I have a form that a user inputs information and then that
info is used to query my database, but it's not working. I don't get any
errorrs and it appears every thing worked, but nothing gets displayed (see
code below). I know the info is getting passed from the form as it appears
correct in the address bar of my browser. The query below also works if I
use the command line in MySQL and hard code the information.

Any help is appreciated.

http://etc/etc?FromTrade=TRUE&name=1&from=2

$query = "select tmanager.idn, tmanager.total, troster.idp, user, position,
points from troster join treference
join tmanager where tmanager.idn=treference.idn and
treference.idp=troster.idp and tmanager.name like '$name' and
troster.player like '$from'";

$results = mysql_query($query) or die("Query failed");

while ($line = mysql_fetch_array($results, MYSQL_ASSOC)) {

 echo $line[idn];
 echo $line[total];
 echo $line[idp];
 echo $line[position];
 echo $line[points];

This just displays an empty page. So it appears the query found nothing, but
like I said, it works from the command line and there should be one entry
(see below). So I have to assume it is a problem with the variables.

+-++-++--++
| idn | total  | idp | user | position | points |
+-++-++--++
|   1 | 746.75 |   2 | Trevor  | F|  45.00 |
+-++-++--++


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




[PHP] Re: JavaScript or browser detection

2002-12-19 Thread fragmonster
Hope it helps you: 
http://developer.netscape.com/docs/examples/javascript/browser_type_oo.html

Steve Vernon wrote:
Hiya,
I know it is probably out there somewhere, but I cannot find out a
script to detect the browser. I have seen it, and I sorta remember how to do
it, but I just can't find it!

I have a script that adds nice features to my webpage, but if JavaScript
is off the site still can be used. Basically the script does not work in
Netscape 4.08 but works above that, so either I could bracket out and check
the code, but in this case I cannot as it is code I am not allowed to alter,
and I include it, it is not in my HTML file.

So I need a way to say in PHP this is a bad web browser for JavaScript,
so ignore this bit of the file.

Thanks,

Steve




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




RE: [PHP] Check Uploaded File

2002-12-19 Thread Rich Gray
Shaun

Run getimagesize() on the uploaded file - if a valid jpeg the returned
array[2] will be set to 2...

http://www.php.net/manual/en/function.getimagesize.php

HTH
Rich

-Original Message-
From: shaun [mailto:[EMAIL PROTECTED]]
Sent: 19 December 2002 02:24
To: [EMAIL PROTECTED]
Subject: [PHP] Check Uploaded File


Hi,

Is it possible to ensure that a user is uploading a jpeg file from a form
and nothing else?

Thanks for your help



--
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] Looping needs to re-open parm file

2002-12-19 Thread Jacob van Zanen
Hi All,

I'm reading a paramter file and a text file.
Per line of the text file I want to check if there is a word in there from
the parameter file.
However I need to open and read the parameter file for each line in the text
file. How can I change this?

Followin is the code I have.


\n");
 }
 }
}
?>



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




Re: [PHP] Looping needs to re-open parm file

2002-12-19 Thread Wico de Leeuw
Did you look at:
http://www.php.net/manual/en/function.file.php
Puts all lines in an array

Gr,

At 12:00 19-12-02 +0100, Jacob van Zanen wrote:

Hi All,

I'm reading a paramter file and a text file.
Per line of the text file I want to check if there is a word in there from
the parameter file.
However I need to open and read the parameter file for each line in the text
file. How can I change this?

Followin is the code I have.


\n");
 }
 }
}
?>



--
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] JavaScript or browser detection

2002-12-19 Thread Chris Hewitt
Steve Vernon wrote:


I know it is probably out there somewhere, but I cannot find out a
script to detect the browser. I have seen it, and I sorta remember how to do
it, but I just can't find it!


From memory, a full script was posted to this list in the last few days.

HTH
Chris


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




Re: [PHP] FW: checking bounce email

2002-12-19 Thread Chris Hewitt
See kok Boon wrote:


Can someone kindly teach me how to check for bounced emails when I use
mail() to send emails?


Its the "Return-To" smtp field that has the address that bounces are to 
be notified to. Using mail() I think this can be set with the last 
parameter.

I'm being a bit vague here as I don't have this set in my use of mail(). 
Where I need it I've used the smtp class from Manuel Lemos on 
www.phpclasses.org.

HTH
Chris


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



Re: [PHP] display edited field in table

2002-12-19 Thread Chris Hewitt
Lightfirst wrote:


I am using Php/MySql and I am trying to display a table and have one of the
fields (answer) editable. What I would like is to have the user edit the
field and then click update. The result-display the table along with the
updated field. What am I doing wrong? He is my code:


I think it would be helpful if you mentioned exactly what error/problem 
you are getting, that is, how does it not work?

HTH
Chris


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



Re: [PHP] Looping needs to re-open parm file

2002-12-19 Thread Wico de Leeuw
Hiya

something like this

if ($FileContent = file("d:\MyPhp\\test.ora") AND $IniContent = 
file("d:\MyPhp\initORA.ini")) {
foreach($FileContent AS $line) {
if (in_array($line, $iniContent)) {
 echo "$Line\n";
}
}
}
?>

At 12:00 19-12-02 +0100, Jacob van Zanen wrote:
Hi All,

I'm reading a paramter file and a text file.
Per line of the text file I want to check if there is a word in there from
the parameter file.
However I need to open and read the parameter file for each line in the text
file. How can I change this?

Followin is the code I have.


\n");
 }
 }
}
?>



--
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] RegExpres Prob

2002-12-19 Thread John Wards
I have a regexp problem

I want to go through some HTML and where  I want 
to change it to this http://www.domain.com/path/to/image.jpg";>

BUT

if the image tag is like this 

http://www.domain.com/path/to/image.jpg";>

already I don't want anything to happen

I thought this would do it:

ereg_replace("src=\"(^http)","src=\"http://www.domain.com/";, $string);

but it didn't...

Argh...

Cheers
John Wards

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




Re: [PHP] RegExpres Prob

2002-12-19 Thread Wico de Leeuw
At 11:18 19-12-02 +, John Wards wrote:

I have a regexp problem

I want to go through some HTML and where  I want
to change it to this http://www.domain.com/path/to/image.jpg";>

BUT

if the image tag is like this

http://www.domain.com/path/to/image.jpg";>

already I don't want anything to happen

I thought this would do it:

ereg_replace("src=\"(^http)","src=\"http://www.domain.com/";, $string);


Preg_Replace('~src="(?!http://)~iS', 'src="http://www.domain.com/', $string);




but it didn't...

Argh...

Cheers
John Wards

--
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] RegExpres Prob

2002-12-19 Thread John Wards
On Thursday 19 Dec 2002 11:25 am, Wico de Leeuw wrote:
Preg_Replace('~src="(?!http://)~iS', 'src="http://www.domain.com/', $string);

Ha! Ta

I am all for quick fixes but I am new to RegExpresions...so could someone 
explain what its all doing for me.

Cheers
John


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




[PHP] Inserting tab delimited textfiles into mysql

2002-12-19 Thread Thomas Goeminne
I got a tab delimited file which looks like this:

let us call it items.txt

TypeCatalog NumberItem DescriptionSide BProducer
12 AAA502 Afu Ra-D&D Soundclash Mic Stance, Premeir,Curt Cazall
12 AC725 Roc Raida/Wayne-O - Gong Show Burn That Ass Roc
Raida

I want to take all this info and insert it into my mysql dbase. The type is
in a table named categories. The rest should go into the table named items.
With also the id number off the categorie in it.

I have been looking for info on how to do this but I can't find a decent
article about it. First off I dump all the records which were already in the
dbase. And then it needs to get filled up with the new items.txt

I would appreciate your help
greets
--
Thomas Goeminne



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




RE: [PHP] *OK, more eval for today

2002-12-19 Thread Ford, Mike [LSS]
> -Original Message-
> From: Alexey Lysenkov [mailto:[EMAIL PROTECTED]]
> Sent: 18 December 2002 19:08
> 
> 
> I am trying to do this:
> 
> $tempVar1 = '\$HTTP_POST_VARS[\"q4_'.$i.'"]';
>   eval("\$tempVar1=\"$tempVar1\";");
> 

Well, you have the answer right there in front of you -- why not just take the 
statement you build and eval(), and write it directly in the PHP thus:

   $tempVar1 = $HTTP_POST_VARS['q4_'.$i];

or

   $tempVar1 = $HTTP_POST_VARS["q4_$i"];

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] flush output error

2002-12-19 Thread Ford, Mike [LSS]
> -Original Message-
> From: electroteque [mailto:[EMAIL PROTECTED]]
> Sent: 19 December 2002 07:52
> 
> sorry about the false alarm , if you go here u will see a 
> working example
> 
> http://galleries.dyndns.org:1023/progress.php
> 
> i had to add both flush functions together to work , 
> obviosuly flsuh is not
> emptying the buffer within a loop, is this still a bug ?
> 
> flush();
>  ob_flush();

Well, if you use PHP's output buffering, you actually have two buffers: the "output 
buffer" which can be manipulated and accessed from within your script using the ob_*() 
functions, and what might be called the "connection buffer" which exists in the 
general PHP environment and is not accessible to your script, but can be flushed with 
the flush() function or by setting implicit_flush to on.

When you do ob_flush(), this flushes the output buffer to the connection buffer; 
flush() flushes the connection buffer, via the HTTP connection, to your browser.  (The 
browser may then buffer it itself, e.g. whilst waiting for a  tag to show up, 
but that's another matter!)  So, yes, if you have output buffering on you need both 
ob_flush() and flush() (in that order!) to flush all pending output to the browser.

For your application, I would question whether you need output buffering on -- it 
seems to be causing you problems rather than solving them!

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] RegExpres Prob

2002-12-19 Thread Wico de Leeuw
At 11:27 19-12-02 +, John Wards wrote:

On Thursday 19 Dec 2002 11:25 am, Wico de Leeuw wrote:
Preg_Replace('~src="(?!http://)~iS', 'src="http://www.domain.com/', $string);



1. find src="
2. look forward if next chars are http://
i=not case sensitive
S=optimize pattern because we going to use is many times

You should add also a check if it starts with 
like this:

Preg_Replace('~(http://www.domain.com/', $string);


Gr,


Ha! Ta

I am all for quick fixes but I am new to RegExpresions...so could someone
explain what its all doing for me.

Cheers
John



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




php-general Digest 19 Dec 2002 13:01:52 -0000 Issue 1772

2002-12-19 Thread php-general-digest-help

php-general Digest 19 Dec 2002 13:01:52 - Issue 1772

Topics (messages 128790 through 128849):

Re: *OK, more eval for today
128790 by: Martin Towell
128847 by: Ford, Mike   [LSS]

Re: $_SERVER['DOCUMENT_ROOT'] on localhost
128791 by: DL Neil

Re: *Premature end of script headers
128792 by: Dave [Hawk-Systems]
128829 by: Alexey Lysenkov

is there php equiv left() and right() functions?
128793 by: Jeff Bluemel
128795 by: Matthew Gray
128796 by: Philip Olson
128797 by: Jeff Bluemel
128798 by: Jeff Bluemel

Re: creating objects by reference?
128794 by: Matthew Gray
128814 by: Bastian Vogt

recommendation needed for dedicated server hosting
128799 by: Taek Kwon
128801 by: Jason Sheets
128802 by: Tom Rogers
128803 by: Kyle Gibson

PHP and MySQL queries
128800 by: Beauford.2002
128810 by: John W. Holmes
128834 by: Rich Gray

repeat region
128804 by: Bruce Levick
128806 by: Jeff
128808 by: Justin French
128816 by: John Taylor-Johnston
128817 by: Bastian Vogt

Re: PHP question
128805 by: gamin

Re: checking bounce email
128807 by: See kok Boon
128840 by: Chris Hewitt

Re: URL parsing
128809 by: gamin

Re: XML + XSL
128811 by: Hristina

php + xsl + xsm
128812 by: Hristina

Re: flush output error
128813 by: electroteque
128848 by: Ford, Mike   [LSS]

problem with sending pages directly from browser
128815 by: Kocnár Peter

speet testing (was URL parsing)
128818 by: Sean Burlington

display edited field in table
128819 by: Lightfirst
128821 by: Lightfirst
128824 by: Jason Wong
128841 by: Chris Hewitt

delete() and unlink()
128820 by: . Nilaab
128823 by: Jason Wong

AddType application/x-httpd-source .phps
128822 by: Freaky

Displaying first 20 characters of a comment
128825 by: Kevin Meredith
128828 by: Quentin Bennett
128832 by: Jon Haworth

sending AND recieving XML
128826 by: K.C.P. van Zijl
128830 by: Quentin Bennett
128831 by: K.C.P. van Zijl

JavaScript or browser detection
128827 by: Steve Vernon
128835 by: fragmonster
128839 by: Chris Hewitt

Check Uploaded File
128833 by: shaun
128836 by: Rich Gray

Looping needs to re-open parm file
128837 by: Jacob van Zanen
128838 by: Wico de Leeuw
128842 by: Wico de Leeuw

RegExpres Prob
128843 by: John Wards
128844 by: Wico de Leeuw
128845 by: John Wards
128849 by: Wico de Leeuw

Inserting tab delimited textfiles into mysql
128846 by: Thomas Goeminne

Administrivia:

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

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

To post to the list, e-mail:
[EMAIL PROTECTED]


--

--- Begin Message ---
argh! eval()
try this instead: $temp = ${"php_q3_$i"};
to get it directly from $HTTP_POST_VARS: $temp =
$HTTP_POST_VARS["php_q3_$i"];
simple

HTH
Martin

-Original Message-
From: Alexey Lysenkov [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 19, 2002 6:08 AM
To: [EMAIL PROTECTED]
Subject: [PHP] *OK, more eval for today


I know, it's eval = evil, but I don't see any other way I can check for 120
variables submitted via post, without making a temp variable, assigning a
value of the posted Var and checking for it (and deciding on the further run
of the script). Anyways, I took a classical eval thing and am doing fine
with it. It looks like this:

$temp = "\$php_q3_".$i; // $i is a loop index
eval ("\$temp = \"$temp\";");

works alright. Now, how do I eval directly from the $HTTP_POST_VARS?

I am trying to do this:

$tempVar1 = '\$HTTP_POST_VARS[\"q4_'.$i.'"]';
  eval("\$tempVar1=\"$tempVar1\";");

and am obviously failing. If you know any other way to validate 120-150
variables in a loop and then rewrite the values into the fields (checkboxes,
radios and selects) - should an error had been made - let me know.

Best Regards,
Alex

p.s. you do help! :)

--- End Message ---
--- Begin Message ---
> -Original Message-
> From: Alexey Lysenkov [mailto:[EMAIL PROTECTED]]
> Sent: 18 December 2002 19:08
> 
> 
> I am trying to do this:
> 
> $tempVar1 = '\$HTTP_POST_VARS[\"q4_'.$i.'"]';
>   eval("\$tempVar1=\"$tempVar1\";");
> 

Well, you have the answer right there in front of you -- why not just take the 
statement you build and eval(), and write it directly in the PHP thus:

   $tempVar1 = $HTTP_POST_VARS['q4_'.$i];

or

   $tempVar1 = $HTTP_POST_VARS["q4_$i"];

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services

[PHP] mail()

2002-12-19 Thread Edward Peloke
Hello all,

I am using the following code but when I view the sent e-mail (in my yahoo
account) the link info is all plain text.  I see the Activate Account";
   mail($email,'Thanks',$mailcontent,"From:
aircharterunited.com");


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




[PHP] Re: mail()

2002-12-19 Thread Bastian Vogt
Hi,

just add "Content-Type: text/html" to the header information of the mail:
 mail($email,'Thanks',$mailcontent,"From:aircharterunited.com\nContent-Type:
text/html");

HTH,
Bastian


> Hello all,
>
> I am using the following code but when I view the sent e-mail (in my yahoo
> account) the link info is all plain text.  I see the  How do I create it as a link?  I know I can send them because I have done it
> before in my yahoo e-mail, just never through php and mail().
>
> Thanks,
> Eddie
>
> $mailcontent="Thank you for registering with AirCharterUnited \n"
>  ."Your Username is $uname and your password is $pword
> \n"
>  ."Please click the following link to activate your
> account \n"
>." href='http:\\www.aircharterunited.com\pages\activate_account.php?clientid=$u
> name'>Activate Account";
>mail($email,'Thanks',$mailcontent,"From:
> aircharterunited.com");

--
Mit freundlichem Gruß
i.A. Bastian Vogt


+ KomTel Gesellschaft fuer
+ Kommunikations- und
+ Informationsdienste mbH
+
+ Bastian Vogt
+ Nordermarkt 1, D-24937 Flensburg
+
+ Fon: +49-461-9090-00, Fax: +49-461-9090-031
+ EMail: [EMAIL PROTECTED], Internet: http://www.komtel.net
+  +



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




[PHP] Re: mail()

2002-12-19 Thread Mike Mannakee
You need to set the correct header type:

Content-type: text/html

otherwise it defaults to:

Content-type: text/plain

Mike


"Edward Peloke" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hello all,
>
> I am using the following code but when I view the sent e-mail (in my yahoo
> account) the link info is all plain text.  I see the  How do I create it as a link?  I know I can send them because I have done
it
> before in my yahoo e-mail, just never through php and mail().
>
> Thanks,
> Eddie
>
> $mailcontent="Thank you for registering with AirCharterUnited \n"
>  ."Your Username is $uname and your password is $pword
> \n"
>  ."Please click the following link to activate your
> account \n"
>."
href='http:\\www.aircharterunited.com\pages\activate_account.php?clientid=$u
> name'>Activate Account";
>mail($email,'Thanks',$mailcontent,"From:
> aircharterunited.com");
>



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




Re: [PHP] RegExpres Prob

2002-12-19 Thread 1LT John W. Holmes
Why use a regular expression?

$new_string = str_replace('img src="','img
src="http://www.domain.com/',$old_string);

---John Holmes...

- Original Message -
From: "John Wards" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, December 19, 2002 6:18 AM
Subject: [PHP] RegExpres Prob


I have a regexp problem

I want to go through some HTML and where  I
want
to change it to this http://www.domain.com/path/to/image.jpg";>

BUT

if the image tag is like this

http://www.domain.com/path/to/image.jpg";>

already I don't want anything to happen

I thought this would do it:

ereg_replace("src=\"(^http)","src=\"http://www.domain.com/";, $string);

but it didn't...

Argh...

Cheers
John Wards

--
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] speet testing (was URL parsing)

2002-12-19 Thread 1LT John W. Holmes
> > Assuming $url is what you have above:
> >
> > $tilde = strpos($url,"~");
> > $slash = strpos($url,"/",$tilde);
> > $length = $slash - $tilde;
> >
> > $username = substr($url,$tilde,$length);
> >
> > Or you can use a regular expression, but the above is probably faster.
> >
> > preg_match("!(~[^/]*)/!",$url,$match);
> > or
> > preg_match("!(~.*)/!U",$url,$match);
> >
> > In my tests, the first solution (using strpos) was the fastest by 35%.
> >
> > ---John Holmes...
> >
> >
>
> Hi John,
> Ive been very interested to note that you seem to have a very keen idea
> of the relative speed of different functions.
>
> I wonder if you could pass on some pointers for speed testing.
>
> thanks

Nothing fancy. Just using the getmicrotime() function defined on the
microtime() manual page to get the time before the bit I'm testing and after
and subtract to get the difference.

www.php.net/microtime

There are fancier classes out there that'll do this and create pretty graphs
and all that, too. I think PEAR has something to help with it.

---John Holmes...


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




Re: [PHP] Inserting tab delimited textfiles into mysql

2002-12-19 Thread Jason Wong
On Thursday 19 December 2002 19:31, Thomas Goeminne wrote:
> I got a tab delimited file which looks like this:
>
> let us call it items.txt
>
> TypeCatalog NumberItem DescriptionSide BProducer
> 12 AAA502 Afu Ra-D&D Soundclash Mic Stance, Premeir,Curt Cazall
> 12 AC725 Roc Raida/Wayne-O - Gong Show Burn That Ass Roc
> Raida
>
> I want to take all this info and insert it into my mysql dbase. The type is
> in a table named categories. The rest should go into the table named items.
> With also the id number off the categorie in it.
>
> I have been looking for info on how to do this but I can't find a decent
> article about it. First off I dump all the records which were already in
> the dbase. And then it needs to get filled up with the new items.txt

To get you started:

1) use file() to read in the text file
2) use explode(), with "\t" as the delimiter to split each line into their 
component parts

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
On-line, adj.:
The idea that a human being should always be accessible to a computer.
*/


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




RE: [PHP] Re: mail()

2002-12-19 Thread Edward Peloke
Thanks all!  I will give this a shot!

-Original Message-
From: Mike Mannakee [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 19, 2002 8:51 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Re: mail()


You need to set the correct header type:

Content-type: text/html

otherwise it defaults to:

Content-type: text/plain

Mike


"Edward Peloke" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hello all,
>
> I am using the following code but when I view the sent e-mail (in my yahoo
> account) the link info is all plain text.  I see the  How do I create it as a link?  I know I can send them because I have done
it
> before in my yahoo e-mail, just never through php and mail().
>
> Thanks,
> Eddie
>
> $mailcontent="Thank you for registering with AirCharterUnited \n"
>  ."Your Username is $uname and your password is $pword
> \n"
>  ."Please click the following link to activate your
> account \n"
>."
href='http:\\www.aircharterunited.com\pages\activate_account.php?clientid=$u
> name'>Activate Account";
>mail($email,'Thanks',$mailcontent,"From:
> aircharterunited.com");
>



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


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




[PHP] pfpro configuration on win2000

2002-12-19 Thread Daniel Masson
Hello list !!!

Id like to know if theres a way to enable pfpro extension on windows
2000 ... Im currently usong 4.2.3 and i havnt seen any dll for this
extension in the distro 

Thanks for your help ..


Regards.
Daniel.



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




[PHP] date part

2002-12-19 Thread Diana Castillo
How can I get a string containing the month part of a date the user types
in?
e.g. if they type in "06/07/200" I want to get "06"

thanks,
diana



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




RE: [PHP] date part[Scanned]

2002-12-19 Thread Michael Egan
You could use the explode function to break the string down into its different 
elements with '/' as the delimiter.

Problem is if you're allowing users to input the date into a text box you can't be 
sure how they'll enter the data.  The better option is probably to constrain what they 
can enter with drop down boxes for year, month and day.

Michael Egan

-Original Message-
From: Diana Castillo [mailto:[EMAIL PROTECTED]]
Sent: 19 December 2002 14:05
To: [EMAIL PROTECTED]
Subject: [PHP] date part[Scanned]


How can I get a string containing the month part of a date the user types
in?
e.g. if they type in "06/07/200" I want to get "06"

thanks,
diana



-- 
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] Image resizing

2002-12-19 Thread shaun
Hi,

My webserver doesn't have the GD library installed, please can someone tell
me how I can resize uploaded images for thumbnails?

Thanks for your help



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




RE: [PHP] date part

2002-12-19 Thread Edward Peloke
I used a javascript I found online in my php page.  Click on the boxes next
to the date fields:
http://www.aircharterunited.com/pages/submit_bid.php

This way, I know the format of the date when it is entered and I can pull
out any part needed.

Eddie

-Original Message-
From: Diana Castillo [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 19, 2002 9:05 AM
To: [EMAIL PROTECTED]
Subject: [PHP] date part


How can I get a string containing the month part of a date the user types
in?
e.g. if they type in "06/07/200" I want to get "06"

thanks,
diana



--
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: Inserting tab delimited textfiles into mysql

2002-12-19 Thread David Eisenhart
I recommend that you check out phpMyAdmin http://www.phpmyadmin.net/

David



"Thomas Goeminne" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I got a tab delimited file which looks like this:
>
> let us call it items.txt
>
> TypeCatalog NumberItem DescriptionSide BProducer
> 12 AAA502 Afu Ra-D&D Soundclash Mic Stance, Premeir,Curt Cazall
> 12 AC725 Roc Raida/Wayne-O - Gong Show Burn That Ass Roc
> Raida
>
> I want to take all this info and insert it into my mysql dbase. The type
is
> in a table named categories. The rest should go into the table named
items.
> With also the id number off the categorie in it.
>
> I have been looking for info on how to do this but I can't find a decent
> article about it. First off I dump all the records which were already in
the
> dbase. And then it needs to get filled up with the new items.txt
>
> I would appreciate your help
> greets
> --
> Thomas Goeminne
>
>



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




RE: [PHP] date part

2002-12-19 Thread Adam Voigt




I just tried that script, for me under Linux with Mozilla and Netscape, I had to try 5 times before I could move the mouse from the button to the menu fast enough, every other time it would just disappear when I tried to move the mouse from the button to it.



On Thu, 2002-12-19 at 09:59, Edward Peloke wrote:

I used a javascript I found online in my php page.  Click on the boxes next

to the date fields:

http://www.aircharterunited.com/pages/submit_bid.php



This way, I know the format of the date when it is entered and I can pull

out any part needed.



Eddie



-Original Message-

From: Diana Castillo [mailto:[EMAIL PROTECTED]]

Sent: Thursday, December 19, 2002 9:05 AM

To: [EMAIL PROTECTED]

Subject: [PHP] date part





How can I get a string containing the month part of a date the user types

in?

e.g. if they type in "06/07/200" I want to get "06"



thanks,

diana







--

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






-- 
Adam Voigt ([EMAIL PROTECTED])
The Cryptocomm Group
My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc








signature.asc
Description: This is a digitally signed message part


RE: [PHP] date part

2002-12-19 Thread Edward Peloke
Thanks Allan!  That is good to know.  It is just a script that I downloaded from the 
internet.  Not sure how to make it work better for linux but I will look into it.  I 
appreciate the info!

Eddie
  -Original Message-
  From: Adam Voigt [mailto:[EMAIL PROTECTED]]
  Sent: Thursday, December 19, 2002 9:38 AM
  To: Edward Peloke
  Cc: Diana Castillo; [EMAIL PROTECTED]
  Subject: RE: [PHP] date part


  I just tried that script, for me under Linux with Mozilla and Netscape, I had to try 
5 times before I could move the mouse from the button to the menu fast enough, every 
other time it would just disappear when I tried to move the mouse from the button to 
it. 

  On Thu, 2002-12-19 at 09:59, Edward Peloke wrote: 
I used a javascript I found online in my php page. Click on the boxes next 
to the date fields: 
http://www.aircharterunited.com/pages/submit_bid.php 

This way, I know the format of the date when it is entered and I can pull 
out any part needed. 

Eddie 

-Original Message- 
From: Diana Castillo [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, December 19, 2002 9:05 AM 
To: [EMAIL PROTECTED] 
Subject: [PHP] date part 


How can I get a string containing the month part of a date the user types 
in? 
e.g. if they type in "06/07/200" I want to get "06" 

thanks, 
diana 



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

-- 
Adam Voigt ([EMAIL PROTECTED])
The Cryptocomm Group
My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc 



[PHP] Random include???

2002-12-19 Thread Benjamin Trépanier
Hi, I'm a newbie in php so sorry for that question!

I have a table in a html dcc and I want toinclude a file in a cell, but
that file must be random so people load a different page each time they
refresh... The basic syntax I use for the include is below now, I want to
know how to generate the random.

Ex. My file are

folio_1.php3  
folio_2.php3  
folio_3.php3  
folio_4.php3  
folio_5.php3  






Thanks!
Ben


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




RE: [PHP] Random include???

2002-12-19 Thread Edward Peloke
Won't this work?


$random=rand(1,5);

print "";
   include("folio_$random.php");



-Original Message-
From: Benjamin Trépanier [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 19, 2002 9:46 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Random include???


Hi, I'm a newbie in php so sorry for that question!

I have a table in a html dcc and I want toinclude a file in a cell, but
that file must be random so people load a different page each time they
refresh... The basic syntax I use for the include is below now, I want to
know how to generate the random.

Ex. My file are

folio_1.php3
folio_2.php3
folio_3.php3
folio_4.php3
folio_5.php3






Thanks!
Ben


--
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] date part

2002-12-19 Thread Edward Peloke
Sorry ADAM, didn't mean to call you Allan, I apologize!

-Original Message-
From: Edward Peloke [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 19, 2002 10:11 AM
To: [EMAIL PROTECTED]
Subject: RE: [PHP] date part


Thanks Allan!  That is good to know.  It is just a script that I downloaded from the 
internet.  Not sure how to make it work better for linux but I will look into it.  I 
appreciate the info!

Eddie
  -Original Message-
  From: Adam Voigt [mailto:[EMAIL PROTECTED]]
  Sent: Thursday, December 19, 2002 9:38 AM
  To: Edward Peloke
  Cc: Diana Castillo; [EMAIL PROTECTED]
  Subject: RE: [PHP] date part


  I just tried that script, for me under Linux with Mozilla and Netscape, I had to try 
5 times before I could move the mouse from the button to the menu fast enough, every 
other time it would just disappear when I tried to move the mouse from the button to 
it. 

  On Thu, 2002-12-19 at 09:59, Edward Peloke wrote: 
I used a javascript I found online in my php page. Click on the boxes next 
to the date fields: 
http://www.aircharterunited.com/pages/submit_bid.php 

This way, I know the format of the date when it is entered and I can pull 
out any part needed. 

Eddie 

-Original Message- 
From: Diana Castillo [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, December 19, 2002 9:05 AM 
To: [EMAIL PROTECTED] 
Subject: [PHP] date part 


How can I get a string containing the month part of a date the user types 
in? 
e.g. if they type in "06/07/200" I want to get "06" 

thanks, 
diana 



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

-- 
Adam Voigt ([EMAIL PROTECTED])
The Cryptocomm Group
My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc 


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




[PHP] validate date

2002-12-19 Thread Diana Castillo
If a user inputs a date into a form, what function can I use to validate
that he put in a valid date?
I want to use checkdate but that needs the date split up into day, month
year.
Anyone have an easy way of doing this?
Thanks,
Diana




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




RE: [PHP] date part

2002-12-19 Thread Adam Voigt




I do the same thing all the time, when you respond on mailing lists it's

hard to keep track. =)



On Thu, 2002-12-19 at 10:22, Edward Peloke wrote:

Sorry ADAM, didn't mean to call you Allan, I apologize!



-Original Message-

From: Edward Peloke [mailto:[EMAIL PROTECTED]]

Sent: Thursday, December 19, 2002 10:11 AM

To: [EMAIL PROTECTED]

Subject: RE: [PHP] date part





Thanks Allan!  That is good to know.  It is just a script that I downloaded from the internet.  Not sure how to make it work better for linux but I will look into it.  I appreciate the info!



Eddie

  -Original Message-

  From: Adam Voigt [mailto:[EMAIL PROTECTED]]

  Sent: Thursday, December 19, 2002 9:38 AM

  To: Edward Peloke

  Cc: Diana Castillo; [EMAIL PROTECTED]

  Subject: RE: [PHP] date part





  I just tried that script, for me under Linux with Mozilla and Netscape, I had to try 5 times before I could move the mouse from the button to the menu fast enough, every other time it would just disappear when I tried to move the mouse from the button to it. 



  On Thu, 2002-12-19 at 09:59, Edward Peloke wrote: 

I used a javascript I found online in my php page. Click on the boxes next 

to the date fields: 

http://www.aircharterunited.com/pages/submit_bid.php 



This way, I know the format of the date when it is entered and I can pull 

out any part needed. 



Eddie 



-Original Message- 

From: Diana Castillo [mailto:[EMAIL PROTECTED]] 

Sent: Thursday, December 19, 2002 9:05 AM 

To: [EMAIL PROTECTED] 

Subject: [PHP] date part 





How can I get a string containing the month part of a date the user types 

in? 

e.g. if they type in "06/07/200" I want to get "06" 



thanks, 

diana 







-- 

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 



-- 

Adam Voigt ([EMAIL PROTECTED])

The Cryptocomm Group

My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc 





-- 

PHP General Mailing List (http://www.php.net/)

To unsubscribe, visit: http://www.php.net/unsub.php






-- 
Adam Voigt ([EMAIL PROTECTED])
The Cryptocomm Group
My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc








signature.asc
Description: This is a digitally signed message part


RE: [PHP] validate date

2002-12-19 Thread Jon Haworth
Hi Diana,

> If a user inputs a date into a form, what function can I 
> use to validate that he put in a valid date?

You can't. Here are two dates in two different formats. Only one is valid.

  - 13/04/01
  - 13/04/01

Can you spot which is which?

> I want to use checkdate but that needs the date split up 
> into day, month year. Anyone have an easy way of doing this?

You could try separate drop-downs: one for day (with numbers 1-31), one for
month (with names) and one for years (whatever you need). This gives you
three variables that you can easily pass to checkdate().

Don't fall into the trap of thinking that if you put some text on your form
saying "please enter dates in mm-dd-yy format" that that's what you'll get,
unless you *really* know your audience.

Cheers
Jon



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




[PHP] display all results

2002-12-19 Thread Simon
Hi,

I have 6 records in mysql. How can i display all of them, but not using
while. Do i have to use 6 queries. Results need to be hard formated, so that
s the reason why i cant use while.

Thanks



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




[PHP] offline application

2002-12-19 Thread Alexander Kuznetsov
Hi All!

I have a database. And now I need to create something like offline
site with that database: ii means php pages, html and images. After
this I will burn all it to CD. And that CD should be working om every
machine (I suppose win32 as OS and php will be installed if needed).

Question:
can I somehow to make such a project? How can I redirect request from
browser to php.exe?


-- 
Best regards,
Alexander Kuznetsov



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




Re: [PHP] display all results

2002-12-19 Thread Jason Wong
On Thursday 19 December 2002 23:11, Simon wrote:
> Hi,
>
> I have 6 records in mysql. How can i display all of them, but not using
> while. Do i have to use 6 queries. Results need to be hard formated, so
> that s the reason why i cant use while.

Not really sure what you need here but I guess you probably want something 
like:

  mysql_query(...);
  $result = mysql_fetch_*(...);
  // do something with the 1st record
  $result = mysql_fetch_*(...);
  // do something with the 2nd record
  ...
  ...

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
"Those who will be able to conquer software will be able to conquer the
world."
-- Tadahiro Sekimoto, president, NEC Corp.
*/


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




[PHP] Error installing

2002-12-19 Thread Mako Shark
Anybody have any bright ideas?

Trying to install my own PHP on my own server. I'm
getting the error "Redirection limit for this URL
exceeded. Unable to load the requested page."

I'm using Apache 2 and php 4.2.3 and haven't loaded
any extensions in PHP (yet).

__
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

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




[PHP] Re: offline application

2002-12-19 Thread Philippe Saladin
> I have a database. And now I need to create something like offline
> site with that database: ii means php pages, html and images. After
> this I will burn all it to CD. And that CD should be working om every
> machine (I suppose win32 as OS and php will be installed if needed).

You would have a look to "ScriptViewer". From
http://www.angorasoftware.com/scriptviewer.html :
"Develop and distribute web page scripts without a web server. Useful for
CD-ROM distribution, Stand-Alone materials, kiosks, and web page
development. The application starts an executable (like PHP, Perl, Python,
or other script parser) with a file parameter, showing the result in a HTML
viewer. The Zip file has PHP4 enclosed. "

Regards,

Philippe



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




RE: [PHP] Re: offline application

2002-12-19 Thread Edward Peloke
Would it be possible to use something like this to create a page that the
user can open up on their machine that would transfer data from an access
file on their machine to a mysql db on my server?

Thanks,
Edie

-Original Message-
From: Philippe Saladin [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 19, 2002 10:49 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Re: offline application


> I have a database. And now I need to create something like offline
> site with that database: ii means php pages, html and images. After
> this I will burn all it to CD. And that CD should be working om every
> machine (I suppose win32 as OS and php will be installed if needed).

You would have a look to "ScriptViewer". From
http://www.angorasoftware.com/scriptviewer.html :
"Develop and distribute web page scripts without a web server. Useful for
CD-ROM distribution, Stand-Alone materials, kiosks, and web page
development. The application starts an executable (like PHP, Perl, Python,
or other script parser) with a file parameter, showing the result in a HTML
viewer. The Zip file has PHP4 enclosed. "

Regards,

Philippe



--
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] Getting the username

2002-12-19 Thread Manuel Ochoa

I'm developing an Intranet at my company and was wondering if there is any way to get 
the username from someone who is already logged into a Windows network?



Re: [PHP] Getting the username

2002-12-19 Thread 1LT John W. Holmes
> I'm developing an Intranet at my company and was wondering if there is any
way to get the username from someone who is already logged into a Windows
network?

I think $_SERVER['LOGON_USER'] or maybe $_ENV['LOGON_USER'] or something
similar. I think you have to use NT permissions on the directory in order
for this variable to be present, though. There is some setting in (assuming)
IIS that you have to make, but I can't remember exactly what it is.

That was probably no help at all, eh?

---John Holmes...


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




[PHP] Re: Image resizing

2002-12-19 Thread Bogdan Stancescu
What platform are you running PHP on?

Shaun wrote:

Hi,

My webserver doesn't have the GD library installed, please can someone tell
me how I can resize uploaded images for thumbnails?

Thanks for your help





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




[PHP] One php returning several htmls

2002-12-19 Thread John Hinton
I'll go into index.php and return a portion of the html code, upon
clicking a link, I'll return another portion of the html code.

My question is what seems to be the best/cleanest/fastest method for
doing this?

I've done this with forms and the PHP_SELF action method... Wondering
about simple links and alternatives.
-- 
John Hinton - Goshen, VA.
http://www.ew3d.com

Those who dance are considered insane 
by those who can't hear the music

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




Re: [PHP] Re: offline application

2002-12-19 Thread Philippe Saladin

> Would it be possible to use something like this to create a page that the
> user can open up on their machine that would transfer data from an access
> file on their machine to a mysql db on my server?

If I understand well, you want to transfer data from Access to MySql ?
1) Could we imagine a small application that creates a flat text with data
from Access, in the format you want ?
2) the user would upload this file to your server
3) then your server would process this file to import it into MySql (see
Load Data Infile in mysql documentation).

I'm not sure I have well understood your problem. Hope it will help you !
Regards,
Philippe



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




Re: [PHP] validate date

2002-12-19 Thread Manuel Ochoa

Here is a funtion that I use.
A user can enter a date in any of the following ways:
01 01 03
01-01-03
1-1-03
01-1-2003
1-01/03
1/1 03  you get the idea...
This function will standardize the date and make sure it's valid. If invalid it 
returns "ERROR"
function fixdate($data){
 $aux[0]="";
 $aux[1]="";
 $aux[2]="";
 $z=0;
 for($i=0; $i wrote:If a user inputs a date into 
a form, what function can I use to validate
that he put in a valid date?
I want to use checkdate but that needs the date split up into day, month
year.
Anyone have an easy way of doing this?
Thanks,
Diana


[PHP] Regex Help

2002-12-19 Thread Jim
Could someone show me how to use preg_replace to change this:

test test test

into:

anotherword test anotherword

basically, I want to change a value only if it is not in an option
tag.

I also want to account for situations like :

test, something test test!

My thoughts were to do the replace if the word (test) was not
surrounded by quotes or surrounded by greater/less than symbols. I
just have no idea how to formulate that with regex.

Please help! Thanks.

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




RE: [PHP] Re: offline application

2002-12-19 Thread Edward Peloke
This is pretty much what I want with as little work to the user as possible.

-Original Message-
From: Philippe Saladin [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 19, 2002 12:16 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Re: offline application



> Would it be possible to use something like this to create a page that the
> user can open up on their machine that would transfer data from an access
> file on their machine to a mysql db on my server?

If I understand well, you want to transfer data from Access to MySql ?
1) Could we imagine a small application that creates a flat text with data
from Access, in the format you want ?
2) the user would upload this file to your server
3) then your server would process this file to import it into MySql (see
Load Data Infile in mysql documentation).

I'm not sure I have well understood your problem. Hope it will help you !
Regards,
Philippe



-- 
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] Creating access DB in PHP ..

2002-12-19 Thread Chad Day
Not sure if this is possible, and I haven't turned up what I'm looking for
in my searches yet..

I am running PHP on a FreeBSD box .. I need to create an Access database,
fill it in with some data, and have a client download it (as the software
the client is using only imports mdb files).  Is this possible in any way,
even if I have to go some route like creating it as a MySQL DB, doing a
conversion to mdb (I've seen conversion tools for vice versa), etc? ..

Thanks,
Chad


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




Re: [PHP] Regex Help

2002-12-19 Thread Rick Emery
addslashes()

- Original Message - 
From: "Jim" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, December 19, 2002 11:26 AM
Subject: [PHP] Regex Help


Could someone show me how to use preg_replace to change this:

test test test

into:

anotherword test anotherword

basically, I want to change a value only if it is not in an option
tag.

I also want to account for situations like :

test, something test test!

My thoughts were to do the replace if the word (test) was not
surrounded by quotes or surrounded by greater/less than symbols. I
just have no idea how to formulate that with regex.

Please help! Thanks.

-- 
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] Regex Help

2002-12-19 Thread Jim
I'm sorry, I accidentally left the slashes on my second example. My original
message should read:

Could someone show me how to use preg_replace to change this:

test test test

into:

anotherword test anotherword

Note that what I want to accomplish is to change 'test' into 'anotherword'
only if it is not within the option tag.

Thanks!


- Original Message -
From: "Rick Emery" <[EMAIL PROTECTED]>
To: "Jim" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Thursday, December 19, 2002 12:42 PM
Subject: Re: [PHP] Regex Help


> addslashes()
>
> - Original Message -
> From: "Jim" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Thursday, December 19, 2002 11:26 AM
> Subject: [PHP] Regex Help
>
>
> Could someone show me how to use preg_replace to change this:
>
> test test test
>
> into:
>
> anotherword test anotherword
>
> basically, I want to change a value only if it is not in an option
> tag.
>
> I also want to account for situations like :
>
> test, something test test!
>
> My thoughts were to do the replace if the word (test) was not
> surrounded by quotes or surrounded by greater/less than symbols. I
> just have no idea how to formulate that with regex.
>
> Please help! Thanks.
>
> --
> 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] Looping needs to re-open parm file

2002-12-19 Thread John W. Holmes
> I'm reading a paramter file and a text file.
> Per line of the text file I want to check if there is a word in there
from
> the parameter file.
> However I need to open and read the parameter file for each line in
the
> text
> file. How can I change this?

Can't you read the param file first into an array, and then loop through
the text file, using in_array() to see if a line matches a param?

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



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




RE: [PHP] date part

2002-12-19 Thread John W. Holmes
> How can I get a string containing the month part of a date the user
types
> in?
> e.g. if they type in "06/07/200" I want to get "06"

If you know that's the format they're going to use, the you can just use
substr() to grab the first two characters.

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



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




RE: [PHP] validate date

2002-12-19 Thread John W. Holmes
> If a user inputs a date into a form, what function can I use to
validate
> that he put in a valid date?
> I want to use checkdate but that needs the date split up into day,
month
> year.
> Anyone have an easy way of doing this?

You have to specify a date format to your users, or at least assume a
certain amount of formats. If you don't do this, then there's no way to
validate it, because any amount of variations exist of date formats. 

If you require a mm/dd/yy format, then just break it apart and validate
each element. You'll basically have to write your own function, or
possibly use strtotime() to see if it returns a result. 

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



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




Re: [PHP] Regex Help

2002-12-19 Thread Rick Emery
test test";
ereg("(.*)()(.*)",$q,$ar);
$t = "anotherword".$ar[2]."anotherword";
print $t;
?>

outputs:
anotherwordtestanotherword

- Original Message - 
From: "Jim" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, December 19, 2002 11:55 AM
Subject: Re: [PHP] Regex Help


I'm sorry, I accidentally left the slashes on my second example. My original
message should read:

Could someone show me how to use preg_replace to change this:

test test test

into:

anotherword test anotherword

Note that what I want to accomplish is to change 'test' into 'anotherword'
only if it is not within the option tag.

Thanks!


- Original Message -
From: "Rick Emery" <[EMAIL PROTECTED]>
To: "Jim" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Thursday, December 19, 2002 12:42 PM
Subject: Re: [PHP] Regex Help


> addslashes()
>
> - Original Message -
> From: "Jim" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Thursday, December 19, 2002 11:26 AM
> Subject: [PHP] Regex Help
>
>
> Could someone show me how to use preg_replace to change this:
>
> test test test
>
> into:
>
> anotherword test anotherword
>
> basically, I want to change a value only if it is not in an option
> tag.
>
> I also want to account for situations like :
>
> test, something test test!
>
> My thoughts were to do the replace if the word (test) was not
> surrounded by quotes or surrounded by greater/less than symbols. I
> just have no idea how to formulate that with regex.
>
> Please help! Thanks.
>
> --
> 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 General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] date part

2002-12-19 Thread Rick Emery
Following on to the L T:
$ar = explode("/",$thestring);

thenL
$ar[0] = 06
$ar[1] = 07
$ar[2] = 200

- Original Message - 
From: "John W. Holmes" <[EMAIL PROTECTED]>
To: "'Diana Castillo'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Thursday, December 19, 2002 11:56 AM
Subject: RE: [PHP] date part


> How can I get a string containing the month part of a date the user
types
> in?
> e.g. if they type in "06/07/200" I want to get "06"

If you know that's the format they're going to use, the you can just use
substr() to grab the first two characters.

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



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




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




[PHP] case statement?

2002-12-19 Thread Max Clark
Hi-

I was wondering if php had a case function?

Instead of building a large if/elseif/else block I would like to do a case
$page in (list).

Thanks in advance,
Max





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




Fw: [PHP] case statement?

2002-12-19 Thread Rick Emery
switch()
{
  case a:
  case b:
  case c:
  default:
}

RTFM
- Original Message - 
From: "Max Clark" <[EMAIL PROTECTED]>
To: <>
Sent: Thursday, December 19, 2002 12:19 PM
Subject: [PHP] case statement?


Hi-

I was wondering if php had a case function?

Instead of building a large if/elseif/else block I would like to do a case
$page in (list).

Thanks in advance,
Max





-- 
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] case statement?

2002-12-19 Thread Chris Wesley
On Thu, 19 Dec 2002, Max Clark wrote:

> I was wondering if php had a case function?
>
> Instead of building a large if/elseif/else block I would like to do a
> case $page in (list).

switch function ...

http://www.php.net/manual/en/control-structures.switch.php

~Chris


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




RE: [PHP] case statement?

2002-12-19 Thread Ford, Mike [LSS]
> -Original Message-
> From: Max Clark [mailto:[EMAIL PROTECTED]]
> Sent: 19 December 2002 18:19
> 
> I was wondering if php had a case function?
> 
> Instead of building a large if/elseif/else block I would like 
> to do a case
> $page in (list).

http://www.php.net/control-structures.switch

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] Regex Help

2002-12-19 Thread Jim
Thanks for helping. Unfortunately, that doesn't quite accomplish the task
either. The other example for my first post would be mangled with that.

- Original Message -
From: "Rick Emery" <[EMAIL PROTECTED]>
To: "Jim" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Thursday, December 19, 2002 1:09 PM
Subject: Re: [PHP] Regex Help


>  $q = "test test test";
> ereg("(.*)()(.*)",$q,$ar);
> $t = "anotherword".$ar[2]."anotherword";
> print $t;
> ?>
>
> outputs:
> anotherwordtestanotherword
>


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




RE: [PHP] Re: offline application

2002-12-19 Thread Edward Peloke
using php, can I extract data from an access file?

-Original Message-
From: Philippe Saladin [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 19, 2002 12:16 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Re: offline application



> Would it be possible to use something like this to create a page that the
> user can open up on their machine that would transfer data from an access
> file on their machine to a mysql db on my server?

If I understand well, you want to transfer data from Access to MySql ?
1) Could we imagine a small application that creates a flat text with data
from Access, in the format you want ?
2) the user would upload this file to your server
3) then your server would process this file to import it into MySql (see
Load Data Infile in mysql documentation).

I'm not sure I have well understood your problem. Hope it will help you !
Regards,
Philippe



-- 
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] Regex Help

2002-12-19 Thread Jim
Whoops, sorry post aborted prematurely.

What I was going say say was that:

test, something test test!

should become:

anotherword, something test anotherword!

Thanks again for helping!


- Original Message - 
From: "Jim" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, December 19, 2002 1:24 PM
Subject: Re: [PHP] Regex Help


> Thanks for helping. Unfortunately, that doesn't quite accomplish the task
> either. The other example for my first post would be mangled with that.
> 
> - Original Message -
> From: "Rick Emery" <[EMAIL PROTECTED]>
> To: "Jim" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
> Sent: Thursday, December 19, 2002 1:09 PM
> Subject: Re: [PHP] Regex Help
> 
> 
> >  > $q = "test test test";
> > ereg("(.*)()(.*)",$q,$ar);
> > $t = "anotherword".$ar[2]."anotherword";
> > print $t;
> > ?>
> >
> > outputs:
> > anotherwordtestanotherword
> >
> 

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




Re: [PHP] Regex Help

2002-12-19 Thread Rick Emery
gawd, Jim, you are s oicky 

test test";
ereg("(.*)()(.*)",$q,$ar);
$w1 = ereg_replace("test","anotherword",$ar[1]);
$w2 = ereg_replace("test","anotherword",$ar[3]);
$t = $w1.$ar[2].$w2;
print $t;

?>

outputs:
anotherword, something test anotherword

- Original Message - 
From: "Jim" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, December 19, 2002 12:25 PM
Subject: Re: [PHP] Regex Help


Whoops, sorry post aborted prematurely.

What I was going say say was that:

test, something test test!

should become:

anotherword, something test anotherword!

Thanks again for helping!


- Original Message - 
From: "Jim" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, December 19, 2002 1:24 PM
Subject: Re: [PHP] Regex Help


> Thanks for helping. Unfortunately, that doesn't quite accomplish the task
> either. The other example for my first post would be mangled with that.
> 
> - Original Message -
> From: "Rick Emery" <[EMAIL PROTECTED]>
> To: "Jim" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
> Sent: Thursday, December 19, 2002 1:09 PM
> Subject: Re: [PHP] Regex Help
> 
> 
> >  > $q = "test test test";
> > ereg("(.*)()(.*)",$q,$ar);
> > $t = "anotherword".$ar[2]."anotherword";
> > print $t;
> > ?>
> >
> > outputs:
> > anotherwordtestanotherword
> >
> 

-- 
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] Regex Help

2002-12-19 Thread John W. Holmes
There may be better ways, but this little example works. You basically
match everything around the  tag and run a replace on what's
outside of it, and then put it all back together. This example should
run as is. Adapt to your needs. 

test and this
test is good
This test on line 2thing
foo test on line 3
foo2
TesttestTest";

preg_match_all("/(.*)()(.*)/i",$string,$match);

$cnt = count($match[1]);

for($x=0;$x<$cnt;$x++)
{
$p1 = preg_replace("/$word/i",$repl,$match[1][$x]);
$p2 = preg_replace("/$word/i",$repl,$match[3][$x]);

$new_string .= $p1 . $match[2][$x] . $p2 . "\n";
}

echo "$string\n--\n$new_string";

?>

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/

> -Original Message-
> From: Jim [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, December 19, 2002 1:24 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP] Regex Help
> 
> Thanks for helping. Unfortunately, that doesn't quite accomplish the
task
> either. The other example for my first post would be mangled with
that.
> 
> - Original Message -
> From: "Rick Emery" <[EMAIL PROTECTED]>
> To: "Jim" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
> Sent: Thursday, December 19, 2002 1:09 PM
> Subject: Re: [PHP] Regex Help
> 
> 
> >  > $q = "test test test";
> > ereg("(.*)()(.*)",$q,$ar);
> > $t = "anotherword".$ar[2]."anotherword";
> > print $t;
> > ?>
> >
> > outputs:
> > anotherwordtestanotherword
> >
> 
> 
> --
> 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] case statement?

2002-12-19 Thread Manuel Ochoa

Yes, It's called "SWITCH"

Just go to www.php.net and lookup "switch" in the function list
 Max Clark <[EMAIL PROTECTED]> wrote:Hi-

I was wondering if php had a case function?

Instead of building a large if/elseif/else block I would like to do a case
$page in (list).

Thanks in advance,
Max





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



Re: [PHP] case statement?

2002-12-19 Thread Mark Charette

On Thu, 19 Dec 2002, Max Clark wrote:

> Hi-
> 
> I was wondering if php had a case function?
> 
> Instead of building a large if/elseif/else block I would like to do a case
> $page in (list).

The documentation and search capabilities at http://www.php.net are your 
frientd. It would behhove you to at least read the basic language 
statemants.

mark C.


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




Re: [PHP] speet testing (was URL parsing)

2002-12-19 Thread Sean Burlington
1LT John W. Holmes wrote:


I wonder if you could pass on some pointers for speed testing.

thanks



Nothing fancy. Just using the getmicrotime() function defined on the
microtime() manual page to get the time before the bit I'm testing and after
and subtract to get the difference.

www.php.net/microtime

There are fancier classes out there that'll do this and create pretty graphs
and all that, too. I think PEAR has something to help with it.



simple is good :)

thanks for that - I'll start experimenting.

I never used too be too worried about speed  - but have recenetly worked 
on a project that has become very slow and need to start developing 
methods for analysing code changes and thier impact on performance.

--

Sean





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



[PHP] Sound with PHP

2002-12-19 Thread Alfonso Ballesteros
Hello... I'm a newcomer and wish to know if it is possible to play sound
files (mp3 or wav) using PHP. For example, if I have 2 sound files, how to
play one after the other.

Thanks
Alfonso



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




RE: [PHP] delete() and unlink()

2002-12-19 Thread @ Nilaab
Thanks Jason,

That makes much more sense now. I forgot about recursive functions, as I
don't use them often. I should look into it further. It seems to be very
helpful in some cases. Thanks again for your help.

- Nilaab

> -Original Message-
> From: Jason Wong [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, December 19, 2002 3:53 AM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP] delete() and unlink()
>
>
> On Thursday 19 December 2002 17:39, [EMAIL PROTECTED] wrote:
> > Hello Everyone,
> >
> > I'm using a test server on Windows XP. I have the following
> function (which
> > I got from the comment notes on php.net) that works wonders
> when deleting
> > directories that are not empty on a Windows system.
>
> Good.
>
> > But, I'm a bit
> > confused. I searched for the delete() function on php.net and
> it said that
> > delete() was not a real function, but a dummy manual entry for those who
> > are actually looking for the unlink() function.
>
> delete() is a dummy entry in the manual so people looking for
> said function
> will be directed to unlink() which is the correct function to use.
>
> > So then why does the
> > delete() function work in my script?
>
> delete() is undefined in php, that is why you can define your own
> function
> called delete().
>
> > I tried using the unlink() function in
> > place of the delete() function, but unlink() gave me many
> errors (possibly
> > because of permissions).
>
> unlink() can only remove/delete directories that are empty.
>
> > Is there an error in the manual or is it just me?
>
> There's no error in the manual (with regards to this subject). Probably a
> misunderstanding on your part.
>
> > Is there a difference in the two functions? Does the delete()
> function not
> > care about permissions as opposed to the unlink() function?
> This is really
> > bugging me. Can someone clear the air?
>
> The delete() function as defined below is recursive and will
> automatically go
> inside non-empty directories and empty them first.
>
> > $c_dir = "$DOCUMENT_ROOT/world/admin/backup2";  // current directory
> >
> > function delete($dir) {
> >  if (file_exists($dir)) {
> > umask(0);
> > chmod($dir,0777);
> >if (is_dir($dir)) {
> >  $handle = opendir($dir);
> >  while($dirname = readdir($handle)) {
> >if ($dirname != "." && $dirname != "..") {
> > delete($dir."/".$dirname);
> >}
> >  }
> > closedir($handle);
> >  rmdir($dir);
> >} else {
> > unlink($dir);
> >}
> >  }
> > }
> >
> > delete ($c_dir);
>
> To summarise -- there is no delete() function in php, the
> delete() function
> you're using is a user-defined function and as such will do
> whatever you can
> make it do.
>
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.biz
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
>
> /*
> Garbage In -- Gospel Out.
> */
>
>
> --
> 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] Sound with PHP

2002-12-19 Thread Andrew Brampton
If you are trying to play the sounds on the client's PC, then you can't do
this with PHP

PHP is a server side language, so if you tried playing soudns with it, it
would only be heard by the people standing next to your server :)..

You might want to take a look at some HTML or JScript, or Flash, or many
other methods of playing music. (which are all client side "languages")

Andrew
- Original Message -
From: "Alfonso Ballesteros" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, December 19, 2002 8:02 PM
Subject: [PHP] Sound with PHP


> Hello... I'm a newcomer and wish to know if it is possible to play sound
> files (mp3 or wav) using PHP. For example, if I have 2 sound files, how to
> play one after the other.
>
> Thanks
> Alfonso
>
>
>
> --
> 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] Sound with PHP

2002-12-19 Thread James E Hicks III
The only way this would work with PHP on the webserver would be to 
 the sound file in the webpage or some other  to do
it. I even think there is a way to queue files like you are asking
about, but this would be an HTML thing and not PHP.

James


-Original Message-
From: Alfonso Ballesteros [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 19, 2002 3:03 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Sound with PHP


Hello... I'm a newcomer and wish to know if it is possible to play sound
files (mp3 or wav) using PHP. For example, if I have 2 sound files, how to
play one after the other.

Thanks
Alfonso



-- 
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: One php returning several htmls

2002-12-19 Thread Jeff
Go to page 1

"John Hinton" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I'll go into index.php and return a portion of the html code, upon
> clicking a link, I'll return another portion of the html code.
>
> My question is what seems to be the best/cleanest/fastest method for
> doing this?
>
> I've done this with forms and the PHP_SELF action method... Wondering
> about simple links and alternatives.
> --
> John Hinton - Goshen, VA.
> http://www.ew3d.com
>
> Those who dance are considered insane
> by those who can't hear the music



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




[PHP] odbc

2002-12-19 Thread Edward Peloke
Ok,

I am lost now, I am just trying to read the documentation on odbc...here is
what I have so far. This seems to work...or at least not give any errors.
How do I know get to the result set in the select statement to move this
data somewhere else? I just want to get the entire result set so I can load
it into another db.

Thanks,
Eddie




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




[PHP] Question about the exit() command

2002-12-19 Thread Beauford.2002
Hi,

Could someone clarify this for me. I want to be able to exit out of a PHP
webpage and return to the calling page if certain conditions are not met. It
appears using exit() will do this, but I am unclear exactly how to use it.

any info is appreciated.

TIA




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




Re: [PHP] Question about the exit() command

2002-12-19 Thread Philip Olson

How about:

  if (!$conn = mysql_connect($host, $user, $pass)) {
  include 'static_html.inc';
  exit;
  }

  print "Welcome, yes the database is connected";

exit ends the script, nothing after its use is executed.


Regards,
Philip Olson


On Thu, 19 Dec 2002, Beauford.2002 wrote:

> Hi,
> 
> Could someone clarify this for me. I want to be able to exit out of a PHP
> webpage and return to the calling page if certain conditions are not met. It
> appears using exit() will do this, but I am unclear exactly how to use it.
> 
> any info is appreciated.
> 
> TIA
> 
> 
> 
> 
> -- 
> 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




  1   2   >