php-general Digest 28 Sep 2002 03:33:23 -0000 Issue 1611

Topics (messages 117860 through 117915):

Re: problem with new_xmldoc()
        117860 by: Davíð Örn Jóhannsson
        117865 by: Marek Kilimajer
        117873 by: Marek Kilimajer
        117876 by: Marek Kilimajer

Re: Getting part of a string
        117861 by: Marek Kilimajer
        117862 by: debbie_dyer
        117870 by: Ford, Mike               [LSS]
        117906 by: Justin French

mailing-list and forum combination?
        117863 by: taylor
        117871 by: John Wards

quick mysql question
        117864 by: Doug Parker
        117866 by: Jon Haworth
        117869 by: Doug Parker
        117878 by: Gardner Lloyd Bickford III

Re: session & cookies
        117867 by: Jeff Bluemel

Re: length function
        117868 by: Jeff Bluemel

file truncation when generating tar file for download ...
        117872 by: Monique Y. Herman

PHP/Java: Type Casting
        117874 by: Gardner Lloyd Bickford III

Re: exec issue - return value 127 (more and more)
        117875 by: christian haines
        117877 by: Marek Kilimajer

PHP and https no working recieving cookies and header info how to fix needed.
        117879 by: Jeffrey D. Means

Re: Encrypted MySQL passwords
        117880 by: Rodolfo Gonzalez
        117882 by: Rodolfo Segleau
        117895 by: Rodolfo Gonzalez

Multiple Inheritance Emulation
        117881 by: Julio Nobrega
        117883 by: Julio Nobrega
        117884 by: Steve Bradwell

Regular expression help converting doc to xml
        117885 by: Geoff
        117898 by: John Holmes

coding standards - control structures
        117886 by: ed
        117890 by: Kevin Stone
        117892 by: Robert Cummings
        117893 by: Kevin Stone
        117897 by: Bill Farrell

echo writes number of chars written
        117887 by: David Busby

PHP and JavaScript on a form validation task
        117888 by: Riccardo Sepe
        117891 by: Kevin Stone

Sorting Quesiton
        117889 by: php.johnabela.com

Re: Keeping your published script safe?
        117894 by: Stephen Craton

Re: $_SESSION[] and register_globals=on
        117896 by: John Holmes
        117900 by: Andre Dubuc

Re: where's waldo
        117899 by: . Edwin

using CURL to post data to a search engine
        117901 by: rdkurth.starband.net
        117912 by: Paul Nicholson
        117914 by: Chris Shiflett

Assigning data to fields
        117902 by: Ken
        117903 by: Brad Bonkoski
        117911 by: Ken
        117913 by: John Holmes

Re: Carriage returns don't display in HTML
        117904 by: Shane
        117909 by: Jesse Cablek
        117910 by: Paul Nicholson

seeking data validation class
        117905 by: Peter J. Schoenster
        117907 by: Manuel Lemos
        117915 by: Peter J. Schoenster

Re: Send mail in HTML
        117908 by: Manuel Lemos

Administrivia:

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

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

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


----------------------------------------------------------------------
--- Begin Message ---
 
I ran into a problem using new_xmldoc() function I just set up PHP v
4.2.3 because  the 4.0.1. version resulted:
Fatal error: Call to undefined function: new_xmldoc()
 
and so dose the new version v.4.2.3
 
Any Ideas??
 
--- End Message ---
--- Begin Message ---
What does php_info() say, was php compiled --with-dom

Davíð Örn Jóhannsson wrote:

> 
>I ran into a problem using new_xmldoc() function I just set up PHP v
>4.2.3 because  the 4.0.1. version resulted:
>Fatal error: Call to undefined function: new_xmldoc()
> 
>and so dose the new version v.4.2.3
> 
>Any Ideas??
> 
>
>  
>

--- End Message ---
--- Begin Message ---
That's likely an old name, look at the docs

Davíð Örn Jóhannsson wrote:

>Don't know it's a just downloaded the win32 binary package
>
>-----Original Message-----
>From: Marek Kilimajer [mailto:[EMAIL PROTECTED]] 
>Sent: 27. september 2002 15:58
>To: PHP
>Subject: Re: [PHP] FW: problem with new_xmldoc()
>
>What does php_info() say, was php compiled --with-dom
>
>Davíð Örn Jóhannsson wrote:
>
>  
>
>>I ran into a problem using new_xmldoc() function I just set up PHP v
>>4.2.3 because  the 4.0.1. version resulted:
>>Fatal error: Call to undefined function: new_xmldoc()
>>
>>and so dose the new version v.4.2.3
>>
>>Any Ideas??
>>
>>
>> 
>>
>>    
>>
>
>
>  
>

--- End Message ---
--- Begin Message ---
I think the only way is to put the whole xml into a string and replace 
the first line

Davíð Örn Jóhannsson wrote:

>Thanks but I found out what it was I just had to enable some dll's in
>the php.ini on my test enviroment.
>
>But You wouldn't have any Idea how to set encoding="iso-8859-1" whene
>you
>Have created a new_xmldoc with new_xmldoc("1.0");
>
>Thanks for your time.
>
>-----Original Message-----
>From: Marek Kilimajer [mailto:[EMAIL PROTECTED]] 
>Sent: 27. september 2002 16:28
>To: PHP
>Subject: Re: [PHP] FW: problem with new_xmldoc()
>
>That's likely an old name, look at the docs
>
>Davíð Örn Jóhannsson wrote:
>
>  
>
>>Don't know it's a just downloaded the win32 binary package
>>
>>-----Original Message-----
>>From: Marek Kilimajer [mailto:[EMAIL PROTECTED]] 
>>Sent: 27. september 2002 15:58
>>To: PHP
>>Subject: Re: [PHP] FW: problem with new_xmldoc()
>>
>>What does php_info() say, was php compiled --with-dom
>>
>>Davíð Örn Jóhannsson wrote:
>>
>> 
>>
>>    
>>
>>>I ran into a problem using new_xmldoc() function I just set up PHP v
>>>4.2.3 because  the 4.0.1. version resulted:
>>>Fatal error: Call to undefined function: new_xmldoc()
>>>
>>>and so dose the new version v.4.2.3
>>>
>>>Any Ideas??
>>>
>>>
>>>
>>>
>>>   
>>>
>>>      
>>>
>> 
>>
>>    
>>
>
>
>  
>

--- End Message ---
--- Begin Message ---
reg_match('^/[^/]*/([^/]*)/',$a, $match)

$match[1] should contain what you need

[EMAIL PROTECTED] wrote:

>I've got a situation where I need to pull a string from a variable but I
>can't seem to get it figured out. 
>
>I.e.
>
>value of $a = /realtor/Remax/Ed/files/
>
>I need to get the string between the second and third / (slash)
>
>What I need: Remax
>
>Thanks,
>
>Ed
>
>
>
>  
>

--- End Message ---
--- Begin Message ---
I'm not an expert on regex but this seems to work:-

ereg("^/[^/]*/([^/]*)/.*$", "/realtor/Remax/Ed/files/", $regs);
  if (isset($regs[1])) {
    print $regs[1];
  }

Debbie

----- Original Message ----- 
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, September 27, 2002 4:23 PM
Subject: [PHP] Getting part of a string


> 
> I've got a situation where I need to pull a string from a variable but I
> can't seem to get it figured out. 
> 
> I.e.
> 
> value of $a = /realtor/Remax/Ed/files/
> 
> I need to get the string between the second and third / (slash)
> 
> What I need: Remax
> 
> Thanks,
> 
> Ed
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

--- End Message ---
--- Begin Message ---
-----Original Message-----
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]

I've got a situation where I need to pull a string from a variable but I
can't seem to get it figured out. 

I.e.

value of $a = /realtor/Remax/Ed/files/

I need to get the string between the second and third / (slash)

What I need: Remax

---------------------------------------------------------

Just explode the string with / as the delimiter, and then grab the [2] element, for 
instance:

   $dirnames = explode('/', $a);
   echo $dirnames[2];

Cheers!

Mike
--- End Message ---
--- Begin Message ---
Assuming that it will always be in this format (/something/what you
want/...), explode() the string by '/' into an array, and get the right
element back.

<?
$a = /realtor/Remax/Ed/files/
$aa = explode('/', $a);
echo $aa[2];
?>

Enjoy

Justin French



on 28/09/02 1:23 AM, [EMAIL PROTECTED] ([EMAIL PROTECTED]) wrote:

> 
> I've got a situation where I need to pull a string from a variable but I
> can't seem to get it figured out.
> 
> I.e.
> 
> value of $a = /realtor/Remax/Ed/files/
> 
> I need to get the string between the second and third / (slash)
> 
> What I need: Remax
> 
> Thanks,
> 
> Ed
> 
> 

--- End Message ---
--- Begin Message ---
hi,

does anyone know of a php-based combined mailing list and bulletin 
board/forum?
something like a php lovechild of majordomo and yabbse?

any pointers greatly appreciated!

taylor

--- End Message ---
--- Begin Message ---
Well Phorum.org can sort of do it but its not very well documented.

It has a script in the scripts dir called phroum mail. Which takes email in 
and posts it to the selected forum and you can then set the forum to email 
all posts to an address....

I have yet to get my head around it but I think this would do the 
trick....sort of.....

John

On Friday 27 Sep 2002 4:51 pm, taylor wrote:
> hi,
>
> does anyone know of a php-based combined mailing list and bulletin
> board/forum?
> something like a php lovechild of majordomo and yabbse?
>
> any pointers greatly appreciated!
>
> taylor

--- End Message ---
--- Begin Message ---
where can i find info on setting up a mysql database on a remote server? 
  i know how to set them up on a local machine, but i can't figure out 
how to get to the command line setting on a remote server...

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

> where can i find info on setting up a mysql 
> database on a remote server? i know how to 
> set them up on a local machine, but i can't 
> figure out how to get to the command line 
> setting on a remote server...

me@mybox:~$ ssh my.remote.server

Or am I missing something?

Cheers
Jon
--- End Message ---
--- Begin Message ---
jon - thanks for the reply.
i tried this:

prompt> ssh server.net

i got an "open failed: no such file or directoy"

does that mean that ssh is not enabled on the server?  i pinged the 
server and it said it was alive...

Jon Haworth wrote:

> Hi Doug,
> 
> 
>>where can i find info on setting up a mysql 
>>database on a remote server? i know how to 
>>set them up on a local machine, but i can't 
>>figure out how to get to the command line 
>>setting on a remote server...
>>
> 
> me@mybox:~$ ssh my.remote.server
> 
> Or am I missing something?
> 
> Cheers
> Jon
> 

--- End Message ---
--- Begin Message ---
If it's a linux or unix box use ssh or telnet to get a shell on the
remote system then follow the instructions in
http://www.mysql.com/documentation/mysql/full/index.html .

If it's a windows box then you have to use pcAnywhere or go to the
machine to set it up, unless there's a ssh or telnet server running on
the box.

Cheers,
  Gardner

Doug Parker wrote:
> 
> where can i find info on setting up a mysql database on a remote server?
>   i know how to set them up on a local machine, but i can't figure out
> how to get to the command line setting on a remote server...

--
Gardner Lloyd Bickford III
TriAxial Data Systems
36 Brennan Street
Watsonville, CA  95076
Phone: (831) 763-3697 x101
Fax: (831) 763-3699

Please note that the views expressed in this message are the views of 
the author alone and not necessarily the views of TriAxial Data Systems
--- End Message ---
--- Begin Message ---
Chris and I have been working on this through private emails, and we (I mean
he) finally figured out what the problem was...

session.cookie_path was set to /tmp instead of /.

I wanted to thank him for taking the time to help me work through this...

Jeff
"Chris Shiflett" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Jeff,
>
> One quick thought ...
>
> Is your cookie domain the same domain as the URL domain you are using to
> test this? If not, the browser will not send the cookie, so that is a
> potential reason for this behavior.
>
> If the domain is the same, I see no reason why this shouldn't work, but
> I have two ideas you can try.
>
> 1. Rather than using the name of the cookie, try this on the receiving
page:
>
> <pre>
> <?
> print_r($_COOKIE);
> ?>
> </pre>
>
> This should dump the entire array to the screen and would reveal any
> naming problems.
>
> 2. View the HTTP transactions themselves to make sure the proper
> Set-Cookie and Cookie headers are being used. There are several
> utilities that can help do this, and I recently wrote one in PHP (it's a
> quick hack though) you can get at http://protoscope.org/. The messages
> of interest are the original HTTP response from your Web server (which
> should contain the Set-Cookie header) and any future HTTP request (which
> should contain the Cookie header). This is the most reliable way to
> really analyze these types of problems.
>
> Hopefully these ideas will help uncover something.
>
> Chris
>
> Jeff Bluemel wrote:
>
> >ok - no cookie exists...  I have Netscape set to accept all cookies.
> >
>


--- End Message ---
--- Begin Message ---
thanks Edwin...

I had looked through the function list, but couldn't find the command...

Jeff
"@ Edwin" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Why, can't you just use strlen()?
>
>   http://www.php.net/manual/en/function.strlen.php
>
> Or, am I missing something?
>
> - E
>
> "Jeff Bluemel" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > I am looking for a function that will give me the number of characters
of
> a
> > string, or number.  I tried using the function length, but that function
> > seems to deal with arrays, and doesn't seem to function like I am
> intending
> > it to.
> >
> > --
> >
> > Thanks,
> >
> > Jeff Bluemel
> >
> >
>


--- End Message ---
--- Begin Message ---
Thanks in large part to some of the recent discussions on this list,
I've finally implemented some stuff that allows me to select a bunch of
files and tar them up.  This works great for smaller archives.

If the resulting archive is very large, the download begins normally,
but halts at 40-41MB.  After a while, Mozilla comes back telling me that
the file could not be saved because the source file could not be read.

(For the record, yes, I have plenty of room on the partition to which
I'm downloading.)

The only settings I could find in php.ini that *might* apply are
max_execution_time = 30 and memory_limit = 8M.

Any ideas on how to make this work for archives of arbitrary size?  

Here's the code snippet for the tar stuff (yes, I know my variable names
are pretty atrocious) ...

function set_tar_headers () {
    header("Content-Type: application/x-tar");
    header("Content-disposition: attachment; filename=foo.tar");
}

function create_file_list ($foo) {
    while (list ($key, $val) = each ($foo)) {
        $a.=" $val";
    }
    $a = str_replace ($mp3_dir, "", $a);
    return $a;
}
....
//$foo is an array of filenames
    if ($action == "tar") {
        set_tar_headers();
        $a = create_file_list ($foo);
        chdir ($mp3_dir);
        passthru ("tar -cf - $a");
    }




This is all part of a larger script that allows me to search my music
collection, select the songs/playlists/directories I want to listen to,
and create a playlist of URLs to my server, so that I can play my own
music from any machine that has a decent connection.  Tarring and
zipping selections just seemed like a nice add-on to that functionality.

Thank you very much in advance for any insight!

-- monique


--- End Message ---
--- Begin Message ---
Hello,
  I am using php 4.2.3 with the jdk1.3.1_04 running on RedHat 7.2 and
apache 1.3.22. The terms "Factory" and "Proxy" are similar to their
respective design patterns. I have a java Factory that creates Proxy
objects. The Factory returns a base interface that can be cast as the
class that was actually instantiated. 

  The problem is that after I call the Factory method
simpleCreateObject() from php I need to cast the variable returned as a
derived class from within php. In java I would just cast the return
value as whatever class I requested like so:

// java code to cast return type as derived class
  per = (GenericProxy)tcpb.simpleCreateObject("Person", 0, null);

// php code used to call simpleCreateObject()
  $per = $tcpb->simpleCreateObject('Person', 1, null);

How can I cast $per as a different class? 


Thank you,
  Gardner


--
Gardner Lloyd Bickford III
TriAxial Data Systems
36 Brennan Street
Watsonville, CA  95076
Phone: (831) 763-3697 x101
Fax: (831) 763-3699

Please note that the views expressed in this message are the views of 
the author alone and not necessarily the views of TriAxial Data Systems
--- End Message ---
--- Begin Message ---
here is some more info....

i figured out the exec fails because php is running in safe mode. that is ok
when i am at home developing (i can turn it off) however when i go to upload
my app to my server which runs in safe mode.. what do i do then?
is there a way around this?

i tried using the ini_set function to turn safe mode off but this appears not
to work

suggestions would be great as this is driving me nuts!

cheers
c.



Christian Haines wrote:

> ok.. i found that i need to check the httpd error_log and it tells me that
> it can't find the file or directory for the command.
>
> how do i fix this?
>
> i tried a full pathname to the command but it still says it cannot find dir
> or file etc
>
> c.
>
> Christian Haines wrote:
>
> > hi all,
> >
> > i am having a problem with exec. every command i try to run returns 127
> > (seg fault i think) but no array with info.
> > what could be causing this problem?
> >
> > i have tried running the complete path to the command e.g. usr/bin/ls -l
> > etc but with no luck.
> >
> > could this be something to do with my php.ini settings?
> >
> > any help would be greatly appreciated!
> >
> > many thanks in advance,
> >
> > christian

--- End Message ---
--- Begin Message ---
set *safe_mode_exec_dir *and put there your binaries

christian haines wrote:

>here is some more info....
>
>i figured out the exec fails because php is running in safe mode. that is ok
>when i am at home developing (i can turn it off) however when i go to upload
>my app to my server which runs in safe mode.. what do i do then?
>is there a way around this?
>
>i tried using the ini_set function to turn safe mode off but this appears not
>to work
>
>suggestions would be great as this is driving me nuts!
>
>cheers
>c.
>
>
>
>Christian Haines wrote:
>
>  
>
>>ok.. i found that i need to check the httpd error_log and it tells me that
>>it can't find the file or directory for the command.
>>
>>how do i fix this?
>>
>>i tried a full pathname to the command but it still says it cannot find dir
>>or file etc
>>
>>c.
>>
>>Christian Haines wrote:
>>
>>    
>>
>>>hi all,
>>>
>>>i am having a problem with exec. every command i try to run returns 127
>>>(seg fault i think) but no array with info.
>>>what could be causing this problem?
>>>
>>>i have tried running the complete path to the command e.g. usr/bin/ls -l
>>>etc but with no luck.
>>>
>>>could this be something to do with my php.ini settings?
>>>
>>>any help would be greatly appreciated!
>>>
>>>many thanks in advance,
>>>
>>>christian
>>>      
>>>
>
>
>  
>

--- End Message ---
--- Begin Message ---
I am using PHP 4.2.3 with Apache-SSL 1.3.26 and need some advice on how
to get my scripts to receive the cookies that I am setting along with
the POST and GET values from the preceding form.  How do I go about this
task?  My thanks in advance for any help offered as I am totally
stumped.
 
Jeff Means
[EMAIL PROTECTED]
--- End Message ---
--- Begin Message ---
On Thu, 26 Sep 2002, John Holmes wrote:
> > BTW (and I have not checked the CVS/TODO, so I ask here), is
> > there planned support for SSL & MySQL 4.x.x in PHP?.
> Yes. More info in Chapter 4.3.9.1 of the MySQL manual.

Nope, I mean: support for SSL+MySQL4 in PHP's mysql_connect. I know that
MySQL 4.0 supports SSL, but I don't know if PHP has/will have support for
MySQL connections using SSL in future versions.

Thanks.


--- End Message ---
--- Begin Message ---
> ----- Message from [EMAIL PROTECTED] ---------
>     Date: Fri, 27 Sep 2002 13:30:40 -0500 (CDT)
>     From: Rodolfo Gonzalez <[EMAIL PROTECTED]>
> Reply-To: Rodolfo Gonzalez <[EMAIL PROTECTED]>
>  Subject: RE: [PHP] Encrypted MySQL passwords
>       To: John Holmes <[EMAIL PROTECTED]>
> 
> On Thu, 26 Sep 2002, John Holmes wrote:
> > > BTW (and I have not checked the CVS/TODO, so I ask here), is
> > > there planned support for SSL & MySQL 4.x.x in PHP?.
> > Yes. More info in Chapter 4.3.9.1 of the MySQL manual.
> 
> Nope, I mean: support for SSL+MySQL4 in PHP's mysql_connect. I know that
> MySQL 4.0 supports SSL, but I don't know if PHP has/will have support for
> MySQL connections using SSL in future versions.
> 
> Thanks.
> 

Rodolfo (Tocayo!), 

    MySQL uses mysql_real_connect with an int client_flag to enable SSL. 
According to:

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

    The PHP mysql_connect will also use an int client_flag to enable SSL 
connections. It seems that they are going to implement the exact same flags. 
Note, it's planned for PHP v4.3.0

HTH.


Cheers, 

Rodolfo

--
The greatest and noblest pleasure which men can have in this world is to 
discover new truths; the next is to shake off old prejudices. - Frederick the 
Great
--- End Message ---
--- Begin Message ---
On Fri, 27 Sep 2002, Rodolfo Segleau wrote:
> > Nope, I mean: support for SSL+MySQL4 in PHP's mysql_connect. I know that
> > MySQL 4.0 supports SSL, but I don't know if PHP has/will have support for
> > MySQL connections using SSL in future versions.
> Rodolfo (Tocayo!), 

Hola!,

>     The PHP mysql_connect will also use an int client_flag to enable SSL 
> connections. It seems that they are going to implement the exact same flags. 
> Note, it's planned for PHP v4.3.0

Those are real good news. Thanks a lot :)

Regards,
Rodolfo.



--- End Message ---
--- Begin Message ---
I don't fully understand OOP, so my snippet might be wrong. But I need to 
emulate Multiple Inheritance for a script, so I've made the following, 
which I ask for opinions since I am not so sure if it will always work.

class multipleInheritance
{
    function callClass($class_to_call)
    {
        return new $class_to_call();
    }
}

class A
{
    function insideA()
    {
        echo "I'm inside A!<br />";
    }
}

class B
{

    function insideB()
    {
        echo "I'm inside B!<br />";
    }
}

class C extends multipleInheritance
{
    function insideC()
    {
        $a = parent::callClass('A');
        $a->insideA();
        $b = parent::callClass('B');
        $b->insideB();
    }
}

$c = new C();
$c->insideC();

--

And it echo:

I'm inside A!
I'm inside B!

-- 
Julio Nobrega
http://gnet.inerciasensorial.com.br
--- End Message ---
--- Begin Message ---
Julio Nobrega em Friday 27 September 2002 15:40 foi agraciado com uma 
resposta por:

> I don't fully understand OOP, so my snippet might be wrong. But I need to
> emulate Multiple Inheritance for a script, so I've made the following,
> which I ask for opinions since I am not so sure if it will always work.

 Er.. list, nevermind. What I did doesn't make any sense at all. Sorry for 
wasting everybody time and bandwidth.

-- 
Julio Nobrega
http://gnet.inerciasensorial.com.br
--- End Message ---
--- Begin Message ---
LOL, thanks for the laugh on a friday afternoon =].

-----Original Message-----
From: Julio Nobrega [mailto:[EMAIL PROTECTED]]
Sent: Friday, September 27, 2002 3:17 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Re: Multiple Inheritance Emulation


Julio Nobrega em Friday 27 September 2002 15:40 foi agraciado com uma 
resposta por:

> I don't fully understand OOP, so my snippet might be wrong. But I need to
> emulate Multiple Inheritance for a script, so I've made the following,
> which I ask for opinions since I am not so sure if it will always work.

 Er.. list, nevermind. What I did doesn't make any sense at all. Sorry for 
wasting everybody time and bandwidth.

-- 
Julio Nobrega
http://gnet.inerciasensorial.com.br

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
I have a fairly large html document that I need to convert to xml.
The current format is is:
<DD> A whole bunch of text 
        <DT> Something else </DT>
(There is a new line in there before <DT>)

Which I need to convert to
<DD> A whole bunch of text </DD>
        <DT> Something else </DT>

Any ideas??



--- End Message ---
--- Begin Message ---
> I have a fairly large html document that I need to convert to xml.
> The current format is is:
> <DD> A whole bunch of text
>       <DT> Something else </DT>
> (There is a new line in there before <DT>)
> 
> Which I need to convert to
> <DD> A whole bunch of text </DD>
>       <DT> Something else </DT>

$new_text = str_replace("\n\t<DT>","</DD>\n\t<DT>",$your_text);

Assuming there is a tab in there...

You'd be better off getting an editor that'll do this for you. Textpad
lets you search and replace with regular expressions. Other programs do
too.

---John Holmes...

--- End Message ---
--- Begin Message ---
Hey all.  I've read the pear coding standards. 
I assume that if php has any official coding standards

then the pear standards would be them, correct?

Anyways, the pear docs on coding standards show
examples of using controls structures like 
the following:

if ( !$var ) {
    do_something(); 
}
else {
    do_something_else();
}

-------
But I really don't like putting the opening brace 
on the same line as the control statement.

I really prefer doing this:

if ( $var ) 
{   do_something();
}


or 

if( $var )
{   do_something();
}
else
{   do_something_else();
}

-------
Putting the opening brace one line down on the same
column that the control statement starts on seems to 
give me a much better visual cue, especially when
dealing with nested control statements. 

Is doing it my preferred way acceptable?
Will my code be looked down on?

thanks,
--ed


__________________________________________________
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!
http://sbc.yahoo.com
--- End Message ---
--- Begin Message ---
I believe the standards are for coding PEAR modules so all code is presented
in the same style.  It really has no influence on the language or community
at large.  I say code the way you feel most comfortable with and damb to
anyone who complains.  :)
-Kevin

----- Original Message -----
From: "ed" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, September 27, 2002 2:16 PM
Subject: [PHP] coding standards - control structures


> Hey all.  I've read the pear coding standards.
> I assume that if php has any official coding standards
>
> then the pear standards would be them, correct?
>
> Anyways, the pear docs on coding standards show
> examples of using controls structures like
> the following:
>
> if ( !$var ) {
>     do_something();
> }
> else {
>     do_something_else();
> }
>
> -------
> But I really don't like putting the opening brace
> on the same line as the control statement.
>
> I really prefer doing this:
>
> if ( $var )
> {   do_something();
> }
>
>
> or
>
> if( $var )
> {   do_something();
> }
> else
> {   do_something_else();
> }
>
> -------
> Putting the opening brace one line down on the same
> column that the control statement starts on seems to
> give me a much better visual cue, especially when
> dealing with nested control statements.
>
> Is doing it my preferred way acceptable?
> Will my code be looked down on?
>
> thanks,
> --ed
>
>
> __________________________________________________
> Do you Yahoo!?
> New DSL Internet Access from SBC & Yahoo!
> http://sbc.yahoo.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

--- End Message ---
--- Begin Message ---
Kevin Stone wrote:
> 
> I believe the standards are for coding PEAR modules so all code is presented
> in the same style.  It really has no influence on the language or community
> at large.  I say code the way you feel most comfortable with and damb to
> anyone who complains.  :)
> -Kevin

The best way for sure as I stand before God (if you believe in that) is as
follows:

    if( $foo )
    {
        // Do something.
    }
    else
    {
        // Do something else.
    }

Of course you're welcome to disagree ;)

Cheers,
Rob.
-- 
.-----------------.
| Robert Cummings |
:-----------------`----------------------------.
| Webdeployer - Chief PHP and Java Programmer  |
:----------------------------------------------:
| Mail  : mailto:[EMAIL PROTECTED] |
| Phone : (613) 731-4046 x.109                 |
:----------------------------------------------:
| Website : http://www.webmotion.com           |
| Fax     : (613) 260-9545                     |
`----------------------------------------------'
--- End Message ---
--- Begin Message ---
No I totaly agree.  That's exactly the way I code!  *ROTFLMAO*
-Kevin

----- Original Message -----
From: "Robert Cummings" <[EMAIL PROTECTED]>
To: "Kevin Stone" <[EMAIL PROTECTED]>
Cc: "ed" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Friday, September 27, 2002 2:40 PM
Subject: Re: [PHP] coding standards - control structures


> Kevin Stone wrote:
> >
> > I believe the standards are for coding PEAR modules so all code is
presented
> > in the same style.  It really has no influence on the language or
community
> > at large.  I say code the way you feel most comfortable with and damb to
> > anyone who complains.  :)
> > -Kevin
>
> The best way for sure as I stand before God (if you believe in that) is as
> follows:
>
>     if( $foo )
>     {
>         // Do something.
>     }
>     else
>     {
>         // Do something else.
>     }
>
> Of course you're welcome to disagree ;)
>
> Cheers,
> Rob.
> --
> .-----------------.
> | Robert Cummings |
> :-----------------`----------------------------.
> | Webdeployer - Chief PHP and Java Programmer  |
> :----------------------------------------------:
> | Mail  : mailto:[EMAIL PROTECTED] |
> | Phone : (613) 731-4046 x.109                 |
> :----------------------------------------------:
> | Website : http://www.webmotion.com           |
> | Fax     : (613) 260-9545                     |
> `----------------------------------------------'
>

--- End Message ---
--- Begin Message ---
LOL! Right!  I figure that _I'm_ the one who has to
look at my code the most.  May as well leave it where
I put it, how I put it.

Thanks for the chuckle!
B

--- Kevin Stone <[EMAIL PROTECTED]> wrote:
> I believe the standards are for coding PEAR modules
> so all code is presented
> in the same style.  It really has no influence on
> the language or community
> at large.  I say code the way you feel most
> comfortable with and damb to
> anyone who complains.  :)
> -Kevin
> 
> ----- Original Message -----
> From: "ed" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Friday, September 27, 2002 2:16 PM
> Subject: [PHP] coding standards - control structures
> 
> 
> > Hey all.  I've read the pear coding standards.
> > I assume that if php has any official coding
> standards
> >
> > then the pear standards would be them, correct?
> >
> > Anyways, the pear docs on coding standards show
> > examples of using controls structures like
> > the following:
> >
> > if ( !$var ) {
> >     do_something();
> > }
> > else {
> >     do_something_else();
> > }
> >
> > -------
> > But I really don't like putting the opening brace
> > on the same line as the control statement.
> >
> > I really prefer doing this:
> >
> > if ( $var )
> > {   do_something();
> > }
> >
> >
> > or
> >
> > if( $var )
> > {   do_something();
> > }
> > else
> > {   do_something_else();
> > }
> >
> > -------
> > Putting the opening brace one line down on the
> same
> > column that the control statement starts on seems
> to
> > give me a much better visual cue, especially when
> > dealing with nested control statements.
> >
> > Is doing it my preferred way acceptable?
> > Will my code be looked down on?
> >
> > thanks,
> > --ed
> >
> >
> > __________________________________________________
> > Do you Yahoo!?
> > New DSL Internet Access from SBC & Yahoo!
> > http://sbc.yahoo.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
> 


=====
Bill Farrell
Multivalue and *nix Support Specialist

Phone: (828) 667-2245
Fax:   (928) 563-5189
Web:   http://www.jwfarrell.com

__________________________________________________
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!
http://sbc.yahoo.com
--- End Message ---
--- Begin Message ---
List,
        On my php.4.2.3, Apache 4.0.42 install my echo statements all output the 
number of characters written (in hex).

So this code:
echo "<addrone>$id->addrone</addrone>";
echo "<addrtwo>$id->addrtwo</addrtwo>";
echo "<city>$id->city</city>";

Makes this XML:

1d
<addrone>PO BOX 698</addrone>
13
<addrtwo></addrtwo>
1a
<city>ABCDEF GHIJKL</city>

Couldn't see anything in the bug report, ideas?

/B

--- End Message ---
--- Begin Message ---
Hi every1 I'm buidin' up a form that should perform a couple of checks 
before submit.
I used javascript but as the form has got option fields also and some 
field changes upon the checkbox chosen
the script has to know when I'm just changing the option or when I'm 
tryin' 2 send the form...
(in order to change the option or eventually perform the check).
Can I do that on the same page? ..I mean can I pass a variable through 
javascript 2 php?
 
The problem is that if I call the submit button "ready2be_checked" and I 
use an onclick(validate_the_form) handle,
 javascript works fine but it misses the variable "ready2be_checked" so 
the "isset" statement for ex. if(isset($ready2be_checked)){ ....}
doesn't work! 
Using onsubmit instead,
javascript performs the check and sends the form anyway cause the isset 
check finds the variable  $ready2be_checked !!
? ? ? ? ? ? ?

Sorry if I posted it twice
Thanx in advance                                                        
           Ricky


--- End Message ---
--- Begin Message ---
Instead of check for $ready2be_checked, use a hidden form field instead of
relying on the submit button to be pressed.  If the Javascript auto-submits
the form the hidden field will still be there.
-Kevin

----- Original Message -----
From: "Riccardo Sepe" <[EMAIL PROTECTED]>
To: "php-general" <[EMAIL PROTECTED]>
Sent: Friday, September 27, 2002 2:19 PM
Subject: [PHP] PHP and JavaScript on a form validation task


> Hi every1 I'm buidin' up a form that should perform a couple of checks
> before submit.
> I used javascript but as the form has got option fields also and some
> field changes upon the checkbox chosen
> the script has to know when I'm just changing the option or when I'm
> tryin' 2 send the form...
> (in order to change the option or eventually perform the check).
> Can I do that on the same page? ..I mean can I pass a variable through
> javascript 2 php?
>
> The problem is that if I call the submit button "ready2be_checked" and I
> use an onclick(validate_the_form) handle,
>  javascript works fine but it misses the variable "ready2be_checked" so
> the "isset" statement for ex. if(isset($ready2be_checked)){ ....}
> doesn't work!
> Using onsubmit instead,
> javascript performs the check and sends the form anyway cause the isset
> check finds the variable  $ready2be_checked !!
> ? ? ? ? ? ? ?
>
> Sorry if I posted it twice
> Thanx in advance
>            Ricky
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

--- End Message ---
--- Begin Message ---
Hello All.

I have a small 'to-do list' that is working just fine.

the db-table structor is close to this:

id
datetime   (for date of doing the task)
into  (quick title/intro about task)
text  (guts of work I have to do)
active  (is task active or done)


Here is the question I've got:

My datestamp is simply m/d/y. (I need to keep that format)

I would like to be able to move a specific to-do up-or-down the list, for
the given days tasks.
Adding a new table field is not a problem, I'm just not sure how to
control the sort-order, or the re-arrange.
I'm also not against using an array (as a friend suggested) but I'm not
understanding what he was getting at. (quick conversation with him)
Anyway, any ideas on this sort of thing would be great!

Thanks.
John B. Abela






--- End Message ---
--- Begin Message ---
I found a good working program that does the trick. It does, however,
eliminate the process making mods or editing the source for good. I
found just encrypting the copyright part works great. Here's the
program: http://www.rssoftlab.com/

It's called PHP Encoder and I'm pretty sure it's 100% free.

Thanks,
Stephen
http://www.melchior.us
http://php.melchior.us

:: -----Original Message-----
:: From: David Buerer [mailto:[EMAIL PROTECTED]] 
:: Sent: Thursday, September 26, 2002 3:44 PM
:: To: '[EMAIL PROTECTED]'
:: Subject: RE: [PHP] Keeping your published script safe?
:: 
:: 
:: www.zend.com
:: 
:: 
:: -----Original Message-----
:: From: Stephen Craton [mailto:[EMAIL PROTECTED]]
:: Sent: Thursday, September 26, 2002 2:09 PM
:: To: [EMAIL PROTECTED]
:: Subject: [PHP] Keeping your published script safe?
:: 
:: 
:: Hello,
:: 
:: I have many scripts published at various script sites and I 
:: just got a report of an incident where the user has removed 
:: my copyright at the bottom of the script. We have reached an 
:: agreement thank heavens, they're going to go search for a 
:: script that doesn't require the copyright.
:: 
:: Anyway, I was just wondering if there was any program or 
:: script that can keep your script safe from people removing 
:: the copyright. Please help! I'd really like to keep my 
:: scripts safe from those hacker people.
:: 
:: Thanks,
:: Stephen
:: http://www.melchior.us
:: http://php.melchior.us
:: 
:: 
:: 
:: -- 
:: PHP General Mailing List (http://www.php.net/)
:: To unsubscribe, visit: http://www.php.net/unsub.php
:: 
:: 


--- End Message ---
--- Begin Message ---
> My IP informed me that they have register_globals=on in their php.ini.
Is
> this going to cause problems with my scripts that were written  using
> $_POST,
> $_SESSION, etc?

If you can turn it off via, .htaccess, you'd be better. The scripts will
run fine with $_POST or whatever, but realize your open to the
vulnerabilities that made OFF the default. If you use if($value)
anywhere, that value could come from the user. Just something to be
aware of.

Also, with register_globals ON, unregistering a session variable is
tricky. You have to use session_unregister("value") and
unset($_SESSION['value']) and maybe even unset($value); If you don't
ever unregister variables, then you won't have a problem.

---John Holmes...

--- End Message ---
--- Begin Message ---
Thanks John,

I had been debating which IP Iwould use for my site. With the information 
you've provided,  I will use the one that has register_globals=off. 

One re-write of all my code is enough. Besides, the purpose of the default 
'off' behavior is precisely why I'm using  $_SESSION's anyway.

I really appreciate the advice, since I'm almost about to put my site 
on-line. . . .  Just a few (hah!) last-minute-bugs (double-hah!) have to be 
cleared up first before 'InstantFame (tm)  or was that shame???. :> 

The last thing I need is another headache like the one I developed using CSS.

Thanks again,
Andre


On Friday 27 September 2002 05:42 pm, John Holmes wrote:
> > My IP informed me that they have register_globals=on in their php.ini.
>
> Is
>
> > this going to cause problems with my scripts that were written  using
> > $_POST,
> > $_SESSION, etc?
>
> If you can turn it off via, .htaccess, you'd be better. The scripts will
> run fine with $_POST or whatever, but realize your open to the
> vulnerabilities that made OFF the default. If you use if($value)
> anywhere, that value could come from the user. Just something to be
> aware of.
>
> Also, with register_globals ON, unregistering a session variable is
> tricky. You have to use session_unregister("value") and
> unset($_SESSION['value']) and maybe even unset($value); If you don't
> ever unregister variables, then you won't have a problem.
>
> ---John Holmes...
--- End Message ---
--- Begin Message ---
Well, I didn't really mean to imply anything about people's honesty and so
forth...

I just wanted to say that validating (anything) on the client side is not
normally a good (and reliable) idea. Of course, as always mentioned,
validation on the server side is always better.

- E


"Kenneth Love" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]...
> about the peeking at the code...
> yes, you could, unless the images were coded somehow. perhaps just
numbers,
> not names. after a few tries they'd find "waldo" easily enough, but not at
> first.
>
> and besides. i'd like to give people credit for being more honest than
that.
>
>
> "@ Edwin" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > True. Perhaps.
> >
> > But, I think, you can actually do something like that WITH php. Say
> > PHP+Flash or PHP+Javascript...
> >
> > Of course, if you're able to do something like this just by using
> > PHP+Javascript (and HTML only), most probably, you can just take a peek
at
> > the code and find out where "waldo" is... ;)
> >
> > - E
> >
> > On Thursday, September 26, 2002 12:12 AM
> > Marek Kilimajer wrote:
> >
> > > This is for java, javascript, or flash, not much to do for php.
> > >
> > > Kenneth Love wrote:
> > >
> > > >hi all.
> > > >
> > > >i'm interested in creating a php game that generates a page of random
> > (ish)
> > > >images, one of which is waldo (or the like). when the player clicks
on
> > > >waldo, they're taken to the next, slightly harder level.
> > > >
> > > >anyone think that sounds fun?
> > > >any pointers, tips, advice, criticisms?
> > > >
> > > >--
> > > >->-> http://kennethlove.onewingedangel.com <-<-
> > > >
> > > >
>
>
--- End Message ---
--- Begin Message ---
 I am trying to use curl to post data to a search engine and then
 return the results in a variable so I can manipulate it.
  I have tried this but it does not seam to work properly.
  This is just an example of how I am trying to do this I don't have
  to use google for the search engine just thought if I can get it
  working with this I can get it to work with others
  
$ch = curl_init ("http://www.google.com/";);
curl_setopt ($ch, CURLOPT_POST, 1);
$word="php";
$args="action=/search&hl=en&ie=UTF-8&oe=UTF-8&q=$word&btnG=Google Search";
curl_setopt ($ch, CURLOPT_POSTFIELDS, $args);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
$data = curl_exec ($ch);
curl_close ($ch);
echo $data;

There does not seam to be much info or examples on using curl with php
is there anyplace that you know of that has more info than the manual
 


  

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

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

Hey,
I don't think you'll get php to work with google unless you use the google 
api - I heard that google has filtered out the php(and others) user-agent.
If you need more info on the google api just let me know.
~Pauly

On Friday 27 September 2002 07:25 pm, [EMAIL PROTECTED] wrote:
>  I am trying to use curl to post data to a search engine and then
>  return the results in a variable so I can manipulate it.
>   I have tried this but it does not seam to work properly.
>   This is just an example of how I am trying to do this I don't have
>   to use google for the search engine just thought if I can get it
>   working with this I can get it to work with others
>
> $ch = curl_init ("http://www.google.com/";);
> curl_setopt ($ch, CURLOPT_POST, 1);
> $word="php";
> $args="action=/search&hl=en&ie=UTF-8&oe=UTF-8&q=$word&btnG=Google Search";
> curl_setopt ($ch, CURLOPT_POSTFIELDS, $args);
> curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
> $data = curl_exec ($ch);
> curl_close ($ch);
> echo $data;
>
> There does not seam to be much info or examples on using curl with php
> is there anyplace that you know of that has more info than the manual

- -- 
~Paul Nicholson
Design Specialist @ WebPower Design
"The web....the way you want it!"
[EMAIL PROTECTED]

"It said uses Windows 98 or better, so I loaded Linux!"
Registered Linux User #183202 using Register Linux System # 81891
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE9lQ4TDyXNIUN3+UQRAgkDAJ4tTM2U/c0giejT1DzdDEg5HbQm0gCdE1Ht
il6KWww8aId6IE9xpBage08=
=2miE
-----END PGP SIGNATURE-----
--- End Message ---
--- Begin Message ---
Google uses GET anyway, not POST.

A simple fopen() is all you need, but then you'll be parsing HTML. The 
API is better for reliability.

Paul Nicholson wrote:

>I don't think you'll get php to work with google unless you use the google 
>api - I heard that google has filtered out the php(and others) user-agent.
>If you need more info on the google api just let me know.
>
>On Friday 27 September 2002 07:25 pm, [EMAIL PROTECTED] wrote:
>  
>
>> I am trying to use curl to post data to a search engine and then
>> return the results in a variable so I can manipulate it.
>>  I have tried this but it does not seam to work properly.
>>  This is just an example of how I am trying to do this I don't have
>>  to use google for the search engine just thought if I can get it
>>  working with this I can get it to work with others
>>
>>$ch = curl_init ("http://www.google.com/";);
>>curl_setopt ($ch, CURLOPT_POST, 1);
>>$word="php";
>>$args="action=/search&hl=en&ie=UTF-8&oe=UTF-8&q=$word&btnG=Google Search";
>>curl_setopt ($ch, CURLOPT_POSTFIELDS, $args);
>>curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
>>$data = curl_exec ($ch);
>>curl_close ($ch);
>>echo $data;
>>

--- End Message ---
--- Begin Message ---
I am kind of new to PHP. I know how to use a select statement and a query to
get data out of a table in MySQL, but how do I assign those fields to
variables? I know this must be easy! Thanks in advance!!



--- End Message ---
--- Begin Message ---
I think this should be a good reference for you:
http://www.php.net/manual/en/function.mysql-fetch-array.php

HTH
-Brad

Ken wrote:

> I am kind of new to PHP. I know how to use a select statement and a query to
> get data out of a table in MySQL, but how do I assign those fields to
> variables? I know this must be easy! Thanks in advance!!
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---
--- Begin Message ---
I used the examples you have lead me to and I get this error? I am stumped?

mysql_fetch_array(): supplied argument is not a valid MySQL result resource
in /home/pay.php on line 51

Have any idea what this means?
Thanks!



"Brad Bonkoski" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I think this should be a good reference for you:
> http://www.php.net/manual/en/function.mysql-fetch-array.php
>
> HTH
> -Brad
>
> Ken wrote:
>
> > I am kind of new to PHP. I know how to use a select statement and a
query to
> > get data out of a table in MySQL, but how do I assign those fields to
> > variables? I know this must be easy! Thanks in advance!!
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
>


--- End Message ---
--- Begin Message ---
> I used the examples you have lead me to and I get this error? I am
> stumped?
> 
> mysql_fetch_array(): supplied argument is not a valid MySQL result
> resource
> in /home/pay.php on line 51

You're query probably failed. Look at mysql_error().

www.php.net/mysql_error

---John Holmes... 


--- End Message ---
--- Begin Message ---
Greetings folks.

I need my carriage returns to show up in my HTML output from my text form field.

There is a JavaScript function that will convert carriage return to <BR> tags, but is 
there a PHP function that will add <BR> or <P> tags to a text form field in place of 
the carriage returns a user might add.

Thanks in advance!
-NorthBayShane
--- End Message ---
--- Begin Message ---
Shane <mailto:[EMAIL PROTECTED]> scribbled;
>
> There is a JavaScript function that will convert carriage
> return to <BR> tags, but is there a PHP function that will
> add <BR> or <P> tags to a text form field in place of the
> carriage returns a user might add.
> 

nl2br()

-jesse

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

Hey,
Try nl2br(http://www.php.net/nl2br).
~Pauly
 
On Friday 27 September 2002 08:19 pm, Shane wrote:
> Greetings folks.
>
> I need my carriage returns to show up in my HTML output from my text form
> field.
>
> There is a JavaScript function that will convert carriage return to <BR>
> tags, but is there a PHP function that will add <BR> or <P> tags to a text
> form field in place of the carriage returns a user might add.
>
> Thanks in advance!
> -NorthBayShane

- -- 
~Paul Nicholson
Design Specialist @ WebPower Design
"The web....the way you want it!"
[EMAIL PROTECTED]

"It said uses Windows 98 or better, so I loaded Linux!"
Registered Linux User #183202 using Register Linux System # 81891
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE9lQxPDyXNIUN3+UQRAplZAJsHW7SeDvHzESn+mqbXZhmobMw8IwCfcWry
IzMWaMTsegPaXrBmvjl9vVQ=
=sL/V
-----END PGP SIGNATURE-----
--- End Message ---
--- Begin Message ---
Hi,

I looked at phpclasses but saw nothing as simple as I wanted. There's a 
Perl module which does just what I want and perhaps I'll have to port 
it.

The class accepts an assoc array of name=>value, and the key to another 
assoc array which describes the constraints for the assoc array I'm 
passing in. Here is an example of the assoc array (it's Perl) which 
contains all my "forms" and then the class returns 3 assoc arrays 
(valid, invalid,missing using the key names, and this makes it very 
easy to use in your templates e.g. if missing_name, or invalid_zipcode 
etc.).

  my %forms = (  
    confirm_email => {
        required     =>
              [ qw(emailaddress emailaddress_verified 
searchengine_accounts) ],
        constraints  =>
      {
          emailaddress_verified => "email",
          emailaddress   => "email",
      },
      filters       => [ "trim" ],
    },
    verify_contact_info => {
        required     =>
              [ qw(country lastname firstname phone state zipcode city 
company street) ],
        optional     =>
        [ qw(fax) ],              
        constraints  =>
      {
          #phone          => "american_phone",
          #zipcode        => '/^\s*\d{5}(?:[-]\d{4})?\s*$/',
          state          => '/\w{2,}/',
          #fax            => "american_phone",
      },
      filters       => [ "trim" ],
      field_filters => { phone => ["phone"] },
    },

The Perl module that does this is:

HTML::FormValidator

So far I'm find PHP stuff that does everything under the sun. 

Anyone know of something like this?

Peter

--- End Message ---
--- Begin Message ---
Hello,

On 09/27/2002 09:50 PM, Peter J. Schoenster wrote:
> I looked at phpclasses but saw nothing as simple as I wanted. There's a 
> Perl module which does just what I want and perhaps I'll have to port 
> it.
> 
> The class accepts an assoc array of name=>value, and the key to another 
> assoc array which describes the constraints for the assoc array I'm 
> passing in. Here is an example of the assoc array (it's Perl) which 
> contains all my "forms" and then the class returns 3 assoc arrays 
> (valid, invalid,missing using the key names, and this makes it very 
> easy to use in your templates e.g. if missing_name, or invalid_zipcode 
> etc.).
> 
>   my %forms = (  
>     confirm_email => {
>         required     =>
>               [ qw(emailaddress emailaddress_verified 
> searchengine_accounts) ],
>         constraints  =>
>       {
>           emailaddress_verified => "email",
>           emailaddress   => "email",
>       },
>       filters       => [ "trim" ],
>     },
>     verify_contact_info => {
>         required     =>
>               [ qw(country lastname firstname phone state zipcode city 
> company street) ],
>         optional     =>
>         [ qw(fax) ],              
>         constraints  =>
>       {
>           #phone          => "american_phone",
>           #zipcode        => '/^\s*\d{5}(?:[-]\d{4})?\s*$/',
>           state          => '/\w{2,}/',
>           #fax            => "american_phone",
>       },
>       filters       => [ "trim" ],
>       field_filters => { phone => ["phone"] },
>     },
> 
> The Perl module that does this is:
> 
> HTML::FormValidator
> 
> So far I'm find PHP stuff that does everything under the sun. 
> 
> Anyone know of something like this?

Assumming that you tried the forms generation and validation class, what 
did you realize that was missing to match your needs?

http://www.phpclasses.org/formsgeneration


-- 

Regards,
Manuel Lemos

--- End Message ---
--- Begin Message ---
On 27 Sep 2002 at 22:09, Manuel Lemos wrote:

> Assumming that you tried the forms generation and validation class, what
> did you realize that was missing to match your needs?
> 
> http://www.phpclasses.org/formsgeneration

Well that's the first thing I found and I downloaded it. It does much 
more than what I want, for instance here:

>  $subscription->AddInput(array(
>   "TYPE"=>"text",
>   "NAME"=>"email",
>   "MAXLENGTH"=>100,
>   "Capitalization"=>"lowercase",
>   "ValidateAsEmail"=>1,
>   "ValidationErrorMessage"=>"It was not specified a valid e-mail
>   address"
>  ));

Those attributes already exist in the form. I create the forms on the 
fly only once afterwhich they are in the hands of the designers to 
manipulate. I pass back to the form a data structure that will have 
something like:

missing_email
invalid_email

and the designer can check for this, lke this in smarty:

{if $error.missing_email}Yo give me email{/if}
{if $error.invalid_email}Please verify your email{/if}

and I have a script that will generated those if statements so one 
doesn't need to do a lot of typing. 

I don't like generating the form programmatically all the time ... I 
leave that to the *view*. 

I just want to pass the input data I received, the definition of the 
form I'm using with this data and have the function return the 3 arrays 
: good, invalid, missing. I've been very happy with this in Perl. 

The formgen is very powerful, too powerful and too intrusive into the 
other things I'm doing. I only need a small part of it. What I want has 
nothing really to do with html forms, just data validation.

Peter










--- End Message ---
--- Begin Message ---
Hello,

On 09/27/2002 08:52 AM, Christian Ista wrote:
> I use the mail function to send mail. On my development PC, I receive
> the mail in HTML, with the high priority,...
> 
> I put the files on the production server, a linux machine, when I
> receive the mail is not in HTML but in plain text, I don't see the high
> priority. I receive that :
> 
> Content-Type: text/html; charset=iso-8859-1
> 
> X-Priority: 1
> 
> X-Mailer: PHP / 4.2.3
> 
> Click on the link to activate the ....
> 
> Could you tell me what can I do ?
> 
> I use this code to send mail :
> 
> $sender_name = "MyWebsite"; 
> $sender_email = ""; 
>               
> $contactemail = $Email1;
> $myreplyemail = ""; 
>               
> $message = "Click on the link to activate the account.".'<br>';
> $message .= http://www.website.com;
> 
> $subject = "TEST"; 
>               
> $header = "From: \"".addslashes($sender_name)."\"
> <".$sender_email.">\r\n";
> $header .= "Reply-To: ".$sender_email."\r\n";
> $header .= "MIME-Version: 1.0\r\n";
> $header .= "Content-Type: text/html; charset=iso-8859-1\r\n";
> $header .= "X-Priority: 1\r\n";
> $header .= "X-Mailer: PHP / ".phpversion()."\r\n";
>               
> mail($contactemail, $subject, $message, $header);  

The mail function is very problematic. Depending on the platform you are 
using, different reasons may lead to the problem you are experiencing.

Maybe you would like to try this PHP class for composing and sending 
messages, including with HTML, that auto-detects the OS and tries to 
work around some problems automatically for you:

http://www.phpclasses.org/mimemessage

Just let me know if it does not avoid your problem.

-- 

Regards,
Manuel Lemos

--- End Message ---

Reply via email to