[PHP] Re: Text cleaning?

2004-02-27 Thread Five
You mean something like this?

$message = ereg_replace( "\n", " ", $message);

It seems to replace all new line instances with a blank space.



"Karl Timmermann" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
> Does anyone have some PHP code to remove incorrect carriage returns?
>
> Example:
>
> Sentence should be "Hi, my name is Karl and I like PHP."
> but is: "Hi, my name is Karl and I like
> PHP."
>
> or
> "Hi my name is Karl and
> I like PHP."
>
> I think I saw some code before that does it, but can't find it anywhere.
>
> Thanks!
> Karl

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



Re: [PHP] to more fields in register

2004-02-27 Thread devil_online
ok...good awser
"Jason Wong" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> On Saturday 28 February 2004 14:12, devil_online wrote:
> > ok, how do we do an field?
>
> Assuming you're not a troll, and assuming that you're a complete beginner,
and
> assuming that the above is "how do I add a field to an existing table in a
> database?" then I strongly suggest that you search for some basic
tutorials,
> work on them and understand them before proceeding.
>
> -- 
> Jason Wong -> Gremlins Associates -> www.gremlins.biz
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
> --
> Search the list archives before you post
> http://marc.theaimsgroup.com/?l=php-general
> --
> /*
> If truth is beauty, how come no one has their hair done in the library?
> -- Lily Tomlin
> */

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



Re: [PHP] to more fields in register

2004-02-27 Thread Jason Wong
On Saturday 28 February 2004 14:12, devil_online wrote:
> ok, how do we do an field?

Assuming you're not a troll, and assuming that you're a complete beginner, and 
assuming that the above is "how do I add a field to an existing table in a 
database?" then I strongly suggest that you search for some basic tutorials, 
work on them and understand them before proceeding.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
If truth is beauty, how come no one has their hair done in the library?
-- Lily Tomlin
*/

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



Re: [PHP] to more fields in register

2004-02-27 Thread devil_online
ok, how do we do an field?
"Jason Wong" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> On Saturday 28 February 2004 12:32, devil_online wrote:
> > Hi I have a register form that have 2 fields user and pass. Now I would
> > like to put two more fields city and email. How can I do it? thanks
>
> The same way that you did the first two?
>
> -- 
> Jason Wong -> Gremlins Associates -> www.gremlins.biz
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
> --
> Search the list archives before you post
> http://marc.theaimsgroup.com/?l=php-general
> --
> /*
> It may be bad manners to talk with your mouth full, but it isn't too
> good either if you speak when your head is empty.
> */

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



Re: [PHP] to more fields in register

2004-02-27 Thread Jason Wong
On Saturday 28 February 2004 12:32, devil_online wrote:
> Hi I have a register form that have 2 fields user and pass. Now I would
> like to put two more fields city and email. How can I do it? thanks

The same way that you did the first two?

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
It may be bad manners to talk with your mouth full, but it isn't too
good either if you speak when your head is empty.
*/

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



Re: [PHP] Timestamp query...

2004-02-27 Thread Jason Wong
On Saturday 28 February 2004 12:08, Ryan A wrote:

> We needed a timestamp there because of other calcalations from other
> scripts that access the
> same table. Regarding your solution, can you give me a quick example
> please? its 5am and i'm
> pretty braindead
>
> I am familier with the LIKE command with the % operator as I use it often
> to search for words,
> but am just a bit puzzled with what you wrote...

   ... LIKE '20040222%' ...

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
If they can make penicillin out of moldy bread, they can sure make
something out of you.
-- Muhammad Ali
*/

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



[PHP] What's your favorite PHP weather code?

2004-02-27 Thread Karl Timmermann
I'm looking for some code to get the latest weather and put it on my 
webpage, and have it very customizable. What are your favorites?

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


[PHP] Text cleaning?

2004-02-27 Thread Karl Timmermann
Does anyone have some PHP code to remove incorrect carriage returns?

Example:

Sentence should be "Hi, my name is Karl and I like PHP."
but is: "Hi, my name is Karl and I like
PHP."
or
"Hi my name is Karl and
I like PHP."
I think I saw some code before that does it, but can't find it anywhere.

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


[PHP] to more fields in register

2004-02-27 Thread devil_online
Hi I have a register form that have 2 fields user and pass. Now I would like
to put two more fields city and email. How can I do it? thanks

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



[PHP] php package

2004-02-27 Thread edwardspl
Dear All,

Is there ( www.php.net )  RPM / SRPMS packages can be downloaded ?

Thank a lots.

Edward.

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



Re: [PHP] Timestamp query...

2004-02-27 Thread Ryan A

On 2/28/2004 4:43:48 AM, Michal Migurski ([EMAIL PROTECTED]) wrote:
> >The field is join_date_time and the values are something like:
> >2004022215
> >20040223015329
> >
> >Everything is working fine and dandy except now that the client wants a
> >search functionality in his "control panel" where he can enter the day,
> >month, year and see all the people who have joined on that particular
> >date...
> >
> >I have created 3 text boxes in the html form named mm,dd,but how
> >do i search on that?

> All you need is substr() and the mysql keyword 'like', and you should be
> all set. Why didn't you make join_date_time a datetime in the first place?

Hey,
Thanks for replying.

We needed a timestamp there because of other calcalations from other scripts
that access the
same table. Regarding your solution, can you give me a quick example please?
its 5am and i'm
pretty braindead

I am familier with the LIKE command with the % operator as I use it often to
search for words,
but am just a bit puzzled with what you wrote...

Thanks,
-Ryan

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



Re: [PHP] Timestamp query...

2004-02-27 Thread Robert Cummings

On Fri, 2004-02-27 at 22:43, Michal Migurski wrote:
> >The field is join_date_time and the values are something like:
> >2004022215
> >20040223015329
> >
> >Everything is working fine and dandy except now that the client wants a
> >search functionality in his "control panel" where he can enter the day,
> >month, year and see all the people who have joined on that particular
> >date...
> >
> >I have created 3 text boxes in the html form named mm,dd,but how
> >do i search on that?
> 
> All you need is substr() and the mysql keyword 'like', and you should be
> all set. Why didn't you make join_date_time a datetime in the first place?

There's several MySQL functions for retrieving aspects of the date. Look
into YEAR(), MONTH(), and DAYOFMONTH().

For more information:

http://www.mysql.com/documentation/mysql/bychapter/manual_Functions.html#Date_and_time_functions

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



Re: [PHP] Timestamp query...

2004-02-27 Thread Michal Migurski
>The field is join_date_time and the values are something like:
>2004022215
>20040223015329
>
>Everything is working fine and dandy except now that the client wants a
>search functionality in his "control panel" where he can enter the day,
>month, year and see all the people who have joined on that particular
>date...
>
>I have created 3 text boxes in the html form named mm,dd,but how
>do i search on that?

All you need is substr() and the mysql keyword 'like', and you should be
all set. Why didn't you make join_date_time a datetime in the first place?

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

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



[PHP] Timestamp query...

2004-02-27 Thread Ryan A
Hi,
I have a couple of records in the DB with timestamp(14) values.

The field is join_date_time and the values are something like:
2004022215
20040223015329

Everything is working fine and dandy except now that the client wants a
search functionality
in his "control panel" where he can enter the day, month, year and see all
the people who
have joined on that particular date...

I have created 3 text boxes in the html form named mm,dd,but how do
i search on that?

I have been looking at both the PHP and MySql manual for this and
google..the closest solution
I could find was to select all the records from the database then convert
them to a unix timestamp
with mktime and then compare themwhich is a long process and pretty
resource wasteful (IMHO)
as there will most probably be hundreds if not thousands of records...

Any suggestions?

Thanks,
-Ryan

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



Re: [PHP] List files in a dir

2004-02-27 Thread Raditha Dissanayake
Shaun wrote:

Hi,

is it possible to have a file that lists all of the files in the current so
that users can download them - this would be useful for a collection of
images I have?
Thanks for your help

 

it's only a few lines of code and you will find it here: 
http://www.raditha.com/php/dir.php

--
Raditha Dissanayake.

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


Re: [PHP] arrays and sessions

2004-02-27 Thread Justin Patrin
First of all, make sure you're doing session_start() before 
reading/writing any session data and before you do any output.

Second, You likely need to just do something like this:

session_start();
if(post data) {
  $_SESSION['formArray'][] = $_POST;
}
This will save each POST array as-is in the session.

Chris W. Parker wrote:

Kermit Short 
on Friday, February 27, 2004 2:10 PM said:

I've got some code and it simply isn't working.  I thought it might be
because each time the form submits data, the array I'm storing
information in is being re-initialized.  If this is the case, I don't
have the multidimensional array I'm trying to get, but just a vector
array with the most recent submission data.


here are some thoughts...

sounds like you're just not keeping track of each iteration. i mean,
within the session variable you need to somehow differentiate between
each subsequent form submittal.


  $iteration = ++$_POST['iteration'];

  $_SESSION['post_data'][$iteration] = $_POST;

  // include $iteration in the post data
  // so that next time it comes around
  // it can be incremented.
  echo <<

 ...
 
 ...

?>

you should then see a multi-dimensional array with
'print_r($_SESSION);'.
this code is untested and not very complete. ;) but maybe it will give
you some ideas?
hth,
chris.


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


[PHP] PHP application design with WAE UML.

2004-02-27 Thread Lukasz Karapuda
I have recently started to put more emphasis on PHP web application design and
the documenting techniques that are associated with that (UML, flowcharting). I
fairly well acquainted with UML diagraming techniques in general. 

I was not successful in finding a lot of resources on Web that would relate to
proven practices of web application design for PHP. I considered the use of the
"Web Application Extension for UML" standard. It seems however that in order to
sucessfully utilize that standard, there is a need to adopt a certain framework
for application development and assume the use of it for the design process.

I would appreciate any input on proven design/diagramming techniques for PHP web
application design.

-- 
Lukasz Karapuda










This message was sent using IMP, the Internet Messaging Program.

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



Re: [PHP] Math weirdness with doubles...

2004-02-27 Thread Marek Kilimajer
jon roig wrote:
Ok... It's Friday and maybe my brain is dead, but I'm having a weird
problem with some basic math.
Here's a little snippet of the code I'm working with:

---
echo "Current:$currentAmount:".gettype($currentAmount)." -
Paid:$paidAmount:".gettype($paidAmount)."";
$currentAmount = $currentAmount-$paidAmount;
echo "Final Current: $currentAmount";
-
Straightforward... Yeah?

Here's a sample of the output:
Current:97.6:double - Paid:97.6:double
Final Current: 1.42108547152E-014
Now if both $currentAmount and $paidAmount are doubles, subtracting them
should yield a zero, shouldn't it?
No, because they are doubles. If they were integers it would yield a 
zero. Try to compare the doubles and you find out they are not equal:

if($currentAmount == $paidAmount) echo "equal";
else echo "not equal";
You need to know how are floats and doubles represented. They are in 
fact something like 97.589 or 97.601, so you should never 
compare doubles and floats if they are equal, or you should round them 
before.

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


RE: [PHP] arrays and sessions

2004-02-27 Thread Chris W. Parker
Kermit Short 
on Friday, February 27, 2004 2:10 PM said:

> I've got some code and it simply isn't working.  I thought it might be
> because each time the form submits data, the array I'm storing
> information in is being re-initialized.  If this is the case, I don't
> have the multidimensional array I'm trying to get, but just a vector
> array with the most recent submission data.

here are some thoughts...

sounds like you're just not keeping track of each iteration. i mean,
within the session variable you need to somehow differentiate between
each subsequent form submittal.


 ...
 
 ...


?>

you should then see a multi-dimensional array with
'print_r($_SESSION);'.

this code is untested and not very complete. ;) but maybe it will give
you some ideas?


hth,
chris.

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



RE: [PHP] Math weirdness with doubles...

2004-02-27 Thread Daniel Clark
Cool.

There must be a way to display out the full doubles precision huh.



> Thank you so much for the help, folks. That turned out to be weird, but
> correct. Rounding off to 4 decimal point places solved the problem quite
> nicely.
>
>   -- jon
>
>
>
> -Original Message-
> From: Daniel Clark [mailto:[EMAIL PROTECTED]
> Sent: Friday, February 27, 2004 3:16 PM
> To: jon roig
> Cc: [EMAIL PROTECTED]
> Subject: Re: [PHP] Math weirdness with doubles...
>
>
> Looks like the Doubles are not exactly zero.  Must be some precision
> points not displaying.
>
>
>> Ok... It's Friday and maybe my brain is dead, but I'm having a weird
>> problem with some basic math.
>>
>> Here's a little snippet of the code I'm working with:
>>
>> ---
>> echo "Current:$currentAmount:".gettype($currentAmount)." -
>> Paid:$paidAmount:".gettype($paidAmount)."";
>>
>> $currentAmount = $currentAmount-$paidAmount;
>> echo "Final Current: $currentAmount";
>> -
>>
>> Straightforward... Yeah?
>>
>> Here's a sample of the output:
>> Current:97.6:double - Paid:97.6:double
>> Final Current: 1.42108547152E-014
>>
>> Now if both $currentAmount and $paidAmount are doubles, subtracting
>> them should yield a zero, shouldn't it?
>>
>>  -- jon
>>
>> ---
>> jon roig
>> web developer
>> email: [EMAIL PROTECTED]
>> phone: 888.230.7557
>>
>> ---
>
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.593 / Virus Database: 376 - Release Date: 2/20/2004
>
>
> --
> 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] Math weirdness with doubles...

2004-02-27 Thread jon roig
Thank you so much for the help, folks. That turned out to be weird, but
correct. Rounding off to 4 decimal point places solved the problem quite
nicely.

-- jon



-Original Message-
From: Daniel Clark [mailto:[EMAIL PROTECTED] 
Sent: Friday, February 27, 2004 3:16 PM
To: jon roig
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Math weirdness with doubles...


Looks like the Doubles are not exactly zero.  Must be some precision
points not displaying.


> Ok... It's Friday and maybe my brain is dead, but I'm having a weird 
> problem with some basic math.
>
> Here's a little snippet of the code I'm working with:
>
> ---
> echo "Current:$currentAmount:".gettype($currentAmount)." - 
> Paid:$paidAmount:".gettype($paidAmount)."";
>
> $currentAmount = $currentAmount-$paidAmount;
> echo "Final Current: $currentAmount";
> -
>
> Straightforward... Yeah?
>
> Here's a sample of the output:
> Current:97.6:double - Paid:97.6:double
> Final Current: 1.42108547152E-014
>
> Now if both $currentAmount and $paidAmount are doubles, subtracting 
> them should yield a zero, shouldn't it?
>
>   -- jon
>
> ---
> jon roig
> web developer
> email: [EMAIL PROTECTED]
> phone: 888.230.7557
>
> ---


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.593 / Virus Database: 376 - Release Date: 2/20/2004
 

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



Re: [PHP] Math weirdness with doubles...

2004-02-27 Thread D. Wokan
They are not the same amount.  They each got a different rounding error. 
 Double values only display a small number of decimal places 
(relatively speaking).  If you look at the difference you're getting, 
it's 0.0142108547152 (I may be off by a zero or two), so 
given you're working with a currency, I'd say you can safely round to 
about 4 or 8 decimal places to get a reasonably accurate result.  I 
typically use 4 since most money types I've seen only go out 4 decimal 
places to begin with.
--
D. Wokan
(Sorry for the double reply, Jon.  Didn't realise this list doesn't set 
the reply-to until it was too late.)

jon roig wrote:

Ok... It's Friday and maybe my brain is dead, but I'm having a weird
problem with some basic math.
Here's a little snippet of the code I'm working with:

---
echo "Current:$currentAmount:".gettype($currentAmount)." -
Paid:$paidAmount:".gettype($paidAmount)."";
$currentAmount = $currentAmount-$paidAmount;
echo "Final Current: $currentAmount";
-
Straightforward... Yeah?

Here's a sample of the output:
Current:97.6:double - Paid:97.6:double
Final Current: 1.42108547152E-014
Now if both $currentAmount and $paidAmount are doubles, subtracting them
should yield a zero, shouldn't it?
	-- jon

---
jon roig
web developer
email: [EMAIL PROTECTED]
phone: 888.230.7557
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.593 / Virus Database: 376 - Release Date: 2/20/2004
 

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


Re: [PHP] Math weirdness with doubles...

2004-02-27 Thread Daniel Clark
Looks like the Doubles are not exactly zero.  Must be some precision
points not displaying.


> Ok... It's Friday and maybe my brain is dead, but I'm having a weird
> problem with some basic math.
>
> Here's a little snippet of the code I'm working with:
>
> ---
> echo "Current:$currentAmount:".gettype($currentAmount)." -
> Paid:$paidAmount:".gettype($paidAmount)."";
>
> $currentAmount = $currentAmount-$paidAmount;
> echo "Final Current: $currentAmount";
> -
>
> Straightforward... Yeah?
>
> Here's a sample of the output:
> Current:97.6:double - Paid:97.6:double
> Final Current: 1.42108547152E-014
>
> Now if both $currentAmount and $paidAmount are doubles, subtracting them
> should yield a zero, shouldn't it?
>
>   -- jon
>
> ---
> jon roig
> web developer
> email: [EMAIL PROTECTED]
> phone: 888.230.7557
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.593 / Virus Database: 376 - Release Date: 2/20/2004
>
>
> --
> 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] arrays and sessions

2004-02-27 Thread Kermit Short
I've got some code and it simply isn't working.  I thought it might be
because each time the form submits data, the array I'm storing information
in is being re-initialized.  If this is the case, I don't have the
multidimensional array I'm trying to get, but just a vector array with the
most recent submission data.  I tried making the array a session variable,
but I'm not even sure the session part of it is working.  So, if you have
any methods that you think might work better than what I'm trying to do, I'd
love to hear about it.  Basically, my file is structured like this:

1. Pull in POST data, and store them in php variables
2. If the POST data is null, display the first form and get the table name,
field name, field type, primary key, and null allowed information.  On
submit, the information is stored in an array.
3. If the POST data is not null, again display the entry form in case the
user needs to add more fields, and step through the array to display the
existing table info that the user has already entered.  A button in a second
form is also displayed.  When clicked, it actually creates the table.

My problems are that when I try to step through the array and display its
current contents, I get index not defined errors on my for loop indices
(?!).  The second problem is, when I try to use the print_r function to
display my array, it only displays one set of data.  This might be because
I'm trying to do a C++ type 2 dimensional array concept when PHP arrays are
associative by nature, and I'm not sure how to get around this.
Suggestions?

(Yes, Kermit is my real name.  Miss Piggy is well, and sends her regards.)

-Kermit

"Chris W. Parker" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
Kermit Short 
on Friday, February 27, 2004 1:47 PM said:

> A second form will contain an action that
> sends the sql code for creating the table to the database server, and
> viola, I've got myself a new table.

i prefer the violin, but viola's are cool too. ;)

> If anyone has any
> suggestions on how I can get this done I'd appreciate it!

wait.. i don't understand. you're asking us for a method to accomplish
what you describe or are you looking for help with a problem you're
having?? if the former, your method *sounds* ok to me. if the latter
please post the error you're getting.

> I'd really
> rather not post my whole code file, as it's really big and long, and
> emphasizes how novice I am at PHP.

good choice.


> Thanks in advance for your help!

no problem.


> -Kermit

is your real name Kermit?




chris.

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



[PHP] Math weirdness with doubles...

2004-02-27 Thread jon roig
Ok... It's Friday and maybe my brain is dead, but I'm having a weird
problem with some basic math.

Here's a little snippet of the code I'm working with:

---
echo "Current:$currentAmount:".gettype($currentAmount)." -
Paid:$paidAmount:".gettype($paidAmount)."";

$currentAmount = $currentAmount-$paidAmount;
echo "Final Current: $currentAmount";
-

Straightforward... Yeah?

Here's a sample of the output:
Current:97.6:double - Paid:97.6:double
Final Current: 1.42108547152E-014

Now if both $currentAmount and $paidAmount are doubles, subtracting them
should yield a zero, shouldn't it?

-- jon

---
jon roig
web developer
email: [EMAIL PROTECTED]
phone: 888.230.7557

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.593 / Virus Database: 376 - Release Date: 2/20/2004
 

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



RE: [PHP] arrays and sessions

2004-02-27 Thread Chris W. Parker
Kermit Short 
on Friday, February 27, 2004 1:47 PM said:

> A second form will contain an action that
> sends the sql code for creating the table to the database server, and
> viola, I've got myself a new table.

i prefer the violin, but viola's are cool too. ;)

> If anyone has any
> suggestions on how I can get this done I'd appreciate it!

wait.. i don't understand. you're asking us for a method to accomplish
what you describe or are you looking for help with a problem you're
having?? if the former, your method *sounds* ok to me. if the latter
please post the error you're getting.

> I'd really
> rather not post my whole code file, as it's really big and long, and
> emphasizes how novice I am at PHP.

good choice.


> Thanks in advance for your help!

no problem.


> -Kermit

is your real name Kermit?




chris.

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



[PHP] Re: read it immediately

2004-02-27 Thread Justin Patrin
[EMAIL PROTECTED] wrote:

kill the writer of this document!
Thanks Rosencrantz

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


[PHP] Re: List files in a dir

2004-02-27 Thread Justin Patrin
Shaun wrote:

Hi,

is it possible to have a file that lists all of the files in the current so
that users can download them - this would be useful for a collection of
images I have?
Thanks for your help

Try opendir() and readdir().
http://us4.php.net/opendir
--
paperCrane 
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] arrays and sessions

2004-02-27 Thread Kermit Short
Uh, sorry, I'm Kermit, not news.php.net


OK gurus, I'm trying to create a page that allows me to create a table in my
MSSQL database.  I'm accepting the field info one by one in a form using a
PHP_SELF action.  This information is supposed to be collected in an array
that's to be stored as a session variable for semi-permanance, until the
array contains all the fields and information for the table.  A second form
will contain an action that sends the sql code for creating the table to the
database server, and viola, I've got myself a new table.  Or not.  If anyone
has any suggestions on how I can get this done I'd appreciate it!  I'd
really rather not post my whole code file, as it's really big and long, and
emphasizes how novice I am at PHP.  Thanks in advance for your help!

-Kermit

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



php-general Digest 27 Feb 2004 21:42:41 -0000 Issue 2615

2004-02-27 Thread php-general-digest-help

php-general Digest 27 Feb 2004 21:42:41 - Issue 2615

Topics (messages 178991 through 179026):

Re: Passing the value of a variable from PHP to JavaScript.
178991 by: Gareth Williams
178992 by: Prabu Subroto

Re: PHP5 simpleXML bug or am i just being silly :)
178993 by: William Bailey
178994 by: William Bailey

seesions problem
178995 by: Pance
178996 by: Seba
179000 by: Rich Gray
179005 by: Stuart
179008 by: Chris Shiflett
179015 by: Pance
179022 by: Chris Shiflett

Re: bug in PHP
178997 by: Michael Kunze
179007 by: Chris Shiflett

Re: PHP Apache Log Stats and viewer?
178998 by: Michael Kunze

stdClass
178999 by: Jakes

strstr
179001 by: Jakes
179002 by: Richard Davey
179003 by: Burhan Khalid
179006 by: Ben Ramsey

Re: renamed images are now corrupt...
179004 by: Burhan Khalid

Re: Sequential Random Character Generator
179009 by: Burhan Khalid

Importing PDF Text
179010 by: Adam Voigt
179012 by: Stuart
179013 by: Adam Voigt
179014 by: Stuart

Re: Weird result from query...?
179011 by: Jeff Harris

Where to talk business?
179016 by: rogue

php5 and xml
179017 by: Carlos

List files in a dir
179018 by: Shaun
179019 by: Chris W. Parker
179025 by: Ryan A

survey for graduation thesis
179020 by: Joost Wilbrink

read it immediately
179021 by: gaudyc.pt-sd.org

php-mode, emacs, and k&r style
179023 by: James Hughes

PHP and Workflow Engines
179024 by: Pascal Schaedeli

Arrays as session variables
179026 by: news.php.net

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 ---
Try this:

function tes(selCtrl){
document.write('JavaScript');
window.location.replace('http://192.168.23.1/coba/coba.php? 
vtes='+selCtrl.value);

}


or this:

function tes(){
   selCtrl = document.getElementById('vtes');
document.write('JavaScript');
window.location.replace('http://192.168.23.1/coba/coba.php? 
vtes='+selCtrl.value);

}




On 27 Feb 2004, at 10:00, Prabu Subroto wrote:

Dear my friends...

I have my code like this :
==

echo "


function tes(){
document.write('

JavaScript

');
window.location.replace('http://192.168.23.1/coba/coba.php? vtes=$vtes');

}


";
echo "diforward ke javascript";

echo "


1
2

";
?>


==
I expect this result on url column of my internet browser:
"
http://192.168.23.1/coba/coba.php?vtes='1'
"
or
"
http://192.168.23.1/coba/coba.php?vtes='1'
"
But I only get this unexpected result:
"
http://192.168.23.1/coba/coba.php?vtes=
"
Lookslike the value of "$vtes" was not passed to JavaScript
interpreter.
Anybody of you have a solution for me?

Please teach me.

Thank you very much.
--
_
Web-based SMS services available at http://www.operamail.com.
From your mailbox to local or overseas cell phones.
Powered by Outblaze

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

--- End Message ---
--- Begin Message ---
Dear my friend, Gareth...

Yes, it worksThank you very much for your help. I really appreciate your help.

Thanks
- Original Message -
From: Gareth Williams <[EMAIL PROTECTED]>
Date: Fri, 27 Feb 2004 10:08:21 +0100
To: "Prabu Subroto" <[EMAIL PROTECTED]>
Subject: Re: [PHP] Passing the value of a variable from PHP to JavaScript.

> Try this:
> 
> > function tes(selCtrl){
> > document.write('JavaScript');
> > window.location.replace('http://192.168.23.1/coba/coba.php? 
> > vtes='+selCtrl.value);
> >
> > }
> 
> 
> 
> or this:
> 
> > function tes(){
> selCtrl = document.getElementById('vtes');
> > document.write('JavaScript');
> > window.location.replace('http://192.168.23.1/coba/coba.php? 
> > vtes='+selCtrl.value);
> >
> > }
> 
> 
> 
> 
> 
> On 27 Feb 2004, at 10:00, Prabu Subroto wrote:
> 
> > Dear my friends...
> >
> > I have my code like this :
> > ==
> >  > echo "
> > 
> > 
> > function tes(){
> > document.write('

JavaScript

'); > > window.location.replace('http://192.168.23.1/coba/coba.php? > > vtes=$vtes'); > > > > } > > > > > > "; > > > > echo "diforward ke javascript"; > > > > echo " > > > > > > 1 > > 2 > > > > "; > > ?> > > > > > > == > > > > I expect this result on url column of my internet browser: > > " > > http://192.168.23.1/coba/coba.php?vtes='1' > > " > > or > > " > > http://192.168.23.1/coba/coba.php?vtes='1' > > " > > > > But I only get this unexpected re

[PHP] Arrays as session variables

2004-02-27 Thread news.php.net
OK gurus, I'm trying to create a page that allows me to create a table in my
MSSQL database.  I'm accepting the field info one by one in a form using a
PHP_SELF action.  This information is supposed to be collected in an array
that's to be stored as a session variable for semi-permanance, until the
array contains all the fields and information for the table.  A second form
will contain an action that sends the sql code for creating the table to the
database server, and viola, I've got myself a new table.  Or not.  If anyone
has any suggestions on how I can get this done I'd appreciate it!  I'd
really rather not post my whole code file, as it's really big and long, and
emphasizes how novice I am at PHP.  Thanks in advance for your help!

-Kermit

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



Re: [PHP] List files in a dir

2004-02-27 Thread Ryan A
> Hi,

Hi,

> is it possible to have a file that lists all of the files in the current
> so
> that users can download them

Yes, belive it or not...it IS possible.

- this would be useful for a collection of
> images I have?

Sure sounds like it.

> Thanks for your help

Most welcome.


Incase the above didnt automatically solve all your problems you might
want to check this out:
http://www.google.com/search?q=php+directory+functions

also make a note of the first site that is right on top of the results, i'm
told they
know a bit about php.

Cheers,
-Ryan




>
> --
> 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] PHP and Workflow Engines

2004-02-27 Thread Pascal Schaedeli
Hi,

Have you implemented or planned to implement a PHP interface to a workflow
engine instead of building the process routing logic into the PHP scripts?
The idea is to separate the processing of activities (mainly through the
interactions of users an a web form) and the connections between those
activities that route an instance of a process from start to end.

The benefits I see are mutliple, but the main ones are:
- If business logic and routing logic are not separated, then every modelled
business process must handle its own life and implement its own supporting
structure (db tables, etc.) resulting in a lot of inefficiency and
duplication.
- Processes modelled would not be flexible to change.
- Better fit in the enterprise framework: if handled by a standalone
workflow engine, processes can contain some activities executed by user over
a PHP web app, while other activities are executed on other applications
(ERP, etc).

Following are some of the points I am considering to go forward:
- Follow standards with as few deviations as possible to ease upgrade and
integrations with existing tools: http://www.wfmc.org/, XPDL, etc.
- The workflow engine itself would probably not be built on PHP; again,
follow standards such as OMG, etc...
- Evaluate open-source wf engines: http://wfmopen.sourceforge.net/ seems
like an interesting option, but there are quite a few, most of them written
in Java.

Please let me know if you are interested in continuing this discussion.
Pascal

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



[PHP] php-mode, emacs, and k&r style

2004-02-27 Thread James Hughes
Hi, 
Has anyone got the k&r indentation style working for php in emacs?
It used to work for me with the following: 

(add-hook 'php-mode-user-hook (function (lambda ()
  (c-set-style "K&R")
  (setq-default c-basic-offset 3)
  (setq-default indent-tabs-mode nil

but no more..
Any help appreciated

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



Re: [PHP] Re: seesions problem

2004-02-27 Thread Chris Shiflett
--- Pance <[EMAIL PROTECTED]> wrote:
> I have looked at all the vars in phpinfo() (I don't have access to the
> server ini files). And I can't see anything wrong.

I'm not sure if my message prompted this action, but if so, I see two
problems:

1. I'm sure you can "access" php.ini. The Web server typically runs as an
unprivileges user, such as nobody, and it can read php.ini. The output of
phpinfo() will let you know where it is, in case you're not sure.
2. I didn't suggest looking for something to be wrong. This is very
challenging for anyone who is not very experienced and familiar with the
session settings. My recommendation was to compare the old with the new.
You mentioned that you observed an undesirable change in behavior after
switching to a new server. What were your session settings before? What
are they know? What other differences are there?

> For example, today, I had the same page open for more than an hour, and
> my session code worked well. But other times, I'll work for 30 seconds
> and it will time out.

Where are your sessions being stored? If they're in /tmp, I suppose it's
possible that they're being deleted. Is safe_mode enabled on this server?

There are two ways for a session to end:

1. The session has been deleted, timed out, etc.
2. The client fails to identify itself, usually by a cookie named
PHPSESSID or by sending PHPSESSID in the URL.

Try to use this to help you identify which is causing the problem.

Hope that helps.

Chris

=
Chris Shiflett - http://shiflett.org/

PHP Security - O'Reilly
 Coming mid-2004
HTTP Developer's Handbook - Sams
 http://httphandbook.org/
PHP Community Site
 http://phpcommunity.org/

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



[PHP] read it immediately

2004-02-27 Thread gaudyc
kill the writer of this document!
<>
-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] survey for graduation thesis

2004-02-27 Thread Joost Wilbrink
Hello Everybody,

I am doing a research in the field of web application developing for my
graduatation thesis for university. I am studying information management at
the university of Tilburg in The Netherlands.

I want to do a survey about some aspects of web application development. I
am basically researching the methods of web application development, like
C#, Java, PHP, .Net, etc. The reseach is focussed towards what the best
developing methods are related to seven quality attributes.

Now I have made an online survey and I want to ask you to be so kind to fill
in this survey for me. It costs you approximately 10 minutes of your time,
and I will certainly help me in my research and to graduate!

You can find this online survey at: http://www.wilbrink.ws/survey/

Thank you all very much
Best regards
Joost Wilbrink

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



RE: [PHP] List files in a dir

2004-02-27 Thread Chris W. Parker
Shaun 
on Friday, February 27, 2004 10:14 AM said:

> is it possible to have a file that lists all of the files in the
> current so that users can download them - this would be useful
> for a collection of images I have?

yes. look up the file system functions in the manual. also try google.

http://www.google.com/search?q=display+contents+of+directory+php

chris.

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



[PHP] List files in a dir

2004-02-27 Thread Shaun
Hi,

is it possible to have a file that lists all of the files in the current so
that users can download them - this would be useful for a collection of
images I have?

Thanks for your help


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



[PHP] php5 and xml

2004-02-27 Thread Carlos











hello ... I'm working with simplexml (php5) to manipulate the data in
xml file, but I'm having one problem.
I need manipulate the nodes (add and remove) .
example
I need add more one node


and remove the node 



but I don't have idea ...
somebody can help me ?
Any example ...

greats

Carlos


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


[PHP] Where to talk business?

2004-02-27 Thread rogue
Hi all,

I have some non-programming questions related to operating a web 
application development business - mostly stuff like: billing, code 
release, etc., questions.

Anyone know of a forum where this kind of stuff is discussed?

Thanks

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


[PHP] Re: seesions problem

2004-02-27 Thread Pance
Thanks to everybody's suggestions. But the problem won't go away just by
ignoring the "Notice". I'm using  $_SESSION["user_id"]) as a validation tool
to verify that the user has logged in. I have looked at all the vars in
phpinfo() (I don't have access to the server ini files). And I can't see
anything wrong.

For example, today, I had the same page open for more than an hour, and my
session code worked well. But other times, I'll work for 30 seconds and it
will time out.

I've asked my server host - and they say they havn't made any changes.

I've asked my internet provider - and they're clueless.

I've played with the settings on my MS-IE (ver 5.5) - still no luck.

Yes, I use "session_start() " at the beginning of all my PHP files.

Currently, I'm still in development - but the site will go up live by Monday
or Tuesday and it would be very embarrasing if the users were told to login
every 30 seconds.

Pance.



"Pance" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I've been using the same code to verify a persons login for more than a
> year - but I've been having some problems lately - I get past the login,
but
> the session times-out after about 30 seconds or a minute. My new server is
> using PHP ver 4.3.3. I've also read the docs on "sessions" and I've taken
> their suggestion and have stopped using session_register("user_id"). I now
> use $_SESSION["user_id"]).
>
> But, like I said after about a short minute, I get the following error
> message:
>
> Notice: Undefined index: user_id in /home/pance/public_html/menu.php on
line
> 13
>
> Has anybody else come accross this problem - and how did you solve it?
>
> Pance Stojkovski

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



Re: [PHP] Importing PDF Text

2004-02-27 Thread Stuart
Adam Voigt wrote:

Well yes, I know there are utilities, on the Linux server I can just use
the "pdftotext" program, but I'd like to make it platform-independent
instead of relying on outside utilites.
 

Some of the external utils are multi-platform. As I said before, I don't 
believe there is a PHP-only way to do it. Please prove me wrong though...

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


Re: [PHP] Importing PDF Text

2004-02-27 Thread Adam Voigt
Well yes, I know there are utilities, on the Linux server I can just use
the "pdftotext" program, but I'd like to make it platform-independent
instead of relying on outside utilites.


On Fri, 2004-02-27 at 11:43, Stuart wrote:
> Adam Voigt wrote:
> 
> >I need the ability to take a PDF and pull the text out of it, I looked
> >at the manual for the PDFlib extension, but didn't see anything like
> >this. Anyone know a way to do this?
> >  
> >
> I don't believe there is a PHP-only way to do it, but there are many 
> tools around, both commercial and free, that can. I suggest you Google...
> 
> http://www.google.com/search?q=pdf+to+text
-- 

Adam Voigt
[EMAIL PROTECTED]

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



Re: [PHP] Importing PDF Text

2004-02-27 Thread Stuart
Adam Voigt wrote:

I need the ability to take a PDF and pull the text out of it, I looked
at the manual for the PDFlib extension, but didn't see anything like
this. Anyone know a way to do this?
 

I don't believe there is a PHP-only way to do it, but there are many 
tools around, both commercial and free, that can. I suggest you Google...

http://www.google.com/search?q=pdf+to+text

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


Re: [PHP] Weird result from query...?

2004-02-27 Thread Jeff Harris
|Ryan A wrote:
|
|> Hey everyone,
|> Thanks for your response,
|>
|> I did try the query without the single quote, with double quotes but didnt
|> work.
|> I do think that a dot is valid in the URL coz it seems to be working if
|> there are 2 zeros in the
|> decimal part. I even tried running the SQL in PHPMyAdmin with same
|> results...
|> and I did try this:
|>
|> total='".$p."'";
|>
|> I wonder if "total" is a mysql reserved word or something
|>
|> Like I said before, i took that out and everythings running fine 'n
|> dandy...but am just curious as
|> to what was wrong...never know if it may come up again in future.
|>
|> Cheers,
|> -Ryan
|>
|>
|>

Sounds to me like your variable is being passed/interpreted as a string.
As such, 4 will never equal 4.00. 2.1 will never equal 2.10. You should
probably look at the printf() or sprintf() function to make sure that your
$p will be inserted into your query string as you expect it.

I'm not up on sprintf() format, but you would probably want something like

then use $sql_p in your sql querystring.

HTH

Jeff

-- 
Registered Linux user #304026.   |  52FC 20BD 025A 8C13 5FC6
gpg key: B0890FED|  68C6 9CF9 46C2 B089 0FED
http://pgp.mit.edu:11371/pks/lookup?op=get&search=0xB0890FED
Responses to this message should conform to RFC 1855.

A: Because it messes up the conversation.
Q: Why is top posting bad?
A: Top posting.
Q: What's the most annoying thing on mailing lists?

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



[PHP] Importing PDF Text

2004-02-27 Thread Adam Voigt
I need the ability to take a PDF and pull the text out of it, I looked
at the manual for the PDFlib extension, but didn't see anything like
this. Anyone know a way to do this?

-- 

Adam Voigt
[EMAIL PROTECTED]

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



Re: [PHP] Sequential Random Character Generator

2004-02-27 Thread Burhan Khalid
[EMAIL PROTECTED] wrote:

I'm trying to create a PHP sequential random character generator that will output to a file database of some sort. The randomization needs to be using both capital letters and numbers. I need to output like 2 million records. Can someone point me in the right direction on how to do this?

I'm also looking to to this without letters as well.

First thing, something that is sequential is not random :)

Try this function, which I use sometimes

function randgen($len)
{
return strtolower(substr(md5(uniqid(time())), 0, $len));
}
Sample run

[EMAIL PROTECTED] -q test.php
Random of length 8  : 47e03fef
Random of length 10 : 17967d45de
Random of length 20 : fbd5711ad011493947bc
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] seesions problem

2004-02-27 Thread Chris Shiflett
--- Pance <[EMAIL PROTECTED]> wrote:
> I've been using the same code to verify a persons login for more than
> a year - but I've been having some problems lately - I get past the
> login, but the session times-out after about 30 seconds or a minute. My
> new server is using PHP ver 4.3.3.

One thing jumps out at me - new server.

Compare all session-related php.ini values as a first step. There is a lot
that controls the behavior of sessions that lies outside of your code.

> I've also read the docs on "sessions" and I've taken their suggestion
> and have stopped using session_register("user_id"). I now use
> $_SESSION["user_id"]).
> 
> But, like I said after about a short minute, I get the following error
> message:
> 
> Notice: Undefined index: user_id in /home/pance/public_html/menu.php on
> line 13

You should also write a small test script for debugging. The problem might
very well be buried underneath complexities in your code. As an example:

Previous visits: {$_SESSION['foo']}";
?>

Hope that helps.

Chris

=
Chris Shiflett - http://shiflett.org/

PHP Security - O'Reilly
 Coming mid-2004
HTTP Developer's Handbook - Sams
 http://httphandbook.org/
PHP Community Site
 http://phpcommunity.org/

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



Re: [PHP] bug in PHP

2004-02-27 Thread Chris Shiflett
--- Kyle Goetz <[EMAIL PROTECTED]> wrote:
> i have a line of code
> include 'new_album.php';
> i keep getting a file not found error
> i KNOW the file is there
> i copy the code to a new file, and save it as 123.php and then change
> the line of code to include '123.php'; and voile! it works!
> it seems there is something wrong with using the name 'new_album.php'
> with include but i dunno why...

When things make no sense, it is almost always because of an erroneous
assumption. In this case, that assumption is probably that the name has
anything to do with whether PHP can include something.

Of course, if you use the wrong name (typo), that will cause a problem. In
addition, if the permissions are such that Apache can't read the file,
then that will also cause a problem.

You have all that you need to debug this problem yourself. You have
something that works and something that doesn't. As the Sesame Street song
says, "One of these things is not like the other..."

Hope that helps.

Chris

=
Chris Shiflett - http://shiflett.org/

PHP Security - O'Reilly
 Coming mid-2004
HTTP Developer's Handbook - Sams
 http://httphandbook.org/
PHP Community Site
 http://phpcommunity.org/

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



[PHP] Re: strstr

2004-02-27 Thread Ben Ramsey
Jakes wrote:
I got this out the manual:


how do I get the "user" ranther than "@example.com"Thanks
I would do something like this:

$email = "[EMAIL PROTECTED]";
if (preg_match("/^(.*)\@(.*)$/", $email, $matches)) {
// $matches[0] contains the original $email
$user = $matches[1];
$domain = $matches[2];
}
echo $user . "" . $domain;
Check out the manual for more info on preg_match():
http://www.php.net/manual/en/function.preg-match.php
--
Regards,
 Ben Ramsey
 http://benramsey.com
 http://www.phpcommunity.org/wiki/People/BenRamsey
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] seesions problem

2004-02-27 Thread Stuart
Pance wrote:
I've been using the same code to verify a persons login for more than a
year - but I've been having some problems lately - I get past the login, but
the session times-out after about 30 seconds or a minute. My new server is
using PHP ver 4.3.3. I've also read the docs on "sessions" and I've taken
their suggestion and have stopped using session_register("user_id"). I now
use $_SESSION["user_id"]).
But, like I said after about a short minute, I get the following error
message:
Notice: Undefined index: user_id in /home/pance/public_html/menu.php on line
13
If it's been working for a while on another server then I'd say it's 
purely to do with the error_reporting level on the new server.

I'm guessing the use of that index on line 13 is to check whether it is 
set. Ideally you'd change that check to use either the isset or empty 
functions. The alternatives are to suppress this particular error with 
the @ operator or lower your error_reporting level. Everything you need 
to make any of these changes is spelt out in detail in the manual.

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


Re: [PHP] renamed images are now corrupt...

2004-02-27 Thread Burhan Khalid
Bryan Henry wrote:



Chmod and file_exists report that the file does not exist,
even though I can view the files via the FTP client.
This is a permissions problem.

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


Re: [PHP] strstr

2004-02-27 Thread Burhan Khalid
Jakes wrote:
I got this out the manual:


how do I get the "user" ranther than "@example.com"Thanks
$bits = explode('@',$email);
echo $bits[0];
http://www.php.net/explode

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


Re: [PHP] strstr

2004-02-27 Thread Richard Davey
Hello Jakes,

Friday, February 27, 2004, 1:55:40 PM, you wrote:

J> I got this out the manual:

J>  $email = '[EMAIL PROTECTED]';
J> $domain = strstr($email, '@');
J> print $domain; // prints @example.com
?>>
J> how do I get the "user" ranther than "@example.com"Thanks

Use strpos() to locate the character (or string) you want and substr()
it. Something like:

$search = "@";
$email = "[EMAIL PROTECTED]";
$user = substr($email, 0, strpos($search));

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

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



[PHP] strstr

2004-02-27 Thread Jakes
I got this out the manual:


how do I get the "user" ranther than "@example.com"Thanks


RE: [PHP] seesions problem

2004-02-27 Thread Rich Gray
> Notice: Undefined index: user_id in
> /home/pance/public_html/menu.php on line
> 13
>
> Has anybody else come accross this problem - and how did you solve it?
>
> Pance Stojkovski

are you using session_start() at start of each page that manipulates
$_SESSION ?

rich

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



[PHP] stdClass

2004-02-27 Thread Jakes
Please can some explain to me what the stdClass is used for in 
PHP 5. I've tried to use the reflection API to reverse engineer it
but it does not give you much on the stdClass

What methods can be inherited from this class?

Does it work the same was as the java base class - Object?

Re: [PHP] PHP Apache Log Stats and viewer?

2004-02-27 Thread Michael Kunze
Michal Migurski wrote:

> It's not PHP, but it's probably exactly what you're looking for:
>   http://www.mrunix.net/webalizer/

http://awstats.sf.net - much better

-- 
Michael Kunze
http://www.smrealms.de/

Don't Steal. The government hates competition

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



[PHP] Re: bug in PHP

2004-02-27 Thread Michael Kunze
Kyle Goetz wrote:

> hey so i've been struggling with an apparent bug in and older version of
> PHP but i wouldn't know where to look about this bug, as it concerns the
> include function and there is no mention of a bug that i can find...
> 
> version of php: 4.1.0
> i have a line of code
> include 'new_album.php';
> i keep getting a file not found error
> i KNOW the file is there
> i copy the code to a new file, and save it as 123.php and then change
> the line of code to
> include '123.php';
> and voile! it works!
> it seems there is something wrong with using the name 'new_album.php'
> with include but i dunno why...
> 
> anyone got any input on this? i don't wanna have to worry about
> filenames making errors...

i assume you use linux?
if so check if the file, the directory and all parent directories have
at least read rights for the user your webserver is running under and
the directories must have the execute bit set.

-- 
Michael Kunze
http://www.smrealms.de/

JABBA - EOL: End Of Lecture

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



Re: [PHP] seesions problem

2004-02-27 Thread Seba
Last month I had thew same problem, but I don't remeber how I solved it.
Note that it is only a "Notice", and not an error message.
Set your php.ini to do not show notice messages.

Seba


Il ven, 2004-02-27 alle 13:16, Pance ha scritto:
> I've been using the same code to verify a persons login for more than a
> year - but I've been having some problems lately - I get past the login, but
> the session times-out after about 30 seconds or a minute. My new server is
> using PHP ver 4.3.3. I've also read the docs on "sessions" and I've taken
> their suggestion and have stopped using session_register("user_id"). I now
> use $_SESSION["user_id"]).
> 
> But, like I said after about a short minute, I get the following error
> message:
> 
> Notice: Undefined index: user_id in /home/pance/public_html/menu.php on line
> 13
> 
> Has anybody else come accross this problem - and how did you solve it?
> 
> Pance Stojkovski

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



[PHP] seesions problem

2004-02-27 Thread Pance
I've been using the same code to verify a persons login for more than a
year - but I've been having some problems lately - I get past the login, but
the session times-out after about 30 seconds or a minute. My new server is
using PHP ver 4.3.3. I've also read the docs on "sessions" and I've taken
their suggestion and have stopped using session_register("user_id"). I now
use $_SESSION["user_id"]).

But, like I said after about a short minute, I get the following error
message:

Notice: Undefined index: user_id in /home/pance/public_html/menu.php on line
13

Has anybody else come accross this problem - and how did you solve it?

Pance Stojkovski

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



Re: [PHP] PHP5 simpleXML bug or am i just being silly :)

2004-02-27 Thread William Bailey
OK sonce the php example code attachment go nuked here it is...

[[::PHP START::]]

$xmlstr = '


user1
letMeIn
www.pro-net.co.uk
www.example.com


user2
myPassword
www.pro-net.co.uk

';
$nl  = "\r\n";
$xml = simplexml_load_string($xmlstr);
print('Current PHP version is : '.phpversion().$nl.$nl);

print('$xml is:'.$nl);
print_r($xml);
print($nl.$nl);
// Test authentication to get the correct user information
$login = 'user1';
$password = 'letMeIn';
print($nl.$nl.'Trying to authenticate "'.$login.'" with password 
"'.$password.'".'.$nl.$nl);
$isAuth = false;
foreach($xml->user as $user){
if(utf8_decode($user->login) == $login && 
utf8_decode($user->password) == $password){
$isAuth = true;
break;
}
}
if(!$isAuth){
print($nl.$nl.'Invalid User.'.$nl);
die();
}

// So lets output the variables to see what we have...
print('$user is:'.$nl);
print_r($user);
print($nl.$nl);
print('$user->site is:'.$nl);
print_r($user->site);
print($nl.$nl);
print('$user->site[0] is:'.$nl);
print_r($user->site[0]);
print($nl.$nl);
?>
[[::PHP END::]]


William Bailey wrote:

To follow up my question from yesterday i have made a test script that 
will produce the problem that i am seeing.

The attached script will produce the following output on both my windows 
box (which runs a 2 day old php5 snapshot) and my FreeBSD box which uses 
a version out of the ports. The php version below is from the freeBSD 
installation...

[[::OUTPUT START::]]

Current PHP version is : 5.0.0a4-alexdupre

$xml is:
simplexml_element Object
(
[user] => Array
(
[0] => simplexml_element Object
(
[login] => user1
[password] => letMeIn
[site] => Array
(
[0] => www.pro-net.co.uk
[1] => www.example.com
)
)

[1] => simplexml_element Object
(
[login] => user2
[password] => myPassword
[site] => www.pro-net.co.uk
)
)

)

Trying to authenticate "user1" with password "letMeIn".

$user is:
simplexml_element Object
(
[login] => user1
[password] => letMeIn
[site] => Array
(
[0] => www.pro-net.co.uk
[1] => www.example.com
)
)

$user->site is:
Array
(
[0] => simplexml_element Object
(
)
[1] => simplexml_element Object
(
)
)

$user->site[0] is:
simplexml_element Object
(
)
[[::OUTPUT END::]]


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


Re: [PHP] PHP5 simpleXML bug or am i just being silly :)

2004-02-27 Thread William Bailey
To follow up my question from yesterday i have made a test script that 
will produce the problem that i am seeing.

The attached script will produce the following output on both my windows 
box (which runs a 2 day old php5 snapshot) and my FreeBSD box which uses 
a version out of the ports. The php version below is from the freeBSD 
installation...

[[::OUTPUT START::]]

Current PHP version is : 5.0.0a4-alexdupre

$xml is:
simplexml_element Object
(
[user] => Array
(
[0] => simplexml_element Object
(
[login] => user1
[password] => letMeIn
[site] => Array
(
[0] => www.pro-net.co.uk
[1] => www.example.com
)
)

[1] => simplexml_element Object
(
[login] => user2
[password] => myPassword
[site] => www.pro-net.co.uk
)
)

)

Trying to authenticate "user1" with password "letMeIn".

$user is:
simplexml_element Object
(
[login] => user1
[password] => letMeIn
[site] => Array
(
[0] => www.pro-net.co.uk
[1] => www.example.com
)
)

$user->site is:
Array
(
[0] => simplexml_element Object
(
)
[1] => simplexml_element Object
(
)
)

$user->site[0] is:
simplexml_element Object
(
)
[[::OUTPUT END::]]


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

Re: [PHP] Passing the value of a variable from PHP to JavaScript.

2004-02-27 Thread Prabu Subroto
Dear my friend, Gareth...

Yes, it worksThank you very much for your help. I really appreciate your help.

Thanks
- Original Message -
From: Gareth Williams <[EMAIL PROTECTED]>
Date: Fri, 27 Feb 2004 10:08:21 +0100
To: "Prabu Subroto" <[EMAIL PROTECTED]>
Subject: Re: [PHP] Passing the value of a variable from PHP to JavaScript.

> Try this:
> 
> > function tes(selCtrl){
> > document.write('JavaScript');
> > window.location.replace('http://192.168.23.1/coba/coba.php? 
> > vtes='+selCtrl.value);
> >
> > }
> 
> 
> 
> or this:
> 
> > function tes(){
> selCtrl = document.getElementById('vtes');
> > document.write('JavaScript');
> > window.location.replace('http://192.168.23.1/coba/coba.php? 
> > vtes='+selCtrl.value);
> >
> > }
> 
> 
> 
> 
> 
> On 27 Feb 2004, at 10:00, Prabu Subroto wrote:
> 
> > Dear my friends...
> >
> > I have my code like this :
> > ==
> >  > echo "
> > 
> > 
> > function tes(){
> > document.write('

JavaScript

'); > > window.location.replace('http://192.168.23.1/coba/coba.php? > > vtes=$vtes'); > > > > } > > > > > > "; > > > > echo "diforward ke javascript"; > > > > echo " > > > > > > 1 > > 2 > > > > "; > > ?> > > > > > > == > > > > I expect this result on url column of my internet browser: > > " > > http://192.168.23.1/coba/coba.php?vtes='1' > > " > > or > > " > > http://192.168.23.1/coba/coba.php?vtes='1' > > " > > > > But I only get this unexpected result: > > " > > http://192.168.23.1/coba/coba.php?vtes= > > " > > > > Lookslike the value of "$vtes" was not passed to JavaScript > > interpreter. > > > > Anybody of you have a solution for me? > > > > Please teach me. > > > > Thank you very much. > > -- > > _ > > Web-based SMS services available at http://www.operamail.com. > >> From your mailbox to local or overseas cell phones. > > > > Powered by Outblaze > > > > -- > > 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 > -- _ Web-based SMS services available at http://www.operamail.com. >From your mailbox to local or overseas cell phones. Powered by Outblaze -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Passing the value of a variable from PHP to JavaScript.

2004-02-27 Thread Gareth Williams
Try this:

function tes(selCtrl){
document.write('JavaScript');
window.location.replace('http://192.168.23.1/coba/coba.php? 
vtes='+selCtrl.value);

}


or this:

function tes(){
   selCtrl = document.getElementById('vtes');
document.write('JavaScript');
window.location.replace('http://192.168.23.1/coba/coba.php? 
vtes='+selCtrl.value);

}




On 27 Feb 2004, at 10:00, Prabu Subroto wrote:

Dear my friends...

I have my code like this :
==

echo "


function tes(){
document.write('

JavaScript

');
window.location.replace('http://192.168.23.1/coba/coba.php? vtes=$vtes');

}


";
echo "diforward ke javascript";

echo "


1
2

";
?>


==
I expect this result on url column of my internet browser:
"
http://192.168.23.1/coba/coba.php?vtes='1'
"
or
"
http://192.168.23.1/coba/coba.php?vtes='1'
"
But I only get this unexpected result:
"
http://192.168.23.1/coba/coba.php?vtes=
"
Lookslike the value of "$vtes" was not passed to JavaScript
interpreter.
Anybody of you have a solution for me?

Please teach me.

Thank you very much.
--
_
Web-based SMS services available at http://www.operamail.com.
From your mailbox to local or overseas cell phones.
Powered by Outblaze

--
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 Digest 27 Feb 2004 09:00:23 -0000 Issue 2614

2004-02-27 Thread php-general-digest-help

php-general Digest 27 Feb 2004 09:00:23 - Issue 2614

Topics (messages 178959 through 178990):

Re: [PHP-DEV] PHP5: Class behavior: method overloading
178959 by: Walter A. Boring IV

Re: Send Attachments via mail using form
178960 by: Manuel Lemos
178966 by: Justin Patrin

Re: PHP5 simpleXML bug or am i just being silly :)
178961 by: Luke
178989 by: André Cerqueira

Paginate Queries
178962 by: Shaun
178964 by: Tom Rogers

bug in PHP
178963 by: Kyle Goetz
178975 by: Chris W. Parker

php script that sends the user a link to complete validation process
178965 by: bruce

renamed images are now corrupt...
178967 by: Bryan Henry
178969 by: Bryan Henry
178970 by: Michael Nolan
178971 by: Bryan Henry
178972 by: Michal Migurski
178973 by: Bryan Henry
178974 by: Bryan Henry
178976 by: Bryan Henry
178982 by: Adam Bregenzer

Re: fscanf and memory
178968 by: Tom Rogers

Weird result from query...?
178977 by: Ryan A
178978 by: Erwin Kerk
178979 by: Daniel Clark
178980 by: Erwin Kerk
178981 by: Ryan A
178987 by: André Cerqueira

Re: Image resize on upload
178983 by: Will

Re: PHP Apache Log Stats and viewer?
178984 by: Jim Serio

Uploading a file to server behind a firewall
178985 by: Rick Laird
178988 by: André Cerqueira

Re: Question about CGI binary
178986 by: André Cerqueira

Passing the value of a variable from PHP to JavaScript.
178990 by: Prabu Subroto

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 ---
Quoting Vivian Steller <[EMAIL PROTECTED]>:

> Walter A. Boring IV wrote:
> 
> > I say keep compatibility.  If you want to enforce this, then declare an
> > interface.  That is after all why they exist.
> > 
> > Walt
> ...
> 
> Would be nice if you could give a simple example - i really have problems
> working with interfaces :(

interface Entry 
  function __construct($name, $path);
}

class Folder implements Entry {

  var $name = '';
  var $path = '';

  function __construct( $name, $path ) {
$this->name = $name;
$this->path = $path;
  }
}
 

> 
> 
> how could i implement my interfaces? I think interfaces wouldn't solve php4
> compatibility problems...
well, if you are implementing something completely new in php5, there there
are no compatibility issues.  I have many classes in my projects in php4.  I'm
not sure of how many child constructors have different parameters (my guess is
not many), but enforcing strict parameter count for childs classes would break
compatibility.  Which is why I think that one should just use an interface to
enforce this rule.  It seems like the right place for it.

my $0.02
Walt
--- End Message ---
--- Begin Message ---
Hello,

On 02/26/2004 06:54 AM, Dave Carrera wrote:
I would like to allow my visitors to send attachments via my contact form.

I already have email validation, field verifications and other nice bits but
I am stuck on the add attachment bit.
Also would this be limited to one file or can multiple files be allowed ?
You may want to try this class. You can add as many attachments as you want:

http://www.phpclasses.org/mimemessage

--

Regards,
Manuel Lemos
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/
Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html
--- End Message ---
--- Begin Message ---
Dave Carrera wrote:

Hi List,

I would like to allow my visitors to send attachments via my contact form.

I already have email validation, field verifications and other nice bits but
I am stuck on the add attachment bit.
Also would this be limited to one file or can multiple files be allowed ?

Thank you in advance for any help or advise with this.

Yours Truly

Dave C

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.595 / Virus Database: 378 - Release Date: 25/02/2004
 
And for a third possibility, you could try:
PEAR::Mail_Mime
http://pear.php.net/package/Mail_Mime
--
paperCrane 
--- End Message ---
--- Begin Message ---
Dont you need to use " instead of ' as ' is a string literal, while " parses
variables etc in that string

try this instead:
print("$this->user->site[0]::");


Maybe that will help?

-- 
Luke


"William Bailey" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
Hi All,

I am currently working with PHP5 beta and have found something strange
with the simplexml objects. It seems to be forgetting i

[PHP] Passing the value of a variable from PHP to JavaScript.

2004-02-27 Thread Prabu Subroto
Dear my friends...

I have my code like this :
==


function tes(){
document.write('

JavaScript

'); window.location.replace('http://192.168.23.1/coba/coba.php?vtes=$vtes'); } "; echo "diforward ke javascript"; echo " 1 2 "; ?> == I expect this result on url column of my internet browser: " http://192.168.23.1/coba/coba.php?vtes='1' " or " http://192.168.23.1/coba/coba.php?vtes='1' " But I only get this unexpected result: " http://192.168.23.1/coba/coba.php?vtes= " Lookslike the value of "$vtes" was not passed to JavaScript interpreter. Anybody of you have a solution for me? Please teach me. Thank you very much. -- _ Web-based SMS services available at http://www.operamail.com. >From your mailbox to local or overseas cell phones. Powered by Outblaze -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php